diff --git a/web-app.js b/web-app.js index 63b6d8b0..9fda2fca 100644 --- a/web-app.js +++ b/web-app.js @@ -7,7 +7,7 @@ var i=n(6),r=i.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function a(t,e,n) * @author Feross Aboukhadijeh * @license MIT */ -var i=n(151),r=n(152),o=n(76);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function d(t,e){if(l.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(t).length;default:if(i)return q(t).length;e=(""+e).toLowerCase(),i=!0}}function _(t,e,n){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return N(this,e,n);case"utf8":case"utf-8":return E(this,e,n);case"ascii":return C(this,e,n);case"latin1":case"binary":return O(this,e,n);case"base64":return x(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function y(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function m(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=l.from(e,i)),l.isBuffer(e))return 0===e.length?-1:v(t,e,n,i,r);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,i,r){var o,a=1,s=t.length,l=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,s/=2,l/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(r){var u=-1;for(o=n;os&&(n=s-l),o=n;o>=0;o--){for(var p=!0,h=0;hr&&(i=r):i=r;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var a=0;a>8,r=n%256,o.push(r),o.push(i);return o}(e,t.length-n),t,n,i)}function x(t,e,n){return 0===e&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,n))}function E(t,e,n){n=Math.min(t.length,n);for(var i=[],r=e;r239?4:c>223?3:c>191?2:1;if(r+p<=n)switch(p){case 1:c<128&&(u=c);break;case 2:128==(192&(o=t[r+1]))&&(l=(31&c)<<6|63&o)>127&&(u=l);break;case 3:o=t[r+1],a=t[r+2],128==(192&o)&&128==(192&a)&&(l=(15&c)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:o=t[r+1],a=t[r+2],s=t[r+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(u=l)}null===u?(u=65533,p=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u),r+=p}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var n="",i=0;for(;i0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},l.prototype.compare=function(t,e,n,i,r){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(r>>>=0)-(i>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),c=this.slice(i,r),u=t.slice(e,n),p=0;pr)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return $(this,t,e,n);case"utf8":case"utf-8":return g(this,t,e,n);case"ascii":return b(this,t,e,n);case"latin1":case"binary":return w(this,t,e,n);case"base64":return k(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function C(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;ri)&&(n=i);for(var r="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function T(t,e,n,i,r,o){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||et.length)throw new RangeError("Index out of range")}function P(t,e,n,i){e<0&&(e=65535+e+1);for(var r=0,o=Math.min(t.length-n,2);r>>8*(i?r:1-r)}function R(t,e,n,i){e<0&&(e=4294967295+e+1);for(var r=0,o=Math.min(t.length-n,4);r>>8*(i?r:3-r)&255}function A(t,e,n,i,r,o){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function I(t,e,n,i,o){return o||A(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function M(t,e,n,i,o){return o||A(t,0,n,8),r.write(t,e,n,i,52,8),n+8}l.prototype.slice=function(t,e){var n,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(r*=256);)i+=this[t+--e]*r;return i},l.prototype.readUInt8=function(t,e){return e||j(t,1,this.length),this[t]},l.prototype.readUInt16LE=function(t,e){return e||j(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function(t,e){return e||j(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function(t,e){return e||j(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function(t,e){return e||j(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||j(t,e,this.length);for(var i=this[t],r=1,o=0;++o=(r*=128)&&(i-=Math.pow(2,8*e)),i},l.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||j(t,e,this.length);for(var i=e,r=1,o=this[t+--i];i>0&&(r*=256);)o+=this[t+--i]*r;return o>=(r*=128)&&(o-=Math.pow(2,8*e)),o},l.prototype.readInt8=function(t,e){return e||j(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){e||j(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(t,e){e||j(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(t,e){return e||j(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return e||j(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return e||j(t,4,this.length),r.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return e||j(t,4,this.length),r.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return e||j(t,8,this.length),r.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return e||j(t,8,this.length),r.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function(t,e,n,i){(t=+t,e|=0,n|=0,i)||T(this,t,e,n,Math.pow(2,8*n)-1,0);var r=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+r]=t/o&255;return e+n},l.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},l.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):R(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):R(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);T(this,t,e,n,r-1,-r)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+n},l.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);T(this,t,e,n,r-1,-r)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},l.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):R(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):R(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,n){return I(this,t,e,!0,n)},l.prototype.writeFloatBE=function(t,e,n){return I(this,t,e,!1,n)},l.prototype.writeDoubleLE=function(t,e,n){return M(this,t,e,!0,n)},l.prototype.writeDoubleBE=function(t,e,n){return M(this,t,e,!1,n)},l.prototype.copy=function(t,e,n,i){if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--r)t[r+e]=this[r+n];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(r=0;r>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function U(t,e,n,i){for(var r=0;r=e.length||r>=t.length);++r)e[r+n]=t[r];return r}}).call(this,n(7))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(i){var r,o,a;o=[e,n(1)],void 0===(a="function"==typeof(r=function(t,e){"use strict";var n,r=Object,o=e.throwCCE,a=e.Kind.CLASS,s=e.kotlin.coroutines.Continuation,l=(e.kotlin.Annotation,e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED),c=e.kotlin.coroutines.CoroutineImpl,u=e.kotlin.collections.emptyList_287e2$,p=e.kotlin.Unit,h=e.throwUPAE,f=e.kotlin.collections.copyToArray,d=Array,_=e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,y=e.kotlin.collections.ArrayList_init_ww73n8$,m=e.kotlin.Result,v=e.kotlin.coroutines,$=e.kotlin.coroutines.intrinsics.createCoroutineUnintercepted_3a617i$,g=e.kotlin.coroutines.ContinuationInterceptor,b=e.equals,w=e.defineInlineFunction,k=e.wrapFunction,S=e.kotlin.IllegalStateException_init_pdl1vj$,x=e.Kind.INTERFACE,E=Error,C=e.toString,O=e.Kind.OBJECT,N=e.kotlin.createFailure_tcv7n7$,z=e.kotlin.coroutines.AbstractCoroutineContextKey,j=e.kotlin.coroutines.AbstractCoroutineContextElement,T=e.kotlin.RuntimeException,P=e.kotlin.coroutines.CoroutineContext.Key,R=e.kotlin.coroutines.CoroutineContext.Element,A=e.kotlin.coroutines.startCoroutine_x18nsh$,I=e.kotlin.coroutines.startCoroutine_3a617i$,M=e.kotlin.Enum,L=e.throwISE,D=e.Long.MAX_VALUE,q=(e.kotlin.time.Duration,e.Long.ONE),F=e.Long.ZERO,U=new e.Long(0,1),B=(e.Long.fromInt(1e6),new e.Long(2077252342,2147),new e.Long(-1,1073741823),e.ensureNotNull),H=(e.kotlin.Comparable,e.kotlin.IllegalArgumentException_init_pdl1vj$),V=e.kotlin.Error,K=e.kotlin.IllegalStateException,W=e.kotlin.sequences.sequence_o0x0bg$,Y=e.kotlin.collections.ArrayList,G=e.kotlin.text.StringBuilder_init,J=e.kotlin.UnsupportedOperationException,Z=e.kotlin.UnsupportedOperationException_init_pdl1vj$,Q=(e.kotlin.sequences.emptySequence_287e2$,e.kotlin.addSuppressed_oh0dqn$),X=Function,tt=e.kotlin.ranges.coerceAtMost_2p08ub$,et=e.kotlin.collections.fill_jfbbbd$,nt=Math,it=e.kotlin.NoSuchElementException,rt=e.hashCode,ot=(e.kotlin.collections.IndexedValue,e.kotlin.IndexOutOfBoundsException),at=(e.kotlin.collections.LinkedHashMap_init_q3lmfv$,e.kotlin.collections.ArrayList_init_287e2$),st=(e.kotlin.collections.HashSet_init_287e2$,e.kotlin.collections.LinkedHashSet_init_287e2$),lt=(e.kotlin.Pair,e.kotlin.to_ujzrz7$,e.kotlin.collections.indexOf_mjy6jw$),ct=e.kotlin.collections.arrayCopy,ut=e.kotlin.text.trimIndent_pdl1vz$,pt=e.Long.NEG_ONE,ht=e.kotlin.ranges.until_2p08ub$,ft=e.kotlin.collections.copyOf_8ujjk8$,dt=e.kotlin.collections.joinToString_fmv235$,_t=e.kotlin.collections.listOf_mh5how$,yt=(e.toByte,e.kotlin.ranges.coerceAtLeast_dqglrj$,e.kotlin.ArithmeticException,new e.Long(0,805306368),e.Long.fromInt(1073741823),new e.Long(-1073741824,268435455),new e.Long(0,268435456),new e.Long(0,536870912),e.kotlin.text.toLongOrNull_pdl1vz$,e.kotlin.coroutines.intrinsics.createCoroutineUnintercepted_x18nsh$),mt=e.kotlin.collections.shuffle_vvxzk3$,vt=e.Long.fromInt(2147483647),$t=e.kotlin.ranges.coerceIn_ekzx8g$,gt=e.kotlin.collections.HashSet_init_ww73n8$,bt=e.kotlin.collections.get_lastIndex_55thoc$,wt=e.kotlin.NoSuchElementException_init,kt=e.kotlin.collections.MutableIterator,St=e.kotlin.collections.AbstractMutableList,xt=e.kotlin.UnsupportedOperationException_init;function Et(t,e){void 0===e&&(e=!0),$n.call(this,e),this.parentContext=t,this.context_p8rm81$_0=this.parentContext.plus_1fupul$(this)}function Ct(t,e){c.call(this,e),this.exceptionState_0=1,this.local$$receiver=t}function Ot(t){this.deferreds_0=t,this.notCompletedCount_0=this.deferreds_0.length}function Nt(t,e){this.$outer=t,Gt.call(this),this.nodes_0=e}function zt(t,e){this.$outer=t,jn.call(this),this.continuation_0=e,this.handle_45x73s$_0=this.handle_45x73s$_0,this._disposer_0=null}function jt(t,e,n,i){void 0===e&&(e=v.EmptyCoroutineContext),void 0===n&&(n=Ae());var r=As(t,e),o=n.isLazy?new It(r,i):new At(r,!0);return o.start_b5ul0p$(n,o,i),o}function Tt(t,e){Et.call(this,t,e)}function Pt(t,e){c.call(this,e),this.exceptionState_0=1,this.$this=t}function Rt(t,e){Tt.call(this,t,!1),this.continuation_0=$(e,this,this)}function At(t,e){Et.call(this,t,e)}function It(t,e){At.call(this,t,!1),this.continuation_0=$(e,this,this)}function Mt(t,e){Va.call(this,t,e),this._decision_0=0}function Lt(){}function Dt(t){var n,i;return e.isType(t,Pa)?null==(i=null!=(n=t.claimReusableCancellableContinuation())&&n.resetStateReusable_8be2vx$()?n:null)?new Ht(t,2):i:new Ht(t,2)}function qt(t,e){t.invokeOnCancellation_f05bi3$(new Ut(e))}function Ft(t,e){t.invokeOnCancellation_f05bi3$(new Bt(e))}function Ut(t){Jt.call(this),this.node_0=t}function Bt(t){Gt.call(this),this.handle_0=t}function Ht(t,e){Ma.call(this,e),this.delegate_dhbmku$_0=t,this.context_xycjfy$_0=this.delegate.context,this._decision_0=0,this._state_0=Yt(),this._parentHandle_0=null}function Vt(){}function Kt(){Wt=this}Et.prototype=Object.create($n.prototype),Et.prototype.constructor=Et,Gt.prototype=Object.create(js.prototype),Gt.prototype.constructor=Gt,Nt.prototype=Object.create(Gt.prototype),Nt.prototype.constructor=Nt,zs.prototype=Object.create(Ol.prototype),zs.prototype.constructor=zs,jn.prototype=Object.create(zs.prototype),jn.prototype.constructor=jn,zt.prototype=Object.create(jn.prototype),zt.prototype.constructor=zt,Tt.prototype=Object.create(Et.prototype),Tt.prototype.constructor=Tt,Rt.prototype=Object.create(Tt.prototype),Rt.prototype.constructor=Rt,At.prototype=Object.create(Et.prototype),At.prototype.constructor=At,It.prototype=Object.create(At.prototype),It.prototype.constructor=It,Va.prototype=Object.create(Et.prototype),Va.prototype.constructor=Va,Mt.prototype=Object.create(Va.prototype),Mt.prototype.constructor=Mt,Jt.prototype=Object.create(Gt.prototype),Jt.prototype.constructor=Jt,Ut.prototype=Object.create(Jt.prototype),Ut.prototype.constructor=Ut,Bt.prototype=Object.create(Gt.prototype),Bt.prototype.constructor=Bt,Ma.prototype=Object.create(_l.prototype),Ma.prototype.constructor=Ma,Ht.prototype=Object.create(Ma.prototype),Ht.prototype.constructor=Ht,Zt.prototype=Object.create(Gt.prototype),Zt.prototype.constructor=Zt,te.prototype=Object.create($n.prototype),te.prototype.constructor=te,le.prototype=Object.create(se.prototype),le.prototype.constructor=le,ue.prototype=Object.create(z.prototype),ue.prototype.constructor=ue,ce.prototype=Object.create(j.prototype),ce.prototype.constructor=ce,ge.prototype=Object.create(j.prototype),ge.prototype.constructor=ge,Pe.prototype=Object.create(M.prototype),Pe.prototype.constructor=Pe,He.prototype=Object.create(ce.prototype),He.prototype.constructor=He,Gs.prototype=Object.create(He.prototype),Gs.prototype.constructor=Gs,Ye.prototype=Object.create(Gs.prototype),Ge.prototype=Object.create(T.prototype),Ge.prototype.constructor=Ge,Je.prototype=Object.create(V.prototype),Je.prototype.constructor=Je,kn.prototype=Object.create(jn.prototype),kn.prototype.constructor=kn,Sn.prototype=Object.create(Ht.prototype),Sn.prototype.constructor=Sn,Nn.prototype=Object.create($n.prototype),Nn.prototype.constructor=Nn,Pl.prototype=Object.create(Ol.prototype),Pl.prototype.constructor=Pl,Tn.prototype=Object.create(Pl.prototype),Tn.prototype.constructor=Tn,Rn.prototype=Object.create(jn.prototype),Rn.prototype.constructor=Rn,An.prototype=Object.create(jn.prototype),An.prototype.constructor=An,In.prototype=Object.create(jn.prototype),In.prototype.constructor=In,Mn.prototype=Object.create(jn.prototype),Mn.prototype.constructor=Mn,Ln.prototype=Object.create(jn.prototype),Ln.prototype.constructor=Ln,Dn.prototype=Object.create(jn.prototype),Dn.prototype.constructor=Dn,qn.prototype=Object.create(Dn.prototype),qn.prototype.constructor=qn,Fn.prototype=Object.create(Dn.prototype),Fn.prototype.constructor=Fn,Un.prototype=Object.create(Dn.prototype),Un.prototype.constructor=Un,Bn.prototype=Object.create(ce.prototype),Bn.prototype.constructor=Bn,Hn.prototype=Object.create(j.prototype),Vn.prototype=Object.create(Nn.prototype),Vn.prototype.constructor=Vn,Zs.prototype=Object.create(K.prototype),Zs.prototype.constructor=Zs,Kn.prototype=Object.create(Zs.prototype),Kn.prototype.constructor=Kn,Wn.prototype=Object.create(ce.prototype),Wn.prototype.constructor=Wn,jl.prototype=Object.create(Ta.prototype),jl.prototype.constructor=jl,Nl.prototype=Object.create(jl.prototype),Nl.prototype.constructor=Nl,hi.prototype=Object.create(Nl.prototype),hi.prototype.constructor=hi,zl.prototype=Object.create(jl.prototype),zl.prototype.constructor=zl,di.prototype=Object.create(zl.prototype),di.prototype.constructor=di,zi.prototype=Object.create(Ol.prototype),zi.prototype.constructor=zi,yi.prototype=Object.create(zi.prototype),yi.prototype.constructor=yi,mi.prototype=Object.create(zi.prototype),mi.prototype.constructor=mi,gi.prototype=Object.create(zl.prototype),gi.prototype.constructor=gi,Si.prototype=Object.create(Jt.prototype),Si.prototype.constructor=Si,Ai.prototype=Object.create(Ol.prototype),Ai.prototype.constructor=Ai,Ei.prototype=Object.create(Ai.prototype),Ei.prototype.constructor=Ei,Ci.prototype=Object.create(Ei.prototype),Ci.prototype.constructor=Ci,Oi.prototype=Object.create(Ai.prototype),Oi.prototype.constructor=Oi,Ni.prototype=Object.create(Ai.prototype),Ni.prototype.constructor=Ni,vi.prototype=Object.create(pi.prototype),vi.prototype.constructor=vi,Ti.prototype=Object.create(zi.prototype),Ti.prototype.constructor=Ti,Pi.prototype=Object.create(Ti.prototype),Pi.prototype.constructor=Pi,Ri.prototype=Object.create(zi.prototype),Ri.prototype.constructor=Ri,Mi.prototype=Object.create(vi.prototype),Mi.prototype.constructor=Mi,Ii.prototype=Object.create(pi.prototype),Ii.prototype.constructor=Ii,Li.prototype=Object.create(vi.prototype),Li.prototype.constructor=Li,qi.prototype=Object.create(Et.prototype),qi.prototype.constructor=qi,Fi.prototype=Object.create(qi.prototype),Fi.prototype.constructor=Fi,Hi.prototype=Object.create(M.prototype),Hi.prototype.constructor=Hi,ur.prototype=Object.create(K.prototype),ur.prototype.constructor=ur,pr.prototype=Object.create(it.prototype),pr.prototype.constructor=pr,hr.prototype=Object.create(Et.prototype),hr.prototype.constructor=hr,Er.prototype=Object.create(vi.prototype),Er.prototype.constructor=Er,xr.prototype=Object.create(Er.prototype),xr.prototype.constructor=xr,Cr.prototype=Object.create(vi.prototype),Cr.prototype.constructor=Cr,Rr.prototype=Object.create(hr.prototype),Rr.prototype.constructor=Rr,Ar.prototype=Object.create(vi.prototype),Ar.prototype.constructor=Ar,Ir.prototype=Object.create(Hr.prototype),Ir.prototype.constructor=Ir,Lr.prototype=Object.create(yo.prototype),Lr.prototype.constructor=Lr,Dr.prototype=Object.create(Lr.prototype),Dr.prototype.constructor=Dr,Jr.prototype=Object.create(ho.prototype),Jr.prototype.constructor=Jr,Zr.prototype=Object.create(fo.prototype),Zr.prototype.constructor=Zr,so.prototype=Object.create(ho.prototype),so.prototype.constructor=so,lo.prototype=Object.create(fo.prototype),lo.prototype.constructor=lo,$o.prototype=Object.create(yo.prototype),$o.prototype.constructor=$o,wo.prototype=Object.create($o.prototype),wo.prototype.constructor=wo,Oo.prototype=Object.create(Va.prototype),Oo.prototype.constructor=Oo,zo.prototype=Object.create($o.prototype),zo.prototype.constructor=zo,ja.prototype=Object.create(za.prototype),ja.prototype.constructor=ja,Pa.prototype=Object.create(Ma.prototype),Pa.prototype.constructor=Pa,Ha.prototype=Object.create(T.prototype),Ha.prototype.constructor=Ha,hs.prototype=Object.create(Dn.prototype),hs.prototype.constructor=hs,fs.prototype=Object.create(za.prototype),fs.prototype.constructor=fs,ds.prototype=Object.create(ja.prototype),ds.prototype.constructor=ds,_s.prototype=Object.create(Ol.prototype),_s.prototype.constructor=_s,ps.prototype=Object.create(Pl.prototype),ps.prototype.constructor=ps,Ss.prototype=Object.create(za.prototype),Ss.prototype.constructor=Ss,ks.prototype=Object.create(Ta.prototype),ks.prototype.constructor=ks,xs.prototype=Object.create(Pl.prototype),xs.prototype.constructor=xs,Es.prototype=Object.create(Ol.prototype),Es.prototype.constructor=Es,Cs.prototype=Object.create(Es.prototype),Cs.prototype.constructor=Cs,Os.prototype=Object.create(Es.prototype),Os.prototype.constructor=Os,Ns.prototype=Object.create(ja.prototype),Ns.prototype.constructor=Ns,Ls.prototype=Object.create(Va.prototype),Ls.prototype.constructor=Ls,Ks.prototype=Object.create(Bn.prototype),Ks.prototype.constructor=Ks,Ys.prototype=Object.create(He.prototype),Ys.prototype.constructor=Ys,Xs.prototype=Object.create(Zs.prototype),Xs.prototype.constructor=Xs,fl.prototype=Object.create(Na.prototype),fl.prototype.constructor=fl,nl.prototype=Object.create(fl.prototype),nl.prototype.constructor=nl,el.prototype=Object.create(ce.prototype),el.prototype.constructor=el,il.prototype=Object.create(el.prototype),il.prototype.constructor=il,al.prototype=Object.create(el.prototype),al.prototype.constructor=al,cl.prototype=Object.create(Gt.prototype),cl.prototype.constructor=cl,ul.prototype=Object.create(ce.prototype),ul.prototype.constructor=ul,hl.prototype=Object.create(fl.prototype),hl.prototype.constructor=hl,vl.prototype=Object.create(Zs.prototype),vl.prototype.constructor=vl,$l.prototype=Object.create(Zs.prototype),$l.prototype.constructor=$l,El.prototype=Object.create(St.prototype),El.prototype.constructor=El,Tl.prototype=Object.create(za.prototype),Tl.prototype.constructor=Tl,Object.defineProperty(Et.prototype,"context",{configurable:!0,get:function(){return this.context_p8rm81$_0}}),Object.defineProperty(Et.prototype,"coroutineContext",{configurable:!0,get:function(){return this.context}}),Object.defineProperty(Et.prototype,"isActive",{configurable:!0,get:function(){return e.callGetter(this,$n.prototype,"isActive")}}),Et.prototype.initParentJob_8be2vx$=function(){this.initParentJobInternal_8vd9i7$(this.parentContext.get_j3r2sn$(tn()))},Et.prototype.onStart=function(){},Et.prototype.onStartInternal=function(){this.onStart()},Et.prototype.onCompleted_11rb$=function(t){},Et.prototype.onCancelled_z1nxw$=function(t,e){},Et.prototype.cancellationExceptionMessage=function(){return Fs(this)+" was cancelled"},Et.prototype.onCompletionInternal_s8jyv4$=function(t){var n;e.isType(t,se)?this.onCancelled_z1nxw$(t.cause,t.handled):this.onCompleted_11rb$(null==(n=t)||e.isType(n,r)?n:o())},Et.prototype.resumeWith_tl1gpc$=function(t){var e=this.makeCompletingOnce_8ea4ql$(ie(t));e!==pn&&this.afterResume_s8jyv4$(e)},Et.prototype.afterResume_s8jyv4$=function(t){this.afterCompletion_s8jyv4$(t)},Et.prototype.handleOnCompletionException_tcv7n7$=function(t){de(this.context,t)},Et.prototype.nameString=function(){var t;return this.context,null==(t=null)?$n.prototype.nameString.call(this):'"'+t+'":'+$n.prototype.nameString.call(this)},Et.prototype.start_cfq2d3$=function(t,e){this.initParentJob_8be2vx$(),t.invoke_810yno$(e,this)},Et.prototype.start_b5ul0p$=function(t,e,n){this.initParentJob_8be2vx$(),t.invoke_3o0yor$(n,e,this)},Et.$metadata$={kind:a,simpleName:"AbstractCoroutine",interfaces:[Se,s,$n,Ze]},Ct.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Ct.prototype=Object.create(c.prototype),Ct.prototype.constructor=Ct,Ct.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$$receiver.isEmpty())return u();if(this.state_0=2,this.result_0=new Ot(f(this.local$$receiver)).await(this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.result_0;case 3:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.await=function(t){return(n=this,e=function(t){var e,i=n.deferreds_0.length,r=d(i);e=r.length-1|0;for(var o=0;o<=e;o++){var a=n,s=a.deferreds_0[o];s.start();var l=new zt(a,t);l.handle=s.invokeOnCompletion_f05bi3$(l),r[o]=l}var c,u=r,h=new Nt(n,u);for(c=0;c!==u.length;++c)u[c].disposer=h;return t.isCompleted?h.disposeAll():t.invokeOnCancellation_f05bi3$(h),p},function(t){var n=new Ht(_(t),1);return n.initCancellability(),e(n),n.getResult()})(t);var e,n},Nt.prototype.disposeAll=function(){var t,e=this.nodes_0;for(t=0;t!==e.length;++t)e[t].handle.dispose()},Nt.prototype.invoke=function(t){this.disposeAll()},Nt.prototype.toString=function(){return"DisposeHandlersOnCancel["+this.nodes_0+"]"},Nt.$metadata$={kind:a,simpleName:"DisposeHandlersOnCancel",interfaces:[Gt]},Object.defineProperty(zt.prototype,"handle",{configurable:!0,get:function(){return null==this.handle_45x73s$_0?h("handle"):this.handle_45x73s$_0},set:function(t){this.handle_45x73s$_0=t}}),Object.defineProperty(zt.prototype,"disposer",{configurable:!0,get:function(){return this._disposer_0},set:function(t){this._disposer_0=t}}),zt.prototype.invoke=function(t){var e;if(null!=t){var n=this.continuation_0.tryResumeWithException_tcv7n7$(t);null!=n&&(this.continuation_0.completeResume_za3rmp$(n),null!=(e=this.disposer)&&e.disposeAll())}else if(0==--this.$outer.notCompletedCount_0){var i,r=this.continuation_0,o=this.$outer.deferreds_0,a=y(o.length);for(i=0;i!==o.length;++i){var s=o[i];a.add_11rb$(s.getCompleted())}r.resumeWith_tl1gpc$(new m(a))}},zt.$metadata$={kind:a,simpleName:"AwaitAllNode",interfaces:[jn]},Ot.$metadata$={kind:a,simpleName:"AwaitAll",interfaces:[]},Tt.prototype.getCompleted=function(){var t;return null==(t=this.getCompletedInternal_8be2vx$())||e.isType(t,r)?t:o()},Pt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Pt.prototype=Object.create(c.prototype),Pt.prototype.constructor=Pt,Pt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.awaitInternal_8be2vx$(this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return null==(t=this.result_0)||e.isType(t,r)?t:o();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Tt.prototype.await=function(t,e){var n=new Pt(this,t);return e?n:n.doResume(null)},Object.defineProperty(Tt.prototype,"onAwait",{configurable:!0,get:function(){return this}}),Tt.prototype.registerSelectClause1_o3xas4$=function(t,e){this.registerSelectClause1Internal_u6kgbh$(t,e)},Tt.$metadata$={kind:a,simpleName:"DeferredCoroutine",interfaces:[ss,qe,Et]},Rt.prototype.onStart=function(){Qa(this.continuation_0,this)},Rt.$metadata$={kind:a,simpleName:"LazyDeferredCoroutine",interfaces:[Tt]},w("kotlinx-coroutines-core.kotlinx.coroutines.invoke_5xrhu2$",k((function(){var n=t.kotlinx.coroutines.withContext_i5cbzn$;return function(t,i,r){return e.suspendCall(n(t,i,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),At.prototype.handleJobException_tcv7n7$=function(t){return de(this.context,t),!0},At.$metadata$={kind:a,simpleName:"StandaloneCoroutine",interfaces:[Et]},It.prototype.onStart=function(){Qa(this.continuation_0,this)},It.$metadata$={kind:a,simpleName:"LazyStandaloneCoroutine",interfaces:[At]},Mt.prototype.trySuspend_0=function(){var t;for(this._decision_0;;)switch(this._decision_0){case 0:if(0===(t=this)._decision_0&&(t._decision_0=1,1))return!0;break;case 2:return!1;default:throw S("Already suspended".toString())}},Mt.prototype.tryResume_0=function(){var t;for(this._decision_0;;)switch(this._decision_0){case 0:if(0===(t=this)._decision_0&&(t._decision_0=2,1))return!0;break;case 1:return!1;default:throw S("Already resumed".toString())}},Mt.prototype.afterCompletion_s8jyv4$=function(t){this.afterResume_s8jyv4$(t)},Mt.prototype.afterResume_s8jyv4$=function(t){this.tryResume_0()||Ra(_(this.uCont),oe(t,this.uCont))},Mt.prototype.getResult=function(){var t;if(this.trySuspend_0())return l;var n=Cn(this.state_8be2vx$);if(e.isType(n,se))throw n.cause;return null==(t=n)||e.isType(t,r)?t:o()},Mt.$metadata$={kind:a,simpleName:"DispatchedCoroutine",interfaces:[Va]},Lt.prototype.tryResume_19pj23$=function(t,e,n){return void 0===e&&(e=null),n?n(t,e):this.tryResume_19pj23$$default(t,e)},Lt.prototype.cancel_dbl4no$=function(t,e){return void 0===t&&(t=null),e?e(t):this.cancel_dbl4no$$default(t)},Lt.$metadata$={kind:x,simpleName:"CancellableContinuation",interfaces:[s]},w("kotlinx-coroutines-core.kotlinx.coroutines.suspendCancellableCoroutine_o6sdx9$",k((function(){var n=e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,i=t.kotlinx.coroutines.CancellableContinuationImpl;return function(t,r){var o;return e.suspendCall((o=t,function(t){var e=new i(n(t),1);return e.initCancellability(),o(e),e.getResult()})(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.suspendCancellableCoroutineReusable_mkkzkw$",k((function(){var n=e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,i=t.kotlinx.coroutines.getOrCreateCancellableContinuation_3j0xf1$;return function(t,r){var o;return e.suspendCall((o=t,function(t){var e=i(n(t));return o(e),e.getResult()})(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),Ut.prototype.invoke=function(t){this.node_0.remove()},Ut.prototype.toString=function(){return"RemoveOnCancel["+this.node_0+"]"},Ut.$metadata$={kind:a,simpleName:"RemoveOnCancel",interfaces:[Jt]},Bt.prototype.invoke=function(t){this.handle_0.dispose()},Bt.prototype.toString=function(){return"DisposeOnCancel["+this.handle_0+"]"},Bt.$metadata$={kind:a,simpleName:"DisposeOnCancel",interfaces:[Gt]},Object.defineProperty(Ht.prototype,"delegate",{get:function(){return this.delegate_dhbmku$_0}}),Object.defineProperty(Ht.prototype,"context",{configurable:!0,get:function(){return this.context_xycjfy$_0}}),Object.defineProperty(Ht.prototype,"parentHandle_0",{configurable:!0,get:function(){return this._parentHandle_0},set:function(t){this._parentHandle_0=t}}),Object.defineProperty(Ht.prototype,"state_8be2vx$",{configurable:!0,get:function(){return this._state_0}}),Object.defineProperty(Ht.prototype,"isActive",{configurable:!0,get:function(){return e.isType(this.state_8be2vx$,Vt)}}),Object.defineProperty(Ht.prototype,"isCompleted",{configurable:!0,get:function(){return!e.isType(this.state_8be2vx$,Vt)}}),Object.defineProperty(Ht.prototype,"isCancelled",{configurable:!0,get:function(){return e.isType(this.state_8be2vx$,le)}}),Object.defineProperty(Ht.prototype,"stateDebugRepresentation_0",{configurable:!0,get:function(){var t;return t=this.state_8be2vx$,e.isType(t,Vt)?"Active":e.isType(t,le)?"Cancelled":"Completed"}}),Ht.prototype.initCancellability=function(){this.setupCancellation_0()},Ht.prototype.isReusable_0=function(){return e.isType(this.delegate,Pa)&&this.delegate.isReusable_pmw987$(this)},Ht.prototype.resetStateReusable_8be2vx$=function(){var t=this._state_0;return e.isType(t,Qt)&&null!=t.idempotentResume?(this.detachChild_8be2vx$(),!1):(this._decision_0=0,this._state_0=Yt(),!0)},Ht.prototype.setupCancellation_0=function(){var t;if(!this.checkCompleted_0()&&null===this.parentHandle_0&&null!=(t=this.delegate.context.get_j3r2sn$(tn()))){var e=t.invokeOnCompletion_ct2b2z$(!0,void 0,new Un(this));this.parentHandle_0=e,this.isCompleted&&!this.isReusable_0()&&(e.dispose(),this.parentHandle_0=vn())}},Ht.prototype.checkCompleted_0=function(){var t,n,i,r=this.isCompleted;if(!Ia(this.resumeMode))return r;if(null==(n=e.isType(t=this.delegate,Pa)?t:null))return r;if(null==(i=n.checkPostponedCancellation_jp3215$(this)))return r;var o=i;return r||this.cancel_dbl4no$(o),!0},Object.defineProperty(Ht.prototype,"callerFrame",{configurable:!0,get:function(){var t;return e.isType(t=this.delegate,Ml)?t:null}}),Ht.prototype.getStackTraceElement=function(){return null},Ht.prototype.takeState=function(){return this.state_8be2vx$},Ht.prototype.cancelCompletedResult_83a7kv$=function(t,n){var i;for(this._state_0;;){var r=this._state_0;if(e.isType(r,Vt))throw S("Not completed".toString());if(e.isType(r,se))return;if(e.isType(r,Qt)){if(r.cancelled)throw S("Must be called at most once".toString());var o=r.copy_pkdjca$(void 0,void 0,void 0,void 0,n);if((i=this)._state_0===r&&(i._state_0=o,1))return void r.invokeHandlers_gygfbe$(this,n)}else if(function(t){return t._state_0===r&&(t._state_0=new Qt(r,void 0,void 0,void 0,n),!0)}(this))return}},Ht.prototype.cancelLater_0=function(t){var n,i;return!!Ia(this.resumeMode)&&null!=(i=e.isType(n=this.delegate,Pa)?n:null)&&i.postponeCancellation_tcv7n7$(t)},Ht.prototype.cancel_dbl4no$$default=function(t){var n;for(this._state_0;;){var i=this._state_0;t:do{var r,o;if(!e.isType(i,Vt))return!1;var a=new le(this,t,e.isType(i,Gt));if((n=this)._state_0!==i||(n._state_0=a,0))break t;return null!=(o=e.isType(r=i,Gt)?r:null)&&this.callCancelHandler_gluymk$(o,t),this.detachChildIfNonResuable_0(),this.dispatchResume_0(this.resumeMode),!0}while(0)}},Ht.prototype.parentCancelled_8o0b5c$=function(t){this.cancelLater_0(t)||(this.cancel_dbl4no$(t),this.detachChildIfNonResuable_0())},Ht.prototype.callCancelHandlerSafely_0=function(t){try{t()}catch(t){if(!e.isType(t,E))throw t;de(this.context,new Ge("Exception in invokeOnCancellation handler for "+this,t))}},Ht.prototype.callCancelHandler_0=function(t,n){try{Ts(t,n)}catch(t){if(!e.isType(t,E))throw t;de(this.context,new Ge("Exception in invokeOnCancellation handler for "+this,t))}},Ht.prototype.callCancelHandler_gluymk$=function(t,n){try{t.invoke(n)}catch(t){if(!e.isType(t,E))throw t;de(this.context,new Ge("Exception in invokeOnCancellation handler for "+this,t))}},Ht.prototype.callOnCancellation_e590hv$=function(t,n){try{t(n)}catch(t){if(!e.isType(t,E))throw t;de(this.context,new Ge("Exception in resume onCancellation handler for "+this,t))}},Ht.prototype.getContinuationCancellationCause_dqr1mp$=function(t){return t.getCancellationException()},Ht.prototype.trySuspend_0=function(){var t;for(this._decision_0;;)switch(this._decision_0){case 0:if(0===(t=this)._decision_0&&(t._decision_0=1,1))return!0;break;case 2:return!1;default:throw S("Already suspended".toString())}},Ht.prototype.tryResume_0=function(){var t;for(this._decision_0;;)switch(this._decision_0){case 0:if(0===(t=this)._decision_0&&(t._decision_0=2,1))return!0;break;case 1:return!1;default:throw S("Already resumed".toString())}},Ht.prototype.getResult=function(){if(this.setupCancellation_0(),this.trySuspend_0())return l;var t=this.state_8be2vx$;if(e.isType(t,se))throw Rl(t.cause);if(Aa(this.resumeMode)){var n=this.context.get_j3r2sn$(tn());if(null!=n&&!n.isActive){var i=n.getCancellationException();throw this.cancelCompletedResult_83a7kv$(t,i),Rl(i)}}return this.getSuccessfulResult_tpy1pm$(t)},Ht.prototype.resumeWith_tl1gpc$=function(t){this.resumeImpl_0(re(t,this),this.resumeMode)},Ht.prototype.resume_q1ktlu$=function(t,e){this.resumeImpl_0(t,this.resumeMode,e)},Ht.prototype.invokeOnCancellation_f05bi3$=function(t){var n,i=this.makeCancelHandler_0(t);for(this._state_0;;){var r,o,a=this._state_0;if(e.isType(a,Kt)){if((n=this)._state_0===a&&(n._state_0=i,1))return}else if(e.isType(a,Gt))this.multipleHandlersError_0(t,a);else{if(e.isType(a,se))return a.makeHandled()||this.multipleHandlersError_0(t,a),void(e.isType(a,le)&&this.callCancelHandler_0(t,null!=(o=e.isType(r=a,se)?r:null)?o.cause:null));if(e.isType(a,Qt)){if(null!=a.cancelHandler&&this.multipleHandlersError_0(t,a),e.isType(i,Jt))return;if(a.cancelled)return void this.callCancelHandler_0(t,a.cancelCause);var s=a.copy_pkdjca$(void 0,i);if(function(t){return t._state_0===a&&(t._state_0=s,!0)}(this))return}else{if(e.isType(i,Jt))return;var l=new Qt(a,i);if(function(t){return t._state_0===a&&(t._state_0=l,!0)}(this))return}}}},Ht.prototype.multipleHandlersError_0=function(t,e){throw S(("It's prohibited to register multiple handlers, tried to register "+t+", already has "+C(e)).toString())},Ht.prototype.makeCancelHandler_0=function(t){return e.isType(t,Gt)?t:new Zt(t)},Ht.prototype.dispatchResume_0=function(t){this.tryResume_0()||La(this,t)},Ht.prototype.resumedState_0=function(t,n,i,r,o){var a;return e.isType(n,se)||!Aa(i)&&null==o||null==r&&(!e.isType(t,Gt)||e.isType(t,Jt))&&null==o?n:new Qt(n,e.isType(a=t,Gt)?a:null,r,o)},Ht.prototype.resumeImpl_0=function(t,n,i){var r;for(void 0===i&&(i=null),this._state_0;;){var o=this._state_0;t:do{if(e.isType(o,Vt)){var a=this.resumedState_0(o,t,n,i,null);if((r=this)._state_0!==o||(r._state_0=a,0))break t;return this.detachChildIfNonResuable_0(),void this.dispatchResume_0(n)}if(e.isType(o,le)&&o.makeResumed())return void(null!=i&&this.callOnCancellation_e590hv$(i,o.cause));this.alreadyResumedError_0(t)}while(0)}},Ht.prototype.tryResumeImpl_0=function(t,i,r){var o;for(this._state_0;;){var a=this._state_0;t:do{if(e.isType(a,Vt)){var s=this.resumedState_0(a,t,this.resumeMode,r,i);if((o=this)._state_0!==a||(o._state_0=s,0))break t;return this.detachChildIfNonResuable_0(),n}return e.isType(a,Qt)&&null!=i&&a.idempotentResume===i?n:null}while(0)}},Ht.prototype.alreadyResumedError_0=function(t){throw S(("Already resumed, but proposed with update "+C(t)).toString())},Ht.prototype.detachChildIfNonResuable_0=function(){this.isReusable_0()||this.detachChild_8be2vx$()},Ht.prototype.detachChild_8be2vx$=function(){var t=this.parentHandle_0;null!=t&&t.dispose(),this.parentHandle_0=vn()},Ht.prototype.tryResume_19pj23$$default=function(t,e){return this.tryResumeImpl_0(t,e,null)},Ht.prototype.tryResume_i8qury$=function(t,e,n){return this.tryResumeImpl_0(t,e,n)},Ht.prototype.tryResumeWithException_tcv7n7$=function(t){return this.tryResumeImpl_0(new se(t),null,null)},Ht.prototype.completeResume_za3rmp$=function(t){this.dispatchResume_0(this.resumeMode)},Ht.prototype.resumeUndispatched_hyuxa3$=function(t,n){var i,r=e.isType(i=this.delegate,Pa)?i:null;this.resumeImpl_0(n,(null!=r?r.dispatcher:null)===t?4:this.resumeMode)},Ht.prototype.resumeUndispatchedWithException_gd0rtt$=function(t,n){var i,r=e.isType(i=this.delegate,Pa)?i:null;this.resumeImpl_0(new se(n),(null!=r?r.dispatcher:null)===t?4:this.resumeMode)},Ht.prototype.getSuccessfulResult_tpy1pm$=function(t){var n,i;return e.isType(t,Qt)?null==(n=t.result)||e.isType(n,r)?n:o():null==(i=t)||e.isType(i,r)?i:o()},Ht.prototype.getExceptionalResult_s8jyv4$=function(t){var e;return null!=(e=Ma.prototype.getExceptionalResult_s8jyv4$.call(this,t))?Rl(e,this.delegate):null},Ht.prototype.toString=function(){return this.nameString()+"("+Is(this.delegate)+"){"+this.stateDebugRepresentation_0+"}@"+qs(this)},Ht.prototype.nameString=function(){return"CancellableContinuation"},Ht.$metadata$={kind:a,simpleName:"CancellableContinuationImpl",interfaces:[Ml,Lt,Ma]},Vt.$metadata$={kind:x,simpleName:"NotCompleted",interfaces:[]},Kt.prototype.toString=function(){return"Active"},Kt.$metadata$={kind:O,simpleName:"Active",interfaces:[Vt]};var Wt=null;function Yt(){return null===Wt&&new Kt,Wt}function Gt(){js.call(this)}function Jt(){Gt.call(this)}function Zt(t){Gt.call(this),this.handler_0=t}function Qt(t,e,n,i,r){void 0===e&&(e=null),void 0===n&&(n=null),void 0===i&&(i=null),void 0===r&&(r=null),this.result=t,this.cancelHandler=e,this.onCancellation=n,this.idempotentResume=i,this.cancelCause=r}function Xt(){}function te(t){$n.call(this,!0),this.initParentJobInternal_8vd9i7$(t)}function ee(t,e){c.call(this,e),this.exceptionState_0=1,this.$this=t}function ne(){}function ie(t,n){var i,a;void 0===n&&(n=null);var s=t.exceptionOrNull();if(null==s){var l=null==(i=t.value)||e.isType(i,r)?i:o();a=null!=n?new ae(l,n):l}else a=new se(s);return a}function re(t,n){var i,a=t.exceptionOrNull();return null==a?null==(i=t.value)||e.isType(i,r)?i:o():new se(Rl(a))}function oe(t,n){var i;return e.isType(t,se)?new m(N(Rl(t.cause))):(m.Companion,new m(null==(i=t)||e.isType(i,r)?i:o()))}function ae(t,e){this.result=t,this.onCancellation=e}function se(t,e){void 0===e&&(e=!1),this.cause=t,this._handled_0=e}function le(t,e,n){se.call(this,null!=e?e:Qs("Continuation "+t+" was cancelled normally"),n),this._resumed_0=!1}function ce(){fe(),j.call(this,g.Key)}function ue(){he=this,z.call(this,g.Key,pe)}function pe(t){var n;return e.isType(n=t,ce)?n:null}Gt.$metadata$={kind:a,simpleName:"CancelHandler",interfaces:[Vt,js]},Jt.$metadata$={kind:a,simpleName:"BeforeResumeCancelHandler",interfaces:[Gt]},Zt.prototype.invoke=function(t){this.handler_0(t)},Zt.prototype.toString=function(){return"InvokeOnCancel["+Fs(this.handler_0)+"@"+qs(this)+"]"},Zt.$metadata$={kind:a,simpleName:"InvokeOnCancel",interfaces:[Gt]},Object.defineProperty(Qt.prototype,"cancelled",{configurable:!0,get:function(){return null!=this.cancelCause}}),Qt.prototype.invokeHandlers_gygfbe$=function(t,e){var n,i;null!=(n=this.cancelHandler)&&t.callCancelHandler_gluymk$(n,e),null!=(i=this.onCancellation)&&t.callOnCancellation_e590hv$(i,e)},Qt.$metadata$={kind:a,simpleName:"CompletedContinuation",interfaces:[]},Qt.prototype.component1=function(){return this.result},Qt.prototype.component2=function(){return this.cancelHandler},Qt.prototype.component3=function(){return this.onCancellation},Qt.prototype.component4=function(){return this.idempotentResume},Qt.prototype.component5=function(){return this.cancelCause},Qt.prototype.copy_pkdjca$=function(t,e,n,i,r){return new Qt(void 0===t?this.result:t,void 0===e?this.cancelHandler:e,void 0===n?this.onCancellation:n,void 0===i?this.idempotentResume:i,void 0===r?this.cancelCause:r)},Qt.prototype.toString=function(){return"CompletedContinuation(result="+e.toString(this.result)+", cancelHandler="+e.toString(this.cancelHandler)+", onCancellation="+e.toString(this.onCancellation)+", idempotentResume="+e.toString(this.idempotentResume)+", cancelCause="+e.toString(this.cancelCause)+")"},Qt.prototype.hashCode=function(){var t=0;return t=31*(t=31*(t=31*(t=31*(t=31*t+e.hashCode(this.result)|0)+e.hashCode(this.cancelHandler)|0)+e.hashCode(this.onCancellation)|0)+e.hashCode(this.idempotentResume)|0)+e.hashCode(this.cancelCause)|0},Qt.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.result,t.result)&&e.equals(this.cancelHandler,t.cancelHandler)&&e.equals(this.onCancellation,t.onCancellation)&&e.equals(this.idempotentResume,t.idempotentResume)&&e.equals(this.cancelCause,t.cancelCause)},Xt.$metadata$={kind:x,simpleName:"CompletableDeferred",interfaces:[qe]},Object.defineProperty(te.prototype,"onCancelComplete",{configurable:!0,get:function(){return!0}}),te.prototype.getCompleted=function(){var t;return null==(t=this.getCompletedInternal_8be2vx$())||e.isType(t,r)?t:o()},ee.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},ee.prototype=Object.create(c.prototype),ee.prototype.constructor=ee,ee.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.awaitInternal_8be2vx$(this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return null==(t=this.result_0)||e.isType(t,r)?t:o();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},te.prototype.await=function(t,e){var n=new ee(this,t);return e?n:n.doResume(null)},Object.defineProperty(te.prototype,"onAwait",{configurable:!0,get:function(){return this}}),te.prototype.registerSelectClause1_o3xas4$=function(t,e){this.registerSelectClause1Internal_u6kgbh$(t,e)},te.prototype.complete_11rb$=function(t){return this.makeCompleting_8ea4ql$(t)},te.prototype.completeExceptionally_tcv7n7$=function(t){return this.makeCompleting_8ea4ql$(new se(t))},te.$metadata$={kind:a,simpleName:"CompletableDeferredImpl",interfaces:[ss,Xt,$n]},ne.$metadata$={kind:x,simpleName:"CompletableJob",interfaces:[Ze]},ae.$metadata$={kind:a,simpleName:"CompletedWithCancellation",interfaces:[]},ae.prototype.component1=function(){return this.result},ae.prototype.component2=function(){return this.onCancellation},ae.prototype.copy_pe4fyg$=function(t,e){return new ae(void 0===t?this.result:t,void 0===e?this.onCancellation:e)},ae.prototype.toString=function(){return"CompletedWithCancellation(result="+e.toString(this.result)+", onCancellation="+e.toString(this.onCancellation)+")"},ae.prototype.hashCode=function(){var t=0;return t=31*(t=31*t+e.hashCode(this.result)|0)+e.hashCode(this.onCancellation)|0},ae.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.result,t.result)&&e.equals(this.onCancellation,t.onCancellation)},Object.defineProperty(se.prototype,"handled",{configurable:!0,get:function(){return this._handled_0}}),se.prototype.makeHandled=function(){return!1===(t=this)._handled_0&&(t._handled_0=!0,!0);var t},se.prototype.toString=function(){return Fs(this)+"["+this.cause+"]"},se.$metadata$={kind:a,simpleName:"CompletedExceptionally",interfaces:[]},le.prototype.makeResumed=function(){return!1===(t=this)._resumed_0&&(t._resumed_0=!0,!0);var t},le.$metadata$={kind:a,simpleName:"CancelledContinuation",interfaces:[se]},ue.$metadata$={kind:O,simpleName:"Key",interfaces:[z]};var he=null;function fe(){return null===he&&new ue,he}function de(t,n){var i;try{if(null!=(i=t.get_j3r2sn$($e())))return void i.handleException_1ur55u$(t,n)}catch(t){if(e.isType(t,E))return void Ds(0,_e(n,t));throw t}Ds(0,n)}function _e(t,e){return t===e?t:new T("Exception while trying to handle coroutine exception",e)}function ye(){$e()}function me(){ve=this}ce.prototype.isDispatchNeeded_1fupul$=function(t){return!0},ce.prototype.dispatchYield_5bn72i$=function(t,e){this.dispatch_5bn72i$(t,e)},ce.prototype.interceptContinuation_wj8d80$=function(t){return new Pa(this,t)},ce.prototype.releaseInterceptedContinuation_k98bjh$=function(t){var n,i;null!=(i=(e.isType(n=t,Pa)?n:o()).reusableCancellableContinuation)&&i.detachChild_8be2vx$()},ce.prototype.plus_9wrrq5$=function(t){return t},ce.prototype.toString=function(){return Fs(this)+"@"+qs(this)},ce.$metadata$={kind:a,simpleName:"CoroutineDispatcher",interfaces:[g,j]},me.$metadata$={kind:O,simpleName:"Key",interfaces:[P]};var ve=null;function $e(){return null===ve&&new me,ve}function ge(t){ke(),j.call(this,ke()),this.name=t}function be(){we=this}ye.$metadata$={kind:x,simpleName:"CoroutineExceptionHandler",interfaces:[R]},be.$metadata$={kind:O,simpleName:"Key",interfaces:[P]};var we=null;function ke(){return null===we&&new be,we}function Se(){}function xe(){ze=this}ge.prototype.toString=function(){return"CoroutineName("+this.name+")"},ge.$metadata$={kind:a,simpleName:"CoroutineName",interfaces:[j]},ge.prototype.component1=function(){return this.name},ge.prototype.copy_61zpoe$=function(t){return new ge(void 0===t?this.name:t)},ge.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.name)|0},ge.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.name,t.name)},Se.$metadata$={kind:x,simpleName:"CoroutineScope",interfaces:[]},Object.defineProperty(xe.prototype,"coroutineContext",{configurable:!0,get:function(){return v.EmptyCoroutineContext}}),xe.$metadata$={kind:O,simpleName:"GlobalScope",interfaces:[Se]};var Ee,Ce,Oe,Ne,ze=null;function je(t,e){return(n=t,function(t){var e=new Va(t.context,t);return is(e,e,n)})(e);var n}function Te(t,e){var n;if(void 0===e&&(e=null),null==(n=t.coroutineContext.get_j3r2sn$(tn())))throw S(("Scope cannot be cancelled because it does not have a job: "+t).toString());n.cancel_m4sck1$(e)}function Pe(t,e){M.call(this),this.name$=t,this.ordinal$=e}function Re(){Re=function(){},Ee=new Pe("DEFAULT",0),Ce=new Pe("LAZY",1),Oe=new Pe("ATOMIC",2),Ne=new Pe("UNDISPATCHED",3)}function Ae(){return Re(),Ee}function Ie(){return Re(),Ce}function Me(){return Re(),Oe}function Le(){return Re(),Ne}function De(){}function qe(){}function Fe(t){return function(e){var n=new Ht(_(e),1);return n.initCancellability(),t(n),n.getResult()}}function Ue(){}function Be(t){var n,i;return null!=(i=e.isType(n=t.get_j3r2sn$(g.Key),Ue)?n:null)?i:Rs()}function He(){ce.call(this),this.useCount_0=F,this.shared_0=!1,this.unconfinedQueue_0=null}function Ve(){Ke=this,this.ref_0=new Fl}w("kotlinx-coroutines-core.kotlinx.coroutines.currentCoroutineContext",(function(t){return e.coroutineReceiver().context})),Pe.prototype.invoke_810yno$=function(t,n){switch(this.name){case"DEFAULT":Ja(t,n);break;case"ATOMIC":A(t,n);break;case"UNDISPATCHED":es(t,n);break;case"LAZY":break;default:e.noWhenBranchMatched()}},Pe.prototype.invoke_3o0yor$=function(t,n,i){switch(this.name){case"DEFAULT":Za(t,n,i);break;case"ATOMIC":I(t,n,i);break;case"UNDISPATCHED":ns(t,n,i);break;case"LAZY":break;default:e.noWhenBranchMatched()}},Object.defineProperty(Pe.prototype,"isLazy",{configurable:!0,get:function(){return this===Ie()}}),Pe.$metadata$={kind:a,simpleName:"CoroutineStart",interfaces:[M]},Pe.values=function(){return[Ae(),Ie(),Me(),Le()]},Pe.valueOf_61zpoe$=function(t){switch(t){case"DEFAULT":return Ae();case"LAZY":return Ie();case"ATOMIC":return Me();case"UNDISPATCHED":return Le();default:L("No enum constant kotlinx.coroutines.CoroutineStart."+t)}},De.$metadata$={kind:x,simpleName:"CopyableThrowable",interfaces:[]},qe.$metadata$={kind:x,simpleName:"Deferred",interfaces:[Ze]},Ue.prototype.delay_s8cxhz$=function(t,e){var n,i;if(!(t.toNumber()<=0))return Fe((n=t,i=this,function(t){return i.scheduleResumeAfterDelay_egqmvs$(n,t),p}))(e)},Ue.prototype.invokeOnTimeout_oczv3n$=function(t,e,n){return Rs().invokeOnTimeout_oczv3n$(t,e,n)},Ue.$metadata$={kind:x,simpleName:"Delay",interfaces:[]},He.prototype.processNextEvent=function(){return this.processUnconfinedEvent()?F:D},Object.defineProperty(He.prototype,"isEmpty",{configurable:!0,get:function(){return this.isUnconfinedQueueEmpty}}),Object.defineProperty(He.prototype,"nextTime",{configurable:!0,get:function(){var t;return null==(t=this.unconfinedQueue_0)||t.isEmpty?D:F}}),He.prototype.processUnconfinedEvent=function(){var t,e;return null!=(t=this.unconfinedQueue_0)&&null!=(e=t.removeFirstOrNull())&&(e.run(),!0)},He.prototype.shouldBeProcessedFromContext=function(){return!1},He.prototype.dispatchUnconfined_4avnfa$=function(t){var e,n;if(null!=(e=this.unconfinedQueue_0))n=e;else{var i=new Na;this.unconfinedQueue_0=i,n=i}n.addLast_trkh7z$(t)},Object.defineProperty(He.prototype,"isActive",{configurable:!0,get:function(){return this.useCount_0.toNumber()>0}}),Object.defineProperty(He.prototype,"isUnconfinedLoopActive",{configurable:!0,get:function(){return this.useCount_0.compareTo_11rb$(this.delta_0(!0))>=0}}),Object.defineProperty(He.prototype,"isUnconfinedQueueEmpty",{configurable:!0,get:function(){var t,e;return null==(e=null!=(t=this.unconfinedQueue_0)?t.isEmpty:null)||e}}),He.prototype.delta_0=function(t){return t?U:q},He.prototype.incrementUseCount_6taknv$=function(t){void 0===t&&(t=!1),this.useCount_0=this.useCount_0.add(this.delta_0(t)),t||(this.shared_0=!0)},He.prototype.decrementUseCount_6taknv$=function(t){void 0===t&&(t=!1),this.useCount_0=this.useCount_0.subtract(this.delta_0(t)),this.useCount_0.toNumber()>0||this.shared_0&&this.shutdown()},He.prototype.shutdown=function(){},He.$metadata$={kind:a,simpleName:"EventLoop",interfaces:[ce]},Object.defineProperty(Ve.prototype,"eventLoop_8be2vx$",{configurable:!0,get:function(){var t,e;if(null!=(t=this.ref_0.get()))e=t;else{var n=Ws();this.ref_0.set_11rb$(n),e=n}return e}}),Ve.prototype.currentOrNull_8be2vx$=function(){return this.ref_0.get()},Ve.prototype.resetEventLoop_8be2vx$=function(){this.ref_0.set_11rb$(null)},Ve.prototype.setEventLoop_13etkv$=function(t){this.ref_0.set_11rb$(t)},Ve.$metadata$={kind:O,simpleName:"ThreadLocalEventLoop",interfaces:[]};var Ke=null;function We(){return null===Ke&&new Ve,Ke}function Ye(){Gs.call(this),this._queue_0=null,this._delayed_0=null,this._isCompleted_0=!1}function Ge(t,e){T.call(this,t,e),this.name="CompletionHandlerException"}function Je(t,e){V.call(this,t,e),this.name="CoroutinesInternalError"}function Ze(){tn()}function Qe(){Xe=this,$e()}Ge.$metadata$={kind:a,simpleName:"CompletionHandlerException",interfaces:[T]},Je.$metadata$={kind:a,simpleName:"CoroutinesInternalError",interfaces:[V]},Qe.$metadata$={kind:O,simpleName:"Key",interfaces:[P]};var Xe=null;function tn(){return null===Xe&&new Qe,Xe}function en(t){return void 0===t&&(t=null),new Nn(t)}function nn(){}function rn(){}function on(){}function an(){}function sn(t){if(!t.isActive)throw t.getCancellationException()}function ln(t){var e;null!=(e=t.get_j3r2sn$(tn()))&&sn(e)}function cn(){mn=this}Ze.prototype.cancel_m4sck1$=function(t,e){void 0===t&&(t=null),e?e(t):this.cancel_m4sck1$$default(t)},Ze.prototype.cancel=function(){this.cancel_m4sck1$(null)},Ze.prototype.cancel_dbl4no$=function(t,e){return void 0===t&&(t=null),e?e(t):this.cancel_dbl4no$$default(t)},Ze.prototype.invokeOnCompletion_ct2b2z$=function(t,e,n,i){return void 0===t&&(t=!1),void 0===e&&(e=!0),i?i(t,e,n):this.invokeOnCompletion_ct2b2z$$default(t,e,n)},Ze.prototype.plus_dqr1mp$=function(t){return t},Ze.$metadata$={kind:x,simpleName:"Job",interfaces:[R]},nn.$metadata$={kind:x,simpleName:"DisposableHandle",interfaces:[]},rn.$metadata$={kind:x,simpleName:"ChildJob",interfaces:[Ze]},on.$metadata$={kind:x,simpleName:"ParentJob",interfaces:[Ze]},an.$metadata$={kind:x,simpleName:"ChildHandle",interfaces:[nn]},cn.prototype.dispose=function(){},cn.prototype.childCancelled_tcv7n7$=function(t){return!1},cn.prototype.toString=function(){return"NonDisposableHandle"},cn.$metadata$={kind:O,simpleName:"NonDisposableHandle",interfaces:[an,nn]};var un,pn,hn,fn,dn,_n,yn,mn=null;function vn(){return null===mn&&new cn,mn}function $n(t){this._state_v70vig$_0=t?yn:_n,this._parentHandle_acgcx5$_0=null}function gn(t,e){return function(){return t.state_8be2vx$===e}}function bn(t,e,n,i){c.call(this,i),this.$controller=n,this.exceptionState_0=1,this.local$this$JobSupport=t,this.local$tmp$=void 0,this.local$tmp$_0=void 0,this.local$cur=void 0,this.local$$receiver=e}function wn(t,e,n){this.list_m9wkmb$_0=t,this._isCompleting_0=e,this._rootCause_0=n,this._exceptionsHolder_0=null}function kn(t,e,n,i){jn.call(this),this.parent_0=t,this.state_0=e,this.child_0=n,this.proposedUpdate_0=i}function Sn(t,e){Ht.call(this,t,1),this.job_0=e}function xn(t){this.state=t}function En(t){return e.isType(t,zn)?new xn(t):t}function Cn(t){var n,i,r;return null!=(r=null!=(i=e.isType(n=t,xn)?n:null)?i.state:null)?r:t}function On(t){this.isActive_hyoax9$_0=t}function Nn(t){$n.call(this,!0),this.initParentJobInternal_8vd9i7$(t),this.handlesException_fejgjb$_0=this.handlesExceptionF()}function zn(){}function jn(){zs.call(this),this.job_ndnibc$_0=this.job_ndnibc$_0}function Tn(){Pl.call(this)}function Pn(t){this.list_afai45$_0=t}function Rn(t){jn.call(this),this.handler_0=t}function An(t){jn.call(this),this.continuation_0=t}function In(t){jn.call(this),this.continuation_0=t}function Mn(t,e){jn.call(this),this.select_0=t,this.block_0=e}function Ln(t,e){jn.call(this),this.select_0=t,this.block_0=e}function Dn(){jn.call(this)}function qn(t){Dn.call(this),this.handler_0=t,this._invoked_0=0}function Fn(t){Dn.call(this),this.childJob=t}function Un(t){Dn.call(this),this.child=t}function Bn(){ce.call(this)}function Hn(){j.call(this,tn())}function Vn(t){Nn.call(this,t)}function Kn(t,e){Qs(t,this),this.coroutine_8be2vx$=e,this.name="TimeoutCancellationException"}function Wn(){Yn=this,ce.call(this)}Object.defineProperty($n.prototype,"key",{configurable:!0,get:function(){return tn()}}),Object.defineProperty($n.prototype,"parentHandle_8be2vx$",{configurable:!0,get:function(){return this._parentHandle_acgcx5$_0},set:function(t){this._parentHandle_acgcx5$_0=t}}),$n.prototype.initParentJobInternal_8vd9i7$=function(t){if(null!=t){t.start();var e=t.attachChild_kx8v25$(this);this.parentHandle_8be2vx$=e,this.isCompleted&&(e.dispose(),this.parentHandle_8be2vx$=vn())}else this.parentHandle_8be2vx$=vn()},Object.defineProperty($n.prototype,"state_8be2vx$",{configurable:!0,get:function(){for(this._state_v70vig$_0;;){var t=this._state_v70vig$_0;if(!e.isType(t,za))return t;t.perform_s8jyv4$(this)}}}),$n.prototype.loopOnState_46ivxf$_0=function(t){for(;;)t(this.state_8be2vx$)},Object.defineProperty($n.prototype,"isActive",{configurable:!0,get:function(){var t=this.state_8be2vx$;return e.isType(t,zn)&&t.isActive}}),Object.defineProperty($n.prototype,"isCompleted",{configurable:!0,get:function(){return!e.isType(this.state_8be2vx$,zn)}}),Object.defineProperty($n.prototype,"isCancelled",{configurable:!0,get:function(){var t=this.state_8be2vx$;return e.isType(t,se)||e.isType(t,wn)&&t.isCancelling}}),$n.prototype.finalizeFinishingState_10mr1z$_0=function(t,n){var i,r,a,s=null!=(r=e.isType(i=n,se)?i:null)?r.cause:null,l={v:!1};l.v=t.isCancelling;var c=t.sealLocked_dbl4no$(s),u=this.getFinalRootCause_3zkch4$_0(t,c);null!=u&&this.addSuppressedExceptions_85dgeo$_0(u,c);var p,h=u,f=null==h||h===s?n:new se(h);return null!=h&&(this.cancelParent_7dutpz$_0(h)||this.handleJobException_tcv7n7$(h))&&(e.isType(a=f,se)?a:o()).makeHandled(),l.v||this.onCancelling_dbl4no$(h),this.onCompletionInternal_s8jyv4$(f),(p=this)._state_v70vig$_0===t&&(p._state_v70vig$_0=En(f)),this.completeStateFinalization_a4ilmi$_0(t,f),f},$n.prototype.getFinalRootCause_3zkch4$_0=function(t,n){if(n.isEmpty())return t.isCancelling?new Xs(this.cancellationExceptionMessage(),null,this):null;var i;t:do{var r;for(r=n.iterator();r.hasNext();){var o=r.next();if(!e.isType(o,Zs)){i=o;break t}}i=null}while(0);if(null!=i)return i;var a=n.get_za3lpa$(0);if(e.isType(a,Kn)){var s;t:do{var l;for(l=n.iterator();l.hasNext();){var c=l.next();if(c!==a&&e.isType(c,Kn)){s=c;break t}}s=null}while(0);if(null!=s)return s}return a},$n.prototype.addSuppressedExceptions_85dgeo$_0=function(t,n){var i;if(!(n.size<=1)){var r=xl(n.size),o=t;for(i=n.iterator();i.hasNext();){var a=i.next();a!==t&&a!==o&&!e.isType(a,Zs)&&r.add_11rb$(a)}}},$n.prototype.tryFinalizeSimpleState_5emg4m$_0=function(t,e){return(n=this)._state_v70vig$_0===t&&(n._state_v70vig$_0=En(e),!0)&&(this.onCancelling_dbl4no$(null),this.onCompletionInternal_s8jyv4$(e),this.completeStateFinalization_a4ilmi$_0(t,e),!0);var n},$n.prototype.completeStateFinalization_a4ilmi$_0=function(t,n){var i,r,o,a;null!=(i=this.parentHandle_8be2vx$)&&(i.dispose(),this.parentHandle_8be2vx$=vn());var s=null!=(o=e.isType(r=n,se)?r:null)?o.cause:null;if(e.isType(t,jn))try{t.invoke(s)}catch(n){if(!e.isType(n,E))throw n;this.handleOnCompletionException_tcv7n7$(new Ge("Exception in completion handler "+t+" for "+this,n))}else null!=(a=t.list)&&this.notifyCompletion_mgxta4$_0(a,s)},$n.prototype.notifyCancelling_xkpzb8$_0=function(t,n){var i;this.onCancelling_dbl4no$(n);for(var r={v:null},o=t._next;!b(o,t);){if(e.isType(o,Dn)){var a,s=o;try{s.invoke(n)}catch(t){if(!e.isType(t,E))throw t;null==(null!=(a=r.v)?a:null)&&(r.v=new Ge("Exception in completion handler "+s+" for "+this,t))}}o=o._next}null!=(i=r.v)&&this.handleOnCompletionException_tcv7n7$(i),this.cancelParent_7dutpz$_0(n)},$n.prototype.cancelParent_7dutpz$_0=function(t){if(this.isScopedCoroutine)return!0;var n=e.isType(t,Zs),i=this.parentHandle_8be2vx$;return null===i||i===vn()?n:i.childCancelled_tcv7n7$(t)||n},$n.prototype.notifyCompletion_mgxta4$_0=function(t,n){for(var i,r={v:null},o=t._next;!b(o,t);){if(e.isType(o,jn)){var a,s=o;try{s.invoke(n)}catch(t){if(!e.isType(t,E))throw t;null==(null!=(a=r.v)?a:null)&&(r.v=new Ge("Exception in completion handler "+s+" for "+this,t))}}o=o._next}null!=(i=r.v)&&this.handleOnCompletionException_tcv7n7$(i)},$n.prototype.notifyHandlers_8g4jwh$_0=k((function(){var t=e.equals;return function(n,i,r,o){for(var a,s={v:null},l=r._next;!t(l,r);){if(i(l)){var c,u=l;try{u.invoke(o)}catch(t){if(!e.isType(t,E))throw t;null==(null!=(c=s.v)?c:null)&&(s.v=new Ge("Exception in completion handler "+u+" for "+this,t))}}l=l._next}null!=(a=s.v)&&this.handleOnCompletionException_tcv7n7$(a)}})),$n.prototype.start=function(){for(;;)switch(this.startInternal_tp1bqd$_0(this.state_8be2vx$)){case 0:return!1;case 1:return!0}},$n.prototype.startInternal_tp1bqd$_0=function(t){return e.isType(t,On)?t.isActive?0:(n=this)._state_v70vig$_0!==t||(n._state_v70vig$_0=yn,0)?-1:(this.onStartInternal(),1):e.isType(t,Pn)?function(e){return e._state_v70vig$_0===t&&(e._state_v70vig$_0=t.list,!0)}(this)?(this.onStartInternal(),1):-1:0;var n},$n.prototype.onStartInternal=function(){},$n.prototype.getCancellationException=function(){var t,n,i=this.state_8be2vx$;if(e.isType(i,wn)){if(null==(n=null!=(t=i.rootCause)?this.toCancellationException_rg9tb7$(t,Fs(this)+" is cancelling"):null))throw S(("Job is still new or active: "+this).toString());return n}if(e.isType(i,zn))throw S(("Job is still new or active: "+this).toString());return e.isType(i,se)?this.toCancellationException_rg9tb7$(i.cause):new Xs(Fs(this)+" has completed normally",null,this)},$n.prototype.toCancellationException_rg9tb7$=function(t,n){var i,r;return void 0===n&&(n=null),null!=(r=e.isType(i=t,Zs)?i:null)?r:new Xs(null!=n?n:this.cancellationExceptionMessage(),t,this)},Object.defineProperty($n.prototype,"completionCause",{configurable:!0,get:function(){var t,n=this.state_8be2vx$;if(e.isType(n,wn)){if(null==(t=n.rootCause))throw S(("Job is still new or active: "+this).toString());return t}if(e.isType(n,zn))throw S(("Job is still new or active: "+this).toString());return e.isType(n,se)?n.cause:null}}),Object.defineProperty($n.prototype,"completionCauseHandled",{configurable:!0,get:function(){var t=this.state_8be2vx$;return e.isType(t,se)&&t.handled}}),$n.prototype.invokeOnCompletion_f05bi3$=function(t){return this.invokeOnCompletion_ct2b2z$(!1,!0,t)},$n.prototype.invokeOnCompletion_ct2b2z$$default=function(t,n,i){for(var r,a=this.makeNode_9qhc1i$_0(i,t);;){var s=this.state_8be2vx$;t:do{var l,c,u;if(e.isType(s,On))if(s.isActive){if((r=this)._state_v70vig$_0===s&&(r._state_v70vig$_0=a,1))return a}else this.promoteEmptyToNodeList_lchanx$_0(s);else{if(!e.isType(s,zn))return n&&Ts(i,null!=(u=e.isType(c=s,se)?c:null)?u.cause:null),vn();var p=s.list;if(null==p)this.promoteSingleToNodeList_l9deey$_0(e.isType(l=s,jn)?l:o());else{var h={v:null},f={v:vn()};if(t&&e.isType(s,wn)){h.v=s.rootCause;var d=null==h.v;if(d||(d=e.isType(i,Fn)&&!s.isCompleting),d){if(!this.addLastAtomic_ct8uo8$_0(s,p,a))break t;if(null==h.v)return a;f.v=a}}if(null!=h.v)return n&&Ts(i,h.v),f.v;if(this.addLastAtomic_ct8uo8$_0(s,p,a))return a}}}while(0)}},$n.prototype.makeNode_9qhc1i$_0=function(t,n){var i,r,o,a,s,l=n?null!=(r=e.isType(i=t,Dn)?i:null)?r:new qn(t):null!=(s=null!=(a=e.isType(o=t,jn)?o:null)?a:null)?s:new Rn(t);return l.job=this,l},$n.prototype.addLastAtomic_ct8uo8$_0=function(t,e,n){var i;t:do{if(!gn(this,t)()){i=!1;break t}e.addLast_l2j9rm$(n),i=!0}while(0);return i},$n.prototype.promoteEmptyToNodeList_lchanx$_0=function(t){var e,n=new Tn,i=t.isActive?n:new Pn(n);(e=this)._state_v70vig$_0===t&&(e._state_v70vig$_0=i)},$n.prototype.promoteSingleToNodeList_l9deey$_0=function(t){t.addOneIfEmpty_l2j9rm$(new Tn);var e,n=t._next;(e=this)._state_v70vig$_0===t&&(e._state_v70vig$_0=n)},$n.prototype.join=function(t){if(this.joinInternal_ta6o25$_0())return this.joinSuspend_kfh5g8$_0(t);ci(t.context)},$n.prototype.joinInternal_ta6o25$_0=function(){for(;;){var t=this.state_8be2vx$;if(!e.isType(t,zn))return!1;if(this.startInternal_tp1bqd$_0(t)>=0)return!0}},$n.prototype.joinSuspend_kfh5g8$_0=function(t){return(n=this,e=function(t){return Ft(t,n.invokeOnCompletion_f05bi3$(new An(t))),p},function(t){var n=new Ht(_(t),1);return n.initCancellability(),e(n),n.getResult()})(t);var e,n},Object.defineProperty($n.prototype,"onJoin",{configurable:!0,get:function(){return this}}),$n.prototype.registerSelectClause0_s9h9qd$=function(t,n){for(;;){var i=this.state_8be2vx$;if(t.isSelected)return;if(!e.isType(i,zn))return void(t.trySelect()&&Xa(n,t.completion));if(0===this.startInternal_tp1bqd$_0(i))return void t.disposeOnSelect_rvfg84$(this.invokeOnCompletion_f05bi3$(new Mn(t,n)))}},$n.prototype.removeNode_jr34ao$=function(t){for(;;){var n=this.state_8be2vx$;if(!e.isType(n,jn))return e.isType(n,zn)?void(null!=n.list&&t.remove()):void 0;if(n!==t)return;if((i=this)._state_v70vig$_0===n&&(i._state_v70vig$_0=yn,1))return}var i},Object.defineProperty($n.prototype,"onCancelComplete",{configurable:!0,get:function(){return!1}}),$n.prototype.cancel_m4sck1$$default=function(t){this.cancelInternal_tcv7n7$(null!=t?t:new Xs(this.cancellationExceptionMessage(),null,this))},$n.prototype.cancellationExceptionMessage=function(){return"Job was cancelled"},$n.prototype.cancel_dbl4no$$default=function(t){var e;return this.cancelInternal_tcv7n7$(null!=(e=null!=t?this.toCancellationException_rg9tb7$(t):null)?e:new Xs(this.cancellationExceptionMessage(),null,this)),!0},$n.prototype.cancelInternal_tcv7n7$=function(t){this.cancelImpl_8ea4ql$(t)},$n.prototype.parentCancelled_pv1t6x$=function(t){this.cancelImpl_8ea4ql$(t)},$n.prototype.childCancelled_tcv7n7$=function(t){return!!e.isType(t,Zs)||this.cancelImpl_8ea4ql$(t)&&this.handlesException},$n.prototype.cancelCoroutine_dbl4no$=function(t){return this.cancelImpl_8ea4ql$(t)},$n.prototype.cancelImpl_8ea4ql$=function(t){var e,n=un;return!(!this.onCancelComplete||(n=this.cancelMakeCompleting_z3ww04$_0(t))!==pn)||(n===un&&(n=this.makeCancelling_xjon1g$_0(t)),n===un||n===pn?e=!0:n===fn?e=!1:(this.afterCompletion_s8jyv4$(n),e=!0),e)},$n.prototype.cancelMakeCompleting_z3ww04$_0=function(t){for(;;){var n=this.state_8be2vx$;if(!e.isType(n,zn)||e.isType(n,wn)&&n.isCompleting)return un;var i=new se(this.createCauseException_kfrsk8$_0(t)),r=this.tryMakeCompleting_w5s53t$_0(n,i);if(r!==hn)return r}},$n.prototype.defaultCancellationException_6umzry$=w("kotlinx-coroutines-core.kotlinx.coroutines.JobSupport.defaultCancellationException_6umzry$",k((function(){var e=t.kotlinx.coroutines.JobCancellationException;return function(t,n){return void 0===t&&(t=null),void 0===n&&(n=null),new e(null!=t?t:this.cancellationExceptionMessage(),n,this)}}))),$n.prototype.getChildJobCancellationCause=function(){var t,n,i,r=this.state_8be2vx$;if(e.isType(r,wn))t=r.rootCause;else if(e.isType(r,se))t=r.cause;else{if(e.isType(r,zn))throw S(("Cannot be cancelling child in this state: "+C(r)).toString());t=null}var o=t;return null!=(i=e.isType(n=o,Zs)?n:null)?i:new Xs("Parent job is "+this.stateString_u2sjqg$_0(r),o,this)},$n.prototype.createCauseException_kfrsk8$_0=function(t){var n;return null==t||e.isType(t,E)?null!=t?t:new Xs(this.cancellationExceptionMessage(),null,this):(e.isType(n=t,on)?n:o()).getChildJobCancellationCause()},$n.prototype.makeCancelling_xjon1g$_0=function(t){for(var n={v:null};;){var i,r,o=this.state_8be2vx$;if(e.isType(o,wn)){var a;if(o.isSealed)return fn;var s=o.isCancelling;if(null!=t||!s){var l;if(null!=(a=n.v))l=a;else{var c=this.createCauseException_kfrsk8$_0(t);n.v=c,l=c}var u=l;o.addExceptionLocked_tcv7n7$(u)}var p=o.rootCause,h=s?null:p;return null!=h&&this.notifyCancelling_xkpzb8$_0(o.list,h),un}if(!e.isType(o,zn))return fn;if(null!=(i=n.v))r=i;else{var f=this.createCauseException_kfrsk8$_0(t);n.v=f,r=f}var d=r;if(o.isActive){if(this.tryMakeCancelling_v0qvyy$_0(o,d))return un}else{var _=this.tryMakeCompleting_w5s53t$_0(o,new se(d));if(_===un)throw S(("Cannot happen in "+C(o)).toString());if(_!==hn)return _}}},$n.prototype.getOrPromoteCancellingList_dmij2j$_0=function(t){var n,i;if(null==(i=t.list)){if(e.isType(t,On))n=new Tn;else{if(!e.isType(t,jn))throw S(("State should have list: "+t).toString());this.promoteSingleToNodeList_l9deey$_0(t),n=null}i=n}return i},$n.prototype.tryMakeCancelling_v0qvyy$_0=function(t,e){var n;if(null==(n=this.getOrPromoteCancellingList_dmij2j$_0(t)))return!1;var i,r=n,o=new wn(r,!1,e);return(i=this)._state_v70vig$_0===t&&(i._state_v70vig$_0=o,!0)&&(this.notifyCancelling_xkpzb8$_0(r,e),!0)},$n.prototype.makeCompleting_8ea4ql$=function(t){for(;;){var e=this.tryMakeCompleting_w5s53t$_0(this.state_8be2vx$,t);if(e===un)return!1;if(e===pn)return!0;if(e!==hn)return this.afterCompletion_s8jyv4$(e),!0}},$n.prototype.makeCompletingOnce_8ea4ql$=function(t){for(;;){var e=this.tryMakeCompleting_w5s53t$_0(this.state_8be2vx$,t);if(e===un)throw new K("Job "+this+" is already complete or completing, but is being completed with "+C(t),this.get_exceptionOrNull_ejijbb$_0(t));if(e!==hn)return e}},$n.prototype.tryMakeCompleting_w5s53t$_0=function(t,n){return e.isType(t,zn)?!e.isType(t,On)&&!e.isType(t,jn)||e.isType(t,Fn)||e.isType(n,se)?this.tryMakeCompletingSlowPath_uh1ctj$_0(t,n):this.tryFinalizeSimpleState_5emg4m$_0(t,n)?n:hn:un},$n.prototype.tryMakeCompletingSlowPath_uh1ctj$_0=function(t,n){var i,r,o,a;if(null==(i=this.getOrPromoteCancellingList_dmij2j$_0(t)))return hn;var s,l,c,u=i,p=null!=(o=e.isType(r=t,wn)?r:null)?o:new wn(u,!1,null),h={v:null};if(p.isCompleting)return un;if(p.isCompleting=!0,p!==t&&((c=this)._state_v70vig$_0!==t||(c._state_v70vig$_0=p,0)))return hn;var f=p.isCancelling;null!=(l=e.isType(s=n,se)?s:null)&&p.addExceptionLocked_tcv7n7$(l.cause);var d=p.rootCause;h.v=f?null:d,null!=(a=h.v)&&this.notifyCancelling_xkpzb8$_0(u,a);var _=this.firstChild_15hr5g$_0(t);return null!=_&&this.tryWaitForChild_dzo3im$_0(p,_,n)?pn:this.finalizeFinishingState_10mr1z$_0(p,n)},$n.prototype.get_exceptionOrNull_ejijbb$_0=function(t){var n,i;return null!=(i=e.isType(n=t,se)?n:null)?i.cause:null},$n.prototype.firstChild_15hr5g$_0=function(t){var n,i,r;return null!=(r=e.isType(n=t,Fn)?n:null)?r:null!=(i=t.list)?this.nextChild_n2no7k$_0(i):null},$n.prototype.tryWaitForChild_dzo3im$_0=function(t,e,n){var i;if(e.childJob.invokeOnCompletion_ct2b2z$(void 0,!1,new kn(this,t,e,n))!==vn())return!0;if(null==(i=this.nextChild_n2no7k$_0(e)))return!1;var r=i;return this.tryWaitForChild_dzo3im$_0(t,r,n)},$n.prototype.continueCompleting_vth2d4$_0=function(t,e,n){var i=this.nextChild_n2no7k$_0(e);if(null==i||!this.tryWaitForChild_dzo3im$_0(t,i,n)){var r=this.finalizeFinishingState_10mr1z$_0(t,n);this.afterCompletion_s8jyv4$(r)}},$n.prototype.nextChild_n2no7k$_0=function(t){for(var n=t;n._removed;)n=n._prev;for(;;)if(!(n=n._next)._removed){if(e.isType(n,Fn))return n;if(e.isType(n,Tn))return null}},bn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},bn.prototype=Object.create(c.prototype),bn.prototype.constructor=bn,bn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=this.local$this$JobSupport.state_8be2vx$;if(e.isType(t,Fn)){if(this.state_0=8,this.result_0=this.local$$receiver.yield_11rb$(t.childJob,this),this.result_0===l)return l;continue}if(e.isType(t,zn)){if(null!=(this.local$tmp$=t.list)){this.local$cur=this.local$tmp$._next,this.state_0=2;continue}this.local$tmp$_0=null,this.state_0=6;continue}this.state_0=7;continue;case 1:throw this.exception_0;case 2:if(b(this.local$cur,this.local$tmp$)){this.state_0=5;continue}if(e.isType(this.local$cur,Fn)){if(this.state_0=3,this.result_0=this.local$$receiver.yield_11rb$(this.local$cur.childJob,this),this.result_0===l)return l;continue}this.state_0=4;continue;case 3:this.state_0=4;continue;case 4:this.local$cur=this.local$cur._next,this.state_0=2;continue;case 5:this.local$tmp$_0=p,this.state_0=6;continue;case 6:return this.local$tmp$_0;case 7:this.state_0=9;continue;case 8:return this.result_0;case 9:return p;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty($n.prototype,"children",{configurable:!0,get:function(){return W((t=this,function(e,n,i){var r=new bn(t,e,this,n);return i?r:r.doResume(null)}));var t}}),$n.prototype.attachChild_kx8v25$=function(t){var n;return e.isType(n=this.invokeOnCompletion_ct2b2z$(!0,void 0,new Fn(t)),an)?n:o()},$n.prototype.handleOnCompletionException_tcv7n7$=function(t){throw t},$n.prototype.onCancelling_dbl4no$=function(t){},Object.defineProperty($n.prototype,"isScopedCoroutine",{configurable:!0,get:function(){return!1}}),Object.defineProperty($n.prototype,"handlesException",{configurable:!0,get:function(){return!0}}),$n.prototype.handleJobException_tcv7n7$=function(t){return!1},$n.prototype.onCompletionInternal_s8jyv4$=function(t){},$n.prototype.afterCompletion_s8jyv4$=function(t){},$n.prototype.toString=function(){return this.toDebugString()+"@"+qs(this)},$n.prototype.toDebugString=function(){return this.nameString()+"{"+this.stateString_u2sjqg$_0(this.state_8be2vx$)+"}"},$n.prototype.nameString=function(){return Fs(this)},$n.prototype.stateString_u2sjqg$_0=function(t){return e.isType(t,wn)?t.isCancelling?"Cancelling":t.isCompleting?"Completing":"Active":e.isType(t,zn)?t.isActive?"Active":"New":e.isType(t,se)?"Cancelled":"Completed"},Object.defineProperty(wn.prototype,"list",{get:function(){return this.list_m9wkmb$_0}}),Object.defineProperty(wn.prototype,"isCompleting",{configurable:!0,get:function(){return this._isCompleting_0},set:function(t){this._isCompleting_0=t}}),Object.defineProperty(wn.prototype,"rootCause",{configurable:!0,get:function(){return this._rootCause_0},set:function(t){this._rootCause_0=t}}),Object.defineProperty(wn.prototype,"exceptionsHolder_0",{configurable:!0,get:function(){return this._exceptionsHolder_0},set:function(t){this._exceptionsHolder_0=t}}),Object.defineProperty(wn.prototype,"isSealed",{configurable:!0,get:function(){return this.exceptionsHolder_0===dn}}),Object.defineProperty(wn.prototype,"isCancelling",{configurable:!0,get:function(){return null!=this.rootCause}}),Object.defineProperty(wn.prototype,"isActive",{configurable:!0,get:function(){return null==this.rootCause}}),wn.prototype.sealLocked_dbl4no$=function(t){var n,i,r=this.exceptionsHolder_0;if(null==r)i=this.allocateList_0();else if(e.isType(r,E)){var a=this.allocateList_0();a.add_11rb$(r),i=a}else{if(!e.isType(r,Y))throw S(("State is "+C(r)).toString());i=e.isType(n=r,Y)?n:o()}var s=i,l=this.rootCause;return null!=l&&s.add_wxm5ur$(0,l),null==t||b(t,l)||s.add_11rb$(t),this.exceptionsHolder_0=dn,s},wn.prototype.addExceptionLocked_tcv7n7$=function(t){var n,i=this.rootCause;if(null!=i){if(t!==i){var r=this.exceptionsHolder_0;if(null==r)this.exceptionsHolder_0=t;else if(e.isType(r,E)){if(t===r)return;var a=this.allocateList_0();a.add_11rb$(r),a.add_11rb$(t),this.exceptionsHolder_0=a}else{if(!e.isType(r,Y))throw S(("State is "+C(r)).toString());(e.isType(n=r,Y)?n:o()).add_11rb$(t)}}}else this.rootCause=t},wn.prototype.allocateList_0=function(){return y(4)},wn.prototype.toString=function(){return"Finishing[cancelling="+this.isCancelling+", completing="+this.isCompleting+", rootCause="+C(this.rootCause)+", exceptions="+C(this.exceptionsHolder_0)+", list="+this.list+"]"},wn.$metadata$={kind:a,simpleName:"Finishing",interfaces:[zn]},$n.prototype.get_isCancelling_dpdoz8$_0=function(t){return e.isType(t,wn)&&t.isCancelling},kn.prototype.invoke=function(t){this.parent_0.continueCompleting_vth2d4$_0(this.state_0,this.child_0,this.proposedUpdate_0)},kn.$metadata$={kind:a,simpleName:"ChildCompletion",interfaces:[jn]},Sn.prototype.getContinuationCancellationCause_dqr1mp$=function(t){var n,i=this.job_0.state_8be2vx$;return e.isType(i,wn)&&null!=(n=i.rootCause)?n:e.isType(i,se)?i.cause:t.getCancellationException()},Sn.prototype.nameString=function(){return"AwaitContinuation"},Sn.$metadata$={kind:a,simpleName:"AwaitContinuation",interfaces:[Ht]},Object.defineProperty($n.prototype,"isCompletedExceptionally",{configurable:!0,get:function(){return e.isType(this.state_8be2vx$,se)}}),$n.prototype.getCompletionExceptionOrNull=function(){var t=this.state_8be2vx$;if(e.isType(t,zn))throw S("This job has not completed yet".toString());return this.get_exceptionOrNull_ejijbb$_0(t)},$n.prototype.getCompletedInternal_8be2vx$=function(){var t=this.state_8be2vx$;if(e.isType(t,zn))throw S("This job has not completed yet".toString());if(e.isType(t,se))throw t.cause;return Cn(t)},$n.prototype.awaitInternal_8be2vx$=function(t){for(;;){var n=this.state_8be2vx$;if(!e.isType(n,zn)){if(e.isType(n,se))throw n.cause;return Cn(n)}if(this.startInternal_tp1bqd$_0(n)>=0)break}return this.awaitSuspend_ixl9xw$_0(t)},$n.prototype.awaitSuspend_ixl9xw$_0=function(t){return(e=this,function(t){var n=new Sn(_(t),e);return Ft(n,e.invokeOnCompletion_f05bi3$(new In(n))),n.getResult()})(t);var e},$n.prototype.registerSelectClause1Internal_u6kgbh$=function(t,n){for(;;){var i,a=this.state_8be2vx$;if(t.isSelected)return;if(!e.isType(a,zn))return void(t.trySelect()&&(e.isType(a,se)?t.resumeSelectWithException_tcv7n7$(a.cause):ts(n,null==(i=Cn(a))||e.isType(i,r)?i:o(),t.completion)));if(0===this.startInternal_tp1bqd$_0(a))return void t.disposeOnSelect_rvfg84$(this.invokeOnCompletion_f05bi3$(new Ln(t,n)))}},$n.prototype.selectAwaitCompletion_u6kgbh$=function(t,n){var i,a=this.state_8be2vx$;e.isType(a,se)?t.resumeSelectWithException_tcv7n7$(a.cause):Za(n,null==(i=Cn(a))||e.isType(i,r)?i:o(),t.completion)},$n.$metadata$={kind:a,simpleName:"JobSupport",interfaces:[as,on,rn,Ze]},xn.$metadata$={kind:a,simpleName:"IncompleteStateBox",interfaces:[]},Object.defineProperty(On.prototype,"isActive",{get:function(){return this.isActive_hyoax9$_0}}),Object.defineProperty(On.prototype,"list",{configurable:!0,get:function(){return null}}),On.prototype.toString=function(){return"Empty{"+(this.isActive?"Active":"New")+"}"},On.$metadata$={kind:a,simpleName:"Empty",interfaces:[zn]},Object.defineProperty(Nn.prototype,"onCancelComplete",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Nn.prototype,"handlesException",{configurable:!0,get:function(){return this.handlesException_fejgjb$_0}}),Nn.prototype.complete=function(){return this.makeCompleting_8ea4ql$(p)},Nn.prototype.completeExceptionally_tcv7n7$=function(t){return this.makeCompleting_8ea4ql$(new se(t))},Nn.prototype.handlesExceptionF=function(){var t,n,i,r,o,a;if(null==(i=null!=(n=e.isType(t=this.parentHandle_8be2vx$,Fn)?t:null)?n.job:null))return!1;for(var s=i;;){if(s.handlesException)return!0;if(null==(a=null!=(o=e.isType(r=s.parentHandle_8be2vx$,Fn)?r:null)?o.job:null))return!1;s=a}},Nn.$metadata$={kind:a,simpleName:"JobImpl",interfaces:[ne,$n]},zn.$metadata$={kind:x,simpleName:"Incomplete",interfaces:[]},Object.defineProperty(jn.prototype,"job",{configurable:!0,get:function(){return null==this.job_ndnibc$_0?h("job"):this.job_ndnibc$_0},set:function(t){this.job_ndnibc$_0=t}}),Object.defineProperty(jn.prototype,"isActive",{configurable:!0,get:function(){return!0}}),Object.defineProperty(jn.prototype,"list",{configurable:!0,get:function(){return null}}),jn.prototype.dispose=function(){this.job.removeNode_jr34ao$(this)},jn.prototype.toString=function(){return Fs(this)+"@"+qs(this)+"[job@"+qs(this.job)+"]"},jn.$metadata$={kind:a,simpleName:"JobNode",interfaces:[zn,nn,zs]},Object.defineProperty(Tn.prototype,"isActive",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Tn.prototype,"list",{configurable:!0,get:function(){return this}}),Tn.prototype.getString_61zpoe$=function(t){var n=G();n.append_pdl1vj$("List{"),n.append_pdl1vj$(t),n.append_pdl1vj$("}[");for(var i={v:!0},r=this._next;!b(r,this);){if(e.isType(r,jn)){var o=r;i.v?i.v=!1:n.append_pdl1vj$(", "),n.append_s8jyv4$(o)}r=r._next}return n.append_pdl1vj$("]"),n.toString()},Tn.prototype.toString=function(){return oa?this.getString_61zpoe$("Active"):Pl.prototype.toString.call(this)},Tn.$metadata$={kind:a,simpleName:"NodeList",interfaces:[zn,Pl]},Object.defineProperty(Pn.prototype,"list",{get:function(){return this.list_afai45$_0}}),Object.defineProperty(Pn.prototype,"isActive",{configurable:!0,get:function(){return!1}}),Pn.prototype.toString=function(){return oa?this.list.getString_61zpoe$("New"):r.prototype.toString.call(this)},Pn.$metadata$={kind:a,simpleName:"InactiveNodeList",interfaces:[zn]},Rn.prototype.invoke=function(t){this.handler_0(t)},Rn.$metadata$={kind:a,simpleName:"InvokeOnCompletion",interfaces:[jn]},An.prototype.invoke=function(t){this.continuation_0.resumeWith_tl1gpc$(new m(p))},An.$metadata$={kind:a,simpleName:"ResumeOnCompletion",interfaces:[jn]},In.prototype.invoke=function(t){var n,i,a=this.job.state_8be2vx$;if(e.isType(a,se)){var s=this.continuation_0,l=a.cause;s.resumeWith_tl1gpc$(new m(N(l)))}else{i=this.continuation_0;var c=null==(n=Cn(a))||e.isType(n,r)?n:o();i.resumeWith_tl1gpc$(new m(c))}},In.$metadata$={kind:a,simpleName:"ResumeAwaitOnCompletion",interfaces:[jn]},Mn.prototype.invoke=function(t){this.select_0.trySelect()&&Ja(this.block_0,this.select_0.completion)},Mn.$metadata$={kind:a,simpleName:"SelectJoinOnCompletion",interfaces:[jn]},Ln.prototype.invoke=function(t){this.select_0.trySelect()&&this.job.selectAwaitCompletion_u6kgbh$(this.select_0,this.block_0)},Ln.$metadata$={kind:a,simpleName:"SelectAwaitOnCompletion",interfaces:[jn]},Dn.$metadata$={kind:a,simpleName:"JobCancellingNode",interfaces:[jn]},qn.prototype.invoke=function(t){var e;0===(e=this)._invoked_0&&(e._invoked_0=1,1)&&this.handler_0(t)},qn.$metadata$={kind:a,simpleName:"InvokeOnCancelling",interfaces:[Dn]},Fn.prototype.invoke=function(t){this.childJob.parentCancelled_pv1t6x$(this.job)},Fn.prototype.childCancelled_tcv7n7$=function(t){return this.job.childCancelled_tcv7n7$(t)},Fn.$metadata$={kind:a,simpleName:"ChildHandleNode",interfaces:[an,Dn]},Un.prototype.invoke=function(t){this.child.parentCancelled_8o0b5c$(this.child.getContinuationCancellationCause_dqr1mp$(this.job))},Un.$metadata$={kind:a,simpleName:"ChildContinuation",interfaces:[Dn]},Bn.prototype.toString=function(){var t;return null!=(t=this.toStringInternalImpl())?t:Fs(this)+"@"+qs(this)},Bn.prototype.toStringInternalImpl=function(){var t,n=Vs().Main;if(this===n)return"Dispatchers.Main";try{t=n.immediate}catch(n){if(!e.isType(n,J))throw n;t=null}return this===t?"Dispatchers.Main.immediate":null},Bn.$metadata$={kind:a,simpleName:"MainCoroutineDispatcher",interfaces:[ce]},Vn.prototype.childCancelled_tcv7n7$=function(t){return!1},Vn.$metadata$={kind:a,simpleName:"SupervisorJobImpl",interfaces:[Nn]},Kn.prototype.createCopy=function(){var t,e=new Kn(null!=(t=this.message)?t:"",this.coroutine_8be2vx$);return e},Kn.$metadata$={kind:a,simpleName:"TimeoutCancellationException",interfaces:[De,Zs]},Wn.prototype.isDispatchNeeded_1fupul$=function(t){return!1},Wn.prototype.dispatch_5bn72i$=function(t,e){var n=t.get_j3r2sn$(li());if(null==n)throw Z("Dispatchers.Unconfined.dispatch function can only be used by the yield function. If you wrap Unconfined dispatcher in your code, make sure you properly delegate isDispatchNeeded and dispatch calls.");n.dispatcherWasUnconfined=!0},Wn.prototype.toString=function(){return"Dispatchers.Unconfined"},Wn.$metadata$={kind:O,simpleName:"Unconfined",interfaces:[ce]};var Yn=null;function Gn(){return null===Yn&&new Wn,Yn}function Jn(){li(),j.call(this,li()),this.dispatcherWasUnconfined=!1}function Zn(){si=this}Zn.$metadata$={kind:O,simpleName:"Key",interfaces:[P]};var Qn,Xn,ti,ei,ni,ii,ri,oi,ai,si=null;function li(){return null===si&&new Zn,si}function ci(t){var e=t.get_j3r2sn$(tn());if(null!=e&&!e.isActive)throw e.getCancellationException()}function ui(t){return function(e){var n=Dt(_(e));return t(n),n.getResult()}}function pi(t){this.onUndeliveredElement_0=t,this.queue_0=new Pl,this.onCloseHandler_0=null}function hi(t,e){Nl.call(this,t,new mi(e))}function fi(t){return function(){return t.isBufferFull}}function di(t,e){zl.call(this,e),this.element=t}function _i(t){this.this$AbstractSendChannel=t}function yi(t,e,n,i){zi.call(this),this.pollResult_m5nr4l$_0=t,this.channel=e,this.select=n,this.block=i}function mi(t){zi.call(this),this.element=t}function vi(t){pi.call(this,t)}function $i(t){return function(){return t.isBufferEmpty}}function gi(t){zl.call(this,t)}function bi(t){this.this$AbstractChannel=t}function wi(t){this.this$AbstractChannel=t}function ki(t){this.this$AbstractChannel=t}function Si(t,e){this.$outer=t,Jt.call(this),this.receive_0=e}function xi(t){this.channel=t,this.result=ei}function Ei(t,e){Ai.call(this),this.cont=t,this.receiveMode=e}function Ci(t,e,n){Ei.call(this,t,e),this.onUndeliveredElement=n}function Oi(t,e){Ai.call(this),this.iterator=t,this.cont=e}function Ni(t,e,n,i){Ai.call(this),this.channel=t,this.select=e,this.block=n,this.receiveMode=i}function zi(){Ol.call(this)}function ji(){}function Ti(t,e){zi.call(this),this.pollResult_vo6xxe$_0=t,this.cont=e}function Pi(t,e,n){Ti.call(this,t,e),this.onUndeliveredElement=n}function Ri(t){zi.call(this),this.closeCause=t}function Ai(){Ol.call(this)}function Ii(t){if(pi.call(this,null),this.capacity=t,!(this.capacity>=1)){var n="ArrayBroadcastChannel capacity must be at least 1, but "+this.capacity+" was specified";throw H(n.toString())}this.bufferLock_0=new kl,this.buffer_0=e.newArray(this.capacity,null),this._head_0=F,this._tail_0=F,this._size_0=0,this.subscribers_0=Sl()}function Mi(t){vi.call(this,null),this.broadcastChannel_0=t,this.subLock_0=new kl,this._subHead_0=F}function Li(t,n,i){if(vi.call(this,i),this.capacity_0=t,this.onBufferOverflow_0=n,!(this.capacity_0>=1)){var r="ArrayChannel capacity must be at least 1, but "+this.capacity_0+" was specified";throw H(r.toString())}this.lock_0=new kl;var o=this.capacity_0,a=e.newArray(nt.min(o,8),null);et(a,Qn),this.buffer_0=a,this.head_0=0,this.size_0=0}function Di(t,e,n,i,r,o){void 0===e&&(e=v.EmptyCoroutineContext),void 0===n&&(n=1),void 0===i&&(i=Ie()),void 0===r&&(r=null);var a=As(t,e),s=Bi(n),l=i.isLazy?new Fi(a,s,o):new qi(a,s,!0);return null!=r&&l.invokeOnCompletion_f05bi3$(r),l.start_b5ul0p$(i,l,o),l}function qi(t,e,n){Et.call(this,t,n),this._channel_0=e}function Fi(t,e,n){qi.call(this,t,e,!1),this.continuation_0=$(n,this,this)}function Ui(){}function Bi(t){switch(t){case 0:throw H("Unsupported 0 capacity for BroadcastChannel");case 2147483647:throw H("Unsupported UNLIMITED capacity for BroadcastChannel");case-1:return new dr;case-2:return new Ii(lr().CHANNEL_DEFAULT_CAPACITY_8be2vx$);default:return new Ii(t)}}function Hi(t,e){M.call(this),this.name$=t,this.ordinal$=e}function Vi(){Vi=function(){},ri=new Hi("SUSPEND",0),oi=new Hi("DROP_OLDEST",1),ai=new Hi("DROP_LATEST",2)}function Ki(){return Vi(),ri}function Wi(){return Vi(),oi}function Yi(){return Vi(),ai}function Gi(){}function Ji(){}function Zi(t){er(),this.holder_0=t}function Qi(t){this.cause=t}function Xi(){tr=this}pi.prototype.offerInternal_11rb$=function(t){for(var e;;){if(null==(e=this.takeFirstReceiveOrPeekClosed()))return ti;var n=e;if(null!=n.tryResumeReceive_j43gjz$(t,null))return n.completeResumeReceive_11rb$(t),n.offerResult}},pi.prototype.offerSelectInternal_ys5ufj$=function(t,e){var n=this.describeTryOffer_0(t),i=e.performAtomicTrySelect_6q0pxr$(n);if(null!=i)return i;var r=n.result;return r.completeResumeReceive_11rb$(t),r.offerResult},Object.defineProperty(pi.prototype,"closedForSend_0",{configurable:!0,get:function(){var t,n,i;return null!=(n=e.isType(t=this.queue_0._prev,Ri)?t:null)?(this.helpClose_0(n),i=n):i=null,i}}),Object.defineProperty(pi.prototype,"closedForReceive_0",{configurable:!0,get:function(){var t,n,i;return null!=(n=e.isType(t=this.queue_0._next,Ri)?t:null)?(this.helpClose_0(n),i=n):i=null,i}}),pi.prototype.takeFirstSendOrPeekClosed_0=function(){var t,n=this.queue_0;t:do{var i=n._next;if(i===n){t=null;break t}if(!e.isType(i,zi)){t=null;break t}if(e.isType(i,Ri)){t=i;break t}if(!i.remove())throw S("Should remove".toString());t=i}while(0);return t},pi.prototype.sendBuffered_0=function(t){var n=this.queue_0,i=new mi(t),r=n._prev;return e.isType(r,ji)?r:(n.addLast_l2j9rm$(i),null)},pi.prototype.describeSendBuffered_0=function(t){return new hi(this.queue_0,t)},hi.prototype.failure_l2j9rm$=function(t){return e.isType(t,Ri)?t:e.isType(t,ji)?ti:null},hi.$metadata$={kind:a,simpleName:"SendBufferedDesc",interfaces:[Nl]},Object.defineProperty(pi.prototype,"isClosedForSend",{configurable:!0,get:function(){return null!=this.closedForSend_0}}),Object.defineProperty(pi.prototype,"isFull",{configurable:!0,get:function(){return this.isFullImpl_0}}),Object.defineProperty(pi.prototype,"isFullImpl_0",{configurable:!0,get:function(){return!e.isType(this.queue_0._next,ji)&&this.isBufferFull}}),pi.prototype.send_11rb$=function(t,e){if(this.offerInternal_11rb$(t)!==Xn)return this.sendSuspend_0(t,e)},pi.prototype.offer_11rb$=function(t){var n,i=this.offerInternal_11rb$(t);if(i!==Xn){if(i===ti){if(null==(n=this.closedForSend_0))return!1;throw this.helpCloseAndGetSendException_0(t,n)}throw e.isType(i,Ri)?this.helpCloseAndGetSendException_0(t,i):S(("offerInternal returned "+i.toString()).toString())}return!0},pi.prototype.helpCloseAndGetSendException_0=function(t,e){var n,i;if(this.helpClose_0(e),null!=(i=null!=(n=this.onUndeliveredElement_0)?Fa(n,t):null))throw Q(i,e.sendException),i;return e.sendException},pi.prototype.sendSuspend_0=function(t,n){return ui((i=this,r=t,function(t){for(;;){if(i.isFullImpl_0){var n=null==i.onUndeliveredElement_0?new Ti(r,t):new Pi(r,t,i.onUndeliveredElement_0),o=i.enqueueSend_vs6846$(n);if(null==o)return void qt(t,n);if(e.isType(o,Ri))return void i.helpCloseAndResumeWithSendException_0(t,r,o);if(o!==ni&&!e.isType(o,Ai))throw S(("enqueueSend returned "+C(o)).toString())}var a=i.offerInternal_11rb$(r);if(a===Xn)return void t.resumeWith_tl1gpc$(new m(p));if(a!==ti){if(e.isType(a,Ri))return void i.helpCloseAndResumeWithSendException_0(t,r,a);throw S(("offerInternal returned "+a.toString()).toString())}}}))(n);var i,r},pi.prototype.helpCloseAndResumeWithSendException_0=function(t,e,n){var i,r;this.helpClose_0(n);var o=n.sendException;if(null!=(r=null!=(i=this.onUndeliveredElement_0)?Fa(i,e):null))return Q(r,o),void t.resumeWith_tl1gpc$(new m(N(r)));t.resumeWith_tl1gpc$(new m(N(o)))},pi.prototype.enqueueSend_vs6846$=function(t){if(this.isBufferAlwaysFull){var n=this.queue_0,i=n._prev;if(e.isType(i,ji))return i;n.addLast_l2j9rm$(t)}else{var r,o=this.queue_0;t:do{var a=o._prev;if(e.isType(a,ji))return a;if(!fi(this)()){r=!1;break t}o.addLast_l2j9rm$(t),r=!0}while(0);if(!r)return ni}return null},pi.prototype.close_dbl4no$$default=function(t){var n,i,r=new Ri(t),a=this.queue_0;t:do{if(e.isType(a._prev,Ri)){i=!1;break t}a.addLast_l2j9rm$(r),i=!0}while(0);var s=i,l=s?r:e.isType(n=this.queue_0._prev,Ri)?n:o();return this.helpClose_0(l),s&&this.invokeOnCloseHandler_0(t),s},pi.prototype.invokeOnCloseHandler_0=function(t){var e,n,i=this.onCloseHandler_0;null!==i&&i!==ii&&(n=this).onCloseHandler_0===i&&(n.onCloseHandler_0=ii,1)&&("function"==typeof(e=i)?e:o())(t)},pi.prototype.invokeOnClose_f05bi3$=function(t){if(null!=(n=this).onCloseHandler_0||(n.onCloseHandler_0=t,0)){var e=this.onCloseHandler_0;if(e===ii)throw S("Another handler was already registered and successfully invoked");throw S("Another handler was already registered: "+C(e))}var n,i=this.closedForSend_0;null!=i&&function(e){return e.onCloseHandler_0===t&&(e.onCloseHandler_0=ii,!0)}(this)&&t(i.closeCause)},pi.prototype.helpClose_0=function(t){for(var n,i,a=new qa;null!=(i=e.isType(n=t._prev,Ai)?n:null);){var s=i;s.remove()?a=a.plus_11rb$(s):s.helpRemove()}var l,c,u,p=a;if(null!=(l=p.holder_0))if(e.isType(l,Y))for(var h=e.isType(u=p.holder_0,Y)?u:o(),f=h.size-1|0;f>=0;f--)h.get_za3lpa$(f).resumeReceiveClosed_1zqbm$(t);else(null==(c=p.holder_0)||e.isType(c,r)?c:o()).resumeReceiveClosed_1zqbm$(t);this.onClosedIdempotent_l2j9rm$(t)},pi.prototype.onClosedIdempotent_l2j9rm$=function(t){},pi.prototype.takeFirstReceiveOrPeekClosed=function(){var t,n=this.queue_0;t:do{var i=n._next;if(i===n){t=null;break t}if(!e.isType(i,ji)){t=null;break t}if(e.isType(i,Ri)){t=i;break t}if(!i.remove())throw S("Should remove".toString());t=i}while(0);return t},pi.prototype.describeTryOffer_0=function(t){return new di(t,this.queue_0)},di.prototype.failure_l2j9rm$=function(t){return e.isType(t,Ri)?t:e.isType(t,ji)?null:ti},di.prototype.onPrepare_xe32vn$=function(t){var n,i;return null==(i=(e.isType(n=t.affected,ji)?n:o()).tryResumeReceive_j43gjz$(this.element,t))?Ho:i===Fo?Fo:null},di.$metadata$={kind:a,simpleName:"TryOfferDesc",interfaces:[zl]},_i.prototype.registerSelectClause2_rol3se$=function(t,e,n){this.this$AbstractSendChannel.registerSelectSend_0(t,e,n)},_i.$metadata$={kind:a,interfaces:[ls]},Object.defineProperty(pi.prototype,"onSend",{configurable:!0,get:function(){return new _i(this)}}),pi.prototype.registerSelectSend_0=function(t,n,i){for(;;){if(t.isSelected)return;if(this.isFullImpl_0){var r=new yi(n,this,t,i),o=this.enqueueSend_vs6846$(r);if(null==o)return void t.disposeOnSelect_rvfg84$(r);if(e.isType(o,Ri))throw this.helpCloseAndGetSendException_0(n,o);if(o!==ni&&!e.isType(o,Ai))throw S(("enqueueSend returned "+C(o)+" ").toString())}var a=this.offerSelectInternal_ys5ufj$(n,t);if(a===Ko)return;if(a!==ti&&a!==Fo){if(a===Xn)return void ts(i,this,t.completion);throw e.isType(a,Ri)?this.helpCloseAndGetSendException_0(n,a):S(("offerSelectInternal returned "+a.toString()).toString())}}},pi.prototype.toString=function(){return Fs(this)+"@"+qs(this)+"{"+this.queueDebugStateString_0+"}"+this.bufferDebugString},Object.defineProperty(pi.prototype,"queueDebugStateString_0",{configurable:!0,get:function(){var t=this.queue_0._next;if(t===this.queue_0)return"EmptyQueue";var n=e.isType(t,Ri)?t.toString():e.isType(t,Ai)?"ReceiveQueued":e.isType(t,zi)?"SendQueued":"UNEXPECTED:"+t,i=this.queue_0._prev;return i!==t&&(n+=",queueSize="+this.countQueueSize_0(),e.isType(i,Ri)&&(n+=",closedForSend="+i)),n}}),pi.prototype.countQueueSize_0=function(){for(var t={v:0},n=this.queue_0,i=n._next;!b(i,n);)e.isType(i,Ol)&&(t.v=t.v+1|0),i=i._next;return t.v},Object.defineProperty(pi.prototype,"bufferDebugString",{configurable:!0,get:function(){return""}}),Object.defineProperty(yi.prototype,"pollResult",{get:function(){return this.pollResult_m5nr4l$_0}}),yi.prototype.tryResumeSend_uc1cc4$=function(t){var n;return null==(n=this.select.trySelectOther_uc1cc4$(t))||e.isType(n,Wa)?n:o()},yi.prototype.completeResumeSend=function(){Za(this.block,this.channel,this.select.completion)},yi.prototype.dispose=function(){this.remove()&&this.undeliveredElement()},yi.prototype.resumeSendClosed_1zqbm$=function(t){this.select.trySelect()&&this.select.resumeSelectWithException_tcv7n7$(t.sendException)},yi.prototype.undeliveredElement=function(){var t;null!=(t=this.channel.onUndeliveredElement_0)&&Ua(t,this.pollResult,this.select.completion.context)},yi.prototype.toString=function(){return"SendSelect@"+qs(this)+"("+this.pollResult+")["+this.channel+", "+this.select+"]"},yi.$metadata$={kind:a,simpleName:"SendSelect",interfaces:[nn,zi]},Object.defineProperty(mi.prototype,"pollResult",{configurable:!0,get:function(){return this.element}}),mi.prototype.tryResumeSend_uc1cc4$=function(t){return null!=t&&t.finishPrepare(),n},mi.prototype.completeResumeSend=function(){},mi.prototype.resumeSendClosed_1zqbm$=function(t){},mi.prototype.toString=function(){return"SendBuffered@"+qs(this)+"("+this.element+")"},mi.$metadata$={kind:a,simpleName:"SendBuffered",interfaces:[zi]},pi.$metadata$={kind:a,simpleName:"AbstractSendChannel",interfaces:[Gi]},vi.prototype.pollInternal=function(){for(var t;;){if(null==(t=this.takeFirstSendOrPeekClosed_0()))return ei;var e=t;if(null!=e.tryResumeSend_uc1cc4$(null))return e.completeResumeSend(),e.pollResult;e.undeliveredElement()}},vi.prototype.pollSelectInternal_y5yyj0$=function(t){var e=this.describeTryPoll_0(),n=t.performAtomicTrySelect_6q0pxr$(e);return null!=n?n:(e.result.completeResumeSend(),e.result.pollResult)},Object.defineProperty(vi.prototype,"hasReceiveOrClosed_0",{configurable:!0,get:function(){return e.isType(this.queue_0._next,ji)}}),Object.defineProperty(vi.prototype,"isClosedForReceive",{configurable:!0,get:function(){return null!=this.closedForReceive_0&&this.isBufferEmpty}}),Object.defineProperty(vi.prototype,"isEmpty",{configurable:!0,get:function(){return this.isEmptyImpl_0}}),Object.defineProperty(vi.prototype,"isEmptyImpl_0",{configurable:!0,get:function(){return!e.isType(this.queue_0._next,zi)&&this.isBufferEmpty}}),vi.prototype.receive=function(t){var n,i=this.pollInternal();return i===ei||e.isType(i,Ri)?this.receiveSuspend_0(0,t):null==(n=i)||e.isType(n,r)?n:o()},vi.prototype.receiveSuspend_0=function(t,n){return ui((i=this,a=t,function(t){var n,s,l,c,u,h,f;null==i.onUndeliveredElement_0?u=new Ei(e.isType(n=t,Lt)?n:o(),a):(l=e.isType(s=t,Lt)?s:o(),c=i.onUndeliveredElement_0,u=new Ci(l,a,c));for(var d=u;;){if(i.enqueueReceive_0(d))return void i.removeReceiveOnCancel_0(t,d);var _=i.pollInternal();if(e.isType(_,Ri))return void d.resumeReceiveClosed_1zqbm$(_);if(_!==ei)return void t.resume_q1ktlu$(d.resumeValue_11rb$(null==(h=_)||e.isType(h,r)?h:o()),d.resumeOnCancellationFun_11rb$(null==(f=_)||e.isType(f,r)?f:o()))}return p}))(n);var i,a},vi.prototype.enqueueReceiveInternal_i292ax$=function(t){var n;if(this.isBufferAlwaysEmpty){var i,r=this.queue_0;t:do{if(e.isType(r._prev,zi)){i=!1;break t}r.addLast_l2j9rm$(t),i=!0}while(0);n=i}else{var o,a=this.queue_0;t:do{if(e.isType(a._prev,zi)){o=!1;break t}if(!$i(this)()){o=!1;break t}a.addLast_l2j9rm$(t),o=!0}while(0);n=o}return n},vi.prototype.enqueueReceive_0=function(t){var e=this.enqueueReceiveInternal_i292ax$(t);return e&&this.onReceiveEnqueued(),e},vi.prototype.receiveOrNull=function(t){var n,i=this.pollInternal();return i===ei||e.isType(i,Ri)?this.receiveSuspend_0(1,t):null==(n=i)||e.isType(n,r)?n:o()},vi.prototype.receiveOrNullResult_0=function(t){var n;if(e.isType(t,Ri)){if(null!=t.closeCause)throw t.closeCause;return null}return null==(n=t)||e.isType(n,r)?n:o()},vi.prototype.receiveOrClosed=function(t){var n,i,a=this.pollInternal();return a!==ei?(e.isType(a,Ri)?n=new Zi(new Qi(a.closeCause)):(er(),n=new Zi(null==(i=a)||e.isType(i,r)?i:o())),n):this.receiveSuspend_0(2,t)},vi.prototype.poll=function(){var t=this.pollInternal();return t===ei?null:this.receiveOrNullResult_0(t)},vi.prototype.cancel_dbl4no$$default=function(t){return this.cancelInternal_fg6mcv$(t)},vi.prototype.cancel_m4sck1$$default=function(t){this.isClosedForReceive||this.cancelInternal_fg6mcv$(null!=t?t:Qs(Fs(this)+" was cancelled"))},vi.prototype.cancelInternal_fg6mcv$=function(t){var e=this.close_dbl4no$(t);return this.onCancelIdempotent_6taknv$(e),e},vi.prototype.onCancelIdempotent_6taknv$=function(t){var n;if(null==(n=this.closedForSend_0))throw S("Cannot happen".toString());for(var i=n,r=new qa;;){var a,s=i._prev;if(e.isType(s,Pl))break;s.remove()?r=r.plus_11rb$(e.isType(a=s,zi)?a:o()):s.helpRemove()}this.onCancelIdempotentList_kji3ae$(r,i)},vi.prototype.onCancelIdempotentList_kji3ae$=function(t,n){var i,a,s;if(null!=(i=t.holder_0))if(e.isType(i,Y))for(var l=e.isType(s=t.holder_0,Y)?s:o(),c=l.size-1|0;c>=0;c--)l.get_za3lpa$(c).resumeSendClosed_1zqbm$(n);else(null==(a=t.holder_0)||e.isType(a,r)?a:o()).resumeSendClosed_1zqbm$(n)},vi.prototype.iterator=function(){return new xi(this)},vi.prototype.describeTryPoll_0=function(){return new gi(this.queue_0)},gi.prototype.failure_l2j9rm$=function(t){return e.isType(t,Ri)?t:e.isType(t,zi)?null:ei},gi.prototype.onPrepare_xe32vn$=function(t){var n,i;return null==(i=(e.isType(n=t.affected,zi)?n:o()).tryResumeSend_uc1cc4$(t))?Ho:i===Fo?Fo:null},gi.prototype.onRemoved_l2j9rm$=function(t){var n;(e.isType(n=t,zi)?n:o()).undeliveredElement()},gi.$metadata$={kind:a,simpleName:"TryPollDesc",interfaces:[zl]},bi.prototype.registerSelectClause1_o3xas4$=function(t,n){var i,r;r=e.isType(i=n,X)?i:o(),this.this$AbstractChannel.registerSelectReceiveMode_0(t,0,r)},bi.$metadata$={kind:a,interfaces:[ss]},Object.defineProperty(vi.prototype,"onReceive",{configurable:!0,get:function(){return new bi(this)}}),wi.prototype.registerSelectClause1_o3xas4$=function(t,n){var i,r;r=e.isType(i=n,X)?i:o(),this.this$AbstractChannel.registerSelectReceiveMode_0(t,1,r)},wi.$metadata$={kind:a,interfaces:[ss]},Object.defineProperty(vi.prototype,"onReceiveOrNull",{configurable:!0,get:function(){return new wi(this)}}),ki.prototype.registerSelectClause1_o3xas4$=function(t,n){var i,r;r=e.isType(i=n,X)?i:o(),this.this$AbstractChannel.registerSelectReceiveMode_0(t,2,r)},ki.$metadata$={kind:a,interfaces:[ss]},Object.defineProperty(vi.prototype,"onReceiveOrClosed",{configurable:!0,get:function(){return new ki(this)}}),vi.prototype.registerSelectReceiveMode_0=function(t,e,n){for(;;){if(t.isSelected)return;if(this.isEmptyImpl_0){if(this.enqueueReceiveSelect_0(t,n,e))return}else{var i=this.pollSelectInternal_y5yyj0$(t);if(i===Ko)return;i!==ei&&i!==Fo&&this.tryStartBlockUnintercepted_0(n,t,e,i)}}},vi.prototype.tryStartBlockUnintercepted_0=function(t,n,i,a){var s,l;if(e.isType(a,Ri))switch(i){case 0:throw a.receiveException;case 2:if(!n.trySelect())return;ts(t,new Zi(new Qi(a.closeCause)),n.completion);break;case 1:if(null!=a.closeCause)throw a.receiveException;if(!n.trySelect())return;ts(t,null,n.completion)}else 2===i?(e.isType(a,Ri)?s=new Zi(new Qi(a.closeCause)):(er(),s=new Zi(null==(l=a)||e.isType(l,r)?l:o())),ts(t,s,n.completion)):ts(t,a,n.completion)},vi.prototype.enqueueReceiveSelect_0=function(t,e,n){var i=new Ni(this,t,e,n),r=this.enqueueReceive_0(i);return r&&t.disposeOnSelect_rvfg84$(i),r},vi.prototype.takeFirstReceiveOrPeekClosed=function(){var t=pi.prototype.takeFirstReceiveOrPeekClosed.call(this);return null==t||e.isType(t,Ri)||this.onReceiveDequeued(),t},vi.prototype.onReceiveEnqueued=function(){},vi.prototype.onReceiveDequeued=function(){},vi.prototype.removeReceiveOnCancel_0=function(t,e){t.invokeOnCancellation_f05bi3$(new Si(this,e))},Si.prototype.invoke=function(t){this.receive_0.remove()&&this.$outer.onReceiveDequeued()},Si.prototype.toString=function(){return"RemoveReceiveOnCancel["+this.receive_0+"]"},Si.$metadata$={kind:a,simpleName:"RemoveReceiveOnCancel",interfaces:[Jt]},xi.prototype.hasNext=function(t){return this.result!==ei?this.hasNextResult_0(this.result):(this.result=this.channel.pollInternal(),this.result!==ei?this.hasNextResult_0(this.result):this.hasNextSuspend_0(t))},xi.prototype.hasNextResult_0=function(t){if(e.isType(t,Ri)){if(null!=t.closeCause)throw t.receiveException;return!1}return!0},xi.prototype.hasNextSuspend_0=function(t){return ui((n=this,function(t){for(var i,a,s,l,c=new Oi(n,t);;){if(n.channel.enqueueReceive_0(c))return void n.channel.removeReceiveOnCancel_0(t,c);var u=n.channel.pollInternal();if(n.result=u,e.isType(u,Ri)){if(null==u.closeCause)t.resumeWith_tl1gpc$(new m(!1));else{var h=u.receiveException;t.resumeWith_tl1gpc$(new m(N(h)))}return}if(u!==ei)return l=n.channel.onUndeliveredElement_0,a=null==(i=u)||e.isType(i,r)?i:o(),s=t.context,void t.resume_q1ktlu$(!0,null!=l?Ba(l,a,s):null)}return p}))(t);var n},xi.prototype.next=function(){var t,n=this.result;if(e.isType(n,Ri))throw n.receiveException;if(n!==ei)return this.result=ei,null==(t=n)||e.isType(t,r)?t:o();throw S("'hasNext' should be called prior to 'next' invocation")},xi.$metadata$={kind:a,simpleName:"Itr",interfaces:[nr]},Ei.prototype.resumeValue_11rb$=function(t){return 2===this.receiveMode?new Zi(t):t},Ei.prototype.tryResumeReceive_j43gjz$=function(t,e){return null==this.cont.tryResume_i8qury$(this.resumeValue_11rb$(t),null!=e?e.desc:null,this.resumeOnCancellationFun_11rb$(t))?null:(null!=e&&e.finishPrepare(),n)},Ei.prototype.completeResumeReceive_11rb$=function(t){this.cont.completeResume_za3rmp$(n)},Ei.prototype.resumeReceiveClosed_1zqbm$=function(t){if(1===this.receiveMode&&null==t.closeCause)this.cont.resumeWith_tl1gpc$(new m(null));else if(2===this.receiveMode){var e=this.cont,n=new Zi(new Qi(t.closeCause));e.resumeWith_tl1gpc$(new m(n))}else{var i=this.cont,r=t.receiveException;i.resumeWith_tl1gpc$(new m(N(r)))}},Ei.prototype.toString=function(){return"ReceiveElement@"+qs(this)+"[receiveMode="+this.receiveMode+"]"},Ei.$metadata$={kind:a,simpleName:"ReceiveElement",interfaces:[Ai]},Ci.prototype.resumeOnCancellationFun_11rb$=function(t){return Ba(this.onUndeliveredElement,t,this.cont.context)},Ci.$metadata$={kind:a,simpleName:"ReceiveElementWithUndeliveredHandler",interfaces:[Ei]},Oi.prototype.tryResumeReceive_j43gjz$=function(t,e){return null==this.cont.tryResume_i8qury$(!0,null!=e?e.desc:null,this.resumeOnCancellationFun_11rb$(t))?null:(null!=e&&e.finishPrepare(),n)},Oi.prototype.completeResumeReceive_11rb$=function(t){this.iterator.result=t,this.cont.completeResume_za3rmp$(n)},Oi.prototype.resumeReceiveClosed_1zqbm$=function(t){var e=null==t.closeCause?this.cont.tryResume_19pj23$(!1):this.cont.tryResumeWithException_tcv7n7$(t.receiveException);null!=e&&(this.iterator.result=t,this.cont.completeResume_za3rmp$(e))},Oi.prototype.resumeOnCancellationFun_11rb$=function(t){var e;return null!=(e=this.iterator.channel.onUndeliveredElement_0)?Ba(e,t,this.cont.context):null},Oi.prototype.toString=function(){return"ReceiveHasNext@"+qs(this)},Oi.$metadata$={kind:a,simpleName:"ReceiveHasNext",interfaces:[Ai]},Ni.prototype.tryResumeReceive_j43gjz$=function(t,n){var i;return null==(i=this.select.trySelectOther_uc1cc4$(n))||e.isType(i,Wa)?i:o()},Ni.prototype.completeResumeReceive_11rb$=function(t){Za(this.block,2===this.receiveMode?new Zi(t):t,this.select.completion,this.resumeOnCancellationFun_11rb$(t))},Ni.prototype.resumeReceiveClosed_1zqbm$=function(t){if(this.select.trySelect())switch(this.receiveMode){case 0:this.select.resumeSelectWithException_tcv7n7$(t.receiveException);break;case 2:Za(this.block,new Zi(new Qi(t.closeCause)),this.select.completion);break;case 1:null==t.closeCause?Za(this.block,null,this.select.completion):this.select.resumeSelectWithException_tcv7n7$(t.receiveException)}},Ni.prototype.dispose=function(){this.remove()&&this.channel.onReceiveDequeued()},Ni.prototype.resumeOnCancellationFun_11rb$=function(t){var e;return null!=(e=this.channel.onUndeliveredElement_0)?Ba(e,t,this.select.completion.context):null},Ni.prototype.toString=function(){return"ReceiveSelect@"+qs(this)+"["+this.select+",receiveMode="+this.receiveMode+"]"},Ni.$metadata$={kind:a,simpleName:"ReceiveSelect",interfaces:[nn,Ai]},vi.$metadata$={kind:a,simpleName:"AbstractChannel",interfaces:[rr,pi]},zi.prototype.undeliveredElement=function(){},zi.$metadata$={kind:a,simpleName:"Send",interfaces:[Ol]},ji.$metadata$={kind:x,simpleName:"ReceiveOrClosed",interfaces:[]},Object.defineProperty(Ti.prototype,"pollResult",{get:function(){return this.pollResult_vo6xxe$_0}}),Ti.prototype.tryResumeSend_uc1cc4$=function(t){return null==this.cont.tryResume_19pj23$(p,null!=t?t.desc:null)?null:(null!=t&&t.finishPrepare(),n)},Ti.prototype.completeResumeSend=function(){this.cont.completeResume_za3rmp$(n)},Ti.prototype.resumeSendClosed_1zqbm$=function(t){var e=this.cont,n=t.sendException;e.resumeWith_tl1gpc$(new m(N(n)))},Ti.prototype.toString=function(){return Fs(this)+"@"+qs(this)+"("+this.pollResult+")"},Ti.$metadata$={kind:a,simpleName:"SendElement",interfaces:[zi]},Pi.prototype.remove=function(){return!!Ti.prototype.remove.call(this)&&(this.undeliveredElement(),!0)},Pi.prototype.undeliveredElement=function(){Ua(this.onUndeliveredElement,this.pollResult,this.cont.context)},Pi.$metadata$={kind:a,simpleName:"SendElementWithUndeliveredHandler",interfaces:[Ti]},Object.defineProperty(Ri.prototype,"sendException",{configurable:!0,get:function(){var t;return null!=(t=this.closeCause)?t:new ur(ar)}}),Object.defineProperty(Ri.prototype,"receiveException",{configurable:!0,get:function(){var t;return null!=(t=this.closeCause)?t:new pr(ar)}}),Object.defineProperty(Ri.prototype,"offerResult",{configurable:!0,get:function(){return this}}),Object.defineProperty(Ri.prototype,"pollResult",{configurable:!0,get:function(){return this}}),Ri.prototype.tryResumeSend_uc1cc4$=function(t){return null!=t&&t.finishPrepare(),n},Ri.prototype.completeResumeSend=function(){},Ri.prototype.tryResumeReceive_j43gjz$=function(t,e){return null!=e&&e.finishPrepare(),n},Ri.prototype.completeResumeReceive_11rb$=function(t){},Ri.prototype.resumeSendClosed_1zqbm$=function(t){},Ri.prototype.toString=function(){return"Closed@"+qs(this)+"["+C(this.closeCause)+"]"},Ri.$metadata$={kind:a,simpleName:"Closed",interfaces:[ji,zi]},Object.defineProperty(Ai.prototype,"offerResult",{configurable:!0,get:function(){return Xn}}),Ai.prototype.resumeOnCancellationFun_11rb$=function(t){return null},Ai.$metadata$={kind:a,simpleName:"Receive",interfaces:[ji,Ol]},Object.defineProperty(Ii.prototype,"head_0",{configurable:!0,get:function(){return this._head_0},set:function(t){this._head_0=t}}),Object.defineProperty(Ii.prototype,"tail_0",{configurable:!0,get:function(){return this._tail_0},set:function(t){this._tail_0=t}}),Object.defineProperty(Ii.prototype,"size_0",{configurable:!0,get:function(){return this._size_0},set:function(t){this._size_0=t}}),Object.defineProperty(Ii.prototype,"isBufferAlwaysFull",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Ii.prototype,"isBufferFull",{configurable:!0,get:function(){return this.size_0>=this.capacity}}),Ii.prototype.openSubscription=function(){var t=new Mi(this);return this.updateHead_0(t),t},Ii.prototype.close_dbl4no$$default=function(t){return!!this.close_dbl4no$(t,pi.prototype.close_dbl4no$$default.bind(this))&&(this.checkSubOffers_0(),!0)},Ii.prototype.cancel_dbl4no$$default=function(t){return this.cancelInternal_0(t)},Ii.prototype.cancel_m4sck1$$default=function(t){this.cancelInternal_0(t)},Ii.prototype.cancelInternal_0=function(t){var e,n=this.close_dbl4no$(t);for(e=this.subscribers_0.iterator();e.hasNext();)e.next().cancelInternal_fg6mcv$(t);return n},Ii.prototype.offerInternal_11rb$=function(t){var n;if(null!=(n=this.closedForSend_0))return n;var i=this.size_0;if(i>=this.capacity)return ti;var r=this.tail_0;return this.buffer_0[r.modulo(e.Long.fromInt(this.capacity)).toInt()]=t,this.size_0=i+1|0,this.tail_0=r.add(e.Long.fromInt(1)),this.checkSubOffers_0(),Xn},Ii.prototype.offerSelectInternal_ys5ufj$=function(t,n){var i;if(null!=(i=this.closedForSend_0))return i;var r=this.size_0;if(r>=this.capacity)return ti;if(!n.trySelect())return Ko;var o=this.tail_0;return this.buffer_0[o.modulo(e.Long.fromInt(this.capacity)).toInt()]=t,this.size_0=r+1|0,this.tail_0=o.add(e.Long.fromInt(1)),this.checkSubOffers_0(),Xn},Ii.prototype.checkSubOffers_0=function(){var t,e=!1,n=!1;for(t=this.subscribers_0.iterator();t.hasNext();)n=!0,t.next().checkOffer()&&(e=!0);!e&&n||this.updateHead_0()},Ii.prototype.updateHead_0=function(t,n){void 0===t&&(t=null),void 0===n&&(n=null);var i={v:null};t:do{var r,a;if(null!=t){t.subHead=this.tail_0;var s=this.subscribers_0.isEmpty();if(this.subscribers_0.add_11rb$(t),!s)return}if(null!=n&&(this.subscribers_0.remove_11rb$(n),!b(this.head_0,n.subHead)))return;var l=this.computeMinHead_0(),c=this.tail_0,u=this.head_0,p=tt(l,c);if(p.compareTo_11rb$(u)<=0)return;for(var h=this.size_0;u.compareTo_11rb$(p)<0;){this.buffer_0[u.modulo(e.Long.fromInt(this.capacity)).toInt()]=null;var f=h>=this.capacity;if(this.head_0=u=u.inc(),this.size_0=h=h-1|0,f)for(;null!=(r=this.takeFirstSendOrPeekClosed_0())&&(i.v=r,!e.isType(i.v,Ri));)if(null!=B(i.v).tryResumeSend_uc1cc4$(null)){this.buffer_0[c.modulo(e.Long.fromInt(this.capacity)).toInt()]=(e.isType(a=i.v,zi)?a:o()).pollResult,this.size_0=h+1|0,this.tail_0=c.add(e.Long.fromInt(1));break t}}return}while(0);B(i.v).completeResumeSend(),this.checkSubOffers_0(),this.updateHead_0()},Ii.prototype.computeMinHead_0=function(){var t,e=D;for(t=this.subscribers_0.iterator();t.hasNext();){var n=t.next();e=tt(e,n.subHead)}return e},Ii.prototype.elementAt_0=function(t){var n;return null==(n=this.buffer_0[t.modulo(e.Long.fromInt(this.capacity)).toInt()])||e.isType(n,r)?n:o()},Object.defineProperty(Mi.prototype,"subHead",{configurable:!0,get:function(){return this._subHead_0},set:function(t){this._subHead_0=t}}),Object.defineProperty(Mi.prototype,"isBufferAlwaysEmpty",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Mi.prototype,"isBufferEmpty",{configurable:!0,get:function(){return this.subHead.compareTo_11rb$(this.broadcastChannel_0.tail_0)>=0}}),Object.defineProperty(Mi.prototype,"isBufferAlwaysFull",{configurable:!0,get:function(){throw S("Should not be used".toString())}}),Object.defineProperty(Mi.prototype,"isBufferFull",{configurable:!0,get:function(){throw S("Should not be used".toString())}}),Mi.prototype.close_dbl4no$$default=function(t){var e=this.close_dbl4no$(t,vi.prototype.close_dbl4no$$default.bind(this));return e&&(this.broadcastChannel_0.updateHead_0(void 0,this),this.subHead=this.broadcastChannel_0.tail_0),e},Mi.prototype.checkOffer=function(){var t,n,i,a=!1,s=null;t:for(;this.needsToCheckOfferWithoutLock_0()&&this.subLock_0.tryLock();){var l,c;try{if((c=this.peekUnderLock_0())===ei)continue t;if(e.isType(c,Ri)){s=c;break t}if(null==(t=this.takeFirstReceiveOrPeekClosed()))break;if(l=t,e.isType(l,Ri))break;if(null==l.tryResumeReceive_j43gjz$(null==(n=c)||e.isType(n,r)?n:o(),null))continue;var u=this.subHead;this.subHead=u.add(e.Long.fromInt(1)),a=!0}finally{this.subLock_0.unlock()}B(l).completeResumeReceive_11rb$(null==(i=c)||e.isType(i,r)?i:o())}return null!=s&&this.close_dbl4no$(s.closeCause),a},Mi.prototype.pollInternal=function(){var t,n,i={v:!1},r=this.peekUnderLock_0();if(!e.isType(r,Ri)&&r!==ei){var o=this.subHead;this.subHead=o.add(e.Long.fromInt(1)),i.v=!0}var a=r;return null!=(n=e.isType(t=a,Ri)?t:null)&&this.close_dbl4no$(n.closeCause),this.checkOffer()&&(i.v=!0),i.v&&this.broadcastChannel_0.updateHead_0(),a},Mi.prototype.pollSelectInternal_y5yyj0$=function(t){var n,i,r={v:!1},o=this.peekUnderLock_0();if(!e.isType(o,Ri)&&o!==ei)if(t.trySelect()){var a=this.subHead;this.subHead=a.add(e.Long.fromInt(1)),r.v=!0}else o=Ko;var s=o;return null!=(i=e.isType(n=s,Ri)?n:null)&&this.close_dbl4no$(i.closeCause),this.checkOffer()&&(r.v=!0),r.v&&this.broadcastChannel_0.updateHead_0(),s},Mi.prototype.needsToCheckOfferWithoutLock_0=function(){return null==this.closedForReceive_0&&(!this.isBufferEmpty||null!=this.broadcastChannel_0.closedForReceive_0)},Mi.prototype.peekUnderLock_0=function(){var t,e=this.subHead,n=this.broadcastChannel_0.closedForReceive_0,i=this.broadcastChannel_0.tail_0;if(e.compareTo_11rb$(i)>=0)return null!=(t=null!=n?n:this.closedForReceive_0)?t:ei;var r=this.broadcastChannel_0.elementAt_0(e),o=this.closedForReceive_0;return null!=o?o:r},Mi.$metadata$={kind:a,simpleName:"Subscriber",interfaces:[vi,Ji]},Object.defineProperty(Ii.prototype,"bufferDebugString",{configurable:!0,get:function(){return"(buffer:capacity="+this.buffer_0.length+",size="+this.size_0+")"}}),Ii.$metadata$={kind:a,simpleName:"ArrayBroadcastChannel",interfaces:[Ui,pi]},Object.defineProperty(Li.prototype,"isBufferAlwaysEmpty",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Li.prototype,"isBufferEmpty",{configurable:!0,get:function(){return 0===this.size_0}}),Object.defineProperty(Li.prototype,"isBufferAlwaysFull",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Li.prototype,"isBufferFull",{configurable:!0,get:function(){return this.size_0===this.capacity_0&&this.onBufferOverflow_0===Ki()}}),Object.defineProperty(Li.prototype,"isFull",{configurable:!0,get:function(){return this.isFullImpl_0}}),Object.defineProperty(Li.prototype,"isEmpty",{configurable:!0,get:function(){return this.isEmptyImpl_0}}),Object.defineProperty(Li.prototype,"isClosedForReceive",{configurable:!0,get:function(){return e.callGetter(this,vi.prototype,"isClosedForReceive")}}),Li.prototype.offerInternal_11rb$=function(t){var n={v:null};t:do{var i,r,o,a=this.size_0;if(null!=(i=this.closedForSend_0))return i;if(null!=(r=this.updateBufferSize_0(a)))return r;if(0===a)for(;null!=(o=this.takeFirstReceiveOrPeekClosed());){if(n.v=o,e.isType(n.v,Ri))return this.size_0=a,B(n.v);if(null!=B(n.v).tryResumeReceive_j43gjz$(t,null)){this.size_0=a;break t}}return this.enqueueElement_0(a,t),Xn}while(0);return B(n.v).completeResumeReceive_11rb$(t),B(n.v).offerResult},Li.prototype.offerSelectInternal_ys5ufj$=function(t,n){var i={v:null};t:do{var r,o,a=this.size_0;if(null!=(r=this.closedForSend_0))return r;if(null!=(o=this.updateBufferSize_0(a)))return o;if(0===a)e:for(;;){var s=this.describeTryOffer_0(t),l=n.performAtomicTrySelect_6q0pxr$(s);if(null==l){this.size_0=a,i.v=s.result;break t}if(l===ti)break e;if(l!==Fo){if(l===Ko||e.isType(l,Ri))return this.size_0=a,l;throw S(("performAtomicTrySelect(describeTryOffer) returned "+C(l)).toString())}}return n.trySelect()?(this.enqueueElement_0(a,t),Xn):(this.size_0=a,Ko)}while(0);return B(i.v).completeResumeReceive_11rb$(t),B(i.v).offerResult},Li.prototype.enqueueSend_vs6846$=function(t){return vi.prototype.enqueueSend_vs6846$.call(this,t)},Li.prototype.updateBufferSize_0=function(t){var n;if(t=this.buffer_0.length){for(var n=2*this.buffer_0.length|0,i=this.capacity_0,r=nt.min(n,i),o=e.newArray(r,null),a=0;a0&&(l=u,c=p)}return l}catch(t){throw e.isType(t,n)?(a=t,t):t}finally{i(t,a)}}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.channels.none_4c38lx$",k((function(){var n=e.kotlin.Unit,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s=null;try{var l;for(l=t.iterator();e.suspendCall(l.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());)if(o(l.next()))return!1}catch(t){throw e.isType(t,i)?(s=t,t):t}finally{r(t,s)}return e.setCoroutineResult(n,e.coroutineReceiver()),!0}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.channels.reduce_vk3vfd$",k((function(){var n=e.kotlin.UnsupportedOperationException_init_pdl1vj$,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s=null;try{var l=t.iterator();if(e.suspendCall(l.hasNext(e.coroutineReceiver())),!e.coroutineResult(e.coroutineReceiver()))throw n("Empty channel can't be reduced.");for(var c=l.next();e.suspendCall(l.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());)c=o(c,l.next());return c}catch(t){throw e.isType(t,i)?(s=t,t):t}finally{r(t,s)}}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.channels.reduceIndexed_a6mkxp$",k((function(){var n=e.kotlin.UnsupportedOperationException_init_pdl1vj$,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s=null;try{var l,c=t.iterator();if(e.suspendCall(c.hasNext(e.coroutineReceiver())),!e.coroutineResult(e.coroutineReceiver()))throw n("Empty channel can't be reduced.");for(var u=1,p=c.next();e.suspendCall(c.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());)p=o((u=(l=u)+1|0,l),p,c.next());return p}catch(t){throw e.isType(t,i)?(s=t,t):t}finally{r(t,s)}}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.channels.sumBy_fl2dz0$",k((function(){var n=e.kotlin.Unit,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s={v:0},l=null;try{var c;for(c=t.iterator();e.suspendCall(c.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());){var u=c.next();s.v=s.v+o(u)|0}}catch(t){throw e.isType(t,i)?(l=t,t):t}finally{r(t,l)}return e.setCoroutineResult(n,e.coroutineReceiver()),s.v}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.channels.sumByDouble_jy8qhg$",k((function(){var n=e.kotlin.Unit,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s={v:0},l=null;try{var c;for(c=t.iterator();e.suspendCall(c.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());){var u=c.next();s.v+=o(u)}}catch(t){throw e.isType(t,i)?(l=t,t):t}finally{r(t,l)}return e.setCoroutineResult(n,e.coroutineReceiver()),s.v}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.channels.partition_4c38lx$",k((function(){var n=e.kotlin.collections.ArrayList_init_287e2$,i=e.kotlin.Unit,r=e.kotlin.Pair,o=Error,a=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,s,l){var c=n(),u=n(),p=null;try{var h;for(h=t.iterator();e.suspendCall(h.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());){var f=h.next();s(f)?c.add_11rb$(f):u.add_11rb$(f)}}catch(t){throw e.isType(t,o)?(p=t,t):t}finally{a(t,p)}return e.setCoroutineResult(i,e.coroutineReceiver()),new r(c,u)}}))),_r.$metadata$={kind:O,simpleName:"Companion",interfaces:[]};var yr,mr,vr,$r,gr=null;function br(){return null===gr&&new _r,gr}function wr(t,e){this.value=t,this.subscribers=e}function kr(t){this.closeCause=t}function Sr(t){this.this$ConflatedBroadcastChannel=t}function xr(t){Er.call(this,null),this.broadcastChannel_0=t}function Er(t){vi.call(this,t),this.lock_0=new kl,this.value_0=Qn}function Cr(t){vi.call(this,t)}function Or(t){return function(e){var n=new Ht(_(e),1);return n.initCancellability(),t(n),n.getResult()}}function Nr(){}function zr(){return p}function jr(t){return function(e){var n;return t.invokeOnClose_f05bi3$((n=e,function(t){return n.resumeWith_tl1gpc$(new m(p)),p})),p}}function Tr(t,e,n){c.call(this,n),this.exceptionState_0=5,this.local$$receiver=t,this.local$block=e}function Pr(t,e,n,i,r,o,a){void 0===e&&(e=v.EmptyCoroutineContext),void 0===n&&(n=0),void 0===i&&(i=Ki()),void 0===r&&(r=Ae()),void 0===o&&(o=null);var s=cr(n,i),l=new Rr(As(t,e),s);return null!=o&&l.invokeOnCompletion_f05bi3$(o),l.start_b5ul0p$(r,l,a),l}function Rr(t,e){hr.call(this,t,e,!0)}function Ar(t){vi.call(this,t)}function Ir(t){Hr.call(this),this.block_0=t}function Mr(t,e,n){c.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$collector=e}function Lr(t,e,n,i){void 0===e&&(e=v.EmptyCoroutineContext),void 0===n&&(n=-2),void 0===i&&(i=Ki()),yo.call(this,e,n,i),this.block_0=t}function Dr(t,e,n,i){void 0===e&&(e=v.EmptyCoroutineContext),void 0===n&&(n=-2),void 0===i&&(i=Ki()),Lr.call(this,t,e,n,i),this.block_1=t}function qr(t,e,n){c.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$scope=e}function Fr(t,e,n){return r=new Ur(t,e,!0,n),i?r:r.doResume(null);var i,r}function Ur(t,e,n,i){c.call(this,i),this.exceptionState_0=9,this.local$cause=void 0,this.local$result=void 0,this.local$$receiver=t,this.local$channel=e,this.local$consume=n}function Br(){}function Hr(){}function Vr(t,e,n){c.call(this,n),this.exceptionState_0=5,this.$this=t,this.local$safeCollector=void 0,this.local$collector=e}function Kr(){}function Wr(t){return function(e){var n=new Ht(_(e),1);return n.initCancellability(),t(n),n.getResult()}}function Yr(){}function Gr(){}function Jr(){ho.call(this),this.index=pt,this.cont=null}function Zr(t,e,n){fo.call(this),this.replay_0=t,this.bufferCapacity_0=e,this.onBufferOverflow_0=n,this.buffer_0=null,this.replayIndex_0=F,this.minCollectorIndex_0=F,this.bufferSize_0=0,this.queueSize_0=0}function Qr(t,e,n){c.call(this,n),this.exceptionState_0=11,this.$this=t,this.local$slot=void 0,this.local$collectorJob=void 0,this.local$newValue=void 0,this.local$collector=e}function Xr(t,e,n){c.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$value=e}function to(t,e,n,i){this.flow=t,this.index=e,this.value=n,this.cont=i}function eo(t,e){return t[e.toInt()&t.length-1]}function no(t,e,n){t[e.toInt()&t.length-1]=n}function io(t,e,n,i){return 0!==n&&-3!==n||i!==Ki()?new wo(t,e,n,i):t}function ro(){}function oo(){}function ao(t){return new lo(null!=t?t:Do)}function so(){ho.call(this),this._state_0=null}function lo(t){fo.call(this),this._state_0=t,this.sequence_0=0}function co(t,e,n){c.call(this,n),this.exceptionState_0=10,this.$this=t,this.local$slot=void 0,this.local$collectorJob=void 0,this.local$oldState=void 0,this.local$newState=void 0,this.local$collector=e}function uo(t,e){for(;;){var n=t.value;if(t.compareAndSet_xwzc9q$(n,n+e|0))return}}function po(t,e,n,i){return(0<=n&&n<=1||-2===n)&&i===Wi()?t:io(t,e,n,i)}function ho(){}function fo(){this.slots_jbqomn$_0=null,this.nCollectors_uj653m$_0=0,this.nextIndex_0=0,this._subscriptionCount_0=null}function _o(){}function yo(t,e,n){this.context=t,this.capacity=e,this.onBufferOverflow=n}function mo(t,e,n){c.call(this,n),this.exceptionState_0=1,this.local$this$ChannelFlow=t,this.local$it=e}function vo(t,e,n,i,r){c.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$collector=t,this.local$this$ChannelFlow=e,this.local$$receiver=n}function $o(t,e,n,i){yo.call(this,e,n,i),this.flow_0=t}function go(t,e,n){c.call(this,n),this.exceptionState_0=1,this.local$this$ChannelFlowOperator=t,this.local$it=e}function bo(t,e,n){c.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$collectContext=void 0,this.local$newContext=void 0,this.local$collector=e}function wo(t,e,n,i){void 0===e&&(e=v.EmptyCoroutineContext),void 0===n&&(n=-3),void 0===i&&(i=Ki()),$o.call(this,t,e,n,i)}function ko(t,e){var n;this.emitContext_0=e,this.countOrElement_0=(this.emitContext_0,0),this.emitRef_0=(n=t,function(t,e,i){var r=new So(n,t,e);return i?r:r.doResume(null)})}function So(t,e,n){c.call(this,n),this.exceptionState_0=1,this.local$closure$downstream=t,this.local$it=e}function xo(t,e,n,i,r){return void 0===n&&(n=0),(o=t,a=i,s=e,function(t){return a(s,new Eo(t,o),!1)})(r);var o,a,s}function Eo(t,e){this.uCont_0=t,this.context_rbjqds$_0=e}function Co(t,e){return(n=t,function(t){var e=new Oo(t.context,t);return is(e,e,n)})(e);var n}function Oo(t,e){Va.call(this,t,e)}function No(t){this.closure$action=t}function zo(t,e,n,i,r){void 0===n&&(n=v.EmptyCoroutineContext),void 0===i&&(i=-2),void 0===r&&(r=Ki()),$o.call(this,e,n,i,r),this.transform_0=t}function jo(t,e,n,i,r,o){c.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$collector=t,this.local$this$ChannelFlowTransformLatest=e,this.local$closure$value=n}function To(t,e,n){return function(i,r,o){var a=new jo(t,e,n,i,this,r);return o?a:a.doResume(null)}}function Po(t,e,n,i,r,o){c.call(this,o),this.exceptionState_0=1,this.local$closure$previousFlow=t,this.local$closure$collector=e,this.local$this$ChannelFlowTransformLatest=n,this.local$this$=i,this.local$value=r}function Ro(t,e,n,i){return function(r,o,a){var s=new Po(t,e,n,i,r,o);return a?s:s.doResume(null)}}function Ao(t,e,n,i,r){c.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$this$ChannelFlowTransformLatest=t,this.local$closure$collector=e,this.local$$receiver=n}function Io(t,e){return function(n,i,r){var o=new Ao(t,e,n,this,i);return r?o:o.doResume(null)}}function Mo(t,e,n){c.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$collector=e}function Lo(){aa=this}wr.$metadata$={kind:a,simpleName:"State",interfaces:[]},Object.defineProperty(kr.prototype,"sendException",{configurable:!0,get:function(){var t;return null!=(t=this.closeCause)?t:new ur(ar)}}),Object.defineProperty(kr.prototype,"valueException",{configurable:!0,get:function(){var t;return null!=(t=this.closeCause)?t:S(ar)}}),kr.$metadata$={kind:a,simpleName:"Closed",interfaces:[]},Object.defineProperty(dr.prototype,"value",{configurable:!0,get:function(){for(this._state_0;;){var t,n=this._state_0;if(e.isType(n,kr))throw n.valueException;if(e.isType(n,wr)){if(n.value===br().UNDEFINED_0)throw S("No value");return null==(t=n.value)||e.isType(t,r)?t:o()}throw S(("Invalid state "+n.toString()).toString())}}}),Object.defineProperty(dr.prototype,"valueOrNull",{configurable:!0,get:function(){var t=this._state_0;if(e.isType(t,kr))return null;if(e.isType(t,wr)){var n,i=t.value;return i===br().UNDEFINED_0?null:null==(n=i)||e.isType(n,r)?n:o()}throw S(("Invalid state "+t.toString()).toString())}}),Object.defineProperty(dr.prototype,"isClosedForSend",{configurable:!0,get:function(){return e.isType(this._state_0,kr)}}),Object.defineProperty(dr.prototype,"isFull",{configurable:!0,get:function(){return!1}}),dr.prototype.openSubscription=function(){var t,n=new xr(this);for(this._state_0;;){var i,a,s=this._state_0;if(e.isType(s,kr))return n.close_dbl4no$(s.closeCause),n;if(!e.isType(s,wr))throw S(("Invalid state "+s.toString()).toString());s.value!==br().UNDEFINED_0&&n.offerInternal_11rb$(null==(i=s.value)||e.isType(i,r)?i:o());var l=new wr(s.value,this.addSubscriber_0((e.isType(a=s,wr)?a:o()).subscribers,n));if((t=this)._state_0===s&&(t._state_0=l,1))return n}},dr.prototype.closeSubscriber_0=function(t){var n;for(this._state_0;;){var i,r=this._state_0;if(e.isType(r,kr))return;if(!e.isType(r,wr))throw S(("Invalid state "+r.toString()).toString());var a=new wr(r.value,this.removeSubscriber_0(B((e.isType(i=r,wr)?i:o()).subscribers),t));if((n=this)._state_0===r&&(n._state_0=a,1))return}},dr.prototype.addSubscriber_0=function(t,e){if(null==t){var n,i=d(1);n=i.length-1|0;for(var r=0;r<=n;r++)i[r]=e;return i}return t.concat([e])},dr.prototype.removeSubscriber_0=function(t,n){var i,r=t.length,a=lt(t,n);if(1===r)return null;var s=e.newArray(r-1|0,null);return ct(t,s,0,0,a),ct(t,s,a,a+1|0,t.length),e.isArray(i=s)?i:o()},dr.prototype.close_dbl4no$$default=function(t){var n;for(this._state_0;;){var i,r,a=this._state_0;if(e.isType(a,kr))return!1;if(!e.isType(a,wr))throw S(("Invalid state "+a.toString()).toString());var s=null==t?br().CLOSED_0:new kr(t);if((n=this)._state_0===a&&(n._state_0=s,1)){var l;if(null!=(r=(e.isType(i=a,wr)?i:o()).subscribers))for(l=0;l!==r.length;++l)r[l].close_dbl4no$(t);return this.invokeOnCloseHandler_0(t),!0}}},dr.prototype.invokeOnCloseHandler_0=function(t){var e,n,i=this.onCloseHandler_0;null!==i&&i!==ii&&(n=this).onCloseHandler_0===i&&(n.onCloseHandler_0=ii,1)&&("function"==typeof(e=i)?e:o())(t)},dr.prototype.invokeOnClose_f05bi3$=function(t){if(null!=(i=this).onCloseHandler_0||(i.onCloseHandler_0=t,0)){var n=this.onCloseHandler_0;throw S(n===ii?"Another handler was already registered and successfully invoked":"Another handler was already registered: "+C(n))}var i,r=this._state_0;e.isType(r,kr)&&function(e){return e.onCloseHandler_0===t&&(e.onCloseHandler_0=ii,!0)}(this)&&t(r.closeCause)},dr.prototype.cancel_dbl4no$$default=function(t){return this.close_dbl4no$(t)},dr.prototype.cancel_m4sck1$$default=function(t){this.close_dbl4no$(t)},dr.prototype.send_11rb$=function(t,e){var n;if(null!=(n=this.offerInternal_0(t)))throw n.sendException},dr.prototype.offer_11rb$=function(t){var e;if(null!=(e=this.offerInternal_0(t)))throw e.sendException;return!0},dr.prototype.offerInternal_0=function(t){if(0!==(n=this)._updating_0||(n._updating_0=1,0))return null;var n;try{for(this._state_0;;){var i,r,a=this._state_0;if(e.isType(a,kr))return a;if(!e.isType(a,wr))throw S(("Invalid state "+a.toString()).toString());var s=new wr(t,(e.isType(i=a,wr)?i:o()).subscribers);if(function(t){return t._state_0===a&&(t._state_0=s,!0)}(this)){var l;if(null!=(r=a.subscribers))for(l=0;l!==r.length;++l)r[l].offerInternal_11rb$(t);return null}}}finally{this._updating_0=0}},Sr.prototype.registerSelectClause2_rol3se$=function(t,e,n){this.this$ConflatedBroadcastChannel.registerSelectSend_0(t,e,n)},Sr.$metadata$={kind:a,interfaces:[ls]},Object.defineProperty(dr.prototype,"onSend",{configurable:!0,get:function(){return new Sr(this)}}),dr.prototype.registerSelectSend_0=function(t,e,n){var i;t.trySelect()&&(null==(i=this.offerInternal_0(e))?ts(n,this,t.completion):t.resumeSelectWithException_tcv7n7$(i.sendException))},xr.prototype.onCancelIdempotent_6taknv$=function(t){t&&this.broadcastChannel_0.closeSubscriber_0(this)},xr.prototype.offerInternal_11rb$=function(t){return Er.prototype.offerInternal_11rb$.call(this,t)},xr.$metadata$={kind:a,simpleName:"Subscriber",interfaces:[Er,Ji]},dr.$metadata$={kind:a,simpleName:"ConflatedBroadcastChannel",interfaces:[Ui]},Object.defineProperty(Er.prototype,"isBufferAlwaysEmpty",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Er.prototype,"isBufferEmpty",{configurable:!0,get:function(){return this.value_0===Qn}}),Object.defineProperty(Er.prototype,"isBufferAlwaysFull",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Er.prototype,"isBufferFull",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Er.prototype,"isEmpty",{configurable:!0,get:function(){return this.isEmptyImpl_0}}),Er.prototype.offerInternal_11rb$=function(t){var n={v:null};t:do{var i,r,o;if(null!=(i=this.closedForSend_0))return i;if(this.value_0===Qn)for(;null!=(r=this.takeFirstReceiveOrPeekClosed());){if(n.v=r,e.isType(n.v,Ri))return B(n.v);if(null!=B(n.v).tryResumeReceive_j43gjz$(t,null))break t}if(null!=(o=this.updateValueLocked_0(t)))throw o;return Xn}while(0);return B(n.v).completeResumeReceive_11rb$(t),B(n.v).offerResult},Er.prototype.offerSelectInternal_ys5ufj$=function(t,n){var i={v:null};t:do{var r,o;if(null!=(r=this.closedForSend_0))return r;if(this.value_0===Qn)e:for(;;){var a=this.describeTryOffer_0(t),s=n.performAtomicTrySelect_6q0pxr$(a);if(null==s){i.v=a.result;break t}if(s===ti)break e;if(s!==Fo){if(s===Ko||e.isType(s,Ri))return s;throw S(("performAtomicTrySelect(describeTryOffer) returned "+C(s)).toString())}}if(!n.trySelect())return Ko;if(null!=(o=this.updateValueLocked_0(t)))throw o;return Xn}while(0);return B(i.v).completeResumeReceive_11rb$(t),B(i.v).offerResult},Er.prototype.pollInternal=function(){var t,e={v:null};return this.value_0===Qn?null!=(t=this.closedForSend_0)?t:ei:(e.v=this.value_0,this.value_0=Qn,e.v)},Er.prototype.pollSelectInternal_y5yyj0$=function(t){var e,n={v:null};return this.value_0===Qn?null!=(e=this.closedForSend_0)?e:ei:t.trySelect()?(n.v=this.value_0,this.value_0=Qn,n.v):Ko},Er.prototype.onCancelIdempotent_6taknv$=function(t){var e,n={v:null};if(n.v=this.updateValueLocked_0(Qn),vi.prototype.onCancelIdempotent_6taknv$.call(this,t),null!=(e=n.v))throw e},Er.prototype.updateValueLocked_0=function(t){var n,i,a,s,l=this.value_0;l===Qn?s=null:(a=this.onUndeliveredElement_0,i=null==(n=l)||e.isType(n,r)?n:o(),s=null!=a?Fa(a,i):null);var c=s;return this.value_0=t,c},Er.prototype.enqueueReceiveInternal_i292ax$=function(t){return vi.prototype.enqueueReceiveInternal_i292ax$.call(this,t)},Object.defineProperty(Er.prototype,"bufferDebugString",{configurable:!0,get:function(){return"(value="+C(this.value_0)+")"}}),Er.$metadata$={kind:a,simpleName:"ConflatedChannel",interfaces:[vi]},Object.defineProperty(Cr.prototype,"isBufferAlwaysEmpty",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Cr.prototype,"isBufferEmpty",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Cr.prototype,"isBufferAlwaysFull",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Cr.prototype,"isBufferFull",{configurable:!0,get:function(){return!1}}),Cr.prototype.offerInternal_11rb$=function(t){for(;;){var n=vi.prototype.offerInternal_11rb$.call(this,t);if(n===Xn)return Xn;if(n!==ti){if(e.isType(n,Ri))return n;throw S(("Invalid offerInternal result "+n.toString()).toString())}var i=this.sendBuffered_0(t);if(null==i)return Xn;if(e.isType(i,Ri))return i}},Cr.prototype.offerSelectInternal_ys5ufj$=function(t,n){for(var i;;){var r=this.hasReceiveOrClosed_0?vi.prototype.offerSelectInternal_ys5ufj$.call(this,t,n):null!=(i=n.performAtomicTrySelect_6q0pxr$(this.describeSendBuffered_0(t)))?i:Xn;if(r===Ko)return Ko;if(r===Xn)return Xn;if(r!==ti&&r!==Fo){if(e.isType(r,Ri))return r;throw S(("Invalid result "+r.toString()).toString())}}},Cr.prototype.onCancelIdempotentList_kji3ae$=function(t,n){var i,a,s,l,c={v:null};if(null!=(a=t.holder_0))if(e.isType(a,Y))for(var u=e.isType(l=t.holder_0,Y)?l:o(),p=u.size-1|0;p>=0;p--){var h,f,d,_,y=u.get_za3lpa$(p);e.isType(y,mi)?(_=this.onUndeliveredElement_0,f=null==(h=y.element)||e.isType(h,r)?h:o(),d=c.v,c.v=null!=_?Fa(_,f,d):null):y.resumeSendClosed_1zqbm$(n)}else{var m,v,$,g,b=null==(s=t.holder_0)||e.isType(s,r)?s:o();e.isType(b,mi)?(g=this.onUndeliveredElement_0,v=null==(m=b.element)||e.isType(m,r)?m:o(),$=c.v,c.v=null!=g?Fa(g,v,$):null):b.resumeSendClosed_1zqbm$(n)}if(null!=(i=c.v))throw i},Cr.$metadata$={kind:a,simpleName:"LinkedListChannel",interfaces:[vi]},Nr.$metadata$={kind:x,simpleName:"ProducerScope",interfaces:[Gi,Se]},Tr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Tr.prototype=Object.create(c.prototype),Tr.prototype.constructor=Tr,Tr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(void 0===this.local$block&&(this.local$block=zr),this.context.get_j3r2sn$(tn())!==this.local$$receiver)throw S("awaitClose() can only be invoked from the producer context".toString());if(this.exceptionState_0=3,this.state_0=1,this.result_0=Or(jr(this.local$$receiver))(this),this.result_0===l)return l;continue;case 1:this.exceptionState_0=5,this.finallyPath_0=[2],this.state_0=4;continue;case 2:return;case 3:this.finallyPath_0=[5],this.state_0=4;continue;case 4:this.exceptionState_0=5,this.local$block(),this.state_0=this.finallyPath_0.shift();continue;case 5:throw this.exception_0;default:throw this.state_0=5,new Error("State Machine Unreachable execution")}}catch(t){if(5===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(Rr.prototype,"isActive",{configurable:!0,get:function(){return e.callGetter(this,hr.prototype,"isActive")}}),Rr.prototype.onCompleted_11rb$=function(t){this._channel_0.close_dbl4no$()},Rr.prototype.onCancelled_z1nxw$=function(t,e){this._channel_0.close_dbl4no$(t)||e||de(this.context,t)},Rr.$metadata$={kind:a,simpleName:"ProducerCoroutine",interfaces:[Nr,hr]},Object.defineProperty(Ar.prototype,"isBufferAlwaysEmpty",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Ar.prototype,"isBufferEmpty",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Ar.prototype,"isBufferAlwaysFull",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Ar.prototype,"isBufferFull",{configurable:!0,get:function(){return!0}}),Ar.$metadata$={kind:a,simpleName:"RendezvousChannel",interfaces:[vi]},Mr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Mr.prototype=Object.create(c.prototype),Mr.prototype.constructor=Mr,Mr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.block_0(this.local$collector,this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ir.prototype.collectSafely_42ocv1$=function(t,e,n){var i=new Mr(this,t,e);return n?i:i.doResume(null)},Ir.$metadata$={kind:a,simpleName:"SafeFlow",interfaces:[Hr]},Lr.prototype.create_5k3f3z$=function(t,e,n){return new Lr(this.block_0,t,e,n)},Lr.prototype.collectTo_sz7tnc$=function(t,e){return this.block_0(t,e)},Lr.prototype.toString=function(){return"block["+this.block_0+"] -> "+yo.prototype.toString.call(this)},Lr.$metadata$={kind:a,simpleName:"ChannelFlowBuilder",interfaces:[yo]},qr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},qr.prototype=Object.create(c.prototype),qr.prototype.constructor=qr,qr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Lr.prototype.collectTo_sz7tnc$.call(this.$this,this.local$scope,this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:if(!this.local$scope.isClosedForSend)throw S(ut("\n 'awaitClose { yourCallbackOrListener.cancel() }' should be used in the end of callbackFlow block.\n Otherwise, a callback/listener may leak in case of external cancellation.\n See callbackFlow API documentation for the details.\n "));return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Dr.prototype.collectTo_sz7tnc$=function(t,e,n){var i=new qr(this,t,e);return n?i:i.doResume(null)},Dr.prototype.create_5k3f3z$=function(t,e,n){return new Dr(this.block_1,t,e,n)},Dr.$metadata$={kind:a,simpleName:"CallbackFlowBuilder",interfaces:[Lr]},Ur.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Ur.prototype=Object.create(c.prototype),Ur.prototype.constructor=Ur,Ur.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;this.local$cause=null,this.exceptionState_0=6,this.state_0=1;continue;case 1:if(this.state_0=2,this.result_0=this.local$channel.receiveOrClosed(this),this.result_0===l)return l;continue;case 2:if(this.local$result=this.result_0,this.local$result.isClosed){if(null!=(t=this.local$result.closeCause))throw t;this.state_0=5;continue}this.state_0=3;continue;case 3:if(this.state_0=4,this.result_0=this.local$$receiver.emit_11rb$(this.local$result.value,this),this.result_0===l)return l;continue;case 4:this.state_0=1;continue;case 5:this.exceptionState_0=9,this.finallyPath_0=[8],this.state_0=7;continue;case 6:this.finallyPath_0=[9],this.exceptionState_0=7;var n=this.exception_0;throw e.isType(n,E)?(this.local$cause=n,n):n;case 7:this.exceptionState_0=9,this.local$consume&&fr(this.local$channel,this.local$cause),this.state_0=this.finallyPath_0.shift();continue;case 8:return;case 9:throw this.exception_0;default:throw this.state_0=9,new Error("State Machine Unreachable execution")}}catch(n){if(9===this.state_0)throw this.exceptionState_0=this.state_0,n;this.state_0=this.exceptionState_0,this.exception_0=n}},Br.$metadata$={kind:x,simpleName:"Flow",interfaces:[]},Vr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Vr.prototype=Object.create(c.prototype),Vr.prototype.constructor=Vr,Vr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$safeCollector=new gl(this.local$collector,this.context),this.exceptionState_0=3,this.state_0=1,this.result_0=this.$this.collectSafely_42ocv1$(this.local$safeCollector,this),this.result_0===l)return l;continue;case 1:this.exceptionState_0=5,this.finallyPath_0=[2],this.state_0=4;continue;case 2:return;case 3:this.finallyPath_0=[5],this.state_0=4;continue;case 4:this.exceptionState_0=5,this.local$safeCollector.releaseIntercepted(),this.state_0=this.finallyPath_0.shift();continue;case 5:throw this.exception_0;default:throw this.state_0=5,new Error("State Machine Unreachable execution")}}catch(t){if(5===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Hr.prototype.collect_42ocv1$=function(t,e,n){var i=new Vr(this,t,e);return n?i:i.doResume(null)},Hr.$metadata$={kind:a,simpleName:"AbstractFlow",interfaces:[ha,Br]},Kr.$metadata$={kind:x,simpleName:"FlowCollector",interfaces:[]},Yr.$metadata$={kind:x,simpleName:"SharedFlow",interfaces:[Br]},Gr.$metadata$={kind:x,simpleName:"MutableSharedFlow",interfaces:[Kr,Yr]},Jr.prototype.allocateLocked_11rb$=function(t){return!(this.index.toNumber()>=0||(this.index=t.updateNewCollectorIndexLocked_8be2vx$(),0))},Jr.prototype.freeLocked_11rb$=function(t){var e=this.index;return this.index=pt,this.cont=null,t.updateCollectorIndexLocked_8e33dg$(e)},Jr.$metadata$={kind:a,simpleName:"SharedFlowSlot",interfaces:[ho]},Object.defineProperty(Zr.prototype,"head_0",{configurable:!0,get:function(){var t=this.minCollectorIndex_0,e=this.replayIndex_0;return t.compareTo_11rb$(e)<=0?t:e}}),Object.defineProperty(Zr.prototype,"replaySize_0",{configurable:!0,get:function(){return this.head_0.add(e.Long.fromInt(this.bufferSize_0)).subtract(this.replayIndex_0).toInt()}}),Object.defineProperty(Zr.prototype,"totalSize_0",{configurable:!0,get:function(){return this.bufferSize_0+this.queueSize_0|0}}),Object.defineProperty(Zr.prototype,"bufferEndIndex_0",{configurable:!0,get:function(){return this.head_0.add(e.Long.fromInt(this.bufferSize_0))}}),Object.defineProperty(Zr.prototype,"queueEndIndex_0",{configurable:!0,get:function(){return this.head_0.add(e.Long.fromInt(this.bufferSize_0)).add(e.Long.fromInt(this.queueSize_0))}}),Object.defineProperty(Zr.prototype,"replayCache",{configurable:!0,get:function(){var t=this.replaySize_0;if(0===t)return u();for(var n=y(t),i=B(this.buffer_0),a=0;a=this.bufferCapacity_0&&this.minCollectorIndex_0.compareTo_11rb$(this.replayIndex_0)<=0)switch(this.onBufferOverflow_0.name){case"SUSPEND":return!1;case"DROP_LATEST":return!0}return this.enqueueLocked_0(t),this.bufferSize_0=this.bufferSize_0+1|0,this.bufferSize_0>this.bufferCapacity_0&&this.dropOldestLocked_0(),this.replaySize_0>this.replay_0&&this.updateBufferLocked_0(this.replayIndex_0.add(e.Long.fromInt(1)),this.minCollectorIndex_0,this.bufferEndIndex_0,this.queueEndIndex_0),!0},Zr.prototype.tryEmitNoCollectorsLocked_0=function(t){return 0===this.replay_0||(this.enqueueLocked_0(t),this.bufferSize_0=this.bufferSize_0+1|0,this.bufferSize_0>this.replay_0&&this.dropOldestLocked_0(),this.minCollectorIndex_0=this.head_0.add(e.Long.fromInt(this.bufferSize_0))),!0},Zr.prototype.dropOldestLocked_0=function(){no(B(this.buffer_0),this.head_0,null),this.bufferSize_0=this.bufferSize_0-1|0;var t=this.head_0.add(e.Long.fromInt(1));this.replayIndex_0.compareTo_11rb$(t)<0&&(this.replayIndex_0=t),this.minCollectorIndex_0.compareTo_11rb$(t)<0&&this.correctCollectorIndexesOnDropOldest_0(t)},Zr.prototype.correctCollectorIndexesOnDropOldest_0=function(t){var e;this.forEachSlotLocked_0((e=t,function(t){return t.index.toNumber()>=0&&t.index.compareTo_11rb$(e)<0&&(t.index=e),p})),this.minCollectorIndex_0=t},Zr.prototype.enqueueLocked_0=function(t){var n=this.totalSize_0,i=this.buffer_0;no(null==i?this.growBuffer_0(null,0,2):n>=i.length?this.growBuffer_0(i,n,2*i.length|0):i,this.head_0.add(e.Long.fromInt(n)),t)},Zr.prototype.growBuffer_0=function(t,n,i){if(!(i>0))throw S("Buffer size overflow".toString());var r=e.newArray(i,null);this.buffer_0=r;var o=r;if(null==t)return o;for(var a=this.head_0,s=0;s0)return $r;var a,s=this.head_0,l={v:s.add(e.Long.fromInt(this.bufferSize_0))};if(0===this.bufferCapacity_0&&this.queueSize_0>0&&(l.v=l.v.inc()),this.forEachSlotLocked_0((a=l,function(t){return t.index.toNumber()>=0&&t.index.compareTo_11rb$(a.v)<0&&(a.v=t.index),p})),l.v.compareTo_11rb$(this.minCollectorIndex_0)<=0)return $r;var c=this.bufferEndIndex_0;if(this.nCollectors_0>0){var u=c.subtract(l.v).toInt(),h=this.queueSize_0,f=this.bufferCapacity_0-u|0;n=nt.min(h,f)}else n=this.queueSize_0;var d=n,_=$r,y=c.add(e.Long.fromInt(this.queueSize_0));if(d>0){_=e.newArray(d,null);var m=0,v=B(this.buffer_0);for(i=ht(c,y).iterator();i.hasNext();){var $=i.next(),g=eo(v,$);if(g!==yr&&(e.isType(g,to)||o(),_[(r=m,m=r+1|0,r)]=g.cont,no(v,$,yr),no(v,c,g.value),c=c.inc(),m>=d))break}}var w=c.subtract(s).toInt();0===this.nCollectors_0&&(l.v=c);var k=this.replayIndex_0,S=c,x=this.replay_0,E=S.subtract(e.Long.fromInt(nt.min(x,w))),C=k.compareTo_11rb$(E)>=0?k:E;return 0===this.bufferCapacity_0&&C.compareTo_11rb$(y)<0&&b(eo(B(this.buffer_0),C),yr)&&(c=c.inc(),C=C.inc()),this.updateBufferLocked_0(C,l.v,c,y),this.cleanupTailLocked_0(),0!==_.length&&(_=this.findSlotsToResumeLocked_0(_)),_},Zr.prototype.updateBufferLocked_0=function(t,e,n,i){var r,o=e.compareTo_11rb$(t)<=0?e:t;for(r=ht(this.head_0,o).iterator();r.hasNext();){var a=r.next();no(B(this.buffer_0),a,null)}this.replayIndex_0=t,this.minCollectorIndex_0=e,this.bufferSize_0=n.subtract(o).toInt(),this.queueSize_0=i.subtract(n).toInt()},Zr.prototype.cleanupTailLocked_0=function(){if(!(0===this.bufferCapacity_0&&this.queueSize_0<=1))for(var t=B(this.buffer_0);this.queueSize_0>0&&eo(t,this.head_0.add(e.Long.fromInt(this.totalSize_0)).subtract(e.Long.fromInt(1)))===yr;)this.queueSize_0=this.queueSize_0-1|0,no(t,this.head_0.add(e.Long.fromInt(this.totalSize_0)),null)},Zr.prototype.tryTakeValue_0=function(t){var n,i,r,o={v:$r},a=this.tryPeekLocked_0(t);if(a.toNumber()<0)r=yr;else{var s=t.index,l=this.getPeekedValueLockedAt_0(a);t.index=a.add(e.Long.fromInt(1)),o.v=this.updateCollectorIndexLocked_8e33dg$(s),r=l}var c=r;for(n=o.v,i=0;i!==n.length;++i){var u=n[i];null!=u&&u.resumeWith_tl1gpc$(new m(p))}return c},Zr.prototype.tryPeekLocked_0=function(t){var e=t.index;return e.compareTo_11rb$(this.bufferEndIndex_0)<0?e:this.bufferCapacity_0>0||e.compareTo_11rb$(this.head_0)>0||0===this.queueSize_0?pt:e},Zr.prototype.getPeekedValueLockedAt_0=function(t){var n=eo(B(this.buffer_0),t);return e.isType(n,to)?n.value:n},Zr.prototype.awaitValue_0=function(t,e){return Wr((n=this,i=t,function(t){var e=i,r=n;t:do{if(!(r.tryPeekLocked_0(e).toNumber()<0)){t.resumeWith_tl1gpc$(new m(p));break t}e.cont=t,e.cont=t}while(0);return p}))(e);var n,i},Zr.prototype.findSlotsToResumeLocked_0=function(t){var e,n,i,r={v:t},o={v:t.length};return this.forEachSlotLocked_0((e=this,n=o,i=r,function(t){var r,o;if(null!=(r=t.cont)){var a=r;if(!(e.tryPeekLocked_0(t).toNumber()<0)){if(n.v>=i.v.length){var s=i,l=i.v,c=2*i.v.length|0;s.v=ft(l,nt.max(2,c))}return i.v[(o=n.v,n.v=o+1|0,o)]=a,t.cont=null,p}}})),r.v},Zr.prototype.createSlot=function(){return new Jr},Zr.prototype.createSlotArray_za3lpa$=function(t){return e.newArray(t,null)},Zr.prototype.resetReplayCache=function(){this.updateBufferLocked_0(this.bufferEndIndex_0,this.minCollectorIndex_0,this.bufferEndIndex_0,this.queueEndIndex_0)},Zr.prototype.fuse_5k3f3z$$default=function(t,e,n){return io(this,t,e,n)},to.prototype.dispose=function(){this.flow.cancelEmitter_0(this)},to.$metadata$={kind:a,simpleName:"Emitter",interfaces:[nn]},Zr.$metadata$={kind:a,simpleName:"SharedFlowImpl",interfaces:[_o,ha,Gr,fo]},ro.$metadata$={kind:x,simpleName:"StateFlow",interfaces:[Yr]},oo.$metadata$={kind:x,simpleName:"MutableStateFlow",interfaces:[Gr,ro]},so.prototype.allocateLocked_11rb$=function(t){return null==this._state_0&&(this._state_0=mr,!0)},so.prototype.freeLocked_11rb$=function(t){return this._state_0=null,$r},so.prototype.makePending=function(){var t;for(this._state_0;;){var n,i=this._state_0;if(null==i)return;if(i===vr)return;if(i===mr){if((t=this)._state_0===i&&(t._state_0=vr,1))return}else if(function(t){return t._state_0===i&&(t._state_0=mr,!0)}(this))return void(e.isType(n=i,Ht)?n:o()).resumeWith_tl1gpc$(new m(p))}},so.prototype.takePending=function(){return B((e=(t=this)._state_0,t._state_0=mr,e))===vr;var t,e},so.prototype.awaitPending=function(t){return(n=this,e=function(t){if(n._state_0!==mr||(n._state_0=t,0))return t.resumeWith_tl1gpc$(new m(p)),p},function(t){var n=new Ht(_(t),1);return n.initCancellability(),e(n),n.getResult()})(t);var e,n},so.$metadata$={kind:a,simpleName:"StateFlowSlot",interfaces:[ho]},Object.defineProperty(lo.prototype,"value",{configurable:!0,get:function(){var t,n=this._state_0;return n===Do?null:null==(t=n)||e.isType(t,r)?t:o()},set:function(t){this.updateState_0(null,null!=t?t:Do)}}),lo.prototype.compareAndSet_xwzc9q$=function(t,e){return this.updateState_0(null!=t?t:Do,null!=e?e:Do)},lo.prototype.updateState_0=function(t,e){var n,i={v:0},r={v:this.slots_0},o=this._state_0;if(null!=t&&!b(o,t))return!1;if(b(o,e))return!0;if(this._state_0=e,i.v=this.sequence_0,0!=(1&i.v))return this.sequence_0=i.v+2|0,!0;for(i.v=i.v+1|0,this.sequence_0=i.v,r.v=this.slots_0;;){var a;if(null!=(n=r.v))for(a=0;a!==n.length;++a){var s=n[a];null!=s&&s.makePending()}if(this.sequence_0===i.v)return this.sequence_0=i.v+1|0,!0;i.v=this.sequence_0,r.v=this.slots_0}},Object.defineProperty(lo.prototype,"replayCache",{configurable:!0,get:function(){return _t(this.value)}}),lo.prototype.tryEmit_11rb$=function(t){return this.value=t,!0},lo.prototype.emit_11rb$=function(t,e){this.value=t},lo.prototype.resetReplayCache=function(){throw Z("MutableStateFlow.resetReplayCache is not supported")},co.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},co.prototype=Object.create(c.prototype),co.prototype.constructor=co,co.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$slot=this.$this.allocateSlot_0(),this.exceptionState_0=8,e.isType(this.local$collector,ya)){if(this.state_0=1,this.result_0=this.local$collector.onSubscription(this),this.result_0===l)return l;continue}this.state_0=2;continue;case 1:this.state_0=2;continue;case 2:this.result_0=this.context,this.local$collectorJob=this.result_0.get_j3r2sn$(tn()),this.local$oldState=null,this.state_0=3;continue;case 3:if(this.local$newState=this.$this._state_0,null!=this.local$collectorJob&&sn(this.local$collectorJob),null!=this.local$oldState&&b(this.local$oldState,this.local$newState)){this.state_0=5;continue}var t;if(this.state_0=4,this.result_0=this.local$collector.emit_11rb$(this.local$newState===Do?null:null==(t=this.local$newState)||e.isType(t,r)?t:o(),this),this.result_0===l)return l;continue;case 4:this.local$oldState=this.local$newState,this.state_0=5;continue;case 5:if(this.local$slot.takePending()){this.state_0=7;continue}if(this.state_0=6,this.result_0=this.local$slot.awaitPending(this),this.result_0===l)return l;continue;case 6:this.state_0=7;continue;case 7:this.state_0=3;continue;case 8:this.finallyPath_0=[10],this.state_0=9;continue;case 9:this.exceptionState_0=10,this.$this.freeSlot_0(this.local$slot),this.state_0=this.finallyPath_0.shift();continue;case 10:throw this.exception_0;default:throw this.state_0=10,new Error("State Machine Unreachable execution")}}catch(t){if(10===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},lo.prototype.collect_42ocv1$=function(t,e,n){var i=new co(this,t,e);return n?i:i.doResume(null)},lo.prototype.createSlot=function(){return new so},lo.prototype.createSlotArray_za3lpa$=function(t){return e.newArray(t,null)},lo.prototype.fuse_5k3f3z$$default=function(t,e,n){return po(this,t,e,n)},lo.$metadata$={kind:a,simpleName:"StateFlowImpl",interfaces:[_o,ha,oo,fo]},ho.$metadata$={kind:a,simpleName:"AbstractSharedFlowSlot",interfaces:[]},Object.defineProperty(fo.prototype,"slots_0",{configurable:!0,get:function(){return this.slots_jbqomn$_0},set:function(t){this.slots_jbqomn$_0=t}}),Object.defineProperty(fo.prototype,"nCollectors_0",{configurable:!0,get:function(){return this.nCollectors_uj653m$_0},set:function(t){this.nCollectors_uj653m$_0=t}}),Object.defineProperty(fo.prototype,"subscriptionCount",{configurable:!0,get:function(){var t,e;if(null!=(t=this._subscriptionCount_0))e=t;else{var n=ao(this.nCollectors_0);this._subscriptionCount_0=n,e=n}return e}}),fo.prototype.allocateSlot_0=function(){var t,n,i,r,a={v:null},s=this.slots_0;if(null==s){var l=this.createSlotArray_za3lpa$(2);this.slots_0=l,n=l}else if(this.nCollectors_0>=s.length){var c=ft(s,2*s.length|0);this.slots_0=c,n=c}else n=s;for(var u,p={v:n},h={v:this.nextIndex_0};;){var f;if(null!=(i=p.v[h.v]))f=i;else{var d=this.createSlot();p.v[h.v]=d,f=d}if(u=f,h.v=h.v+1|0,h.v>=p.v.length&&(h.v=0),(e.isType(r=u,ho)?r:o()).allocateLocked_11rb$(this))break}this.nextIndex_0=h.v,this.nCollectors_0=this.nCollectors_0+1|0,a.v=this._subscriptionCount_0;var _=u;return null!=(t=a.v)&&uo(t,1),_},fo.prototype.freeSlot_0=function(t){var n,i,r,a={v:null};this.nCollectors_0=this.nCollectors_0-1|0,a.v=this._subscriptionCount_0,0===this.nCollectors_0&&(this.nextIndex_0=0);var s=(e.isType(r=t,ho)?r:o()).freeLocked_11rb$(this);for(n=0;n!==s.length;++n){var l=s[n];null!=l&&l.resumeWith_tl1gpc$(new m(p))}null!=(i=a.v)&&uo(i,-1)},fo.prototype.forEachSlotLocked_0=function(t){var e,n;if(0!==this.nCollectors_0&&null!=(e=this.slots_0))for(n=0;n!==e.length;++n){var i=e[n];null!=i&&t(i)}},fo.$metadata$={kind:a,simpleName:"AbstractSharedFlow",interfaces:[]},_o.prototype.fuse_5k3f3z$=function(t,e,n,i){return void 0===t&&(t=v.EmptyCoroutineContext),void 0===e&&(e=-3),void 0===n&&(n=Ki()),i?i(t,e,n):this.fuse_5k3f3z$$default(t,e,n)},_o.$metadata$={kind:x,simpleName:"FusibleFlow",interfaces:[Br]},mo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},mo.prototype=Object.create(c.prototype),mo.prototype.constructor=mo,mo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$this$ChannelFlow.collectTo_sz7tnc$(this.local$it,this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(yo.prototype,"collectToFun_8be2vx$",{configurable:!0,get:function(){return t=this,function(e,n,i){var r=new mo(t,e,n);return i?r:r.doResume(null)};var t}}),Object.defineProperty(yo.prototype,"produceCapacity_ik5e2$_0",{configurable:!0,get:function(){return-3===this.capacity?-2:this.capacity}}),yo.prototype.dropChannelOperators=function(){return null},yo.prototype.fuse_5k3f3z$$default=function(t,e,n){var i,r,o,a=t.plus_1fupul$(this.context);if(n!==Ki())r=e,o=n;else{if(-3===this.capacity)i=e;else if(-3===e)i=this.capacity;else if(-2===this.capacity)i=e;else if(-2===e)i=this.capacity;else{var s=this.capacity+e|0;i=s>=0?s:2147483647}r=i,o=this.onBufferOverflow}return b(a,this.context)&&r===this.capacity&&o===this.onBufferOverflow?this:this.create_5k3f3z$(a,r,o)},yo.prototype.broadcastImpl_uicbxq$=function(t,n){var i;switch(this.onBufferOverflow.name){case"SUSPEND":i=this.produceCapacity_ik5e2$_0;break;case"DROP_OLDEST":i=-1;break;case"DROP_LATEST":throw H("Broadcast channel does not support BufferOverflow.DROP_LATEST");default:i=e.noWhenBranchMatched()}var r=i;return Di(t,this.context,r,n,void 0,this.collectToFun_8be2vx$)},yo.prototype.produceImpl_gkk88$=function(t){return Pr(t,this.context,this.produceCapacity_ik5e2$_0,this.onBufferOverflow,Me(),void 0,this.collectToFun_8be2vx$)},vo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},vo.prototype=Object.create(c.prototype),vo.prototype.constructor=vo,vo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Fr(this.local$closure$collector,this.local$this$ChannelFlow.produceImpl_gkk88$(this.local$$receiver),this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},yo.prototype.collect_42ocv1$=function(t,e){return je((n=t,i=this,function(t,e,r){var o=new vo(n,i,t,this,e);return r?o:o.doResume(null)}),e);var n,i},yo.prototype.additionalToStringProps=function(){return null},yo.prototype.toString=function(){var t,e=y(4);return null!=(t=this.additionalToStringProps())&&e.add_11rb$(t),this.context!==v.EmptyCoroutineContext&&e.add_11rb$("context="+this.context),-3!==this.capacity&&e.add_11rb$("capacity="+this.capacity),this.onBufferOverflow!==Ki()&&e.add_11rb$("onBufferOverflow="+this.onBufferOverflow),Fs(this)+"["+dt(e,", ")+"]"},yo.$metadata$={kind:a,simpleName:"ChannelFlow",interfaces:[_o]},go.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},go.prototype=Object.create(c.prototype),go.prototype.constructor=go,go.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$this$ChannelFlowOperator.flowCollect_42ocu6$(this.local$it,this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},$o.prototype.collectWithContextUndispatched_0=function(t,n,i){var r,o,a;return xo(n,(r=t,o=i.context,e.isType(r,ua)||e.isType(r,Lo)?r:new ko(r,o)),void 0,(a=this,function(t,e,n){var i=new go(a,t,e);return n?i:i.doResume(null)}),i)},$o.prototype.collectTo_sz7tnc$=function(t,e){return this.flowCollect_42ocu6$(new ua(t),e)},bo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},bo.prototype=Object.create(c.prototype),bo.prototype.constructor=bo,bo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(-3===this.$this.capacity){if(this.local$collectContext=this.context,this.local$newContext=this.local$collectContext.plus_1fupul$(this.$this.context),b(this.local$newContext,this.local$collectContext)){if(this.state_0=2,this.result_0=this.$this.flowCollect_42ocu6$(this.local$collector,this),this.result_0===l)return l;continue}this.state_0=3;continue}this.state_0=6;continue;case 1:throw this.exception_0;case 2:return this.result_0;case 3:if(b(this.local$newContext.get_j3r2sn$(g.Key),this.local$collectContext.get_j3r2sn$(g.Key))){if(this.state_0=4,this.result_0=this.$this.collectWithContextUndispatched_0(this.local$collector,this.local$newContext,this),this.result_0===l)return l;continue}this.state_0=5;continue;case 4:return this.result_0;case 5:this.state_0=6;continue;case 6:if(this.state_0=7,this.result_0=yo.prototype.collect_42ocv1$.call(this.$this,this.local$collector,this),this.result_0===l)return l;continue;case 7:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},$o.prototype.collect_42ocv1$=function(t,e,n){var i=new bo(this,t,e);return n?i:i.doResume(null)},$o.prototype.toString=function(){return this.flow_0.toString()+" -> "+yo.prototype.toString.call(this)},$o.$metadata$={kind:a,simpleName:"ChannelFlowOperator",interfaces:[yo]},wo.prototype.create_5k3f3z$=function(t,e,n){return new wo(this.flow_0,t,e,n)},wo.prototype.dropChannelOperators=function(){return this.flow_0},wo.prototype.flowCollect_42ocu6$=function(t,e){return this.flow_0.collect_42ocv1$(t,e)},wo.$metadata$={kind:a,simpleName:"ChannelFlowOperatorImpl",interfaces:[$o]},ko.prototype.emit_11rb$=function(t,e){return xo(this.emitContext_0,t,this.countOrElement_0,this.emitRef_0,e)},So.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},So.prototype=Object.create(c.prototype),So.prototype.constructor=So,So.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$downstream.emit_11rb$(this.local$it,this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ko.$metadata$={kind:a,simpleName:"UndispatchedContextCollector",interfaces:[Kr]},Object.defineProperty(Eo.prototype,"context",{get:function(){return this.context_rbjqds$_0}}),Object.defineProperty(Eo.prototype,"callerFrame",{configurable:!0,get:function(){var t;return e.isType(t=this.uCont_0,Ml)?t:null}}),Eo.prototype.resumeWith_tl1gpc$=function(t){this.uCont_0.resumeWith_tl1gpc$(t)},Eo.prototype.getStackTraceElement=function(){return null},Eo.$metadata$={kind:a,simpleName:"StackFrameContinuation",interfaces:[Ml,s]},Oo.prototype.childCancelled_tcv7n7$=function(t){return!!e.isType(t,$l)||this.cancelImpl_8ea4ql$(t)},Oo.$metadata$={kind:a,simpleName:"FlowCoroutine",interfaces:[Va]},No.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},No.$metadata$={kind:a,interfaces:[Kr]},zo.prototype.create_5k3f3z$=function(t,e,n){return new zo(this.transform_0,this.flow_0,t,e,n)},jo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},jo.prototype=Object.create(c.prototype),jo.prototype.constructor=jo,jo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$this$ChannelFlowTransformLatest.transform_0(this.local$closure$collector,this.local$closure$value,this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Po.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Po.prototype=Object.create(c.prototype),Po.prototype.constructor=Po,Po.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(null!=(t=this.local$closure$previousFlow.v)){if(t.cancel_m4sck1$(new $l),this.state_0=2,this.result_0=t.join(this),this.result_0===l)return l;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.state_0=3;continue;case 3:return this.local$closure$previousFlow.v=jt(this.local$this$,void 0,Le(),To(this.local$closure$collector,this.local$this$ChannelFlowTransformLatest,this.local$value)),p;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ao.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Ao.prototype=Object.create(c.prototype),Ao.prototype.constructor=Ao,Ao.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$this$ChannelFlowTransformLatest.flow_0.collect_42ocv1$(new No(Ro({v:null},this.local$closure$collector,this.local$this$ChannelFlowTransformLatest,this.local$$receiver)),this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Mo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Mo.prototype=Object.create(c.prototype),Mo.prototype.constructor=Mo,Mo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Co(Io(this.$this,this.local$collector),this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},zo.prototype.flowCollect_42ocu6$=function(t,e,n){var i=new Mo(this,t,e);return n?i:i.doResume(null)},zo.$metadata$={kind:a,simpleName:"ChannelFlowTransformLatest",interfaces:[$o]},Lo.prototype.emit_11rb$=function(t,e){},Lo.$metadata$={kind:O,simpleName:"NopCollector",interfaces:[Kr]};var Do,qo,Fo,Uo,Bo,Ho,Vo,Ko,Wo,Yo,Go,Jo,Zo,Qo,Xo,ta,ea,na,ia,ra,oa,aa=null;function sa(){return null===aa&&new Lo,aa}function la(t,n){var i;if(n.fold_3cc69b$(0,(i=t,function(t,n){var r,a,s=n.key,l=i.collectContext_8be2vx$.get_j3r2sn$(s);if(s!==tn())return n!==l?-2147483648:t+1|0;var c=null==(r=l)||e.isType(r,Ze)?r:o(),u=ca(e.isType(a=n,Ze)?a:o(),c);if(u!==c)throw S(("Flow invariant is violated:\n\t\tEmission from another coroutine is detected.\n\t\tChild of "+C(u)+", expected child of "+C(c)+".\n\t\tFlowCollector is not thread-safe and concurrent emissions are prohibited.\n\t\tTo mitigate this restriction please use 'channelFlow' builder instead of 'flow'").toString());return null==c?t:t+1|0}))!==t.collectContextSize_8be2vx$)throw S(("Flow invariant is violated:\n\t\tFlow was collected in "+t.collectContext_8be2vx$+",\n\t\tbut emission happened in "+n+".\n\t\tPlease refer to 'flow' documentation or use 'flowOn' instead").toString())}function ca(t,n){return null===t?null:t===n?t:e.isType(t,Va)?ca(t.parent_8be2vx$,n):t}function ua(t){this.channel_0=t}function pa(t,n,i){if(void 0===n&&(n=-2),void 0===i&&(i=Ki()),!(n>=0||-2===n||-1===n))throw H(("Buffer size should be non-negative, BUFFERED, or CONFLATED, but was "+n).toString());if(-1===n&&i!==Ki())throw H("CONFLATED capacity cannot be used with non-default onBufferOverflow".toString());var r=n,o=i;return-1===r&&(r=0,o=Wi()),e.isType(t,_o)?t.fuse_5k3f3z$(void 0,r,o):new wo(t,void 0,r,o)}function ha(){}function fa(t,e){return new zo(e,t)}function da(t,e,n,i,r){c.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$transform=t,this.local$$receiver=e,this.local$it=n}function _a(t,e){return fa(t,(n=e,function(t,e,i,r){var o=new da(n,t,e,this,i);return r?o:o.doResume(null)}));var n}function ya(t,e){this.collector_0=t,this.action_0=e}function ma(t,e){c.call(this,e),this.exceptionState_0=7,this.$this=t,this.local$safeCollector=void 0}function va(t,e){return t.collect_42ocv1$(sa(),e)}function $a(t,e,n){c.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$action=e}function ga(t){this.closure$action=t}function ba(t,e,n){c.call(this,n),this.exceptionState_0=1,this.local$closure$destination=t,this.local$value=e}function wa(t){return function(e,n,i){var r=new ba(t,e,n);return i?r:r.doResume(null)}}function ka(t,e,n){c.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$destination=e}function Sa(t,e,n,i){var r=new ka(t,e,n);return i?r:r.doResume(null)}function xa(t){this.closure$action=t}function Ea(t,e,n){c.call(this,n),this.exceptionState_0=1,this.local$closure$i=t}function Ca(t){return function(e,n,i){var r=new Ea(t,e,n);return i?r:r.doResume(null)}}function Oa(t,e){c.call(this,e),this.exceptionState_0=1,this.local$i=void 0,this.local$$receiver=t}function Na(){this.elements_0=e.newArray(16,null),this.head_0=0,this.tail_0=0}function za(){}function ja(){za.call(this),this._consensus_c6dvpx$_0=qo}function Ta(){this.atomicOp_ss7ttb$_0=this.atomicOp_ss7ttb$_0}function Pa(t,e){Ma.call(this,-1),this.dispatcher=t,this.continuation=e,this._state_8be2vx$=Uo,this.countOrElement_8be2vx$=(this.context,0),this._reusableCancellableContinuation_0=null}function Ra(t,n,i){if(void 0===i&&(i=null),e.isType(t,Pa)){var r=ie(n,i);if(t.dispatcher.isDispatchNeeded_1fupul$(t.context))t._state_8be2vx$=r,t.resumeMode=1,t.dispatcher.dispatch_5bn72i$(t.context,t);else{var o=We().eventLoop_8be2vx$;if(o.isUnconfinedLoopActive)t._state_8be2vx$=r,t.resumeMode=1,o.dispatchUnconfined_4avnfa$(t);else{o.incrementUseCount_6taknv$(!0);try{var a;t:do{var s=t.context.get_j3r2sn$(Ze.Key);if(null!=s&&!s.isActive){var l=s.getCancellationException();t.cancelCompletedResult_83a7kv$(r,l),t.resumeWith_tl1gpc$(new m(N(l))),a=!0;break t}a=!1}while(0);for(a||t.continuation.resumeWith_tl1gpc$(n);o.processUnconfinedEvent(););}catch(n){if(!e.isType(n,E))throw n;t.handleFatalException_pr7uss$(n,null)}finally{o.decrementUseCount_6taknv$(!0)}}}}else t.resumeWith_tl1gpc$(n)}function Aa(t){return 1===t||2===t}function Ia(t){return 2===t}function Ma(t){_l.call(this),this.resumeMode=t}function La(t,n){var i=t.delegate,r=4===n;if(!r&&e.isType(i,Pa)&&Aa(n)===Aa(t.resumeMode)){var o=i.dispatcher,a=i.context;o.isDispatchNeeded_1fupul$(a)?o.dispatch_5bn72i$(a,t):function(t){var n=We().eventLoop_8be2vx$;if(n.isUnconfinedLoopActive)n.dispatchUnconfined_4avnfa$(t);else{n.incrementUseCount_6taknv$(!0);try{for(Da(t,t.delegate,!0);n.processUnconfinedEvent(););}catch(n){if(!e.isType(n,E))throw n;t.handleFatalException_pr7uss$(n,null)}finally{n.decrementUseCount_6taknv$(!0)}}}(t)}else Da(t,i,r)}function Da(t,n,i){var r,a=t.takeState(),s=t.getExceptionalResult_s8jyv4$(a),l=new m(null!=s?N(s):t.getSuccessfulResult_tpy1pm$(a));i?(e.isType(r=n,Pa)?r:o()).continuation.resumeWith_tl1gpc$(l):n.resumeWith_tl1gpc$(l)}function qa(t){void 0===t&&(t=null),this.holder_0=t}function Fa(t,n,i){void 0===i&&(i=null);try{t(n)}catch(t){if(!e.isType(t,E))throw t;if(null==i||i.cause===t)return new Ha("Exception in undelivered element handler for "+n,t)}return i}function Ua(t,e,n){var i;null!=(i=Fa(t,e,null))&&de(n,i)}function Ba(t,e,n){return i=e,r=n,o=t,function(t){return Ua(o,i,r),p};var i,r,o}function Ha(t,e){T.call(this,t,e),this.name="UndeliveredElementException"}function Va(t,e){Et.call(this,t,!0),this.uCont=e}function Ka(t){this.coroutineContext_glfhxt$_0=t}function Wa(t){this.symbol=t}function Ya(t,n,i,r){return void 0===i&&(i=1),void 0===r&&(r=2147483647),Ga(0,e.Long.fromInt(n),e.Long.fromInt(i),e.Long.fromInt(r)).toInt()}function Ga(t,e,n,i){return void 0===n&&(n=q),void 0===i&&(i=D),e}function Ja(t,n){try{Ra(_(yt(t,n)),new m(p))}catch(t){if(!e.isType(t,E))throw t;n.resumeWith_tl1gpc$(new m(N(t)))}}function Za(t,n,i,r){void 0===r&&(r=null);try{Ra(_($(t,n,i)),new m(p),r)}catch(t){if(!e.isType(t,E))throw t;i.resumeWith_tl1gpc$(new m(N(t)))}}function Qa(t,n){try{Ra(_(t),new m(p))}catch(t){if(!e.isType(t,E))throw t;n.resumeWith_tl1gpc$(new m(N(t)))}}function Xa(t,n){t:do{var i,a,s=n;try{i=t(s,!1)}catch(t){if(e.isType(t,E)){var c=t;s.resumeWith_tl1gpc$(new m(N(c)));break t}throw t}if(i!==l){var u=null==(a=i)||e.isType(a,r)?a:o();s.resumeWith_tl1gpc$(new m(u))}}while(0)}function ts(t,n,i){t:do{var a,s,c=i;try{a=t(n,c,!1)}catch(t){if(e.isType(t,E)){var u=t;c.resumeWith_tl1gpc$(new m(N(u)));break t}throw t}if(a!==l){var p=null==(s=a)||e.isType(s,r)?s:o();c.resumeWith_tl1gpc$(new m(p))}}while(0)}function es(t,n){t:do{var i,a,s=n;try{n.context,i=t(s,!1)}catch(t){if(e.isType(t,E)){var c=t;s.resumeWith_tl1gpc$(new m(N(c)));break t}throw t}if(i!==l){var u=null==(a=i)||e.isType(a,r)?a:o();s.resumeWith_tl1gpc$(new m(u))}}while(0)}function ns(t,n,i){t:do{var a,s,c=i;try{i.context,a=t(n,c,!1)}catch(t){if(e.isType(t,E)){var u=t;c.resumeWith_tl1gpc$(new m(N(u)));break t}throw t}if(a!==l){var p=null==(s=a)||e.isType(s,r)?s:o();c.resumeWith_tl1gpc$(new m(p))}}while(0)}function is(t,n,i){var r;t.initParentJob_8be2vx$();t:do{var o;try{o=i(n,t,!1)}catch(t){if(!e.isType(t,E))throw t;o=new se(t)}var a=o;if(a===l){r=l;break t}var s=t.makeCompletingOnce_8ea4ql$(a);if(s===pn){r=l;break t}if(e.isType(s,se))throw Rl(s.cause,t.uCont);r=Cn(s)}while(0);return r}function rs(t){this.closure$block=t}function os(){}function as(){}function ss(){}function ls(){}function cs(){}function us(){this.number_0=q}function ps(t){Pl.call(this),this.uCont_0=t,this._state_0=Vo,this._result_0=Wo,this._parentHandle_0=null}function hs(t){this.$outer=t,Dn.call(this)}function fs(t){za.call(this),this.otherOp=t}function ds(t,e){ja.call(this),this.impl=t,this.desc=e,this.opSequence_oe6pw4$_0=Go.next(),this.desc.atomicOp=this}function _s(t){Ol.call(this),this.handle=t}function ys(t){this.instance=new ps(t),this.clauses=at()}function ms(){}function vs(t){this.locked=t}function $s(t){this._state_0=t?ea:na}function gs(t,e){return function(n){return e.unlock_s8jyv4$(t),p}}function bs(t,e){return function(){return t._state_0===e}}function ws(t,e){return function(){return t._state_0===e}}function ks(t,e){Ta.call(this),this.mutex=t,this.owner=e}function Ss(t,e){this.$outer=t,za.call(this),this.atomicOp_o4bkb9$_0=e}function xs(t){Pl.call(this),this.owner=t}function Es(t,e){this.$outer=t,Ol.call(this),this.owner=e}function Cs(t,e,n){this.$outer=t,Es.call(this,this.$outer,e),this.cont=n}function Os(t,e,n,i){this.$outer=t,Es.call(this,this.$outer,e),this.select=n,this.block=i}function Ns(t){ja.call(this),this.queue=t}function zs(){Ol.call(this)}function js(){}function Ts(t,e){b(typeof t,"function")?t(e):t.invoke(e)}function Ps(){if(b(typeof navigator,ia)||null==navigator||"ReactNative"!=navigator.product){if(function(){var t=!b(typeof navigator,ia)&&null!=navigator&&null!=navigator.userAgent;t&&(t=!b(typeof navigator.userAgent,ia));var e=t;return e&&(e=!b(typeof navigator.userAgent.match,ia)),e&&navigator.userAgent.match("\\bjsdom\\b")}())return ol();var t=!b(typeof window,ia)&&null!=window;return t&&(t=!b(typeof window.addEventListener,ia)),t?ml(window):b(typeof i,ia)?ll():ol()}return ol()}function Rs(){var t;return e.isType(t=Vs().Default,Ue)?t:o()}function As(t,e){var n=t.coroutineContext.plus_1fupul$(e);return n!==Vs().Default&&null==n.get_j3r2sn$(g.Key)?n.plus_1fupul$(Vs().Default):n}function Is(t){return t.toString()}function Ms(t){return null}function Ls(t,e){Va.call(this,t,e)}function Ds(t,e){console.error(e)}function qs(t){var e,n=t.__debug_counter;return"number"!=typeof n&&(n=ra=ra+1|0,t.__debug_counter=n),("number"==typeof(e=n)?e:o()).toString()}function Fs(t){var n;return null!=(n=e.getKClassFromExpression(t).simpleName)?n:"Unknown"}function Us(){Hs=this,this.Default=Ps(),this.Main=new Ks(this.Default,!1),this.Unconfined=Gn()}ua.prototype.emit_11rb$=function(t,e){return this.channel_0.send_11rb$(t,e)},ua.$metadata$={kind:a,simpleName:"SendingCollector",interfaces:[Kr]},ha.$metadata$={kind:x,simpleName:"CancellableFlow",interfaces:[Br]},w("kotlinx-coroutines-core.kotlinx.coroutines.flow.collectWhile_rysrwq$",k((function(){var n=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,i=e.kotlin.coroutines.CoroutineImpl,r=t.kotlinx.coroutines.flow.internal.AbortFlowException,o=e.Kind.CLASS,a=t.kotlinx.coroutines.flow.FlowCollector,s=t.kotlinx.coroutines.flow.internal.checkOwnership_ygf9h9$;function l(t){this.closure$predicate=t}function c(t,e,n){i.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$value=e}return c.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[i]},c.prototype=Object.create(i.prototype),c.prototype.constructor=c,c.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.closure$predicate(this.local$value,this),this.result_0===n)return n;continue;case 1:throw this.exception_0;case 2:if(!this.result_0)throw new r(this.$this);return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},l.prototype.emit_11rb$=function(t,e,n){var i=new c(this,t,e);return n?i:i.doResume(null)},l.$metadata$={kind:o,interfaces:[a]},function(t,n,i){var o=new l(n);try{e.suspendCall(t.collect_42ocv1$(o,e.coroutineReceiver()))}catch(t){if(!e.isType(t,r))throw t;s(t,o)}}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.flow.toList_qzmi91$",k((function(){var n=t.kotlinx.coroutines.flow.Flow,i=e.throwCCE,r=t.kotlinx.coroutines.flow.toList_7a0s5y$;return function(t,o){var a;return e.suspendCall(r(e.isType(a=t,n)?a:i(),void 0,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.flow.toSet_qzmi91$",k((function(){var n=t.kotlinx.coroutines.flow.Flow,i=e.throwCCE,r=t.kotlinx.coroutines.flow.toSet_a3q90u$;return function(t,o){var a;return e.suspendCall(r(e.isType(a=t,n)?a:i(),void 0,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.flow.count_qzmi91$",k((function(){var n=t.kotlinx.coroutines.flow.Flow,i=e.throwCCE,r=t.kotlinx.coroutines.flow.count_x2ftfk$;return function(t,o){var a;return e.suspendCall(r(e.isType(a=t,n)?a:i(),e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),da.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},da.prototype=Object.create(c.prototype),da.prototype.constructor=da,da.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$transform(this.local$it,this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.local$$receiver.emit_11rb$(this.result_0,this),this.result_0===l)return l;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ma.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},ma.prototype=Object.create(c.prototype),ma.prototype.constructor=ma,ma.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=this.$this.collector_0,this.result_0=this.context,this.local$safeCollector=new gl(t,this.result_0),this.exceptionState_0=5,this.state_0=1,this.result_0=this.$this.action_0(this.local$safeCollector,this),this.result_0===l)return l;continue;case 1:this.exceptionState_0=7,this.finallyPath_0=[2],this.state_0=6;continue;case 2:if(e.isType(this.$this.collector_0,ya)){if(this.state_0=3,this.result_0=this.$this.collector_0.onSubscription(this),this.result_0===l)return l;continue}this.state_0=4;continue;case 3:this.state_0=4;continue;case 4:return;case 5:this.finallyPath_0=[7],this.state_0=6;continue;case 6:this.exceptionState_0=7,this.local$safeCollector.releaseIntercepted(),this.state_0=this.finallyPath_0.shift();continue;case 7:throw this.exception_0;default:throw this.state_0=7,new Error("State Machine Unreachable execution")}}catch(t){if(7===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ya.prototype.onSubscription=function(t,e){var n=new ma(this,t);return e?n:n.doResume(null)},ya.prototype.emit_11rb$=function(t,e){return this.collector_0.emit_11rb$(t,e)},ya.$metadata$={kind:a,simpleName:"SubscribedFlowCollector",interfaces:[Kr]},w("kotlinx-coroutines-core.kotlinx.coroutines.flow.collect_706ovd$",k((function(){var n=e.Kind.CLASS,i=t.kotlinx.coroutines.flow.FlowCollector;function r(t){this.closure$action=t}return r.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},r.$metadata$={kind:n,interfaces:[i]},function(t,n,i){return e.suspendCall(t.collect_42ocv1$(new r(n),e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.flow.collectIndexed_57beod$",k((function(){var n=e.Kind.CLASS,i=t.kotlinx.coroutines.flow.FlowCollector,r=e.kotlin.ArithmeticException;function o(t){this.closure$action=t,this.index_0=0}return o.prototype.emit_11rb$=function(t,e){var n,i;i=this.closure$action;var o=(n=this.index_0,this.index_0=n+1|0,n);if(o<0)throw new r("Index overflow has happened");return i(o,t,e)},o.$metadata$={kind:n,interfaces:[i]},function(t,n,i){return e.suspendCall(t.collect_42ocv1$(new o(n),e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),$a.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},$a.prototype=Object.create(c.prototype),$a.prototype.constructor=$a,$a.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=va(pa(_a(this.local$$receiver,this.local$action),0),this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("kotlinx-coroutines-core.kotlinx.coroutines.flow.emitAll_c14n1u$",(function(t,n,i){return e.suspendCall(n.collect_42ocv1$(t,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())})),ga.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},ga.$metadata$={kind:a,interfaces:[Kr]},ba.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},ba.prototype=Object.create(c.prototype),ba.prototype.constructor=ba,ba.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return this.local$closure$destination.add_11rb$(this.local$value);case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ka.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},ka.prototype=Object.create(c.prototype),ka.prototype.constructor=ka,ka.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.collect_42ocv1$(new ga(wa(this.local$destination)),this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.local$destination;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},xa.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},xa.$metadata$={kind:a,interfaces:[Kr]},Ea.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Ea.prototype=Object.create(c.prototype),Ea.prototype.constructor=Ea,Ea.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return this.local$closure$i.v=this.local$closure$i.v+1|0,this.local$closure$i.v;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Oa.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Oa.prototype=Object.create(c.prototype),Oa.prototype.constructor=Oa,Oa.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$i={v:0},this.state_0=2,this.result_0=this.local$$receiver.collect_42ocv1$(new xa(Ca(this.local$i)),this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.local$i.v;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("kotlinx-coroutines-core.kotlinx.coroutines.flow.fold_usjyvu$",k((function(){var n=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,i=e.kotlin.coroutines.CoroutineImpl,r=e.kotlin.Unit,o=e.Kind.CLASS,a=t.kotlinx.coroutines.flow.FlowCollector;function s(t){this.closure$action=t}function l(t,e,n,r){i.call(this,r),this.exceptionState_0=1,this.local$closure$operation=t,this.local$closure$accumulator=e,this.local$value=n}return s.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},s.$metadata$={kind:o,interfaces:[a]},l.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[i]},l.prototype=Object.create(i.prototype),l.prototype.constructor=l,l.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$operation(this.local$closure$accumulator.v,this.local$value,this),this.result_0===n)return n;continue;case 1:throw this.exception_0;case 2:return this.local$closure$accumulator.v=this.result_0,r;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},function(t,n,i,r){var o,a,c={v:n};return e.suspendCall(t.collect_42ocv1$(new s((o=i,a=c,function(t,e,n){var i=new l(o,a,t,e);return n?i:i.doResume(null)})),e.coroutineReceiver())),c.v}}))),Object.defineProperty(Na.prototype,"isEmpty",{configurable:!0,get:function(){return this.head_0===this.tail_0}}),Na.prototype.addLast_trkh7z$=function(t){this.elements_0[this.tail_0]=t,this.tail_0=this.tail_0+1&this.elements_0.length-1,this.tail_0===this.head_0&&this.ensureCapacity_0()},Na.prototype.removeFirstOrNull=function(){var t;if(this.head_0===this.tail_0)return null;var n=this.elements_0[this.head_0];return this.elements_0[this.head_0]=null,this.head_0=this.head_0+1&this.elements_0.length-1,e.isType(t=n,r)?t:o()},Na.prototype.clear=function(){this.head_0=0,this.tail_0=0,this.elements_0=e.newArray(this.elements_0.length,null)},Na.prototype.ensureCapacity_0=function(){var t=this.elements_0.length,n=t<<1,i=e.newArray(n,null),r=this.elements_0;ct(r,i,0,this.head_0,r.length),ct(this.elements_0,i,this.elements_0.length-this.head_0|0,0,this.head_0),this.elements_0=i,this.head_0=0,this.tail_0=t},Na.$metadata$={kind:a,simpleName:"ArrayQueue",interfaces:[]},za.prototype.toString=function(){return Fs(this)+"@"+qs(this)},za.prototype.isEarlierThan_bfmzsr$=function(t){var e,n;if(null==(e=this.atomicOp))return!1;var i=e;if(null==(n=t.atomicOp))return!1;var r=n;return i.opSequence.compareTo_11rb$(r.opSequence)<0},za.$metadata$={kind:a,simpleName:"OpDescriptor",interfaces:[]},Object.defineProperty(ja.prototype,"consensus",{configurable:!0,get:function(){return this._consensus_c6dvpx$_0}}),Object.defineProperty(ja.prototype,"isDecided",{configurable:!0,get:function(){return this._consensus_c6dvpx$_0!==qo}}),Object.defineProperty(ja.prototype,"opSequence",{configurable:!0,get:function(){return F}}),Object.defineProperty(ja.prototype,"atomicOp",{configurable:!0,get:function(){return this}}),ja.prototype.decide_s8jyv4$=function(t){var e,n=this._consensus_c6dvpx$_0;return n!==qo?n:(e=this)._consensus_c6dvpx$_0===qo&&(e._consensus_c6dvpx$_0=t,1)?t:this._consensus_c6dvpx$_0},ja.prototype.perform_s8jyv4$=function(t){var n,i,a=this._consensus_c6dvpx$_0;return a===qo&&(a=this.decide_s8jyv4$(this.prepare_11rb$(null==(n=t)||e.isType(n,r)?n:o()))),this.complete_19pj23$(null==(i=t)||e.isType(i,r)?i:o(),a),a},ja.$metadata$={kind:a,simpleName:"AtomicOp",interfaces:[za]},Object.defineProperty(Ta.prototype,"atomicOp",{configurable:!0,get:function(){return null==this.atomicOp_ss7ttb$_0?h("atomicOp"):this.atomicOp_ss7ttb$_0},set:function(t){this.atomicOp_ss7ttb$_0=t}}),Ta.$metadata$={kind:a,simpleName:"AtomicDesc",interfaces:[]},Object.defineProperty(Pa.prototype,"callerFrame",{configurable:!0,get:function(){var t;return e.isType(t=this.continuation,Ml)?t:null}}),Pa.prototype.getStackTraceElement=function(){return null},Object.defineProperty(Pa.prototype,"reusableCancellableContinuation",{configurable:!0,get:function(){var t;return e.isType(t=this._reusableCancellableContinuation_0,Ht)?t:null}}),Pa.prototype.isReusable_pmw987$=function(t){var n;if(null==(n=this._reusableCancellableContinuation_0))return!1;var i=n;return!e.isType(i,Ht)||i===t},Pa.prototype.claimReusableCancellableContinuation=function(){var t;for(this._reusableCancellableContinuation_0;;){var n,i=this._reusableCancellableContinuation_0;if(null===i)return this._reusableCancellableContinuation_0=Bo,null;if(!e.isType(i,Ht))throw S(("Inconsistent state "+C(i)).toString());if((t=this)._reusableCancellableContinuation_0===i&&(t._reusableCancellableContinuation_0=Bo,1))return e.isType(n=i,Ht)?n:o()}},Pa.prototype.checkPostponedCancellation_jp3215$=function(t){var n;for(this._reusableCancellableContinuation_0;;){var i=this._reusableCancellableContinuation_0;if(i!==Bo){if(null===i)return null;if(e.isType(i,E)){if(!function(t){return t._reusableCancellableContinuation_0===i&&(t._reusableCancellableContinuation_0=null,!0)}(this))throw H("Failed requirement.".toString());return i}throw S(("Inconsistent state "+C(i)).toString())}if((n=this)._reusableCancellableContinuation_0===Bo&&(n._reusableCancellableContinuation_0=t,1))return null}},Pa.prototype.postponeCancellation_tcv7n7$=function(t){var n;for(this._reusableCancellableContinuation_0;;){var i=this._reusableCancellableContinuation_0;if(b(i,Bo)){if((n=this)._reusableCancellableContinuation_0===Bo&&(n._reusableCancellableContinuation_0=t,1))return!0}else{if(e.isType(i,E))return!0;if(function(t){return t._reusableCancellableContinuation_0===i&&(t._reusableCancellableContinuation_0=null,!0)}(this))return!1}}},Pa.prototype.takeState=function(){var t=this._state_8be2vx$;return this._state_8be2vx$=Uo,t},Object.defineProperty(Pa.prototype,"delegate",{configurable:!0,get:function(){return this}}),Pa.prototype.resumeWith_tl1gpc$=function(t){var n=this.continuation.context,i=ie(t);if(this.dispatcher.isDispatchNeeded_1fupul$(n))this._state_8be2vx$=i,this.resumeMode=0,this.dispatcher.dispatch_5bn72i$(n,this);else{var r=We().eventLoop_8be2vx$;if(r.isUnconfinedLoopActive)this._state_8be2vx$=i,this.resumeMode=0,r.dispatchUnconfined_4avnfa$(this);else{r.incrementUseCount_6taknv$(!0);try{for(this.context,this.continuation.resumeWith_tl1gpc$(t);r.processUnconfinedEvent(););}catch(t){if(!e.isType(t,E))throw t;this.handleFatalException_pr7uss$(t,null)}finally{r.decrementUseCount_6taknv$(!0)}}}},Pa.prototype.resumeCancellableWith_rdpv6h$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.DispatchedContinuation.resumeCancellableWith_rdpv6h$",k((function(){var n=t.kotlinx.coroutines.toState_fbj1ua$,i=e.kotlin.Unit,r=e.wrapFunction,o=Error,a=t.kotlinx.coroutines.Job,s=e.kotlin.Result,l=e.kotlin.createFailure_tcv7n7$;return r((function(){var n=t.kotlinx.coroutines.Job,r=e.kotlin.Result,o=e.kotlin.createFailure_tcv7n7$;return function(t,e,a){return function(){var s,l=e,c=t;t:do{var u=l.context.get_j3r2sn$(n.Key);if(null!=u&&!u.isActive){var p=u.getCancellationException();l.cancelCompletedResult_83a7kv$(c,p),l.resumeWith_tl1gpc$(new r(o(p))),s=!0;break t}s=!1}while(0);return s||e.continuation.resumeWith_tl1gpc$(a),i}}})),function(t,i){var r=n(t,i);if(this.dispatcher.isDispatchNeeded_1fupul$(this.context))this._state_8be2vx$=r,this.resumeMode=1,this.dispatcher.dispatch_5bn72i$(this.context,this);else{var c=We().eventLoop_8be2vx$;if(c.isUnconfinedLoopActive)this._state_8be2vx$=r,this.resumeMode=1,c.dispatchUnconfined_4avnfa$(this);else{c.incrementUseCount_6taknv$(!0);try{var u;t:do{var p=this.context.get_j3r2sn$(a.Key);if(null!=p&&!p.isActive){var h=p.getCancellationException();this.cancelCompletedResult_83a7kv$(r,h),this.resumeWith_tl1gpc$(new s(l(h))),u=!0;break t}u=!1}while(0);for(u||this.continuation.resumeWith_tl1gpc$(t);c.processUnconfinedEvent(););}catch(t){if(!e.isType(t,o))throw t;this.handleFatalException_pr7uss$(t,null)}finally{c.decrementUseCount_6taknv$(!0)}}}}}))),Pa.prototype.cancelCompletedResult_83a7kv$=function(t,n){e.isType(t,ae)&&t.onCancellation(n)},Pa.prototype.resumeCancelled_s8jyv4$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.DispatchedContinuation.resumeCancelled_s8jyv4$",k((function(){var n=t.kotlinx.coroutines.Job,i=e.kotlin.Result,r=e.kotlin.createFailure_tcv7n7$;return function(t){var e=this.context.get_j3r2sn$(n.Key);if(null!=e&&!e.isActive){var o=e.getCancellationException();return this.cancelCompletedResult_83a7kv$(t,o),this.resumeWith_tl1gpc$(new i(r(o))),!0}return!1}}))),Pa.prototype.resumeUndispatchedWith_tl1gpc$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.DispatchedContinuation.resumeUndispatchedWith_tl1gpc$",(function(t){this.continuation.resumeWith_tl1gpc$(t)})),Pa.prototype.dispatchYield_6v298r$=function(t,e){this._state_8be2vx$=e,this.resumeMode=1,this.dispatcher.dispatchYield_5bn72i$(t,this)},Pa.prototype.toString=function(){return"DispatchedContinuation["+this.dispatcher+", "+Is(this.continuation)+"]"},Object.defineProperty(Pa.prototype,"context",{configurable:!0,get:function(){return this.continuation.context}}),Pa.$metadata$={kind:a,simpleName:"DispatchedContinuation",interfaces:[s,Ml,Ma]},Ma.prototype.cancelCompletedResult_83a7kv$=function(t,e){},Ma.prototype.getSuccessfulResult_tpy1pm$=function(t){var n;return null==(n=t)||e.isType(n,r)?n:o()},Ma.prototype.getExceptionalResult_s8jyv4$=function(t){var n,i;return null!=(i=e.isType(n=t,se)?n:null)?i.cause:null},Ma.prototype.run=function(){var t,n=null;try{var i=(e.isType(t=this.delegate,Pa)?t:o()).continuation,r=i.context,a=this.takeState(),s=this.getExceptionalResult_s8jyv4$(a),l=null==s&&Aa(this.resumeMode)?r.get_j3r2sn$(tn()):null;if(null==l||l.isActive)if(null!=s)i.resumeWith_tl1gpc$(new m(N(s)));else{var c=this.getSuccessfulResult_tpy1pm$(a);i.resumeWith_tl1gpc$(new m(c))}else{var u=l.getCancellationException();this.cancelCompletedResult_83a7kv$(a,u),i.resumeWith_tl1gpc$(new m(N(Rl(u))))}}catch(t){if(!e.isType(t,E))throw t;n=t}finally{var h;try{h=new m(p)}catch(t){if(!e.isType(t,E))throw t;h=new m(N(t))}var f=h;this.handleFatalException_pr7uss$(n,f.exceptionOrNull())}},Ma.prototype.handleFatalException_pr7uss$=function(t,e){if(null!==t||null!==e){var n=new Je("Fatal exception in coroutines machinery for "+this+". Please read KDoc to 'handleFatalException' method and report this incident to maintainers",B(null!=t?t:e));de(this.delegate.context,n)}},Ma.$metadata$={kind:a,simpleName:"DispatchedTask",interfaces:[_l]},qa.prototype.plus_11rb$=function(t){var n,i,a,s;if(null==(n=this.holder_0))s=new qa(t);else if(e.isType(n,Y))(e.isType(i=this.holder_0,Y)?i:o()).add_11rb$(t),s=new qa(this.holder_0);else{var l=y(4);l.add_11rb$(null==(a=this.holder_0)||e.isType(a,r)?a:o()),l.add_11rb$(t),s=new qa(l)}return s},qa.prototype.forEachReversed_qlkmfe$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.InlineList.forEachReversed_qlkmfe$",k((function(){var t=Object,n=e.throwCCE,i=e.kotlin.collections.ArrayList;return function(r){var o,a,s;if(null!=(o=this.holder_0))if(e.isType(o,i))for(var l=e.isType(s=this.holder_0,i)?s:n(),c=l.size-1|0;c>=0;c--)r(l.get_za3lpa$(c));else r(null==(a=this.holder_0)||e.isType(a,t)?a:n())}}))),qa.$metadata$={kind:a,simpleName:"InlineList",interfaces:[]},qa.prototype.unbox=function(){return this.holder_0},qa.prototype.toString=function(){return"InlineList(holder="+e.toString(this.holder_0)+")"},qa.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.holder_0)|0},qa.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.holder_0,t.holder_0)},Ha.$metadata$={kind:a,simpleName:"UndeliveredElementException",interfaces:[T]},Object.defineProperty(Va.prototype,"callerFrame",{configurable:!0,get:function(){var t;return e.isType(t=this.uCont,Ml)?t:null}}),Va.prototype.getStackTraceElement=function(){return null},Object.defineProperty(Va.prototype,"isScopedCoroutine",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Va.prototype,"parent_8be2vx$",{configurable:!0,get:function(){return this.parentContext.get_j3r2sn$(tn())}}),Va.prototype.afterCompletion_s8jyv4$=function(t){Ra(_(this.uCont),oe(t,this.uCont))},Va.prototype.afterResume_s8jyv4$=function(t){this.uCont.resumeWith_tl1gpc$(oe(t,this.uCont))},Va.$metadata$={kind:a,simpleName:"ScopeCoroutine",interfaces:[Ml,Et]},Object.defineProperty(Ka.prototype,"coroutineContext",{configurable:!0,get:function(){return this.coroutineContext_glfhxt$_0}}),Ka.prototype.toString=function(){return"CoroutineScope(coroutineContext="+this.coroutineContext+")"},Ka.$metadata$={kind:a,simpleName:"ContextScope",interfaces:[Se]},Wa.prototype.toString=function(){return"<"+this.symbol+">"},Wa.prototype.unbox_tpy1pm$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.Symbol.unbox_tpy1pm$",k((function(){var t=Object,n=e.throwCCE;return function(i){var r;return i===this?null:null==(r=i)||e.isType(r,t)?r:n()}}))),Wa.$metadata$={kind:a,simpleName:"Symbol",interfaces:[]},rs.prototype.run=function(){this.closure$block()},rs.$metadata$={kind:a,interfaces:[dl]},os.prototype.invoke_en0wgx$=function(t,e){this.invoke_ha2bmj$(t,null,e)},os.$metadata$={kind:x,simpleName:"SelectBuilder",interfaces:[]},as.$metadata$={kind:x,simpleName:"SelectClause0",interfaces:[]},ss.$metadata$={kind:x,simpleName:"SelectClause1",interfaces:[]},ls.$metadata$={kind:x,simpleName:"SelectClause2",interfaces:[]},cs.$metadata$={kind:x,simpleName:"SelectInstance",interfaces:[]},w("kotlinx-coroutines-core.kotlinx.coroutines.selects.select_wd2ujs$",k((function(){var n=t.kotlinx.coroutines.selects.SelectBuilderImpl,i=Error;return function(t,r){var o;return e.suspendCall((o=t,function(t){var r=new n(t);try{o(r)}catch(t){if(!e.isType(t,i))throw t;r.handleBuilderException_tcv7n7$(t)}return r.getResult()})(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),us.prototype.next=function(){return(t=this).number_0=t.number_0.inc();var t},us.$metadata$={kind:a,simpleName:"SeqNumber",interfaces:[]},Object.defineProperty(ps.prototype,"callerFrame",{configurable:!0,get:function(){var t;return e.isType(t=this.uCont_0,Ml)?t:null}}),ps.prototype.getStackTraceElement=function(){return null},Object.defineProperty(ps.prototype,"parentHandle_0",{configurable:!0,get:function(){return this._parentHandle_0},set:function(t){this._parentHandle_0=t}}),Object.defineProperty(ps.prototype,"context",{configurable:!0,get:function(){return this.uCont_0.context}}),Object.defineProperty(ps.prototype,"completion",{configurable:!0,get:function(){return this}}),ps.prototype.doResume_0=function(t,e){var n;for(this._result_0;;){var i=this._result_0;if(i===Wo){var r=t();if((n=this)._result_0===Wo&&(n._result_0=r,1))return}else{if(i!==l)throw S("Already resumed");if(function(t){return t._result_0===l&&(t._result_0=Yo,!0)}(this))return void e()}}},ps.prototype.resumeWith_tl1gpc$=function(t){t:do{for(this._result_0;;){var e=this._result_0;if(e===Wo){var n=ie(t);if((r=this)._result_0===Wo&&(r._result_0=n,1))break t}else{if(e!==l)throw S("Already resumed");if(function(t){return t._result_0===l&&(t._result_0=Yo,!0)}(this)){if(t.isFailure){var i=this.uCont_0;i.resumeWith_tl1gpc$(new m(N(Rl(B(t.exceptionOrNull())))))}else this.uCont_0.resumeWith_tl1gpc$(t);break t}}}}while(0);var r},ps.prototype.resumeSelectWithException_tcv7n7$=function(t){t:do{for(this._result_0;;){var e=this._result_0;if(e===Wo){var n=new se(Rl(t,this.uCont_0));if((i=this)._result_0===Wo&&(i._result_0=n,1))break t}else{if(e!==l)throw S("Already resumed");if(function(t){return t._result_0===l&&(t._result_0=Yo,!0)}(this)){_(this.uCont_0).resumeWith_tl1gpc$(new m(N(t)));break t}}}}while(0);var i},ps.prototype.getResult=function(){this.isSelected||this.initCancellability_0();var t,n=this._result_0;if(n===Wo){if((t=this)._result_0===Wo&&(t._result_0=l,1))return l;n=this._result_0}if(n===Yo)throw S("Already resumed");if(e.isType(n,se))throw n.cause;return n},ps.prototype.initCancellability_0=function(){var t;if(null!=(t=this.context.get_j3r2sn$(tn()))){var e=t.invokeOnCompletion_ct2b2z$(!0,void 0,new hs(this));this.parentHandle_0=e,this.isSelected&&e.dispose()}},hs.prototype.invoke=function(t){this.$outer.trySelect()&&this.$outer.resumeSelectWithException_tcv7n7$(this.job.getCancellationException())},hs.$metadata$={kind:a,simpleName:"SelectOnCancelling",interfaces:[Dn]},ps.prototype.handleBuilderException_tcv7n7$=function(t){if(this.trySelect())this.resumeWith_tl1gpc$(new m(N(t)));else if(!e.isType(t,Zs)){var n=this.getResult();e.isType(n,se)&&n.cause===t||de(this.context,t)}},Object.defineProperty(ps.prototype,"isSelected",{configurable:!0,get:function(){for(this._state_0;;){var t=this._state_0;if(t===Vo)return!1;if(!e.isType(t,za))return!0;t.perform_s8jyv4$(this)}}}),ps.prototype.disposeOnSelect_rvfg84$=function(t){var e=new _s(t);(this.isSelected||(this.addLast_l2j9rm$(e),this.isSelected))&&t.dispose()},ps.prototype.doAfterSelect_0=function(){var t;null!=(t=this.parentHandle_0)&&t.dispose();for(var n=this._next;!b(n,this);)e.isType(n,_s)&&n.handle.dispose(),n=n._next},ps.prototype.trySelect=function(){var t,e=this.trySelectOther_uc1cc4$(null);if(e===n)t=!0;else{if(null!=e)throw S(("Unexpected trySelectIdempotent result "+C(e)).toString());t=!1}return t},ps.prototype.trySelectOther_uc1cc4$=function(t){var i;for(this._state_0;;){var r=this._state_0;t:do{if(r===Vo){if(null==t){if((i=this)._state_0!==Vo||(i._state_0=null,0))break t}else{var o=new fs(t);if(!function(t){return t._state_0===Vo&&(t._state_0=o,!0)}(this))break t;var a=o.perform_s8jyv4$(this);if(null!==a)return a}return this.doAfterSelect_0(),n}if(!e.isType(r,za))return null==t?null:r===t.desc?n:null;if(null!=t){var s=t.atomicOp;if(e.isType(s,ds)&&s.impl===this)throw S("Cannot use matching select clauses on the same object".toString());if(s.isEarlierThan_bfmzsr$(r))return Fo}r.perform_s8jyv4$(this)}while(0)}},fs.prototype.perform_s8jyv4$=function(t){var n,i=e.isType(n=t,ps)?n:o();this.otherOp.finishPrepare();var r,a=this.otherOp.atomicOp.decide_s8jyv4$(null),s=null==a?this.otherOp.desc:Vo;return r=this,i._state_0===r&&(i._state_0=s),a},Object.defineProperty(fs.prototype,"atomicOp",{configurable:!0,get:function(){return this.otherOp.atomicOp}}),fs.$metadata$={kind:a,simpleName:"PairSelectOp",interfaces:[za]},ps.prototype.performAtomicTrySelect_6q0pxr$=function(t){return new ds(this,t).perform_s8jyv4$(null)},ps.prototype.toString=function(){return"SelectInstance(state="+C(this._state_0)+", result="+C(this._result_0)+")"},Object.defineProperty(ds.prototype,"opSequence",{configurable:!0,get:function(){return this.opSequence_oe6pw4$_0}}),ds.prototype.prepare_11rb$=function(t){var n;if(null==t&&null!=(n=this.prepareSelectOp_0()))return n;try{return this.desc.prepare_4uxf5b$(this)}catch(n){throw e.isType(n,E)?(null==t&&this.undoPrepare_0(),n):n}},ds.prototype.complete_19pj23$=function(t,e){this.completeSelect_0(e),this.desc.complete_ayrq83$(this,e)},ds.prototype.prepareSelectOp_0=function(){var t;for(this.impl._state_0;;){var n=this.impl._state_0;if(n===this)return null;if(e.isType(n,za))n.perform_s8jyv4$(this.impl);else{if(n!==Vo)return Ko;if((t=this).impl._state_0===Vo&&(t.impl._state_0=t,1))return null}}},ds.prototype.undoPrepare_0=function(){var t;(t=this).impl._state_0===t&&(t.impl._state_0=Vo)},ds.prototype.completeSelect_0=function(t){var e,n=null==t,i=n?null:Vo;(e=this).impl._state_0===e&&(e.impl._state_0=i,1)&&n&&this.impl.doAfterSelect_0()},ds.prototype.toString=function(){return"AtomicSelectOp(sequence="+this.opSequence.toString()+")"},ds.$metadata$={kind:a,simpleName:"AtomicSelectOp",interfaces:[ja]},ps.prototype.invoke_nd4vgy$=function(t,e){t.registerSelectClause0_s9h9qd$(this,e)},ps.prototype.invoke_veq140$=function(t,e){t.registerSelectClause1_o3xas4$(this,e)},ps.prototype.invoke_ha2bmj$=function(t,e,n){t.registerSelectClause2_rol3se$(this,e,n)},ps.prototype.onTimeout_7xvrws$=function(t,e){if(t.compareTo_11rb$(F)<=0)this.trySelect()&&Xa(e,this.completion);else{var n,i,r=new rs((n=this,i=e,function(){return n.trySelect()&&Ja(i,n.completion),p}));this.disposeOnSelect_rvfg84$(Be(this.context).invokeOnTimeout_oczv3n$(t,r,this.context))}},_s.$metadata$={kind:a,simpleName:"DisposeNode",interfaces:[Ol]},ps.$metadata$={kind:a,simpleName:"SelectBuilderImpl",interfaces:[Ml,s,cs,os,Pl]},w("kotlinx-coroutines-core.kotlinx.coroutines.selects.selectUnbiased_wd2ujs$",k((function(){var n=t.kotlinx.coroutines.selects.UnbiasedSelectBuilderImpl,i=Error;return function(t,r){var o;return e.suspendCall((o=t,function(t){var r=new n(t);try{o(r)}catch(t){if(!e.isType(t,i))throw t;r.handleBuilderException_tcv7n7$(t)}return r.initSelectResult()})(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),ys.prototype.handleBuilderException_tcv7n7$=function(t){this.instance.handleBuilderException_tcv7n7$(t)},ys.prototype.initSelectResult=function(){if(!this.instance.isSelected)try{var t;for(mt(this.clauses),t=this.clauses.iterator();t.hasNext();)t.next()()}catch(t){if(!e.isType(t,E))throw t;this.instance.handleBuilderException_tcv7n7$(t)}return this.instance.getResult()},ys.prototype.invoke_nd4vgy$=function(t,e){var n,i,r;this.clauses.add_11rb$((n=this,i=e,r=t,function(){return r.registerSelectClause0_s9h9qd$(n.instance,i),p}))},ys.prototype.invoke_veq140$=function(t,e){var n,i,r;this.clauses.add_11rb$((n=this,i=e,r=t,function(){return r.registerSelectClause1_o3xas4$(n.instance,i),p}))},ys.prototype.invoke_ha2bmj$=function(t,e,n){var i,r,o,a;this.clauses.add_11rb$((i=this,r=e,o=n,a=t,function(){return a.registerSelectClause2_rol3se$(i.instance,r,o),p}))},ys.prototype.onTimeout_7xvrws$=function(t,e){var n,i,r;this.clauses.add_11rb$((n=this,i=t,r=e,function(){return n.instance.onTimeout_7xvrws$(i,r),p}))},ys.$metadata$={kind:a,simpleName:"UnbiasedSelectBuilderImpl",interfaces:[os]},w("kotlinx-coroutines-core.kotlinx.coroutines.selects.whileSelect_vmyjlh$",k((function(){var n=t.kotlinx.coroutines.selects.SelectBuilderImpl,i=Error;function r(t){return function(r){var o=new n(r);try{t(o)}catch(t){if(!e.isType(t,i))throw t;o.handleBuilderException_tcv7n7$(t)}return o.getResult()}}return function(t,n){for(;e.suspendCall(r(t)(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver()););}}))),ms.prototype.tryLock_s8jyv4$=function(t,e){return void 0===t&&(t=null),e?e(t):this.tryLock_s8jyv4$$default(t)},ms.prototype.lock_s8jyv4$=function(t,e,n){return void 0===t&&(t=null),n?n(t,e):this.lock_s8jyv4$$default(t,e)},ms.prototype.unlock_s8jyv4$=function(t,e){void 0===t&&(t=null),e?e(t):this.unlock_s8jyv4$$default(t)},ms.$metadata$={kind:x,simpleName:"Mutex",interfaces:[]},w("kotlinx-coroutines-core.kotlinx.coroutines.sync.withLock_8701tb$",(function(t,n,i,r){void 0===n&&(n=null),e.suspendCall(t.lock_s8jyv4$(n,e.coroutineReceiver()));try{return i()}finally{t.unlock_s8jyv4$(n)}})),vs.prototype.toString=function(){return"Empty["+this.locked.toString()+"]"},vs.$metadata$={kind:a,simpleName:"Empty",interfaces:[]},Object.defineProperty($s.prototype,"isLocked",{configurable:!0,get:function(){for(this._state_0;;){var t=this._state_0;if(e.isType(t,vs))return t.locked!==ta;if(e.isType(t,xs))return!0;if(!e.isType(t,za))throw S(("Illegal state "+C(t)).toString());t.perform_s8jyv4$(this)}}}),Object.defineProperty($s.prototype,"isLockedEmptyQueueState_8be2vx$",{configurable:!0,get:function(){var t=this._state_0;return e.isType(t,xs)&&t.isEmpty}}),$s.prototype.tryLock_s8jyv4$$default=function(t){var n;for(this._state_0;;){var i=this._state_0;if(e.isType(i,vs)){if(i.locked!==ta)return!1;var r=null==t?ea:new vs(t);if((n=this)._state_0===i&&(n._state_0=r,1))return!0}else{if(e.isType(i,xs)){if(i.owner===t){var o="Already locked by "+C(t);throw S(o.toString())}return!1}if(!e.isType(i,za))throw S(("Illegal state "+C(i)).toString());i.perform_s8jyv4$(this)}}},$s.prototype.lock_s8jyv4$$default=function(t,e){if(!this.tryLock_s8jyv4$(t))return this.lockSuspend_0(t,e)},$s.prototype.lockSuspend_0=function(t,n){return(r=t,o=this,i=function(t){var n=new Cs(o,r,t);for(o._state_0;;){var i=o,a=r,s=o._state_0;if(e.isType(s,vs))if(s.locked!==ta)i._state_0===s&&(i._state_0=new xs(s.locked));else{var l=null==a?ea:new vs(a);if(i._state_0===s&&(i._state_0=l,1))return void t.resume_q1ktlu$(p,gs(a,i))}else if(e.isType(s,xs)){if(s.owner===a){var c="Already locked by "+C(a);throw S(c.toString())}var u,h=bs(i,s);t:do{if(!h()){u=!1;break t}s.addLast_l2j9rm$(n),u=!0}while(0);if(u)return void qt(t,n)}else{if(!e.isType(s,za))throw S(("Illegal state "+C(s)).toString());s.perform_s8jyv4$(i)}}return p},function(t){var e=Dt(_(t));return i(e),e.getResult()})(n);var i,r,o},Object.defineProperty($s.prototype,"onLock",{configurable:!0,get:function(){return this}}),$s.prototype.registerSelectClause2_rol3se$=function(t,n,i){for(;;){if(t.isSelected)return;var r=this._state_0;if(e.isType(r,vs))if(r.locked!==ta)(c=this)._state_0===r&&(c._state_0=new xs(r.locked));else{var o=t.performAtomicTrySelect_6q0pxr$(new ks(this,n));if(null==o)return void ts(i,this,t.completion);if(o===Ko)return;if(o!==Jo&&o!==Fo)throw S(("performAtomicTrySelect(TryLockDesc) returned "+C(o)).toString())}else if(e.isType(r,xs)){if(r.owner===n){var a="Already locked by "+C(n);throw S(a.toString())}var s,l=new Os(this,n,t,i);t:do{if(!ws(this,r)()){s=!1;break t}r.addLast_l2j9rm$(l),s=!0}while(0);if(s)return void t.disposeOnSelect_rvfg84$(l)}else{if(!e.isType(r,za))throw S(("Illegal state "+C(r)).toString());r.perform_s8jyv4$(this)}}var c},Object.defineProperty(Ss.prototype,"atomicOp",{get:function(){return this.atomicOp_o4bkb9$_0}}),Ss.prototype.perform_s8jyv4$=function(t){var n,i,r=this.atomicOp.isDecided?na:this.atomicOp;return i=this,(e.isType(n=t,$s)?n:o())._state_0===i&&((e.isType(n=t,$s)?n:o())._state_0=r),null},Ss.$metadata$={kind:a,simpleName:"PrepareOp",interfaces:[za]},ks.prototype.prepare_4uxf5b$=function(t){var e,n=new Ss(this,t);return(e=this).mutex._state_0!==na||(e.mutex._state_0=n,0)?Jo:n.perform_s8jyv4$(this.mutex)},ks.prototype.complete_ayrq83$=function(t,e){var n,i=null!=e?na:null==this.owner?ea:new vs(this.owner);(n=this).mutex._state_0===t&&(n.mutex._state_0=i)},ks.$metadata$={kind:a,simpleName:"TryLockDesc",interfaces:[Ta]},$s.prototype.holdsLock_za3rmp$=function(t){var n=this._state_0;return e.isType(n,vs)?n.locked===t:!!e.isType(n,xs)&&n.owner===t},$s.prototype.unlock_s8jyv4$$default=function(t){var n;for(this._state_0;;){var i,r,a=this._state_0;if(e.isType(a,vs)){if(null==t){if(a.locked===ta)throw S("Mutex is not locked".toString())}else if(a.locked!==t){var s="Mutex is locked by "+a.locked.toString()+" but expected "+C(t);throw S(s.toString())}if((n=this)._state_0===a&&(n._state_0=na,1))return}else if(e.isType(a,za))a.perform_s8jyv4$(this);else{if(!e.isType(a,xs))throw S(("Illegal state "+C(a)).toString());if(null!=t&&a.owner!==t){var l="Mutex is locked by "+a.owner.toString()+" but expected "+C(t);throw S(l.toString())}var c=a.removeFirstOrNull();if(null==c){var u=new Ns(a);if(function(t){return t._state_0===a&&(t._state_0=u,!0)}(this)&&null==u.perform_s8jyv4$(this))return}else{var p=(e.isType(i=c,Es)?i:o()).tryResumeLockWaiter();if(null!=p)return a.owner=null!=(r=c.owner)?r:Xo,void c.completeResumeLockWaiter_za3rmp$(p)}}}},$s.prototype.toString=function(){for(this._state_0;;){var t=this._state_0;if(e.isType(t,vs))return"Mutex["+t.locked.toString()+"]";if(!e.isType(t,za)){if(e.isType(t,xs))return"Mutex["+t.owner.toString()+"]";throw S(("Illegal state "+C(t)).toString())}t.perform_s8jyv4$(this)}},xs.prototype.toString=function(){return"LockedQueue["+this.owner.toString()+"]"},xs.$metadata$={kind:a,simpleName:"LockedQueue",interfaces:[Pl]},Es.prototype.dispose=function(){this.remove()},Es.$metadata$={kind:a,simpleName:"LockWaiter",interfaces:[nn,Ol]},Cs.prototype.tryResumeLockWaiter=function(){return this.cont.tryResume_i8qury$(p,null,(t=this,e=this.$outer,function(n){return e.unlock_s8jyv4$(t.owner),p}));var t,e},Cs.prototype.completeResumeLockWaiter_za3rmp$=function(t){this.cont.completeResume_za3rmp$(t)},Cs.prototype.toString=function(){return"LockCont["+C(this.owner)+", "+this.cont+"] for "+this.$outer},Cs.$metadata$={kind:a,simpleName:"LockCont",interfaces:[Es]},Os.prototype.tryResumeLockWaiter=function(){return this.select.trySelect()?Qo:null},Os.prototype.completeResumeLockWaiter_za3rmp$=function(t){var e,n;Za(this.block,this.$outer,this.select.completion,(e=this,n=this.$outer,function(t){return n.unlock_s8jyv4$(e.owner),p}))},Os.prototype.toString=function(){return"LockSelect["+C(this.owner)+", "+this.select+"] for "+this.$outer},Os.$metadata$={kind:a,simpleName:"LockSelect",interfaces:[Es]},Ns.prototype.prepare_11rb$=function(t){return this.queue.isEmpty?null:Zo},Ns.prototype.complete_19pj23$=function(t,e){var n,i=null==e?na:this.queue;n=this,t._state_0===n&&(t._state_0=i)},Ns.$metadata$={kind:a,simpleName:"UnlockOp",interfaces:[ja]},$s.$metadata$={kind:a,simpleName:"MutexImpl",interfaces:[ls,ms]},w("kotlinx-coroutines-core.kotlinx.coroutines.sync.withPermit_103m5a$",(function(t,n,i){e.suspendCall(t.acquire(e.coroutineReceiver()));try{return n()}finally{t.release()}})),zs.$metadata$={kind:a,simpleName:"CompletionHandlerBase",interfaces:[Ol]},js.$metadata$={kind:a,simpleName:"CancelHandlerBase",interfaces:[]},Ls.prototype.afterResume_s8jyv4$=function(t){this.uCont.resumeWith_tl1gpc$(oe(t,this.uCont))},Ls.$metadata$={kind:a,simpleName:"UndispatchedCoroutine",interfaces:[Va]},Us.$metadata$={kind:O,simpleName:"Dispatchers",interfaces:[]};var Bs,Hs=null;function Vs(){return null===Hs&&new Us,Hs}function Ks(t,e){Bn.call(this),this.delegate=t,this.invokeImmediately_0=e,this.immediate_iydbla$_0=this.invokeImmediately_0?this:new Ks(this.delegate,!0)}function Ws(){return new Ys}function Ys(){He.call(this)}function Gs(){He.call(this)}function Js(){throw Z("runBlocking event loop is not supported")}function Zs(t,e){K.call(this,t,e),this.name="CancellationException"}function Qs(t,e){return e=e||Object.create(Zs.prototype),Zs.call(e,t,null),e}function Xs(t,e,n){Zs.call(this,t,e),this.job_8be2vx$=n,this.name="JobCancellationException"}function tl(t){return $t(t,F,Bs).toInt()}function el(){ce.call(this),this.messageQueue_8be2vx$=new nl(this)}function nl(t){var e;this.$outer=t,fl.call(this),this.processQueue_8be2vx$=(e=this,function(){return e.process(),p})}function il(){rl=this,el.call(this)}Object.defineProperty(Ks.prototype,"immediate",{configurable:!0,get:function(){return this.immediate_iydbla$_0}}),Ks.prototype.isDispatchNeeded_1fupul$=function(t){return!this.invokeImmediately_0},Ks.prototype.dispatch_5bn72i$=function(t,e){this.delegate.dispatch_5bn72i$(t,e)},Ks.prototype.dispatchYield_5bn72i$=function(t,e){this.delegate.dispatchYield_5bn72i$(t,e)},Ks.prototype.toString=function(){var t;return null!=(t=this.toStringInternalImpl())?t:this.delegate.toString()},Ks.$metadata$={kind:a,simpleName:"JsMainDispatcher",interfaces:[Bn]},Ys.prototype.dispatch_5bn72i$=function(t,e){Js()},Ys.$metadata$={kind:a,simpleName:"UnconfinedEventLoop",interfaces:[He]},Gs.prototype.unpark_0=function(){Js()},Gs.prototype.reschedule_0=function(t,e){Js()},Gs.$metadata$={kind:a,simpleName:"EventLoopImplPlatform",interfaces:[He]},Zs.$metadata$={kind:a,simpleName:"CancellationException",interfaces:[K]},Xs.prototype.toString=function(){return Zs.prototype.toString.call(this)+"; job="+this.job_8be2vx$},Xs.prototype.equals=function(t){return t===this||e.isType(t,Xs)&&b(t.message,this.message)&&b(t.job_8be2vx$,this.job_8be2vx$)&&b(t.cause,this.cause)},Xs.prototype.hashCode=function(){var t,e;return(31*((31*rt(B(this.message))|0)+rt(this.job_8be2vx$)|0)|0)+(null!=(e=null!=(t=this.cause)?rt(t):null)?e:0)|0},Xs.$metadata$={kind:a,simpleName:"JobCancellationException",interfaces:[Zs]},nl.prototype.schedule=function(){this.$outer.scheduleQueueProcessing()},nl.prototype.reschedule=function(){setTimeout(this.processQueue_8be2vx$,0)},nl.$metadata$={kind:a,simpleName:"ScheduledMessageQueue",interfaces:[fl]},el.prototype.dispatch_5bn72i$=function(t,e){this.messageQueue_8be2vx$.enqueue_771g0p$(e)},el.prototype.invokeOnTimeout_oczv3n$=function(t,e,n){var i;return new cl(setTimeout((i=e,function(){return i.run(),p}),tl(t)))},el.prototype.scheduleResumeAfterDelay_egqmvs$=function(t,e){var n,i,r=setTimeout((n=e,i=this,function(){return n.resumeUndispatched_hyuxa3$(i,p),p}),tl(t));e.invokeOnCancellation_f05bi3$(new cl(r))},el.$metadata$={kind:a,simpleName:"SetTimeoutBasedDispatcher",interfaces:[Ue,ce]},il.prototype.scheduleQueueProcessing=function(){i.nextTick(this.messageQueue_8be2vx$.processQueue_8be2vx$)},il.$metadata$={kind:O,simpleName:"NodeDispatcher",interfaces:[el]};var rl=null;function ol(){return null===rl&&new il,rl}function al(){sl=this,el.call(this)}al.prototype.scheduleQueueProcessing=function(){setTimeout(this.messageQueue_8be2vx$.processQueue_8be2vx$,0)},al.$metadata$={kind:O,simpleName:"SetTimeoutDispatcher",interfaces:[el]};var sl=null;function ll(){return null===sl&&new al,sl}function cl(t){Gt.call(this),this.handle_0=t}function ul(t){ce.call(this),this.window_0=t,this.queue_0=new hl(this.window_0)}function pl(t,e){this.this$WindowDispatcher=t,this.closure$handle=e}function hl(t){var e;fl.call(this),this.window_0=t,this.messageName_0="dispatchCoroutine",this.window_0.addEventListener("message",(e=this,function(t){return t.source==e.window_0&&t.data==e.messageName_0&&(t.stopPropagation(),e.process()),p}),!0)}function fl(){Na.call(this),this.yieldEvery=16,this.scheduled_0=!1}function dl(){}function _l(){}function yl(t){}function ml(t){var e,n;if(null!=(e=t.coroutineDispatcher))n=e;else{var i=new ul(t);t.coroutineDispatcher=i,n=i}return n}function vl(t){Qs("Flow was aborted, no more elements needed",this),this.owner=t,this.name="AbortFlowException"}function $l(){Qs("Child of the scoped flow was cancelled",this),this.name="ChildCancelledException"}function gl(t,e){this.collector_8be2vx$=t,this.collectContext_8be2vx$=e,this.collectContextSize_8be2vx$=this.collectContext_8be2vx$.fold_3cc69b$(0,wl),this.lastEmissionContext_0=null}function bl(t,e,n){c.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$value=e}function wl(t,e){return t+1|0}function kl(){}function Sl(){return new El}function xl(t){return gt(t)}function El(t){void 0===t&&(t=[]),St.call(this),this.array_0=t}function Cl(t){this.array_0=t,this.current_0=0}function Ol(){this._next=this,this._prev=this,this._removed=!1}function Nl(t,e){jl.call(this),this.queue=t,this.node=e}function zl(t){jl.call(this),this.queue=t,this.affectedNode_rjf1fm$_0=this.queue._next}function jl(){Ta.call(this)}function Tl(t,e,n){za.call(this),this.affected=t,this.desc=e,this.atomicOp_khy6pf$_0=n}function Pl(){Ol.call(this)}function Rl(t,e){return t}function Al(t){return t}function Il(t){return t}function Ml(){}function Ll(t,e){}function Dl(t){return null}function ql(t){return 0}function Fl(){this.value_0=null}cl.prototype.dispose=function(){clearTimeout(this.handle_0)},cl.prototype.invoke=function(t){this.dispose()},cl.prototype.toString=function(){return"ClearTimeout["+this.handle_0+"]"},cl.$metadata$={kind:a,simpleName:"ClearTimeout",interfaces:[nn,Gt]},ul.prototype.dispatch_5bn72i$=function(t,e){this.queue_0.enqueue_771g0p$(e)},ul.prototype.scheduleResumeAfterDelay_egqmvs$=function(t,e){var n,i;this.window_0.setTimeout((n=e,i=this,function(){return n.resumeUndispatched_hyuxa3$(i,p),p}),tl(t))},pl.prototype.dispose=function(){this.this$WindowDispatcher.window_0.clearTimeout(this.closure$handle)},pl.$metadata$={kind:a,interfaces:[nn]},ul.prototype.invokeOnTimeout_oczv3n$=function(t,e,n){var i;return new pl(this,this.window_0.setTimeout((i=e,function(){return i.run(),p}),tl(t)))},ul.$metadata$={kind:a,simpleName:"WindowDispatcher",interfaces:[Ue,ce]},hl.prototype.schedule=function(){var t;Promise.resolve(p).then((t=this,function(e){return t.process(),p}))},hl.prototype.reschedule=function(){this.window_0.postMessage(this.messageName_0,"*")},hl.$metadata$={kind:a,simpleName:"WindowMessageQueue",interfaces:[fl]},fl.prototype.enqueue_771g0p$=function(t){this.addLast_trkh7z$(t),this.scheduled_0||(this.scheduled_0=!0,this.schedule())},fl.prototype.process=function(){try{for(var t=this.yieldEvery,e=0;ethis.size)throw new ot("index: "+t+", size: "+this.size)},El.prototype.rangeCheck_0=function(t){if(t<0||t>=this.size)throw new ot("index: "+t+", size: "+this.size);return t},El.$metadata$={kind:a,simpleName:"CopyOnWriteList",interfaces:[St]},Object.defineProperty(Ol.prototype,"nextNode",{configurable:!0,get:w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListNode.get_nextNode",(function(){return this._next}))}),Object.defineProperty(Ol.prototype,"prevNode",{configurable:!0,get:w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListNode.get_prevNode",(function(){return this._prev}))}),Object.defineProperty(Ol.prototype,"isRemoved",{configurable:!0,get:w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListNode.get_isRemoved",(function(){return this._removed}))}),Ol.prototype.addLast_l2j9rm$=function(t){var e=this._prev;t._next=this,t._prev=e,e._next=t,this._prev=t},Ol.prototype.remove=function(){if(this._removed)return!1;var t=this._prev,e=this._next;return t._next=e,e._prev=t,this._removed=!0,!0},Ol.prototype.addOneIfEmpty_l2j9rm$=function(t){return this._next===this&&(this.addLast_l2j9rm$(t),!0)},Ol.prototype.addLastIf_w327v9$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListNode.addLastIf_w327v9$",(function(t,e){return!!e()&&(this.addLast_l2j9rm$(t),!0)})),Ol.prototype.addLastIfPrev_s8xlln$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListNode.addLastIfPrev_s8xlln$",(function(t,e){return!!e(this._prev)&&(this.addLast_l2j9rm$(t),!0)})),Ol.prototype.addLastIfPrevAndIf_dzcug$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListNode.addLastIfPrevAndIf_dzcug$",(function(t,e,n){return!!e(this._prev)&&!!n()&&(this.addLast_l2j9rm$(t),!0)})),Ol.prototype.helpRemove=function(){},Ol.prototype.removeFirstOrNull=function(){var t=this._next;if(t===this)return null;if(!t.remove())throw S("Should remove".toString());return t},Ol.prototype.removeFirstIfIsInstanceOfOrPeekIf_14urrv$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListNode.removeFirstIfIsInstanceOfOrPeekIf_14urrv$",k((function(){var t=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e,n,i){var r=this._next;if(r===this)return null;if(!n(r))return null;if(i(r))return r;if(!r.remove())throw t("Should remove".toString());return r}}))),Ol.$metadata$={kind:a,simpleName:"LinkedListNode",interfaces:[]},Object.defineProperty(Nl.prototype,"affectedNode",{configurable:!0,get:function(){return this.queue._prev}}),Nl.prototype.finishPrepare_xe32vn$=function(t){},Nl.prototype.onComplete=function(){this.queue.addLast_l2j9rm$(this.node)},Nl.prototype.finishOnSuccess_bpl3tg$=function(t,e){},Nl.$metadata$={kind:a,simpleName:"AddLastDesc",interfaces:[jl]},Object.defineProperty(zl.prototype,"result",{configurable:!0,get:function(){var t;return null==(t=this.affectedNode)||e.isType(t,r)?t:o()}}),Object.defineProperty(zl.prototype,"affectedNode",{configurable:!0,get:function(){return this.affectedNode_rjf1fm$_0}}),zl.prototype.finishPrepare_xe32vn$=function(t){},zl.prototype.onComplete=function(){this.queue.removeFirstOrNull()},zl.prototype.finishOnSuccess_bpl3tg$=function(t,e){},zl.$metadata$={kind:a,simpleName:"RemoveFirstDesc",interfaces:[jl]},jl.prototype.onPrepare_xe32vn$=function(t){return this.finishPrepare_xe32vn$(t),null},jl.prototype.onRemoved_l2j9rm$=function(t){},jl.prototype.prepare_4uxf5b$=function(t){var e=this.affectedNode,n=this.failure_l2j9rm$(e);return null!=n?n:this.onPrepare_xe32vn$(new Tl(e,this,t))},jl.prototype.complete_ayrq83$=function(t,e){this.onComplete()},jl.prototype.failure_l2j9rm$=function(t){return null},jl.prototype.retry_ru8hrx$=function(t,e){return!1},jl.$metadata$={kind:a,simpleName:"AbstractAtomicDesc",interfaces:[Ta]},Object.defineProperty(Tl.prototype,"atomicOp",{get:function(){return this.atomicOp_khy6pf$_0}}),Tl.prototype.perform_s8jyv4$=function(t){return null},Tl.prototype.finishPrepare=function(){},Tl.$metadata$={kind:a,simpleName:"PrepareOp",interfaces:[za]},Object.defineProperty(Pl.prototype,"isEmpty",{configurable:!0,get:function(){return this._next===this}}),Pl.prototype.forEach_jgwmnf$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListHead.forEach_jgwmnf$",k((function(){var t=e.equals;return function(e,n,i){for(var r=this._next;!t(r,this);)n(r)&&i(r),r=r._next}}))),Pl.prototype.remove=function(){throw xt()},Pl.$metadata$={kind:a,simpleName:"LinkedListHead",interfaces:[Ol]},w("kotlinx-coroutines-core.kotlinx.coroutines.internal.recoverAndThrow_8o0b5c$",(function(t,e){throw t})),Ml.$metadata$={kind:x,simpleName:"CoroutineStackFrame",interfaces:[]},Fl.prototype.get=function(){var t;return null==(t=this.value_0)||e.isType(t,r)?t:o()},Fl.prototype.set_11rb$=function(t){this.value_0=t},Fl.$metadata$={kind:a,simpleName:"CommonThreadLocal",interfaces:[]};var Ul=t.kotlinx||(t.kotlinx={}),Bl=Ul.coroutines||(Ul.coroutines={});Bl.AbstractCoroutine=Et,Bl.awaitAll_60afti$=function(t,e,n){var i=new Ct(t,e);return n?i:i.doResume(null)},Bl.launch_s496o7$=jt,Bl.async_pda6u4$=function(t,e,n,i){void 0===e&&(e=v.EmptyCoroutineContext),void 0===n&&(n=Ae());var r=As(t,e),o=n.isLazy?new Rt(r,i):new Tt(r,!0);return o.start_b5ul0p$(n,o,i),o},Bl.withContext_i5cbzn$=function(t,e,n){return(i=t,r=e,function(t){var e=t.context,n=e.plus_1fupul$(i);if(ci(n),n===e){var o=new Va(n,t);return is(o,o,r)}if(b(n.get_j3r2sn$(g.Key),e.get_j3r2sn$(g.Key))){var a=new Ls(n,t);return is(a,a,r)}var s=new Mt(n,t);return s.initParentJob_8be2vx$(),Za(r,s,s),s.getResult()})(n);var i,r},Bl.DispatchedCoroutine=Mt,Bl.CancellableContinuation=Lt,Bl.getOrCreateCancellableContinuation_3j0xf1$=Dt,Bl.removeOnCancellation_1u31dd$=qt,Bl.disposeOnCancellation_xredcy$=Ft,Bl.CancellableContinuationImpl=Ht,Bl.NotCompleted=Vt,Bl.CancelHandler=Gt,Bl.BeforeResumeCancelHandler=Jt,Bl.CompletableDeferred=Xt,Bl.CompletableDeferred_xptg6w$=function(t){return void 0===t&&(t=null),new te(t)},Bl.CompletableJob=ne,Bl.toState_fbj1ua$=ie,Bl.toState_bd49bs$=re,Bl.recoverResult_nnrdi1$=oe,Bl.CompletedWithCancellation=ae,Bl.CompletedExceptionally=se,Bl.CancelledContinuation=le,Object.defineProperty(ce,"Key",{get:fe}),Bl.CoroutineDispatcher=ce,Bl.handleCoroutineException_1ur55u$=de,Bl.handlerException_l3aqr5$=_e,Bl.CoroutineExceptionHandler=ye,Object.defineProperty(ye,"Key",{get:$e}),Object.defineProperty(ge,"Key",{get:ke}),Bl.CoroutineName=ge,Bl.CoroutineScope=Se,Bl.get_isActive_e9pf1l$=function(t){var e,n;return null==(n=null!=(e=t.coroutineContext.get_j3r2sn$(tn()))?e.isActive:null)||n},Object.defineProperty(Bl,"GlobalScope",{get:function(){return null===ze&&new xe,ze}}),Bl.coroutineScope_awg8ri$=je,Bl.CoroutineScope_1fupul$=function(t){return new Ka(null!=t.get_j3r2sn$(tn())?t:t.plus_1fupul$(en()))},Bl.cancel_jnvdxk$=Te,Bl.cancel_n4wjt3$=function(t,e,n){void 0===n&&(n=null),Te(t,new Zs(e,n))},Object.defineProperty(Pe,"DEFAULT",{get:Ae}),Object.defineProperty(Pe,"LAZY",{get:Ie}),Object.defineProperty(Pe,"ATOMIC",{get:Me}),Object.defineProperty(Pe,"UNDISPATCHED",{get:Le}),Bl.CoroutineStart=Pe,Bl.CopyableThrowable=De,Bl.Deferred=qe,Bl.Delay=Ue,Bl.delay_s8cxhz$=function(t,e){var n;if(!(t.toNumber()<=0))return Fe((n=t,function(t){return n.compareTo_11rb$(D)<0&&Be(t.context).scheduleResumeAfterDelay_egqmvs$(n,t),p}))(e)},Bl.get_delay_tcgsej$=Be,Bl.EventLoop=He,Object.defineProperty(Bl,"ThreadLocalEventLoop",{get:We}),Bl.EventLoopImplBase=Ye,Bl.CompletionHandlerException=Ge,Bl.CoroutinesInternalError=Je,Object.defineProperty(Ze,"Key",{get:tn}),Bl.Job=Ze,Bl.Job_5dx9e$=en,Bl.DisposableHandle=nn,Bl.ChildJob=rn,Bl.ParentJob=on,Bl.ChildHandle=an,Bl.cancel_x105z1$=function(t,e){var n;void 0===e&&(e=null),null!=(n=t.get_j3r2sn$(tn()))&&n.cancel_m4sck1$(e)},Bl.ensureActive_5dx9u$=sn,Bl.ensureActive_qdnslq$=ln,Bl.cancel_6dgle8$=function(t,e,n){void 0===n&&(n=null),t.cancel_m4sck1$(new Zs(e,n))},Object.defineProperty(Bl,"NonDisposableHandle",{get:vn}),Bl.JobSupport=$n,Bl.boxIncomplete_ntq51o$=En,Bl.unboxState_ntq51o$=Cn,Bl.JobImpl=Nn,Bl.Incomplete=zn,Bl.JobNode=jn,Bl.NodeList=Tn,Bl.InactiveNodeList=Pn,Bl.JobCancellingNode=Dn,Bl.ChildHandleNode=Fn,Bl.ChildContinuation=Un,Bl.MainCoroutineDispatcher=Bn,Bl.SupervisorJob_5dx9e$=function(t){return void 0===t&&(t=null),new Vn(t)},Bl.TimeoutCancellationException=Kn,Object.defineProperty(Bl,"Unconfined",{get:Gn}),Object.defineProperty(Jn,"Key",{get:li}),Bl.YieldContext=Jn,Bl.checkCompletion_tcgsej$=ci,pi.SendBuffered=mi;var Hl=Bl.channels||(Bl.channels={});Hl.AbstractSendChannel=pi,Hl.AbstractChannel=vi,Hl.Send=zi,Hl.ReceiveOrClosed=ji,Hl.SendElement=Ti,Hl.SendElementWithUndeliveredHandler=Pi,Hl.Closed=Ri,Hl.Receive=Ai,Hl.ArrayBroadcastChannel=Ii,Hl.ArrayChannel=Li,Hl.broadcast_sgee0c$=Di,Hl.BroadcastChannel=Ui,Hl.BroadcastChannel_ww73n8$=Bi,Object.defineProperty(Hi,"SUSPEND",{get:Ki}),Object.defineProperty(Hi,"DROP_OLDEST",{get:Wi}),Object.defineProperty(Hi,"DROP_LATEST",{get:Yi}),Hl.BufferOverflow=Hi,Hl.SendChannel=Gi,Hl.ReceiveChannel=Ji,Zi.Closed=Qi,Object.defineProperty(Zi,"Companion",{get:er}),Hl.ValueOrClosed=Zi,Hl.ChannelIterator=nr,Object.defineProperty(rr,"Factory",{get:lr}),Hl.Channel=rr,Hl.Channel_lsve6m$=cr,Hl.Channel_ww73n8$=function(t){return void 0===t&&(t=0),cr(t)},Hl.ClosedSendChannelException=ur,Hl.ClosedReceiveChannelException=pr,Hl.ChannelCoroutine=hr,Hl.cancelConsumed_v57n85$=fr,Hl.ConflatedBroadcastChannel=dr,Hl.ConflatedChannel=Er,Hl.LinkedListChannel=Cr,Hl.ProducerScope=Nr,Hl.awaitClose_msfyrq$=function(t,e,n,i){var r=new Tr(t,e,n);return i?r:r.doResume(null)},Hl.produce_tndwgj$=Pr,Hl.ProducerCoroutine=Rr,Hl.RendezvousChannel=Ar;var Vl=Bl.flow||(Bl.flow={});Vl.flow_sxz0o1$=function(t){return new Ir(t)},Vl.callbackFlow_b9ud7o$=function(t){return new Dr(t)},Vl.emitAll_s9b6ou$=Fr,Vl.Flow=Br,Vl.AbstractFlow=Hr,Vl.FlowCollector=Kr,Vl.SharedFlow=Yr,Vl.MutableSharedFlow=Gr,Vl.MutableSharedFlow_ympafm$=function(t,e,n){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=Ki()),!(t>=0))throw H(("replay cannot be negative, but was "+t).toString());if(!(e>=0))throw H(("extraBufferCapacity cannot be negative, but was "+e).toString());if(!(t>0||e>0||n===Ki()))throw H(("replay or extraBufferCapacity must be positive with non-default onBufferOverflow strategy "+n).toString());var i=t+e|0;return new Zr(t,i<0?2147483647:i,n)},Vl.fuseSharedFlow_mxe5lp$=io,Vl.StateFlow=ro,Vl.MutableStateFlow=oo,Vl.MutableStateFlow_mh5how$=ao,Vl.increment_u8peyx$=uo,Vl.fuseStateFlow_j7j1gt$=po;var Kl=Vl.internal||(Vl.internal={});Kl.AbstractSharedFlowSlot=ho,Kl.AbstractSharedFlow=fo,Kl.FusibleFlow=_o,Kl.ChannelFlow=yo,Kl.ChannelFlowOperator=$o,Kl.ChannelFlowOperatorImpl=wo,Kl.withContextUndispatched_z68y1q$=xo,Kl.flowScope_730rnf$=Co,Kl.checkOwnership_ygf9h9$=function(t,e){if(t.owner!==e)throw t},Kl.ChannelFlowTransformLatest=zo,Object.defineProperty(Kl,"NopCollector",{get:sa}),Kl.checkContext_2zo4vg$=la,Kl.transitiveCoroutineParent_c7vj00$=ca,Kl.SendingCollector=ua,Vl.buffer_g16sm6$=pa,Vl.CancellableFlow=ha,Vl.toList_7a0s5y$=function(t,e,n){return void 0===e&&(e=at()),Sa(t,e,n)},Vl.toSet_a3q90u$=function(t,e,n){return void 0===e&&(e=st()),Sa(t,e,n)},Vl.count_x2ftfk$=function(t,e,n){var i=new Oa(t,e);return n?i:i.doResume(null)},Vl.transformLatest_ig04k9$=fa,Vl.mapLatest_516il8$=_a,Vl.SubscribedFlowCollector=ya,Vl.collect_wkex2n$=va,Vl.collectLatest_706ovd$=function(t,e,n,i){var r=new $a(t,e,n);return i?r:r.doResume(null)},Vl.toCollection_eyr3lx$=Sa;var Wl=Bl.internal||(Bl.internal={});Wl.ArrayQueue=Na,Wl.OpDescriptor=za,Wl.AtomicOp=ja,Wl.AtomicDesc=Ta,Wl.DispatchedContinuation=Pa,Wl.resumeCancellableWith_udi45l$=Ra,Bl.get_isCancellableMode_8e50z4$=Aa,Bl.get_isReusableMode_8e50z4$=Ia,Bl.DispatchedTask=Ma,Bl.dispatch_h66hf9$=La,Bl.resume_h7ljpe$=Da,Wl.recoverStackTrace_ak2v6d$=Rl,Wl.InlineList=qa,Wl.callUndeliveredElementCatchingException_xmr2eb$=Fa,Wl.callUndeliveredElement_ku137g$=Ua,Wl.bindCancellationFun_ku137g$=Ba,Wl.UndeliveredElementException=Ha,Wl.ScopeCoroutine=Va,Wl.ContextScope=Ka,Wl.Symbol=Wa,Wl.systemProp_vrsuct$=Ya,Wl.systemProp_ornks8$=Ga;var Yl=Bl.intrinsics||(Bl.intrinsics={});Yl.startCoroutineCancellable_x18nsh$=Ja,Yl.startCoroutineCancellable_7jvlzs$=Za,Yl.startCoroutineCancellable_he7xzw$=Qa,Yl.startCoroutineUnintercepted_81hn2s$=Xa,Yl.startCoroutineUnintercepted_kew4v3$=ts,Yl.startCoroutineUndispatched_81hn2s$=es,Yl.startCoroutineUndispatched_kew4v3$=ns,Yl.startUndispatchedOrReturn_nxbeil$=is;var Gl=Bl.selects||(Bl.selects={});Gl.SelectBuilder=os,Gl.SelectClause0=as,Gl.SelectClause1=ss,Gl.SelectClause2=ls,Gl.SelectInstance=cs,Gl.SeqNumber=us,Gl.SelectBuilderImpl=ps,Gl.UnbiasedSelectBuilderImpl=ys;var Jl=Bl.sync||(Bl.sync={});return Jl.Mutex=ms,Jl.Mutex_6taknv$=function(t){return void 0===t&&(t=!1),new $s(t)},Jl.MutexImpl=$s,Bl.CompletionHandlerBase=zs,Bl.CancelHandlerBase=js,Bl.invokeIt_beznmj$=Ts,Bl.createDefaultDispatcher_8be2vx$=Ps,Object.defineProperty(Bl,"DefaultDelay_8be2vx$",{get:Rs}),Bl.newCoroutineContext_7n4184$=As,Bl.toDebugString_u0ddlz$=Is,Bl.get_coroutineName_tcgsej$=Ms,Bl.UndispatchedCoroutine=Ls,Bl.handleCoroutineExceptionImpl_yfv4gr$=Ds,Bl.get_hexAddress_8ea4r1$=qs,Bl.get_classSimpleName_8ea4r1$=Fs,Object.defineProperty(Bl,"Dispatchers",{get:Vs}),Bl.createEventLoop_8be2vx$=Ws,Bl.UnconfinedEventLoop=Ys,Bl.EventLoopImplPlatform=Gs,Bl.CancellationException_init_pdl1vj$=Qs,Bl.CancellationException=Zs,Bl.JobCancellationException=Xs,el.ScheduledMessageQueue=nl,Bl.SetTimeoutBasedDispatcher=el,Object.defineProperty(Bl,"NodeDispatcher",{get:ol}),Object.defineProperty(Bl,"SetTimeoutDispatcher",{get:ll}),Bl.WindowDispatcher=ul,Bl.MessageQueue=fl,Bl.Runnable=dl,Bl.SchedulerTask=_l,Bl.get_taskContext_5sfo4y$=yl,Bl.asCoroutineDispatcher_nz12v2$=ml,Kl.AbortFlowException=vl,Kl.ChildCancelledException=$l,Kl.SafeCollector=gl,Wl.NoOpLock=kl,Wl.subscriberList_tnbmyv$=Sl,Wl.identitySet_46rbr$=xl,Wl.CopyOnWriteList=El,Wl.LinkedListNode=Ol,Wl.AddLastDesc=Nl,Wl.RemoveFirstDesc=zl,Wl.AbstractAtomicDesc=jl,Wl.PrepareOp=Tl,Wl.LinkedListHead=Pl,Wl.recoverStackTrace_87698k$=Al,Wl.unwrap_87698k$=Il,Wl.CoroutineStackFrame=Ml,Wl.initCause_oz8fe6$=Ll,Wl.systemProp_y4putb$=Dl,Wl.threadContextElements_v4qu62$=ql,Wl.CommonThreadLocal=Fl,Ze.prototype.plus_1fupul$=R.prototype.plus_1fupul$,Ze.prototype.fold_3cc69b$=R.prototype.fold_3cc69b$,Ze.prototype.get_j3r2sn$=R.prototype.get_j3r2sn$,Ze.prototype.minusKey_yeqjby$=R.prototype.minusKey_yeqjby$,rn.prototype.cancel=Ze.prototype.cancel,rn.prototype.plus_dqr1mp$=Ze.prototype.plus_dqr1mp$,rn.prototype.plus_1fupul$=Ze.prototype.plus_1fupul$,rn.prototype.fold_3cc69b$=Ze.prototype.fold_3cc69b$,rn.prototype.get_j3r2sn$=Ze.prototype.get_j3r2sn$,rn.prototype.minusKey_yeqjby$=Ze.prototype.minusKey_yeqjby$,rn.prototype.cancel_m4sck1$=Ze.prototype.cancel_m4sck1$,rn.prototype.cancel_dbl4no$=Ze.prototype.cancel_dbl4no$,rn.prototype.invokeOnCompletion_ct2b2z$=Ze.prototype.invokeOnCompletion_ct2b2z$,on.prototype.cancel=Ze.prototype.cancel,on.prototype.plus_dqr1mp$=Ze.prototype.plus_dqr1mp$,on.prototype.plus_1fupul$=Ze.prototype.plus_1fupul$,on.prototype.fold_3cc69b$=Ze.prototype.fold_3cc69b$,on.prototype.get_j3r2sn$=Ze.prototype.get_j3r2sn$,on.prototype.minusKey_yeqjby$=Ze.prototype.minusKey_yeqjby$,on.prototype.cancel_m4sck1$=Ze.prototype.cancel_m4sck1$,on.prototype.cancel_dbl4no$=Ze.prototype.cancel_dbl4no$,on.prototype.invokeOnCompletion_ct2b2z$=Ze.prototype.invokeOnCompletion_ct2b2z$,$n.prototype.cancel=Ze.prototype.cancel,$n.prototype.plus_dqr1mp$=Ze.prototype.plus_dqr1mp$,$n.prototype.plus_1fupul$=Ze.prototype.plus_1fupul$,$n.prototype.fold_3cc69b$=Ze.prototype.fold_3cc69b$,$n.prototype.get_j3r2sn$=Ze.prototype.get_j3r2sn$,$n.prototype.minusKey_yeqjby$=Ze.prototype.minusKey_yeqjby$,$n.prototype.invokeOnCompletion_ct2b2z$=Ze.prototype.invokeOnCompletion_ct2b2z$,$n.prototype.cancel_m4sck1$=Ze.prototype.cancel_m4sck1$,$n.prototype.cancel_dbl4no$=Ze.prototype.cancel_dbl4no$,qe.prototype.cancel=Ze.prototype.cancel,qe.prototype.plus_dqr1mp$=Ze.prototype.plus_dqr1mp$,qe.prototype.plus_1fupul$=Ze.prototype.plus_1fupul$,qe.prototype.fold_3cc69b$=Ze.prototype.fold_3cc69b$,qe.prototype.get_j3r2sn$=Ze.prototype.get_j3r2sn$,qe.prototype.minusKey_yeqjby$=Ze.prototype.minusKey_yeqjby$,qe.prototype.cancel_m4sck1$=Ze.prototype.cancel_m4sck1$,qe.prototype.cancel_dbl4no$=Ze.prototype.cancel_dbl4no$,qe.prototype.invokeOnCompletion_ct2b2z$=Ze.prototype.invokeOnCompletion_ct2b2z$,Ht.prototype.cancel_dbl4no$=Lt.prototype.cancel_dbl4no$,Ht.prototype.tryResume_19pj23$=Lt.prototype.tryResume_19pj23$,Xt.prototype.cancel=qe.prototype.cancel,Xt.prototype.plus_dqr1mp$=qe.prototype.plus_dqr1mp$,Xt.prototype.plus_1fupul$=qe.prototype.plus_1fupul$,Xt.prototype.fold_3cc69b$=qe.prototype.fold_3cc69b$,Xt.prototype.get_j3r2sn$=qe.prototype.get_j3r2sn$,Xt.prototype.minusKey_yeqjby$=qe.prototype.minusKey_yeqjby$,Xt.prototype.cancel_m4sck1$=qe.prototype.cancel_m4sck1$,Xt.prototype.cancel_dbl4no$=qe.prototype.cancel_dbl4no$,Xt.prototype.invokeOnCompletion_ct2b2z$=qe.prototype.invokeOnCompletion_ct2b2z$,ne.prototype.cancel=Ze.prototype.cancel,ne.prototype.plus_dqr1mp$=Ze.prototype.plus_dqr1mp$,ne.prototype.plus_1fupul$=Ze.prototype.plus_1fupul$,ne.prototype.fold_3cc69b$=Ze.prototype.fold_3cc69b$,ne.prototype.get_j3r2sn$=Ze.prototype.get_j3r2sn$,ne.prototype.minusKey_yeqjby$=Ze.prototype.minusKey_yeqjby$,ne.prototype.cancel_m4sck1$=Ze.prototype.cancel_m4sck1$,ne.prototype.cancel_dbl4no$=Ze.prototype.cancel_dbl4no$,ne.prototype.invokeOnCompletion_ct2b2z$=Ze.prototype.invokeOnCompletion_ct2b2z$,ce.prototype.get_j3r2sn$=g.prototype.get_j3r2sn$,ce.prototype.minusKey_yeqjby$=g.prototype.minusKey_yeqjby$,ye.prototype.fold_3cc69b$=R.prototype.fold_3cc69b$,ye.prototype.get_j3r2sn$=R.prototype.get_j3r2sn$,ye.prototype.minusKey_yeqjby$=R.prototype.minusKey_yeqjby$,ye.prototype.plus_1fupul$=R.prototype.plus_1fupul$,Ye.prototype.delay_s8cxhz$=Ue.prototype.delay_s8cxhz$,Ye.prototype.invokeOnTimeout_oczv3n$=Ue.prototype.invokeOnTimeout_oczv3n$,Hn.prototype.cancel=Ze.prototype.cancel,Hn.prototype.plus_dqr1mp$=Ze.prototype.plus_dqr1mp$,Hn.prototype.invokeOnCompletion_ct2b2z$=Ze.prototype.invokeOnCompletion_ct2b2z$,Hn.prototype.cancel_m4sck1$=Ze.prototype.cancel_m4sck1$,Hn.prototype.cancel_dbl4no$=Ze.prototype.cancel_dbl4no$,pi.prototype.close_dbl4no$=Gi.prototype.close_dbl4no$,xi.prototype.next0=nr.prototype.next0,rr.prototype.cancel=Ji.prototype.cancel,rr.prototype.close_dbl4no$=Gi.prototype.close_dbl4no$,rr.prototype.cancel_m4sck1$=Ji.prototype.cancel_m4sck1$,rr.prototype.cancel_dbl4no$=Ji.prototype.cancel_dbl4no$,vi.prototype.cancel=rr.prototype.cancel,vi.prototype.cancel_dbl4no$=rr.prototype.cancel_dbl4no$,vi.prototype.cancel_m4sck1$=rr.prototype.cancel_m4sck1$,Ui.prototype.close_dbl4no$=Gi.prototype.close_dbl4no$,Ii.prototype.cancel_dbl4no$=Ui.prototype.cancel_dbl4no$,Ii.prototype.cancel_m4sck1$=Ui.prototype.cancel_m4sck1$,Nr.prototype.close_dbl4no$=Gi.prototype.close_dbl4no$,qi.prototype.close_dbl4no$=Nr.prototype.close_dbl4no$,hr.prototype.close_dbl4no$=rr.prototype.close_dbl4no$,dr.prototype.close_dbl4no$=Ui.prototype.close_dbl4no$,dr.prototype.cancel_dbl4no$=Ui.prototype.cancel_dbl4no$,dr.prototype.cancel_m4sck1$=Ui.prototype.cancel_m4sck1$,yo.prototype.fuse_5k3f3z$=_o.prototype.fuse_5k3f3z$,Zr.prototype.fuse_5k3f3z$=_o.prototype.fuse_5k3f3z$,lo.prototype.fuse_5k3f3z$=_o.prototype.fuse_5k3f3z$,_o.prototype.fuse_5k3f3z$,_o.prototype.fuse_5k3f3z$,ps.prototype.invoke_en0wgx$=os.prototype.invoke_en0wgx$,ys.prototype.invoke_en0wgx$=os.prototype.invoke_en0wgx$,$s.prototype.tryLock_s8jyv4$=ms.prototype.tryLock_s8jyv4$,$s.prototype.lock_s8jyv4$=ms.prototype.lock_s8jyv4$,$s.prototype.unlock_s8jyv4$=ms.prototype.unlock_s8jyv4$,el.prototype.delay_s8cxhz$=Ue.prototype.delay_s8cxhz$,ul.prototype.delay_s8cxhz$=Ue.prototype.delay_s8cxhz$,n=new Wa("RESUME_TOKEN"),new Wa("REMOVED_TASK"),new Wa("CLOSED_EMPTY"),un=new Wa("COMPLETING_ALREADY"),pn=new Wa("COMPLETING_WAITING_CHILDREN"),hn=new Wa("COMPLETING_RETRY"),fn=new Wa("TOO_LATE_TO_CANCEL"),dn=new Wa("SEALED"),_n=new On(!1),yn=new On(!0),Qn=new Wa("EMPTY"),Xn=new Wa("OFFER_SUCCESS"),ti=new Wa("OFFER_FAILED"),ei=new Wa("POLL_FAILED"),ni=new Wa("ENQUEUE_FAILED"),ii=new Wa("ON_CLOSE_HANDLER_INVOKED"),ar="Channel was closed",yr=new Wa("NO_VALUE"),mr=new Wa("NONE"),vr=new Wa("PENDING"),$r=e.newArray(0,null),Do=new Wa("NULL"),new Wa("UNINITIALIZED"),new Wa("DONE"),Ya("kotlinx.coroutines.flow.defaultConcurrency",16,1,2147483647),qo=new Wa("NO_DECISION"),Fo=new Wa("RETRY_ATOMIC"),new Wa("CLOSED"),Uo=new Wa("UNDEFINED"),Bo=new Wa("REUSABLE_CLAIMED"),Ho=new Wa("REMOVE_PREPARED"),Vo=new Wa("NOT_SELECTED"),Ko=new Wa("ALREADY_SELECTED"),Wo=new Wa("UNDECIDED"),Yo=new Wa("RESUMED"),Go=new us,Jo=new Wa("LOCK_FAIL"),Zo=new Wa("UNLOCK_FAIL"),Qo=new Wa("SELECT_SUCCESS"),Xo=new Wa("LOCKED"),ta=new Wa("UNLOCKED"),ea=new vs(Xo),na=new vs(ta),Ya("kotlinx.coroutines.semaphore.maxSpinCycles",100),new Wa("PERMIT"),new Wa("TAKEN"),new Wa("BROKEN"),new Wa("CANCELLED"),Ya("kotlinx.coroutines.semaphore.segmentSize",16),ia="undefined",ra=0,oa=!1,Bs=vt,t})?r.apply(e,o):r)||(t.exports=a)}).call(this,n(4))},function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=n,n.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)}},function(t,e,n){"use strict";var i=e,r=n(5),o=n(9),a=n(113);i.assert=o,i.toArray=a.toArray,i.zero2=a.zero2,i.toHex=a.toHex,i.encode=a.encode,i.getNAF=function(t,e,n){var i=new Array(Math.max(t.bitLength(),n)+1);i.fill(0);for(var r=1<(r>>1)-1?(r>>1)-l:l,o.isubn(s)):s=0,i[a]=s,o.iushrn(1)}return i},i.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var i,r=0,o=0;t.cmpn(-r)>0||e.cmpn(-o)>0;){var a,s,l=t.andln(3)+r&3,c=e.andln(3)+o&3;3===l&&(l=-1),3===c&&(c=-1),a=0==(1&l)?0:3!==(i=t.andln(7)+r&7)&&5!==i||2!==c?l:-l,n[0].push(a),s=0==(1&c)?0:3!==(i=e.andln(7)+o&7)&&5!==i||2!==l?c:-c,n[1].push(s),2*r===a+1&&(r=1-r),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},i.cachedProperty=function(t,e,n){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=n.call(this)}},i.parseBytes=function(t){return"string"==typeof t?i.toArray(t,"hex"):t},i.intFromLE=function(t){return new r(t,"hex","le")}},function(t,e,n){"use strict";var i=n(9),r=n(0);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function a(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?"0"+t:t}function l(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=r,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),r=0;r>6|192,n[i++]=63&a|128):o(t,r)?(a=65536+((1023&a)<<10)+(1023&t.charCodeAt(++r)),n[i++]=a>>18|240,n[i++]=a>>12&63|128,n[i++]=a>>6&63|128,n[i++]=63&a|128):(n[i++]=a>>12|224,n[i++]=a>>6&63|128,n[i++]=63&a|128)}else for(r=0;r>>0}return a},e.split32=function(t,e){for(var n=new Array(4*t.length),i=0,r=0;i>>24,n[r+1]=o>>>16&255,n[r+2]=o>>>8&255,n[r+3]=255&o):(n[r+3]=o>>>24,n[r+2]=o>>>16&255,n[r+1]=o>>>8&255,n[r]=255&o)}return n},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,n){return t+e+n>>>0},e.sum32_4=function(t,e,n,i){return t+e+n+i>>>0},e.sum32_5=function(t,e,n,i,r){return t+e+n+i+r>>>0},e.sum64=function(t,e,n,i){var r=t[e],o=i+t[e+1]>>>0,a=(o>>0,t[e+1]=o},e.sum64_hi=function(t,e,n,i){return(e+i>>>0>>0},e.sum64_lo=function(t,e,n,i){return e+i>>>0},e.sum64_4_hi=function(t,e,n,i,r,o,a,s){var l=0,c=e;return l+=(c=c+i>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,n,i,r,o,a,s){return e+i+o+s>>>0},e.sum64_5_hi=function(t,e,n,i,r,o,a,s,l,c){var u=0,p=e;return u+=(p=p+i>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,n,i,r,o,a,s,l,c){return e+i+o+s+c>>>0},e.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},e.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},e.shr64_hi=function(t,e,n){return t>>>n},e.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return"string"==typeof t&&i.test(t)};var i=/-webkit-|-moz-|-ms-/;t.exports=e.default},function(t,e,n){var i,r,o;r=[e,n(1),n(8)],void 0===(o="function"==typeof(i=function(t,e,n){"use strict";var i,r=e.Kind.INTERFACE,o=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,a=e.kotlin.coroutines.CoroutineImpl,s=e.Long.MAX_VALUE,l=e.Long.fromInt(4088),c=e.ensureNotNull,u=e.kotlin.Unit,p=e.throwCCE,h=e.Kind.CLASS,f=e.Long.ZERO,d=e.equals,_=e.toByte,y=e.kotlin.text.StringBuilder_init,m=n.kotlinx.coroutines.CancellationException_init_pdl1vj$,v=e.kotlin.ranges.coerceAtMost_2p08ub$,$=Object,g=Math,b=e.kotlin.IllegalArgumentException_init_pdl1vj$,w=e.defineInlineFunction,k=e.wrapFunction,S=e.toShort,x=n.kotlinx.coroutines.CancellationException,E=Error,C=n.kotlinx.coroutines.Job,O=n.kotlinx.coroutines.CoroutineScope,N=e.kotlin.coroutines,z=n.kotlinx.coroutines,j=(n.kotlinx.coroutines.newCoroutineContext_7n4184$,n.kotlinx.coroutines.CoroutineScope_1fupul$,n.kotlinx.coroutines.CoroutineDispatcher),T=n.kotlinx.coroutines.launch_s496o7$,P=e.kotlin.ranges.coerceAtMost_dqglrj$,R=e.kotlin.IllegalStateException_init_pdl1vj$,A=e.kotlin.UnsupportedOperationException_init_pdl1vj$,I=e.kotlin.UShort,M=(e.kotlin.UInt,e.kotlin.ULong,e.Long.fromInt(16)),L=e.kotlin.text.StringBuilder_init_za3lpa$,D=e.kotlin.UnsupportedOperationException_init,q=e.kotlin.text.Appendable,F=e.kotlin.ranges.coerceAtLeast_dqglrj$,U=e.unboxChar,B=e.Kind.OBJECT,H=e.toChar,V=e.toBoxedChar,K=e.kotlin.Exception_init_pdl1vj$,W=e.kotlin.Exception,Y=(e.kotlin.UByte,new e.Long(-1,0)),G=(e.kotlin.Annotation,e.Long.NEG_ONE),J=e.kotlin.ranges.until_ebnic$,Z=e.floatToRawBits,Q=e.doubleToRawBits,X=(e.kotlin.text.contains_sgbm27$,e.kotlin.collections.copyOf_mrm5p$,e.Long.fromInt(2147483647)),tt=e.PropertyMetadata,et=e.kotlin.properties.ReadWriteProperty,nt=e.kotlin.IndexOutOfBoundsException,it=e.kotlin.CharSequence,rt=e.kotlin.text.isLowSurrogate_myv2d0$,ot=e.kotlin.text.isHighSurrogate_myv2d0$,at=(e.kotlin.Error_init_pdl1vj$,e.kotlin.NotImplementedError,n.kotlinx.coroutines.Job_5dx9e$),st=e.toString,lt=e.hashCode,ct=e.Long.ONE,ut=e.kotlin.lazy_klfg04$,pt=(e.kotlin.Result,e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,e.kotlin.coroutines.SafeContinuation_init_wj8d80$,e.kotlin.io.println_s8jyv4$,e.kotlin.text.replace_r2fvfm$),ht=Int8Array,ft=e.kotlin.properties.ReadOnlyProperty,dt=e.kotlin.Enum,_t=e.throwISE,yt=e.kotlin.IndexOutOfBoundsException_init,mt=e.kotlin.collections.setOf_i5x0yv$,vt=e.kotlin.text.decodeToString_964n91$,$t=e.kotlin.text.trim_gw00vp$;function gt(){}function bt(t){this.closure$message=t,uo.call(this)}function wt(t,e,n){void 0===n&&(n=ao().Pool),this.autoFlush_tqevpj$_0=e,this.state_9883ul$_0=new Qo,this.writable=new Mi(0,n),this.readable=Ui(t,n),this.slot_2l2jew$_0=new Io,this.flushMutex_pw64cr$_0=new $,this.flushBuffer_1r7aq2$_0=el()}function kt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$count=e}function St(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$count=e}function xt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$b=e}function Et(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$s=e}function Ct(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$i=e}function Ot(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$l=e}function Nt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$f=e}function zt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$d=e}function jt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$packet=e}function Tt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$src=e}function Pt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$src=e}function Rt(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$currentIndex=void 0,this.local$endIndex=void 0,this.local$src=e,this.local$offset=n,this.local$length=i}function At(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$currentIndex=void 0,this.local$memory=e,this.local$startIndex=n,this.local$endIndex=i}function It(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$srcRemaining=void 0,this.local$src=e}function Mt(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$src=e,this.local$offset=n,this.local$length=i}function Lt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$visitor=e}function Dt(t){this.this$ByteChannelSequentialBase=t}function qt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$n=e}function Ft(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function Ut(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Bt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function Ht(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Vt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function Kt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Wt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function Yt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Gt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Jt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Zt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Qt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Xt(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$limit=e,this.local$headerSizeHint=n}function te(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$builder=e,this.local$limit=n}function ee(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$size=e,this.local$headerSizeHint=n}function ne(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$remaining=void 0,this.local$builder=e,this.local$size=n}function ie(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$dst=e}function re(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$dst=e}function oe(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$dst=e,this.local$n=n}function ae(t){return function(){return"Not enough space in the destination buffer to write "+t+" bytes"}}function se(){return"n shouldn't be negative"}function le(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$dst=e,this.local$n=n}function ce(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$dst=e,this.local$n=n}function ue(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$dst=e,this.local$offset=n,this.local$length=i}function pe(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$dst=e,this.local$offset=n,this.local$length=i}function he(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$rc=void 0,this.local$dst=e,this.local$offset=n,this.local$length=i}function fe(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$written=void 0,this.local$dst=e,this.local$offset=n,this.local$length=i}function de(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function _e(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function ye(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function me(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$atLeast=e}function ve(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$max=e}function $e(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$discarded=void 0,this.local$max=e,this.local$discarded0=n}function ge(t,e,n){a.call(this,n),this.exceptionState_0=5,this.$this=t,this.local$consumer=e}function be(t,e,n){a.call(this,n),this.exceptionState_0=1,this.local$this$ByteChannelSequentialBase=t,this.local$size=e}function we(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$sb=void 0,this.local$limit=e}function ke(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$n=e,this.local$block=n}function Se(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$src=e}function xe(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$src=e,this.local$offset=n,this.local$length=i}function Ee(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Ce(t,e,n,i,r,o,s,l,c){a.call(this,c),this.$controller=l,this.exceptionState_0=1,this.local$closure$min=t,this.local$closure$offset=e,this.local$closure$max=n,this.local$closure$destination=i,this.local$closure$destinationOffset=r,this.local$closure$bytesCopied=o,this.local$$receiver=s}function Oe(t,e,n,i,r,o){return function(a,s,l){var c=new Ce(t,e,n,i,r,o,a,this,s);return l?c:c.doResume(null)}}function Ne(t,e,n,i,r,o,s){a.call(this,s),this.exceptionState_0=1,this.$this=t,this.local$bytesCopied=void 0,this.local$destination=e,this.local$destinationOffset=n,this.local$offset=i,this.local$min=r,this.local$max=o}function ze(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.local$$receiver=t,this.local$dst=e,this.local$limit=n}function je(t){return t.close_dbl4no$(null)}function Te(t){m(t,this),this.name="ClosedWriteChannelException"}function Pe(){}function Re(){}function Ae(){}function Ie(){}function Me(t,e,n,i,r,o,s){a.call(this,s),this.$controller=o,this.exceptionState_0=5,this.local$closure$attachJob=t,this.local$closure$channel=e,this.local$closure$block=n,this.local$closure$dispatcher=i,this.local$$receiver=r}function Le(t,e){this.channel_79cwt9$_0=e,this.$delegate_h3p63m$_0=t}function De(t,e){this.delegate_0=t,this.channel_zg1n2y$_0=e}function qe(){}function Fe(){}function Ue(t,e,n){a.call(this,n),this.exceptionState_0=1,this.local$readSession=void 0,this.local$$receiver=t,this.local$desiredSize=e}function Be(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.local$$receiver=t,this.local$buffer=e,this.local$bytesRead=n}function He(t,e,n){a.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$desiredSize=e}function Ve(t,e,n){a.call(this,n),this.exceptionState_0=1,this.local$chunk=void 0,this.local$$receiver=t,this.local$desiredSize=e}function Ke(t,e,n,i){var r=new Ve(t,e,n);return i?r:r.doResume(null)}function We(){}function Ye(){}function Ge(){}function Je(){}function Ze(t,e,n){a.call(this,n),this.exceptionState_0=1,this.local$session=void 0,this.local$$receiver=t,this.local$desiredSpace=e}function Qe(t,e,n){a.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$buffer=e}function Xe(t,e,n){a.call(this,n),this.exceptionState_0=1,this.local$session=t,this.local$desiredSpace=e}function tn(){}function en(t,e,n,i,r){var o={v:n};if(!(o.v>=i)){var a=To(r,1,null);try{for(var s;;){var l=rn(t,e,o.v,i,a);if(!(l>=0))throw R("Check failed.".toString());if(o.v=o.v+l|0,(s=o.v>=i?0:0===l?8:1)<=0)break;a=To(r,s,a)}}finally{Po(r,a)}sn(0,r)}}function nn(t,n,i){void 0===i&&(i=2147483647);var r=e.Long.fromInt(i),o=an(n),a=L((r.compareTo_11rb$(o)<=0?r:o).toInt());return Za(t,n,a,i),a.toString()}function rn(t,e,n,i,r){var o=i-n|0;return Ka(t,new yo(e,n,o),0,o,r)}function on(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length);var o={v:i};if(o.v>=r)return ro;var a=ao().Pool.borrow();try{var s,l=Ka(t,n,o.v,r,a);if(o.v=o.v+l|0,o.v===r){var c=new Int8Array(a.writePosition-a.readPosition|0);return ii(a,c),c}var u=el(0);try{u.appendSingleChunk_pvnryh$(a.duplicate()),ln(t,u,n,o.v,r),s=u.build()}catch(t){throw e.isType(t,E)?(u.release(),t):t}return Fr(s)}finally{a.release_2bs5fo$(ao().Pool)}}function an(t){if(e.isType(t,Li))return t.remaining;if(e.isType(t,un)){var n=t.remaining,i=M;return n.compareTo_11rb$(i)>=0?n:i}return M}function sn(t,e){var n={v:1},i={v:0},r=To(e,1,null);try{for(;;){var o=r,a=o.limit-o.writePosition|0;if(n.v=0,i.v=i.v+(a-(o.limit-o.writePosition|0))|0,!(n.v>0))break;r=To(e,1,r)}}finally{Po(e,r)}return i.v}function ln(t,e,n,i,r){var o={v:i};if(o.v>=r)return 0;var a={v:0},s=To(e,1,null);try{for(var l;;){var c=s,u=c.limit-c.writePosition|0,p=Ka(t,n,o.v,r,c);if(!(p>=0))throw R("Check failed.".toString());if(o.v=o.v+p|0,a.v=a.v+(u-(c.limit-c.writePosition|0))|0,(l=o.v>=r?0:0===p?8:1)<=0)break;s=To(e,l,s)}}finally{Po(e,s)}return a.v=a.v+sn(0,e)|0,a.v}function cn(t){this.closure$message=t,uo.call(this)}function un(t,e,n){_n(),void 0===t&&(t=ao().Empty),void 0===e&&(e=ji(t)),void 0===n&&(n=ao().Pool),this.pool=n,this.state_8q4rcd$_0=new us(t,e),this.noMoreChunksAvailable_2n0tap$_0=!1}function pn(t,e){this.closure$destination=t,this.idx_0=e}function hn(){throw R("It should be no tail remaining bytes if current tail is EmptyBuffer")}function fn(){dn=this}Te.prototype=Object.create(x.prototype),Te.prototype.constructor=Te,os.prototype=Object.create(E.prototype),os.prototype.constructor=os,Pn.prototype=Object.create(W.prototype),Pn.prototype.constructor=Pn,Bn.prototype=Object.create(dl.prototype),Bn.prototype.constructor=Bn,xi.prototype=Object.create(Bo.prototype),xi.prototype.constructor=xi,Pi.prototype=Object.create(W.prototype),Pi.prototype.constructor=Pi,Ai.prototype=Object.create(yn.prototype),Ai.prototype.constructor=Ai,Ri.prototype=Object.create(Ai.prototype),Ri.prototype.constructor=Ri,Mi.prototype=Object.create(Ri.prototype),Mi.prototype.constructor=Mi,Ar.prototype=Object.create(un.prototype),Ar.prototype.constructor=Ar,Bi.prototype=Object.create(Ar.prototype),Bi.prototype.constructor=Bi,Li.prototype=Object.create(Bi.prototype),Li.prototype.constructor=Li,no.prototype=Object.create(Bo.prototype),no.prototype.constructor=no,io.prototype=Object.create(Bo.prototype),io.prototype.constructor=io,Gr.prototype=Object.create($n.prototype),Gr.prototype.constructor=Gr,Co.prototype=Object.create(W.prototype),Co.prototype.constructor=Co,Yo.prototype=Object.create(wt.prototype),Yo.prototype.constructor=Yo,Ha.prototype=Object.create(Ba.prototype),Ha.prototype.constructor=Ha,Ga.prototype=Object.create(Ya.prototype),Ga.prototype.constructor=Ga,rs.prototype=Object.create(La.prototype),rs.prototype.constructor=rs,fs.prototype=Object.create(dt.prototype),fs.prototype.constructor=fs,qs.prototype=Object.create(dl.prototype),qs.prototype.constructor=qs,Us.prototype=Object.create(Bo.prototype),Us.prototype.constructor=Us,Is.prototype=Object.create(Gr.prototype),Is.prototype.constructor=Is,rl.prototype=Object.create(W.prototype),rl.prototype.constructor=rl,al.prototype=Object.create(rl.prototype),al.prototype.constructor=al,gt.$metadata$={kind:r,simpleName:"ByteChannel",interfaces:[ra,Xo]},bt.prototype=Object.create(uo.prototype),bt.prototype.constructor=bt,bt.prototype.doFail=function(){throw b(this.closure$message())},bt.$metadata$={kind:h,interfaces:[uo]},Object.defineProperty(wt.prototype,"autoFlush",{get:function(){return this.autoFlush_tqevpj$_0}}),Object.defineProperty(wt.prototype,"closed",{configurable:!0,get:function(){return this.state_9883ul$_0.closed},set:function(t){this.state_9883ul$_0.closed=t}}),wt.prototype.totalPending_82umvh$_0=function(){return this.availableForRead+this.writable.size|0},Object.defineProperty(wt.prototype,"flushSize_sv6emv$_0",{configurable:!0,get:function(){return this.flushBuffer_1r7aq2$_0.size}}),Object.defineProperty(wt.prototype,"availableForRead",{configurable:!0,get:function(){return this.flushSize_sv6emv$_0+this.readable.remaining.toInt()|0}}),Object.defineProperty(wt.prototype,"availableForWrite",{configurable:!0,get:function(){var t=4088-(this.availableForRead+this.writable.size|0)|0;return g.max(0,t)}}),Object.defineProperty(wt.prototype,"readByteOrder",{configurable:!0,get:function(){return this.state_9883ul$_0.readByteOrder},set:function(t){this.state_9883ul$_0.readByteOrder=t}}),Object.defineProperty(wt.prototype,"writeByteOrder",{configurable:!0,get:function(){return this.state_9883ul$_0.writeByteOrder},set:function(t){this.state_9883ul$_0.writeByteOrder=t}}),Object.defineProperty(wt.prototype,"isClosedForRead",{configurable:!0,get:function(){var t=this.closed;return t&&(t=this.readable.endOfInput),t&&0===this.flushSize_sv6emv$_0&&this.writable.isEmpty}}),Object.defineProperty(wt.prototype,"isClosedForWrite",{configurable:!0,get:function(){return this.closed}}),Object.defineProperty(wt.prototype,"_totalBytesRead_mx8dwu$_0",{configurable:!0,get:function(){return this.state_9883ul$_0.totalBytesRead},set:function(t){this.state_9883ul$_0.totalBytesRead=t}}),Object.defineProperty(wt.prototype,"totalBytesRead",{configurable:!0,get:function(){return this.state_9883ul$_0.totalBytesRead}}),Object.defineProperty(wt.prototype,"_totalBytesWritten_s86f3f$_0",{configurable:!0,get:function(){return this.state_9883ul$_0.totalBytesWritten},set:function(t){this.state_9883ul$_0.totalBytesWritten=t}}),Object.defineProperty(wt.prototype,"totalBytesWritten",{configurable:!0,get:function(){return this.state_9883ul$_0.totalBytesWritten}}),Object.defineProperty(wt.prototype,"closedCause",{configurable:!0,get:function(){return this.state_9883ul$_0.closedCause},set:function(t){this.state_9883ul$_0.closedCause=t}}),kt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},kt.prototype=Object.create(a.prototype),kt.prototype.constructor=kt,kt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.$this.availableForWrite>=this.local$count||this.$this.closed){this.state_0=5;continue}if(this.$this.flushImpl_t0lzva$_0()){this.state_0=4;continue}if(this.state_0=3,this.result_0=this.$this.slot_2l2jew$_0.sleep(this),this.result_0===o)return o;continue;case 3:this.state_0=4;continue;case 4:this.state_0=2;continue;case 5:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.awaitAtLeastNBytesAvailableForWrite_kcn2v3$=function(t,e,n){var i=new kt(this,t,e);return n?i:i.doResume(null)},St.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},St.prototype=Object.create(a.prototype),St.prototype.constructor=St,St.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.$this.availableForRead>=this.local$count||this.$this.closed){this.state_0=4;continue}if(this.state_0=3,this.result_0=this.$this.slot_2l2jew$_0.sleep(this),this.result_0===o)return o;continue;case 3:this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.awaitAtLeastNBytesAvailableForRead_kcn2v3$=function(t,e,n){var i=new St(this,t,e);return n?i:i.doResume(null)},wt.prototype.flush=function(){this.flushImpl_t0lzva$_0()},wt.prototype.flushImpl_t0lzva$_0=function(){return!this.writable.isEmpty&&(this.flushWrittenBytes_2bgxqi$_0(),this.slot_2l2jew$_0.resume(),!0)},wt.prototype.flushWrittenBytes_2bgxqi$_0=function(){var t=c(this.writable.stealAll_8be2vx$());this.flushBuffer_1r7aq2$_0.writeChunkBuffer_pvnryh$(t)},wt.prototype.prepareFlushedBytes=function(){Oo(this.readable,this.flushBuffer_1r7aq2$_0)},wt.prototype.ensureNotClosed_ozgwi5$_0=function(){var t;if(this.closed)throw null!=(t=this.closedCause)?t:new Te("Channel is already closed")},wt.prototype.ensureNotFailed_7bddlw$_0=function(){var t;if(null!=(t=this.closedCause))throw t},wt.prototype.ensureNotFailed_2bmfsh$_0=function(t){var e;if(null!=(e=this.closedCause))throw t.release(),e},xt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},xt.prototype=Object.create(a.prototype),xt.prototype.constructor=xt,xt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return this.$this.writable.writeByte_s8j3t7$(this.local$b),void this.$this.afterWrite_za3lpa$(1);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeByte_s8j3t7$=function(t,e,n){var i=new xt(this,t,e);return n?i:i.doResume(null)},wt.prototype.reverseWrite_hkpayy$_0=function(t,e){return this.writeByteOrder===_s()?t():e()},Et.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Et.prototype=Object.create(a.prototype),Et.prototype.constructor=Et,Et.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(2,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return Cr(this.$this.writable,this.$this.writeByteOrder===_s()?this.local$s:aa(this.local$s)),void this.$this.afterWrite_za3lpa$(2);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeShort_mq22fl$=function(t,e,n){var i=new Et(this,t,e);return n?i:i.doResume(null)},Ct.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ct.prototype=Object.create(a.prototype),Ct.prototype.constructor=Ct,Ct.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(4,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return Or(this.$this.writable,this.$this.writeByteOrder===_s()?this.local$i:sa(this.local$i)),void this.$this.afterWrite_za3lpa$(4);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeInt_za3lpa$=function(t,e,n){var i=new Ct(this,t,e);return n?i:i.doResume(null)},Ot.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ot.prototype=Object.create(a.prototype),Ot.prototype.constructor=Ot,Ot.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(8,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return jr(this.$this.writable,this.$this.writeByteOrder===_s()?this.local$l:la(this.local$l)),void this.$this.afterWrite_za3lpa$(8);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeLong_s8cxhz$=function(t,e,n){var i=new Ot(this,t,e);return n?i:i.doResume(null)},Nt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Nt.prototype=Object.create(a.prototype),Nt.prototype.constructor=Nt,Nt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(4,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return Pr(this.$this.writable,this.$this.writeByteOrder===_s()?this.local$f:ca(this.local$f)),void this.$this.afterWrite_za3lpa$(4);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeFloat_mx4ult$=function(t,e,n){var i=new Nt(this,t,e);return n?i:i.doResume(null)},zt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},zt.prototype=Object.create(a.prototype),zt.prototype.constructor=zt,zt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(8,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return Rr(this.$this.writable,this.$this.writeByteOrder===_s()?this.local$d:ua(this.local$d)),void this.$this.afterWrite_za3lpa$(8);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeDouble_14dthe$=function(t,e,n){var i=new zt(this,t,e);return n?i:i.doResume(null)},jt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},jt.prototype=Object.create(a.prototype),jt.prototype.constructor=jt,jt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:var t=this.local$packet.remaining.toInt();return this.$this.writable.writePacket_3uq2w4$(this.local$packet),void this.$this.afterWrite_za3lpa$(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writePacket_3uq2w4$=function(t,e,n){var i=new jt(this,t,e);return n?i:i.doResume(null)},Tt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Tt.prototype=Object.create(a.prototype),Tt.prototype.constructor=Tt,Tt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.writeFully_b4g5fm$(e.isType(t=this.local$src,$n)?t:p(),this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeFully_99qa0s$=function(t,e,n){var i=new Tt(this,t,e);return n?i:i.doResume(null)},Pt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Pt.prototype=Object.create(a.prototype),Pt.prototype.constructor=Pt,Pt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:var t=this.local$src.writePosition-this.local$src.readPosition|0;return kr(this.$this.writable,this.local$src),void this.$this.afterWrite_za3lpa$(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeFully_b4g5fm$=function(t,e,n){var i=new Pt(this,t,e);return n?i:i.doResume(null)},Rt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Rt.prototype=Object.create(a.prototype),Rt.prototype.constructor=Rt,Rt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$currentIndex=this.local$offset,this.local$endIndex=this.local$offset+this.local$length|0,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$currentIndex>=this.local$endIndex){this.state_0=4;continue}if(this.state_0=3,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 3:var t=this.$this.availableForWrite,e=this.local$endIndex-this.local$currentIndex|0,n=g.min(t,e);mr(this.$this.writable,this.local$src,this.local$currentIndex,n),this.local$currentIndex=this.local$currentIndex+n|0,this.$this.afterWrite_za3lpa$(n),this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeFully_mj6st8$=function(t,e,n,i,r){var o=new Rt(this,t,e,n,i);return r?o:o.doResume(null)},At.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},At.prototype=Object.create(a.prototype),At.prototype.constructor=At,At.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$currentIndex=this.local$startIndex,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$currentIndex>=this.local$endIndex){this.state_0=4;continue}if(this.state_0=3,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 3:var t=this.$this.availableForWrite,e=this.local$endIndex-this.local$currentIndex|0,n=g.min(t,e);Sr(this.$this.writable,this.local$memory,this.local$currentIndex,n),this.local$currentIndex=this.local$currentIndex+n|0,this.$this.afterWrite_za3lpa$(n),this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeFully_9etqdk$=function(t,e,n,i,r){var o=new At(this,t,e,n,i);return r?o:o.doResume(null)},It.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},It.prototype=Object.create(a.prototype),It.prototype.constructor=It,It.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$srcRemaining=this.local$src.writePosition-this.local$src.readPosition|0,0===this.local$srcRemaining)return 0;this.state_0=2;continue;case 1:throw this.exception_0;case 2:var t=this.$this.availableForWrite,e=g.min(this.local$srcRemaining,t);if(0===e){if(this.state_0=3,this.result_0=this.$this.writeAvailableSuspend_5fukw0$_0(this.local$src,this),this.result_0===o)return o;continue}kr(this.$this.writable,this.local$src,e),this.$this.afterWrite_za3lpa$(e),this.local$tmp$=e,this.state_0=4;continue;case 3:this.local$tmp$=this.result_0,this.state_0=4;continue;case 4:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeAvailable_99qa0s$=function(t,e,n){var i=new It(this,t,e);return n?i:i.doResume(null)},Mt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Mt.prototype=Object.create(a.prototype),Mt.prototype.constructor=Mt,Mt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(0===this.local$length)return 0;this.state_0=2;continue;case 1:throw this.exception_0;case 2:var t=this.$this.availableForWrite,e=g.min(this.local$length,t);if(0===e){if(this.state_0=3,this.result_0=this.$this.writeAvailableSuspend_1zn44g$_0(this.local$src,this.local$offset,this.local$length,this),this.result_0===o)return o;continue}mr(this.$this.writable,this.local$src,this.local$offset,e),this.$this.afterWrite_za3lpa$(e),this.local$tmp$=e,this.state_0=4;continue;case 3:this.local$tmp$=this.result_0,this.state_0=4;continue;case 4:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeAvailable_mj6st8$=function(t,e,n,i,r){var o=new Mt(this,t,e,n,i);return r?o:o.doResume(null)},Lt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Lt.prototype=Object.create(a.prototype),Lt.prototype.constructor=Lt,Lt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=this.$this.beginWriteSession();if(this.state_0=2,this.result_0=this.local$visitor(t,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeSuspendSession_8dv01$=function(t,e,n){var i=new Lt(this,t,e);return n?i:i.doResume(null)},Dt.prototype.request_za3lpa$=function(t){var n;return 0===this.this$ByteChannelSequentialBase.availableForWrite?null:e.isType(n=this.this$ByteChannelSequentialBase.writable.prepareWriteHead_za3lpa$(t),Is)?n:p()},Dt.prototype.written_za3lpa$=function(t){this.this$ByteChannelSequentialBase.writable.afterHeadWrite(),this.this$ByteChannelSequentialBase.afterWrite_za3lpa$(t)},Dt.prototype.flush=function(){this.this$ByteChannelSequentialBase.flush()},qt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},qt.prototype=Object.create(a.prototype),qt.prototype.constructor=qt,qt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.this$ByteChannelSequentialBase.availableForWrite=this.local$limit.toNumber()){this.state_0=5;continue}var t=this.local$limit.subtract(e.Long.fromInt(this.local$builder.size)),n=this.$this.readable.remaining,i=t.compareTo_11rb$(n)<=0?t:n;if(this.local$builder.writePacket_pi0yjl$(this.$this.readable,i),this.$this.afterRead_za3lpa$(i.toInt()),this.$this.ensureNotFailed_2bmfsh$_0(this.local$builder),this.$this.isClosedForRead||this.local$builder.size===this.local$limit.toInt()){this.state_0=5;continue}this.state_0=3;continue;case 3:if(this.state_0=4,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===o)return o;continue;case 4:this.state_0=2;continue;case 5:return this.$this.ensureNotFailed_2bmfsh$_0(this.local$builder),this.local$builder.build();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readRemainingSuspend_gfhva8$_0=function(t,e,n,i){var r=new te(this,t,e,n);return i?r:r.doResume(null)},ee.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ee.prototype=Object.create(a.prototype),ee.prototype.constructor=ee,ee.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=el(this.local$headerSizeHint),n=this.local$size,i=e.Long.fromInt(n),r=this.$this.readable.remaining,a=(i.compareTo_11rb$(r)<=0?i:r).toInt();if(n=n-a|0,t.writePacket_f7stg6$(this.$this.readable,a),this.$this.afterRead_za3lpa$(a),n>0){if(this.state_0=2,this.result_0=this.$this.readPacketSuspend_2ns5o1$_0(t,n,this),this.result_0===o)return o;continue}this.local$tmp$=t.build(),this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readPacket_vux9f0$=function(t,e,n,i){var r=new ee(this,t,e,n);return i?r:r.doResume(null)},ne.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ne.prototype=Object.create(a.prototype),ne.prototype.constructor=ne,ne.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$remaining=this.local$size,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$remaining<=0){this.state_0=5;continue}var t=e.Long.fromInt(this.local$remaining),n=this.$this.readable.remaining,i=(t.compareTo_11rb$(n)<=0?t:n).toInt();if(this.local$remaining=this.local$remaining-i|0,this.local$builder.writePacket_f7stg6$(this.$this.readable,i),this.$this.afterRead_za3lpa$(i),this.local$remaining>0){if(this.state_0=3,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===o)return o;continue}this.state_0=4;continue;case 3:this.state_0=4;continue;case 4:this.state_0=2;continue;case 5:return this.local$builder.build();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readPacketSuspend_2ns5o1$_0=function(t,e,n,i){var r=new ne(this,t,e,n);return i?r:r.doResume(null)},wt.prototype.readAvailableClosed=function(){var t;if(null!=(t=this.closedCause))throw t;return-1},wt.prototype.readAvailable_99qa0s$=function(t,n){var i;return this.readAvailable_lh221x$(e.isType(i=t,$n)?i:p(),n)},ie.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ie.prototype=Object.create(a.prototype),ie.prototype.constructor=ie,ie.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(null!=this.$this.closedCause)throw c(this.$this.closedCause);if(this.$this.readable.canRead()){var t=e.Long.fromInt(this.local$dst.limit-this.local$dst.writePosition|0),n=this.$this.readable.remaining,i=(t.compareTo_11rb$(n)<=0?t:n).toInt();return Qi(this.$this.readable,this.local$dst,i),this.$this.afterRead_za3lpa$(i),i}if(this.$this.closed)return this.$this.readAvailableClosed();if(this.local$dst.limit>this.local$dst.writePosition){if(this.state_0=2,this.result_0=this.$this.readAvailableSuspend_b4eait$_0(this.local$dst,this),this.result_0===o)return o;continue}return 0;case 1:throw this.exception_0;case 2:return this.result_0;case 3:this.state_0=4;continue;case 4:this.state_0=5;continue;case 5:this.state_0=6;continue;case 6:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readAvailable_lh221x$=function(t,e,n){var i=new ie(this,t,e);return n?i:i.doResume(null)},re.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},re.prototype=Object.create(a.prototype),re.prototype.constructor=re,re.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.readAvailable_lh221x$(this.local$dst,this),this.result_0===o)return o;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readAvailableSuspend_b4eait$_0=function(t,e,n){var i=new re(this,t,e);return n?i:i.doResume(null)},oe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},oe.prototype=Object.create(a.prototype),oe.prototype.constructor=oe,oe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.readFully_bkznnu$_0(e.isType(t=this.local$dst,$n)?t:p(),this.local$n,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readFully_qr0era$=function(t,e,n,i){var r=new oe(this,t,e,n);return i?r:r.doResume(null)},le.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},le.prototype=Object.create(a.prototype),le.prototype.constructor=le,le.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$n<=(this.local$dst.limit-this.local$dst.writePosition|0)||new bt(ae(this.local$n)).doFail(),this.local$n>=0||new bt(se).doFail(),null!=this.$this.closedCause)throw c(this.$this.closedCause);if(this.$this.readable.remaining.toNumber()>=this.local$n){var t=(Qi(this.$this.readable,this.local$dst,this.local$n),u);this.$this.afterRead_za3lpa$(this.local$n),this.local$tmp$=t,this.state_0=4;continue}if(this.$this.closed)throw new al("Channel is closed and not enough bytes available: required "+this.local$n+" but "+this.$this.availableForRead+" available");if(this.state_0=2,this.result_0=this.$this.readFullySuspend_8xotw2$_0(this.local$dst,this.local$n,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:this.state_0=4;continue;case 4:this.state_0=5;continue;case 5:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readFully_bkznnu$_0=function(t,e,n,i){var r=new le(this,t,e,n);return i?r:r.doResume(null)},ce.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ce.prototype=Object.create(a.prototype),ce.prototype.constructor=ce,ce.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitSuspend_za3lpa$(this.local$n,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.readFully_bkznnu$_0(this.local$dst,this.local$n,this),this.result_0===o)return o;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readFullySuspend_8xotw2$_0=function(t,e,n,i){var r=new ce(this,t,e,n);return i?r:r.doResume(null)},ue.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ue.prototype=Object.create(a.prototype),ue.prototype.constructor=ue,ue.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.readable.canRead()){var t=e.Long.fromInt(this.local$length),n=this.$this.readable.remaining,i=(t.compareTo_11rb$(n)<=0?t:n).toInt();return Ki(this.$this.readable,this.local$dst,this.local$offset,i),this.$this.afterRead_za3lpa$(i),i}if(this.$this.closed)return this.$this.readAvailableClosed();if(this.state_0=2,this.result_0=this.$this.readAvailableSuspend_v6ah9b$_0(this.local$dst,this.local$offset,this.local$length,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return this.result_0;case 3:this.state_0=4;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readAvailable_mj6st8$=function(t,e,n,i,r){var o=new ue(this,t,e,n,i);return r?o:o.doResume(null)},pe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},pe.prototype=Object.create(a.prototype),pe.prototype.constructor=pe,pe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.readAvailable_mj6st8$(this.local$dst,this.local$offset,this.local$length,this),this.result_0===o)return o;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readAvailableSuspend_v6ah9b$_0=function(t,e,n,i,r){var o=new pe(this,t,e,n,i);return r?o:o.doResume(null)},he.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},he.prototype=Object.create(a.prototype),he.prototype.constructor=he,he.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.readAvailable_mj6st8$(this.local$dst,this.local$offset,this.local$length,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.local$rc=this.result_0,this.local$rc===this.local$length)return;this.state_0=3;continue;case 3:if(-1===this.local$rc)throw new al("Unexpected end of stream");if(this.state_0=4,this.result_0=this.$this.readFullySuspend_ayq7by$_0(this.local$dst,this.local$offset+this.local$rc|0,this.local$length-this.local$rc|0,this),this.result_0===o)return o;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readFully_mj6st8$=function(t,e,n,i,r){var o=new he(this,t,e,n,i);return r?o:o.doResume(null)},fe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},fe.prototype=Object.create(a.prototype),fe.prototype.constructor=fe,fe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$written=0,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$written>=this.local$length){this.state_0=4;continue}if(this.state_0=3,this.result_0=this.$this.readAvailable_mj6st8$(this.local$dst,this.local$offset+this.local$written|0,this.local$length-this.local$written|0,this),this.result_0===o)return o;continue;case 3:var t=this.result_0;if(-1===t)throw new al("Unexpected end of stream");this.local$written=this.local$written+t|0,this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readFullySuspend_ayq7by$_0=function(t,e,n,i,r){var o=new fe(this,t,e,n,i);return r?o:o.doResume(null)},de.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},de.prototype=Object.create(a.prototype),de.prototype.constructor=de,de.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.readable.canRead()){var t=this.$this.readable.readByte()===_(1);this.$this.afterRead_za3lpa$(1),this.local$tmp$=t,this.state_0=3;continue}if(this.state_0=2,this.result_0=this.$this.readBooleanSlow_cbbszf$_0(this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readBoolean=function(t,e){var n=new de(this,t);return e?n:n.doResume(null)},_e.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},_e.prototype=Object.create(a.prototype),_e.prototype.constructor=_e,_e.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.$this.checkClosed_ldvyyk$_0(1),this.state_0=3,this.result_0=this.$this.readBoolean(this),this.result_0===o)return o;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readBooleanSlow_cbbszf$_0=function(t,e){var n=new _e(this,t);return e?n:n.doResume(null)},Object.defineProperty(wt.prototype,"lastReadAvailable_1j890x$_0",{configurable:!0,get:function(){return this.state_9883ul$_0.lastReadAvailable},set:function(t){this.state_9883ul$_0.lastReadAvailable=t}}),Object.defineProperty(wt.prototype,"lastReadView_92ta1h$_0",{configurable:!0,get:function(){return this.state_9883ul$_0.lastReadView},set:function(t){this.state_9883ul$_0.lastReadView=t}}),wt.prototype.completeReading_um9rnf$_0=function(){var t=this.lastReadView_92ta1h$_0,e=t.writePosition-t.readPosition|0,n=this.lastReadAvailable_1j890x$_0-e|0;this.lastReadView_92ta1h$_0!==kn().Empty&&zo(this.readable,this.lastReadView_92ta1h$_0),n>0&&this.afterRead_za3lpa$(n),this.lastReadAvailable_1j890x$_0=0,this.lastReadView_92ta1h$_0=ao().Empty},wt.prototype.await_za3lpa$$default=function(t,e){var n;return t>=0||new bt((n=t,function(){return"atLeast parameter shouldn't be negative: "+n})).doFail(),t<=i.toNumber()||new bt(function(t){return function(){return"atLeast parameter shouldn't be larger than max buffer size of "+i.toString()+": "+t}}(t)).doFail(),this.completeReading_um9rnf$_0(),0===t?!this.isClosedForRead:this.readable.remaining.toNumber()>=t||this.awaitSuspend_za3lpa$(t,e)},ye.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ye.prototype=Object.create(a.prototype),ye.prototype.constructor=ye,ye.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.readable.endOfInput){if(this.state_0=2,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===o)return o;continue}return!0;case 1:throw this.exception_0;case 2:return this.result_0;case 3:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.awaitInternalAtLeast1_8be2vx$=function(t,e){var n=new ye(this,t);return e?n:n.doResume(null)},me.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},me.prototype=Object.create(a.prototype),me.prototype.constructor=me,me.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(!(this.local$atLeast>=0))throw b("Failed requirement.".toString());if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForRead_kcn2v3$(this.local$atLeast,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.$this.prepareFlushedBytes(),null!=(t=this.$this.closedCause))throw t;return!this.$this.isClosedForRead&&this.$this.availableForRead>=this.local$atLeast;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.awaitSuspend_za3lpa$=function(t,e,n){var i=new me(this,t,e);return n?i:i.doResume(null)},wt.prototype.discard_za3lpa$=function(t){var e;if(null!=(e=this.closedCause))throw e;if(0===t)return 0;var n=this.readable.discard_za3lpa$(t);return this.afterRead_za3lpa$(t),this.requestNextView_id8q5z$_0(1),n},wt.prototype.request_za3lpa$$default=function(t){var e;if(null!=(e=this.closedCause))throw e;return this.completeReading_um9rnf$_0(),this.requestNextView_id8q5z$_0(t)},wt.prototype.requestNextView_id8q5z$_0=function(t){var n;this.readable.endOfInput&&this.prepareFlushedBytes();var i=null==(n=this.readable.prepareReadHead_za3lpa$(t))||e.isType(n,Is)?n:p();return null==i?(this.lastReadView_92ta1h$_0=ao().Empty,this.lastReadAvailable_1j890x$_0=0):(this.lastReadView_92ta1h$_0=i,this.lastReadAvailable_1j890x$_0=i.writePosition-i.readPosition|0),i},ve.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ve.prototype=Object.create(a.prototype),ve.prototype.constructor=ve,ve.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=this.$this.readable.discard_s8cxhz$(this.local$max);if(d(t,this.local$max)||this.$this.isClosedForRead)return this.$this.ensureNotFailed_7bddlw$_0(),t;if(this.state_0=2,this.result_0=this.$this.discardSuspend_7c0j1e$_0(this.local$max,t,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.discard_s8cxhz$=function(t,e,n){var i=new ve(this,t,e);return n?i:i.doResume(null)},$e.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},$e.prototype=Object.create(a.prototype),$e.prototype.constructor=$e,$e.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$discarded=this.local$discarded0,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.await_za3lpa$(1,this),this.result_0===o)return o;continue;case 3:if(this.result_0){this.state_0=4;continue}this.state_0=5;continue;case 4:if(this.local$discarded=this.local$discarded.add(this.$this.readable.discard_s8cxhz$(this.local$max.subtract(this.local$discarded))),this.local$discarded.compareTo_11rb$(this.local$max)>=0||this.$this.isClosedForRead){this.state_0=5;continue}this.state_0=2;continue;case 5:return this.$this.ensureNotFailed_7bddlw$_0(),this.local$discarded;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.discardSuspend_7c0j1e$_0=function(t,e,n,i){var r=new $e(this,t,e,n);return i?r:r.doResume(null)},wt.prototype.readSession_m70re0$=function(t){try{t(this)}finally{this.completeReading_um9rnf$_0()}},wt.prototype.startReadSession=function(){return this},wt.prototype.endReadSession=function(){this.completeReading_um9rnf$_0()},ge.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ge.prototype=Object.create(a.prototype),ge.prototype.constructor=ge,ge.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=3,this.state_0=1,this.result_0=this.local$consumer(this.$this,this),this.result_0===o)return o;continue;case 1:this.exceptionState_0=5,this.finallyPath_0=[2],this.state_0=4;continue;case 2:return;case 3:this.finallyPath_0=[5],this.state_0=4;continue;case 4:this.exceptionState_0=5,this.$this.completeReading_um9rnf$_0(),this.state_0=this.finallyPath_0.shift();continue;case 5:throw this.exception_0;default:throw this.state_0=5,new Error("State Machine Unreachable execution")}}catch(t){if(5===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readSuspendableSession_kiqllg$=function(t,e,n){var i=new ge(this,t,e);return n?i:i.doResume(null)},be.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},be.prototype=Object.create(a.prototype),be.prototype.constructor=be,be.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$this$ByteChannelSequentialBase.afterRead_za3lpa$(this.local$size),this.state_0=2,this.result_0=this.local$this$ByteChannelSequentialBase.await_za3lpa$(this.local$size,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return this.result_0?this.local$this$ByteChannelSequentialBase.readable:null;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readUTF8LineTo_yhx0yw$=function(t,e,n){if(this.isClosedForRead){var i=this.closedCause;if(null!=i)throw i;return!1}return fo(t,e,(r=this,function(t,e,n){var i=new be(r,t,e);return n?i:i.doResume(null)}),n);var r},we.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},we.prototype=Object.create(a.prototype),we.prototype.constructor=we,we.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$sb=y(),this.state_0=2,this.result_0=this.$this.readUTF8LineTo_yhx0yw$(this.local$sb,this.local$limit,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.result_0){this.state_0=3;continue}return null;case 3:return this.local$sb.toString();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readUTF8Line_za3lpa$=function(t,e,n){var i=new we(this,t,e);return n?i:i.doResume(null)},wt.prototype.cancel_dbl4no$=function(t){return null==this.closedCause&&!this.closed&&this.close_dbl4no$(null!=t?t:m("Channel cancelled"))},wt.prototype.close_dbl4no$=function(t){return!this.closed&&null==this.closedCause&&(this.closedCause=t,this.closed=!0,null!=t?(this.readable.release(),this.writable.release(),this.flushBuffer_1r7aq2$_0.release()):this.flush(),this.slot_2l2jew$_0.cancel_dbl4no$(t),!0)},wt.prototype.transferTo_pxvbjg$=function(t,e){var n,i=this.readable.remaining;return i.compareTo_11rb$(e)<=0?(t.writable.writePacket_3uq2w4$(this.readable),t.afterWrite_za3lpa$(i.toInt()),this.afterRead_za3lpa$(i.toInt()),n=i):n=f,n},ke.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ke.prototype=Object.create(a.prototype),ke.prototype.constructor=ke,ke.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.awaitSuspend_za3lpa$(this.local$n,this),this.result_0===o)return o;continue;case 3:this.$this.readable.hasBytes_za3lpa$(this.local$n)&&this.local$block(),this.$this.checkClosed_ldvyyk$_0(this.local$n),this.state_0=2;continue;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readNSlow_2lkm5r$_0=function(t,e,n,i){var r=new ke(this,t,e,n);return i?r:r.doResume(null)},Se.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Se.prototype=Object.create(a.prototype),Se.prototype.constructor=Se,Se.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.writeAvailable_99qa0s$(this.local$src,this),this.result_0===o)return o;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeAvailableSuspend_5fukw0$_0=function(t,e,n){var i=new Se(this,t,e);return n?i:i.doResume(null)},xe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},xe.prototype=Object.create(a.prototype),xe.prototype.constructor=xe,xe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.writeAvailable_mj6st8$(this.local$src,this.local$offset,this.local$length,this),this.result_0===o)return o;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeAvailableSuspend_1zn44g$_0=function(t,e,n,i,r){var o=new xe(this,t,e,n,i);return r?o:o.doResume(null)},wt.prototype.afterWrite=function(){this.afterWrite_za3lpa$(0)},wt.prototype.afterWrite_za3lpa$=function(t){this._totalBytesWritten_s86f3f$_0=this._totalBytesWritten_s86f3f$_0.add(e.Long.fromInt(t)),this.closed&&(this.writable.release(),this.ensureNotClosed_ozgwi5$_0()),(this.autoFlush||0===this.availableForWrite)&&this.flush()},Ee.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ee.prototype=Object.create(a.prototype),Ee.prototype.constructor=Ee,Ee.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.flush(),this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return void this.$this.ensureNotClosed_ozgwi5$_0();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.awaitFreeSpace=function(t,e){var n=new Ee(this,t);return e?n:n.doResume(null)},Ce.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ce.prototype=Object.create(a.prototype),Ce.prototype.constructor=Ce,Ce.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=v(this.local$closure$min.add(this.local$closure$offset),i).toInt();if(this.state_0=2,this.result_0=this.local$$receiver.await_za3lpa$(n,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:var r=null!=(t=this.local$$receiver.request_za3lpa$(1))?t:Ys().Empty;if((r.writePosition-r.readPosition|0)>this.local$closure$offset.toNumber()){var a=this.local$closure$bytesCopied,s=e.Long.fromInt(r.writePosition-r.readPosition|0).subtract(this.local$closure$offset),l=this.local$closure$max,c=e.Long.fromInt(this.local$closure$destination.view.byteLength).subtract(this.local$closure$destinationOffset),p=l.compareTo_11rb$(c)<=0?l:c;return a.v=s.compareTo_11rb$(p)<=0?s:p,r.memory.copyTo_q2ka7j$(this.local$closure$destination,this.local$closure$offset,this.local$closure$bytesCopied.v,this.local$closure$destinationOffset),u}this.state_0=3;continue;case 3:return u;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ne.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ne.prototype=Object.create(a.prototype),Ne.prototype.constructor=Ne,Ne.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$bytesCopied={v:f},this.state_0=2,this.result_0=this.$this.readSuspendableSession_kiqllg$(Oe(this.local$min,this.local$offset,this.local$max,this.local$destination,this.local$destinationOffset,this.local$bytesCopied),this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return this.local$bytesCopied.v;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.peekTo_afjyek$$default=function(t,e,n,i,r,o,a){var s=new Ne(this,t,e,n,i,r,o);return a?s:s.doResume(null)},wt.$metadata$={kind:h,simpleName:"ByteChannelSequentialBase",interfaces:[Je,We,Fe,gt,ra,Xo]},w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.discardExact_b56lbm$",k((function(){var n=e.equals,i=t.io.ktor.utils.io.errors.EOFException;return function(t,r,o){if(e.suspendCall(t.discard_s8cxhz$(r,e.coroutineReceiver())),!n(e.coroutineResult(e.coroutineReceiver()),r))throw new i("Unable to discard "+r.toString()+" bytes")}}))),ze.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ze.prototype=Object.create(a.prototype),ze.prototype.constructor=ze,ze.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(void 0===this.local$limit&&(this.local$limit=s),this.state_0=2,this.result_0=Wo(this.local$$receiver,this.local$dst,this.local$limit,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return je(this.local$dst),t;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.writePacket_c7ucec$",k((function(){var n=t.io.ktor.utils.io.core.BytePacketBuilder_za3lpa$,i=Error;return function(t,r,o,a){var s;void 0===r&&(r=0);var l=n(r);try{o(l),s=l.build()}catch(t){throw e.isType(t,i)?(l.release(),t):t}return e.suspendCall(t.writePacket_3uq2w4$(s,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),Te.$metadata$={kind:h,simpleName:"ClosedWriteChannelException",interfaces:[x]},w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readShort_e2pdtf$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_5vcgdc$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readShort(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readInt_e2pdtf$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_s8ev3n$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readInt(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readLong_e2pdtf$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_mts6qi$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readLong(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readFloat_e2pdtf$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_81szk$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readFloat(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readDouble_e2pdtf$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_yrwdxr$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readDouble(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readShortLittleEndian_3dmw3p$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_5vcgdc$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readShort(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readIntLittleEndian_3dmw3p$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_s8ev3n$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readInt(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readLongLittleEndian_3dmw3p$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_mts6qi$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readLong(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readFloatLittleEndian_3dmw3p$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_81szk$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readFloat(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readDoubleLittleEndian_3dmw3p$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_yrwdxr$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readDouble(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),Pe.$metadata$={kind:r,simpleName:"ReaderJob",interfaces:[C]},Re.$metadata$={kind:r,simpleName:"WriterJob",interfaces:[C]},Ae.$metadata$={kind:r,simpleName:"ReaderScope",interfaces:[O]},Ie.$metadata$={kind:r,simpleName:"WriterScope",interfaces:[O]},Me.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Me.prototype=Object.create(a.prototype),Me.prototype.constructor=Me,Me.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;this.local$closure$attachJob&&this.local$closure$channel.attachJob_dqr1mp$(c(this.local$$receiver.coroutineContext.get_j3r2sn$(C.Key)));var n=e.isType(t=new Le(this.local$$receiver,this.local$closure$channel),O)?t:p();if(this.exceptionState_0=2,this.state_0=1,this.result_0=this.local$closure$block(n,this),this.result_0===o)return o;continue;case 1:return this.result_0;case 2:this.exceptionState_0=5;var i=this.exception_0;if(e.isType(i,E)){if(!d(this.local$closure$dispatcher,z.Dispatchers.Unconfined)&&null!=this.local$closure$dispatcher)throw i;return this.local$closure$channel.cancel_dbl4no$(i)}throw i;case 3:this.state_0=4;continue;case 4:return;case 5:throw this.exception_0;default:throw this.state_0=5,new Error("State Machine Unreachable execution")}}catch(t){if(5===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(Le.prototype,"channel",{get:function(){return this.channel_79cwt9$_0}}),Object.defineProperty(Le.prototype,"coroutineContext",{configurable:!0,get:function(){return this.$delegate_h3p63m$_0.coroutineContext}}),Le.$metadata$={kind:h,simpleName:"ChannelScope",interfaces:[Ie,Ae,O]},Object.defineProperty(De.prototype,"channel",{get:function(){return this.channel_zg1n2y$_0}}),De.prototype.toString=function(){return"ChannelJob["+this.delegate_0+"]"},Object.defineProperty(De.prototype,"children",{configurable:!0,get:function(){return this.delegate_0.children}}),Object.defineProperty(De.prototype,"isActive",{configurable:!0,get:function(){return this.delegate_0.isActive}}),Object.defineProperty(De.prototype,"isCancelled",{configurable:!0,get:function(){return this.delegate_0.isCancelled}}),Object.defineProperty(De.prototype,"isCompleted",{configurable:!0,get:function(){return this.delegate_0.isCompleted}}),Object.defineProperty(De.prototype,"key",{configurable:!0,get:function(){return this.delegate_0.key}}),Object.defineProperty(De.prototype,"onJoin",{configurable:!0,get:function(){return this.delegate_0.onJoin}}),De.prototype.attachChild_kx8v25$=function(t){return this.delegate_0.attachChild_kx8v25$(t)},De.prototype.cancel=function(){return this.delegate_0.cancel()},De.prototype.cancel_dbl4no$$default=function(t){return this.delegate_0.cancel_dbl4no$$default(t)},De.prototype.cancel_m4sck1$$default=function(t){return this.delegate_0.cancel_m4sck1$$default(t)},De.prototype.fold_3cc69b$=function(t,e){return this.delegate_0.fold_3cc69b$(t,e)},De.prototype.get_j3r2sn$=function(t){return this.delegate_0.get_j3r2sn$(t)},De.prototype.getCancellationException=function(){return this.delegate_0.getCancellationException()},De.prototype.invokeOnCompletion_ct2b2z$$default=function(t,e,n){return this.delegate_0.invokeOnCompletion_ct2b2z$$default(t,e,n)},De.prototype.invokeOnCompletion_f05bi3$=function(t){return this.delegate_0.invokeOnCompletion_f05bi3$(t)},De.prototype.join=function(t){return this.delegate_0.join(t)},De.prototype.minusKey_yeqjby$=function(t){return this.delegate_0.minusKey_yeqjby$(t)},De.prototype.plus_1fupul$=function(t){return this.delegate_0.plus_1fupul$(t)},De.prototype.plus_dqr1mp$=function(t){return this.delegate_0.plus_dqr1mp$(t)},De.prototype.start=function(){return this.delegate_0.start()},De.$metadata$={kind:h,simpleName:"ChannelJob",interfaces:[Re,Pe,C]},w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.read_ons6h$",k((function(){var n=t.io.ktor.utils.io.requestBuffer_78elpf$,i=t.io.ktor.utils.io.core.Buffer,r=t.io.ktor.utils.io.completeReadingFromBuffer_6msh3s$,o=Error;return function(t,a,s,l){var c;void 0===a&&(a=1),e.suspendCall(n(t,a,e.coroutineReceiver()));var u=null!=(c=e.coroutineResult(e.coroutineReceiver()))?c:i.Companion.Empty;try{var p=s(u.memory,e.Long.fromInt(u.readPosition),e.Long.fromInt(u.writePosition));return e.suspendCall(r(t,u,p,e.coroutineReceiver())),p}catch(n){throw e.isType(n,o)?(e.suspendCall(r(t,u,0,e.coroutineReceiver())),n):n}}}))),qe.prototype.request_za3lpa$=function(t,e){return void 0===t&&(t=1),e?e(t):this.request_za3lpa$$default(t)},qe.$metadata$={kind:r,simpleName:"ReadSession",interfaces:[]},Fe.prototype.await_za3lpa$=function(t,e,n){return void 0===t&&(t=1),n?n(t,e):this.await_za3lpa$$default(t,e)},Fe.$metadata$={kind:r,simpleName:"SuspendableReadSession",interfaces:[qe]},Ue.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ue.prototype=Object.create(a.prototype),Ue.prototype.constructor=Ue,Ue.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=e.isType(this.local$$receiver,Fe)?this.local$$receiver:e.isType(this.local$$receiver,We)?this.local$$receiver.startReadSession():null,this.local$readSession=t,null!=this.local$readSession){var n=this.local$readSession.request_za3lpa$(P(this.local$desiredSize,8));if(null!=n)return n;this.state_0=2;continue}this.state_0=4;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=(i=this.local$readSession,r=this.local$desiredSize,a=void 0,s=void 0,s=new He(i,r,this),a?s:s.doResume(null)),this.result_0===o)return o;continue;case 3:return this.result_0;case 4:if(this.state_0=5,this.result_0=Ke(this.local$$receiver,this.local$desiredSize,this),this.result_0===o)return o;continue;case 5:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var i,r,a,s},Be.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Be.prototype=Object.create(a.prototype),Be.prototype.constructor=Be,Be.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(!(this.local$bytesRead>=0)){var t="bytesRead shouldn't be negative: "+this.local$bytesRead;throw R(t.toString())}var n;if(null!=(n=e.isType(this.local$$receiver,We)?this.local$$receiver.startReadSession():null))return n.discard_za3lpa$(this.local$bytesRead),void(e.isType(this.local$$receiver,We)&&this.local$$receiver.endReadSession());this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(e.isType(this.local$buffer,Gr)&&this.local$buffer!==ao().Empty){if(this.local$buffer.release_2bs5fo$(ao().Pool),this.state_0=3,this.result_0=this.local$$receiver.discard_s8cxhz$(e.Long.fromInt(this.local$bytesRead),this),this.result_0===o)return o;continue}this.state_0=4;continue;case 3:this.state_0=4;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},He.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},He.prototype=Object.create(a.prototype),He.prototype.constructor=He,He.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.await_za3lpa$(this.local$desiredSize,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return this.local$$receiver.request_za3lpa$(1);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ve.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ve.prototype=Object.create(a.prototype),Ve.prototype.constructor=Ve,Ve.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$chunk=ao().Pool.borrow(),this.state_0=2,this.result_0=this.local$$receiver.peekTo_afjyek$(this.local$chunk.memory,e.Long.fromInt(this.local$chunk.writePosition),f,e.Long.fromInt(this.local$desiredSize),e.Long.fromInt(this.local$chunk.limit-this.local$chunk.writePosition|0),this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return this.local$chunk.commitWritten_za3lpa$(t.toInt()),this.local$chunk;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},We.$metadata$={kind:r,simpleName:"HasReadSession",interfaces:[]},w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.write_k0oolq$",k((function(){var n=t.io.ktor.utils.io.requestWriteBuffer_9tm6dw$,i=t.io.ktor.utils.io.core.Buffer,r=t.io.ktor.utils.io.completeWriting_oczduq$;return function(t,o,a,s){var l;void 0===o&&(o=1),e.suspendCall(n(t,o,e.coroutineReceiver()));var c=null!=(l=e.coroutineResult(e.coroutineReceiver()))?l:i.Companion.Empty,u=0;try{return u=a(c.memory,e.Long.fromInt(c.writePosition),e.Long.fromInt(c.limit)),c.commitWritten_za3lpa$(u),u}finally{e.suspendCall(r(t,c,u,e.coroutineReceiver()))}}}))),Ye.$metadata$={kind:r,simpleName:"WriterSession",interfaces:[]},Ge.$metadata$={kind:r,simpleName:"WriterSuspendSession",interfaces:[Ye]},Je.$metadata$={kind:r,simpleName:"HasWriteSession",interfaces:[]},Ze.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ze.prototype=Object.create(a.prototype),Ze.prototype.constructor=Ze,Ze.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=e.isType(this.local$$receiver,Je)?this.local$$receiver.beginWriteSession():null,this.local$session=t,null!=this.local$session){var n=this.local$session.request_za3lpa$(this.local$desiredSpace);if(null!=n)return n;this.state_0=2;continue}this.state_0=4;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=(r=this.local$session,a=this.local$desiredSpace,s=void 0,l=void 0,l=new Xe(r,a,this),s?l:l.doResume(null)),this.result_0===o)return o;continue;case 3:return this.result_0;case 4:return i=void 0,(i=ao().Pool.borrow()).resetForWrite(),i.reserveEndGap_za3lpa$(8),i;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var i,r,a,s,l},Qe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Qe.prototype=Object.create(a.prototype),Qe.prototype.constructor=Qe,Qe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(e.isType(this.local$buffer,Is)){if(this.state_0=2,this.result_0=this.local$$receiver.writeFully_99qa0s$(this.local$buffer,this),this.result_0===o)return o;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:return void this.local$buffer.release_duua06$(Ys().Pool);case 3:throw A("Only IoBuffer instance is supported.");default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Xe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Xe.prototype=Object.create(a.prototype),Xe.prototype.constructor=Xe,Xe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.local$session.tryAwait_za3lpa$(this.local$desiredSpace,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return null!=(t=this.local$session.request_za3lpa$(this.local$desiredSpace))?t:this.local$session.request_za3lpa$(1);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},tn.$metadata$={kind:r,simpleName:"Allocator",interfaces:[]},cn.prototype=Object.create(uo.prototype),cn.prototype.constructor=cn,cn.prototype.doFail=function(){throw b(this.closure$message())},cn.$metadata$={kind:h,interfaces:[uo]},Object.defineProperty(un.prototype,"_head_xb1tt$_0",{configurable:!0,get:function(){return this.state_8q4rcd$_0.head},set:function(t){this.state_8q4rcd$_0.head=t,this.state_8q4rcd$_0.headMemory=t.memory,this.state_8q4rcd$_0.headPosition=t.readPosition,this.state_8q4rcd$_0.headEndExclusive=t.writePosition}}),Object.defineProperty(un.prototype,"head",{configurable:!0,get:function(){var t=this._head_xb1tt$_0;return t.discardUntilIndex_kcn2v3$(this.headPosition),t},set:function(t){this._head_xb1tt$_0=t}}),Object.defineProperty(un.prototype,"headMemory",{configurable:!0,get:function(){return this.state_8q4rcd$_0.headMemory},set:function(t){this.state_8q4rcd$_0.headMemory=t}}),Object.defineProperty(un.prototype,"headPosition",{configurable:!0,get:function(){return this.state_8q4rcd$_0.headPosition},set:function(t){this.state_8q4rcd$_0.headPosition=t}}),Object.defineProperty(un.prototype,"headEndExclusive",{configurable:!0,get:function(){return this.state_8q4rcd$_0.headEndExclusive},set:function(t){this.state_8q4rcd$_0.headEndExclusive=t}}),Object.defineProperty(un.prototype,"headRemaining",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.AbstractInput.get_headRemaining",(function(){return this.headEndExclusive-this.headPosition|0})),set:function(t){this.updateHeadRemaining_za3lpa$(t)}}),Object.defineProperty(un.prototype,"tailRemaining_l8ht08$_0",{configurable:!0,get:function(){return this.state_8q4rcd$_0.tailRemaining},set:function(t){var e;t.toNumber()>=0||new cn((e=t,function(){return"tailRemaining shouldn't be negative: "+e.toString()})).doFail(),this.state_8q4rcd$_0.tailRemaining=t}}),Object.defineProperty(un.prototype,"byteOrder",{configurable:!0,get:function(){return _s()},set:function(t){if(t!==_s())throw b("Only BIG_ENDIAN is supported.")}}),un.prototype.prefetch_8e33dg$=function(t){if(t.toNumber()<=0)return!0;var n=this.headEndExclusive-this.headPosition|0;return n>=t.toNumber()||e.Long.fromInt(n).add(this.tailRemaining_l8ht08$_0).compareTo_11rb$(t)>=0||this.doPrefetch_15sylx$_0(t)},un.prototype.peekTo_afjyek$$default=function(t,n,i,r,o){var a;this.prefetch_8e33dg$(r.add(i));for(var s=this.head,l=f,c=i,u=n,p=e.Long.fromInt(t.view.byteLength).subtract(n),h=o.compareTo_11rb$(p)<=0?o:p;l.compareTo_11rb$(r)<0&&l.compareTo_11rb$(h)<0;){var d=s,_=d.writePosition-d.readPosition|0;if(_>c.toNumber()){var y=e.Long.fromInt(_).subtract(c),m=h.subtract(l),v=y.compareTo_11rb$(m)<=0?y:m;s.memory.copyTo_q2ka7j$(t,e.Long.fromInt(s.readPosition).add(c),v,u),c=f,l=l.add(v),u=u.add(v)}else c=c.subtract(e.Long.fromInt(_));if(null==(a=s.next))break;s=a}return l},un.prototype.doPrefetch_15sylx$_0=function(t){var n=zi(this._head_xb1tt$_0),i=e.Long.fromInt(this.headEndExclusive-this.headPosition|0).add(this.tailRemaining_l8ht08$_0);do{var r=this.fill();if(null==r)return this.noMoreChunksAvailable_2n0tap$_0=!0,!1;var o=r.writePosition-r.readPosition|0;n===ao().Empty?(this._head_xb1tt$_0=r,n=r):(n.next=r,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.add(e.Long.fromInt(o))),i=i.add(e.Long.fromInt(o))}while(i.compareTo_11rb$(t)<0);return!0},Object.defineProperty(un.prototype,"remaining",{configurable:!0,get:function(){return e.Long.fromInt(this.headEndExclusive-this.headPosition|0).add(this.tailRemaining_l8ht08$_0)}}),un.prototype.canRead=function(){return this.headPosition!==this.headEndExclusive||!d(this.tailRemaining_l8ht08$_0,f)},un.prototype.hasBytes_za3lpa$=function(t){return e.Long.fromInt(this.headEndExclusive-this.headPosition|0).add(this.tailRemaining_l8ht08$_0).toNumber()>=t},Object.defineProperty(un.prototype,"isEmpty",{configurable:!0,get:function(){return this.endOfInput}}),Object.defineProperty(un.prototype,"isNotEmpty",{configurable:!0,get:function(){return Dr(this)}}),Object.defineProperty(un.prototype,"endOfInput",{configurable:!0,get:function(){return 0==(this.headEndExclusive-this.headPosition|0)&&d(this.tailRemaining_l8ht08$_0,f)&&(this.noMoreChunksAvailable_2n0tap$_0||null==this.doFill_nh863c$_0())}}),un.prototype.release=function(){var t=this.head,e=ao().Empty;t!==e&&(this._head_xb1tt$_0=e,this.tailRemaining_l8ht08$_0=f,Oi(t,this.pool))},un.prototype.close=function(){this.release(),this.noMoreChunksAvailable_2n0tap$_0||(this.noMoreChunksAvailable_2n0tap$_0=!0),this.closeSource()},un.prototype.stealAll_8be2vx$=function(){var t=this.head,e=ao().Empty;return t===e?null:(this._head_xb1tt$_0=e,this.tailRemaining_l8ht08$_0=f,t)},un.prototype.steal_8be2vx$=function(){var t=this.head,n=t.next,i=ao().Empty;return t===i?null:(null==n?(this._head_xb1tt$_0=i,this.tailRemaining_l8ht08$_0=f):(this._head_xb1tt$_0=n,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt(n.writePosition-n.readPosition|0))),t.next=null,t)},un.prototype.append_pvnryh$=function(t){if(t!==ao().Empty){var n=ji(t);this._head_xb1tt$_0===ao().Empty?(this._head_xb1tt$_0=t,this.tailRemaining_l8ht08$_0=n.subtract(e.Long.fromInt(this.headEndExclusive-this.headPosition|0))):(zi(this._head_xb1tt$_0).next=t,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.add(n))}},un.prototype.tryWriteAppend_pvnryh$=function(t){var n=zi(this.head),i=t.writePosition-t.readPosition|0,r=0===i;return r||(r=(n.limit-n.writePosition|0)=0||new cn((e=t,function(){return"Negative discard is not allowed: "+e})).doFail(),this.discardAsMuchAsPossible_3xuwvm$_0(t,0)},un.prototype.discardExact_za3lpa$=function(t){if(this.discard_za3lpa$(t)!==t)throw new al("Unable to discard "+t+" bytes due to end of packet")},un.prototype.read_wbh1sp$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.AbstractInput.read_wbh1sp$",k((function(){var n=t.io.ktor.utils.io.core.prematureEndOfStream_za3lpa$,i=e.kotlin.IllegalStateException_init_pdl1vj$;return function(t){var e,r=null!=(e=this.prepareRead_za3lpa$(1))?e:n(1),o=r.readPosition;try{t(r)}finally{var a=r.readPosition;if(a0?n.tryPeekByte():d(this.tailRemaining_l8ht08$_0,f)&&this.noMoreChunksAvailable_2n0tap$_0?-1:null!=(e=null!=(t=this.prepareReadLoop_3ilf5z$_0(1,n))?t.tryPeekByte():null)?e:-1},un.prototype.peekTo_99qa0s$=function(t){var n,i;if(null==(n=this.prepareReadHead_za3lpa$(1)))return-1;var r=n,o=t.limit-t.writePosition|0,a=r.writePosition-r.readPosition|0,s=g.min(o,a);return ki(e.isType(i=t,$n)?i:p(),r,s),s},un.prototype.discard_s8cxhz$=function(t){return t.toNumber()<=0?f:this.discardAsMuchAsPossible_s35ayg$_0(t,f)},pn.prototype.append_s8itvh$=function(t){var e;return this.closure$destination[(e=this.idx_0,this.idx_0=e+1|0,e)]=t,this},pn.prototype.append_gw00v9$=function(t){var e,n;if("string"==typeof t)il(t,this.closure$destination,this.idx_0),this.idx_0=this.idx_0+t.length|0;else if(null!=t){e=t.length;for(var i=0;i=0){var r=Ur(this,this.remaining.toInt());return t.append_gw00v9$(r),r.length}return this.readASCII_ka9uwb$_0(t,n,i)},un.prototype.readTextExact_a5kscm$=function(t,e){this.readText_5dvtqg$(t,e,e)},un.prototype.readText_vux9f0$=function(t,n){if(void 0===t&&(t=0),void 0===n&&(n=2147483647),0===t&&(0===n||this.endOfInput))return"";var i=this.remaining;if(i.toNumber()>0&&e.Long.fromInt(n).compareTo_11rb$(i)>=0)return Ur(this,i.toInt());var r=L(P(F(t,16),n));return this.readASCII_ka9uwb$_0(r,t,n),r.toString()},un.prototype.readTextExact_za3lpa$=function(t){return this.readText_vux9f0$(t,t)},un.prototype.readASCII_ka9uwb$_0=function(t,e,n){if(0===n&&0===e)return 0;if(this.endOfInput){if(0===e)return 0;this.atLeastMinCharactersRequire_tmg3q9$_0(e)}else n=l)try{var h,f=s;n:do{for(var d={v:0},_={v:0},y={v:0},m=f.memory,v=f.readPosition,$=f.writePosition,g=v;g<$;g++){var b=255&m.view.getInt8(g);if(0==(128&b)){0!==d.v&&go(d.v);var w,k=V(H(b));if(i.v===n?w=!1:(t.append_s8itvh$(U(k)),i.v=i.v+1|0,w=!0),!w){f.discardExact_za3lpa$(g-v|0),h=-1;break n}}else if(0===d.v){var S=128;_.v=b;for(var x=1;x<=6&&0!=(_.v&S);x++)_.v=_.v&~S,S>>=1,d.v=d.v+1|0;if(y.v=d.v,d.v=d.v-1|0,y.v>($-g|0)){f.discardExact_za3lpa$(g-v|0),h=y.v;break n}}else if(_.v=_.v<<6|127&b,d.v=d.v-1|0,0===d.v){if(wo(_.v)){var E,C=V(H(_.v));if(i.v===n?E=!1:(t.append_s8itvh$(U(C)),i.v=i.v+1|0,E=!0),!E){f.discardExact_za3lpa$(g-v-y.v+1|0),h=-1;break n}}else if(ko(_.v)){var O,N=V(H(xo(_.v)));i.v===n?O=!1:(t.append_s8itvh$(U(N)),i.v=i.v+1|0,O=!0);var z=!O;if(!z){var j,T=V(H(So(_.v)));i.v===n?j=!1:(t.append_s8itvh$(U(T)),i.v=i.v+1|0,j=!0),z=!j}if(z){f.discardExact_za3lpa$(g-v-y.v+1|0),h=-1;break n}}else bo(_.v);_.v=0}}var P=$-v|0;f.discardExact_za3lpa$(P),h=0}while(0);l=0===h?1:h>0?h:0}finally{var R=s;c=R.writePosition-R.readPosition|0}else c=p;if(a=!1,0===c)o=jo(this,s);else{var A=c0)}finally{a&&zo(this,s)}}while(0);return i.va?(t.releaseEndGap_8be2vx$(),this.headEndExclusive=t.writePosition,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.add(e.Long.fromInt(a))):(this._head_xb1tt$_0=i,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt((i.writePosition-i.readPosition|0)-a|0)),t.cleanNext(),t.release_2bs5fo$(this.pool))},un.prototype.fixGapAfterReadFallback_q485vf$_0=function(t){if(this.noMoreChunksAvailable_2n0tap$_0&&null==t.next)return this.headPosition=t.readPosition,this.headEndExclusive=t.writePosition,void(this.tailRemaining_l8ht08$_0=f);var e=t.writePosition-t.readPosition|0,n=8-(t.capacity-t.limit|0)|0,i=g.min(e,n);if(e>i)this.fixGapAfterReadFallbackUnreserved_13fwc$_0(t,e,i);else{var r=this.pool.borrow();r.reserveEndGap_za3lpa$(8),r.next=t.cleanNext(),An(r,t,e),this._head_xb1tt$_0=r}t.release_2bs5fo$(this.pool)},un.prototype.fixGapAfterReadFallbackUnreserved_13fwc$_0=function(t,e,n){var i=this.pool.borrow(),r=this.pool.borrow();i.reserveEndGap_za3lpa$(8),r.reserveEndGap_za3lpa$(8),i.next=r,r.next=t.cleanNext(),An(i,t,e-n|0),An(r,t,n),this._head_xb1tt$_0=i,this.tailRemaining_l8ht08$_0=ji(r)},un.prototype.ensureNext_pxb5qx$_0=function(t,n){var i;if(t===n)return this.doFill_nh863c$_0();var r=t.cleanNext();return t.release_2bs5fo$(this.pool),null==r?(this._head_xb1tt$_0=n,this.tailRemaining_l8ht08$_0=f,i=this.ensureNext_pxb5qx$_0(n,n)):r.writePosition>r.readPosition?(this._head_xb1tt$_0=r,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt(r.writePosition-r.readPosition|0)),i=r):i=this.ensureNext_pxb5qx$_0(r,n),i},un.prototype.fill=function(){var t=this.pool.borrow();try{t.reserveEndGap_za3lpa$(8);var n=this.fill_9etqdk$(t.memory,t.writePosition,t.limit-t.writePosition|0);return 0!==n||(this.noMoreChunksAvailable_2n0tap$_0=!0,t.writePosition>t.readPosition)?(t.commitWritten_za3lpa$(n),t):(t.release_2bs5fo$(this.pool),null)}catch(n){throw e.isType(n,E)?(t.release_2bs5fo$(this.pool),n):n}},un.prototype.markNoMoreChunksAvailable=function(){this.noMoreChunksAvailable_2n0tap$_0||(this.noMoreChunksAvailable_2n0tap$_0=!0)},un.prototype.doFill_nh863c$_0=function(){if(this.noMoreChunksAvailable_2n0tap$_0)return null;var t=this.fill();return null==t?(this.noMoreChunksAvailable_2n0tap$_0=!0,null):(this.appendView_4be14h$_0(t),t)},un.prototype.appendView_4be14h$_0=function(t){var e,n,i=zi(this._head_xb1tt$_0);i===ao().Empty?(this._head_xb1tt$_0=t,d(this.tailRemaining_l8ht08$_0,f)||new cn(hn).doFail(),this.tailRemaining_l8ht08$_0=null!=(n=null!=(e=t.next)?ji(e):null)?n:f):(i.next=t,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.add(ji(t)))},un.prototype.prepareRead_za3lpa$=function(t){var e=this.head;return(this.headEndExclusive-this.headPosition|0)>=t?e:this.prepareReadLoop_3ilf5z$_0(t,e)},un.prototype.prepareRead_cvuqs$=function(t,e){return(this.headEndExclusive-this.headPosition|0)>=t?e:this.prepareReadLoop_3ilf5z$_0(t,e)},un.prototype.prepareReadLoop_3ilf5z$_0=function(t,n){var i,r,o=this.headEndExclusive-this.headPosition|0;if(o>=t)return n;if(null==(r=null!=(i=n.next)?i:this.doFill_nh863c$_0()))return null;var a=r;if(0===o)return n!==ao().Empty&&this.releaseHead_pvnryh$(n),this.prepareReadLoop_3ilf5z$_0(t,a);var s=An(n,a,t-o|0);return this.headEndExclusive=n.writePosition,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt(s)),a.writePosition>a.readPosition?a.reserveStartGap_za3lpa$(s):(n.next=null,n.next=a.cleanNext(),a.release_2bs5fo$(this.pool)),(n.writePosition-n.readPosition|0)>=t?n:(t>8&&this.minSizeIsTooBig_5ot22f$_0(t),this.prepareReadLoop_3ilf5z$_0(t,n))},un.prototype.minSizeIsTooBig_5ot22f$_0=function(t){throw R("minSize of "+t+" is too big (should be less than 8)")},un.prototype.afterRead_3wtcpm$_0=function(t){0==(t.writePosition-t.readPosition|0)&&this.releaseHead_pvnryh$(t)},un.prototype.releaseHead_pvnryh$=function(t){var n,i=null!=(n=t.cleanNext())?n:ao().Empty;return this._head_xb1tt$_0=i,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt(i.writePosition-i.readPosition|0)),t.release_2bs5fo$(this.pool),i},fn.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var dn=null;function _n(){return null===dn&&new fn,dn}function yn(t,e){this.headerSizeHint_8gle5k$_0=t,this.pool=e,this.state_80zwyy$_0=new ps,this.byteOrder_t3hxpd$_0=_s()}function mn(t,e){return e=e||Object.create(yn.prototype),yn.call(e,0,t),e}function vn(t){this.closure$message=t,uo.call(this)}function $n(t){kn(),this.memory=t,this.bufferState_jauu7b$_0=new hs(this.memory.view.byteLength),this.capacity=this.memory.view.byteLength}function gn(){wn=this,this.ReservedSize=8}un.$metadata$={kind:h,simpleName:"AbstractInput",interfaces:[Rs]},Object.defineProperty(yn.prototype,"_head_hofq54$_0",{configurable:!0,get:function(){return this.state_80zwyy$_0.head},set:function(t){this.state_80zwyy$_0.head=t}}),Object.defineProperty(yn.prototype,"_tail_hhwkug$_0",{configurable:!0,get:function(){return this.state_80zwyy$_0.tail},set:function(t){this.state_80zwyy$_0.tail=t}}),Object.defineProperty(yn.prototype,"head_8be2vx$",{configurable:!0,get:function(){var t;return null!=(t=this._head_hofq54$_0)?t:ao().Empty}}),Object.defineProperty(yn.prototype,"tail",{configurable:!0,get:function(){return this.prepareWriteHead_za3lpa$(1)}}),Object.defineProperty(yn.prototype,"currentTail",{configurable:!0,get:function(){return this.prepareWriteHead_za3lpa$(1)},set:function(t){this.appendChain_pvnryh$(t)}}),Object.defineProperty(yn.prototype,"tailMemory_8be2vx$",{configurable:!0,get:function(){return this.state_80zwyy$_0.tailMemory},set:function(t){this.state_80zwyy$_0.tailMemory=t}}),Object.defineProperty(yn.prototype,"tailPosition_8be2vx$",{configurable:!0,get:function(){return this.state_80zwyy$_0.tailPosition},set:function(t){this.state_80zwyy$_0.tailPosition=t}}),Object.defineProperty(yn.prototype,"tailEndExclusive_8be2vx$",{configurable:!0,get:function(){return this.state_80zwyy$_0.tailEndExclusive},set:function(t){this.state_80zwyy$_0.tailEndExclusive=t}}),Object.defineProperty(yn.prototype,"tailInitialPosition_f6hjsm$_0",{configurable:!0,get:function(){return this.state_80zwyy$_0.tailInitialPosition},set:function(t){this.state_80zwyy$_0.tailInitialPosition=t}}),Object.defineProperty(yn.prototype,"chainedSize_8c83kq$_0",{configurable:!0,get:function(){return this.state_80zwyy$_0.chainedSize},set:function(t){this.state_80zwyy$_0.chainedSize=t}}),Object.defineProperty(yn.prototype,"tailRemaining_8be2vx$",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.AbstractOutput.get_tailRemaining_8be2vx$",(function(){return this.tailEndExclusive_8be2vx$-this.tailPosition_8be2vx$|0}))}),Object.defineProperty(yn.prototype,"_size",{configurable:!0,get:function(){return this.chainedSize_8c83kq$_0+(this.tailPosition_8be2vx$-this.tailInitialPosition_f6hjsm$_0)|0},set:function(t){}}),Object.defineProperty(yn.prototype,"byteOrder",{configurable:!0,get:function(){return this.byteOrder_t3hxpd$_0},set:function(t){if(this.byteOrder_t3hxpd$_0=t,t!==_s())throw b("Only BIG_ENDIAN is supported. Use corresponding functions to read/writein the little endian")}}),yn.prototype.flush=function(){this.flushChain_iwxacw$_0()},yn.prototype.flushChain_iwxacw$_0=function(){var t;if(null!=(t=this.stealAll_8be2vx$())){var e=t;try{for(var n,i=e;;){var r=i;if(this.flush_9etqdk$(r.memory,r.readPosition,r.writePosition-r.readPosition|0),null==(n=i.next))break;i=n}}finally{Oi(e,this.pool)}}},yn.prototype.stealAll_8be2vx$=function(){var t,e;if(null==(t=this._head_hofq54$_0))return null;var n=t;return null!=(e=this._tail_hhwkug$_0)&&e.commitWrittenUntilIndex_za3lpa$(this.tailPosition_8be2vx$),this._head_hofq54$_0=null,this._tail_hhwkug$_0=null,this.tailPosition_8be2vx$=0,this.tailEndExclusive_8be2vx$=0,this.tailInitialPosition_f6hjsm$_0=0,this.chainedSize_8c83kq$_0=0,this.tailMemory_8be2vx$=ba().Empty,n},yn.prototype.afterBytesStolen_8be2vx$=function(){var t=this.head_8be2vx$;if(t!==ao().Empty){if(null!=t.next)throw R("Check failed.".toString());t.resetForWrite(),t.reserveStartGap_za3lpa$(this.headerSizeHint_8gle5k$_0),t.reserveEndGap_za3lpa$(8),this.tailPosition_8be2vx$=t.writePosition,this.tailInitialPosition_f6hjsm$_0=this.tailPosition_8be2vx$,this.tailEndExclusive_8be2vx$=t.limit}},yn.prototype.appendSingleChunk_pvnryh$=function(t){if(null!=t.next)throw R("It should be a single buffer chunk.".toString());this.appendChainImpl_gq6rjy$_0(t,t,0)},yn.prototype.appendChain_pvnryh$=function(t){var n=zi(t),i=ji(t).subtract(e.Long.fromInt(n.writePosition-n.readPosition|0));i.toNumber()>=2147483647&&co(i,"total size increase");var r=i.toInt();this.appendChainImpl_gq6rjy$_0(t,n,r)},yn.prototype.appendNewChunk_oskcze$_0=function(){var t=this.pool.borrow();return t.reserveEndGap_za3lpa$(8),this.appendSingleChunk_pvnryh$(t),t},yn.prototype.appendChainImpl_gq6rjy$_0=function(t,e,n){var i=this._tail_hhwkug$_0;if(null==i)this._head_hofq54$_0=t,this.chainedSize_8c83kq$_0=0;else{i.next=t;var r=this.tailPosition_8be2vx$;i.commitWrittenUntilIndex_za3lpa$(r),this.chainedSize_8c83kq$_0=this.chainedSize_8c83kq$_0+(r-this.tailInitialPosition_f6hjsm$_0)|0}this._tail_hhwkug$_0=e,this.chainedSize_8c83kq$_0=this.chainedSize_8c83kq$_0+n|0,this.tailMemory_8be2vx$=e.memory,this.tailPosition_8be2vx$=e.writePosition,this.tailInitialPosition_f6hjsm$_0=e.readPosition,this.tailEndExclusive_8be2vx$=e.limit},yn.prototype.writeByte_s8j3t7$=function(t){var e=this.tailPosition_8be2vx$;return e=3){var n,i=this.tailMemory_8be2vx$,r=0|t;0<=r&&r<=127?(i.view.setInt8(e,_(r)),n=1):128<=r&&r<=2047?(i.view.setInt8(e,_(192|r>>6&31)),i.view.setInt8(e+1|0,_(128|63&r)),n=2):2048<=r&&r<=65535?(i.view.setInt8(e,_(224|r>>12&15)),i.view.setInt8(e+1|0,_(128|r>>6&63)),i.view.setInt8(e+2|0,_(128|63&r)),n=3):65536<=r&&r<=1114111?(i.view.setInt8(e,_(240|r>>18&7)),i.view.setInt8(e+1|0,_(128|r>>12&63)),i.view.setInt8(e+2|0,_(128|r>>6&63)),i.view.setInt8(e+3|0,_(128|63&r)),n=4):n=bo(r);var o=n;return this.tailPosition_8be2vx$=e+o|0,this}return this.appendCharFallback_r92zh4$_0(t),this},yn.prototype.appendCharFallback_r92zh4$_0=function(t){var e=this.prepareWriteHead_za3lpa$(3);try{var n,i=e.memory,r=e.writePosition,o=0|t;0<=o&&o<=127?(i.view.setInt8(r,_(o)),n=1):128<=o&&o<=2047?(i.view.setInt8(r,_(192|o>>6&31)),i.view.setInt8(r+1|0,_(128|63&o)),n=2):2048<=o&&o<=65535?(i.view.setInt8(r,_(224|o>>12&15)),i.view.setInt8(r+1|0,_(128|o>>6&63)),i.view.setInt8(r+2|0,_(128|63&o)),n=3):65536<=o&&o<=1114111?(i.view.setInt8(r,_(240|o>>18&7)),i.view.setInt8(r+1|0,_(128|o>>12&63)),i.view.setInt8(r+2|0,_(128|o>>6&63)),i.view.setInt8(r+3|0,_(128|63&o)),n=4):n=bo(o);var a=n;if(e.commitWritten_za3lpa$(a),!(a>=0))throw R("The returned value shouldn't be negative".toString())}finally{this.afterHeadWrite()}},yn.prototype.append_gw00v9$=function(t){return null==t?this.append_ezbsdh$("null",0,4):this.append_ezbsdh$(t,0,t.length),this},yn.prototype.append_ezbsdh$=function(t,e,n){return null==t?this.append_ezbsdh$("null",e,n):(Br(this,t,e,n,is().UTF_8),this)},yn.prototype.writePacket_3uq2w4$=function(t){var e=t.stealAll_8be2vx$();if(null!=e){var n=this._tail_hhwkug$_0;null!=n?this.writePacketMerging_mvdkrn$_0(n,e,t.pool):this.appendChain_pvnryh$(e)}else t.release()},yn.prototype.writeChunkBuffer_pvnryh$=function(t){var e=this._tail_hhwkug$_0;null!=e?this.writePacketMerging_mvdkrn$_0(e,t,this.pool):this.appendChain_pvnryh$(t)},yn.prototype.writePacketMerging_mvdkrn$_0=function(t,e,n){var i;t.commitWrittenUntilIndex_za3lpa$(this.tailPosition_8be2vx$);var r=t.writePosition-t.readPosition|0,o=e.writePosition-e.readPosition|0,a=Bs,s=o0;){var r=t.headEndExclusive-t.headPosition|0;if(!(r<=i.v)){var o,a=null!=(o=t.prepareRead_za3lpa$(1))?o:Kr(1),s=a.readPosition;try{kr(this,a,i.v)}finally{var l=a.readPosition;if(l0;){var o=e.Long.fromInt(t.headEndExclusive-t.headPosition|0);if(!(o.compareTo_11rb$(r.v)<=0)){var a,s=null!=(a=t.prepareRead_za3lpa$(1))?a:Kr(1),l=s.readPosition;try{kr(this,s,r.v.toInt())}finally{var c=s.readPosition;if(c=e)return i;for(i=n(this.prepareWriteHead_za3lpa$(1),i),this.afterHeadWrite();i2047){var i=t.memory,r=t.writePosition,o=t.limit-r|0;if(o<3)throw e("3 bytes character",3,o);var a=i,s=r;return a.view.setInt8(s,_(224|n>>12&15)),a.view.setInt8(s+1|0,_(128|n>>6&63)),a.view.setInt8(s+2|0,_(128|63&n)),t.commitWritten_za3lpa$(3),3}var l=t.memory,c=t.writePosition,u=t.limit-c|0;if(u<2)throw e("2 bytes character",2,u);var p=l,h=c;return p.view.setInt8(h,_(192|n>>6&31)),p.view.setInt8(h+1|0,_(128|63&n)),t.commitWritten_za3lpa$(2),2}})),yn.prototype.release=function(){this.close()},yn.prototype.prepareWriteHead_za3lpa$=function(t){var e;return(this.tailEndExclusive_8be2vx$-this.tailPosition_8be2vx$|0)>=t&&null!=(e=this._tail_hhwkug$_0)?(e.commitWrittenUntilIndex_za3lpa$(this.tailPosition_8be2vx$),e):this.appendNewChunk_oskcze$_0()},yn.prototype.afterHeadWrite=function(){var t;null!=(t=this._tail_hhwkug$_0)&&(this.tailPosition_8be2vx$=t.writePosition)},yn.prototype.write_rtdvbs$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.AbstractOutput.write_rtdvbs$",k((function(){var t=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e,n){var i=this.prepareWriteHead_za3lpa$(e);try{var r=n(i);if(!(r>=0))throw t("The returned value shouldn't be negative".toString());return r}finally{this.afterHeadWrite()}}}))),yn.prototype.addSize_za3lpa$=function(t){if(!(t>=0))throw R(("It should be non-negative size increment: "+t).toString());if(!(t<=(this.tailEndExclusive_8be2vx$-this.tailPosition_8be2vx$|0))){var e="Unable to mark more bytes than available: "+t+" > "+(this.tailEndExclusive_8be2vx$-this.tailPosition_8be2vx$|0);throw R(e.toString())}this.tailPosition_8be2vx$=this.tailPosition_8be2vx$+t|0},yn.prototype.last_99qa0s$=function(t){var n;this.appendSingleChunk_pvnryh$(e.isType(n=t,Gr)?n:p())},yn.prototype.appendNewBuffer=function(){var t;return e.isType(t=this.appendNewChunk_oskcze$_0(),Is)?t:p()},yn.prototype.reset=function(){},yn.$metadata$={kind:h,simpleName:"AbstractOutput",interfaces:[tl,q]},vn.prototype=Object.create(uo.prototype),vn.prototype.constructor=vn,vn.prototype.doFail=function(){throw b(this.closure$message())},vn.$metadata$={kind:h,interfaces:[uo]},Object.defineProperty($n.prototype,"readPosition",{configurable:!0,get:function(){return this.bufferState_jauu7b$_0.readPosition},set:function(t){this.bufferState_jauu7b$_0.readPosition=t}}),Object.defineProperty($n.prototype,"writePosition",{configurable:!0,get:function(){return this.bufferState_jauu7b$_0.writePosition},set:function(t){this.bufferState_jauu7b$_0.writePosition=t}}),Object.defineProperty($n.prototype,"startGap",{configurable:!0,get:function(){return this.bufferState_jauu7b$_0.startGap},set:function(t){this.bufferState_jauu7b$_0.startGap=t}}),Object.defineProperty($n.prototype,"limit",{configurable:!0,get:function(){return this.bufferState_jauu7b$_0.limit},set:function(t){this.bufferState_jauu7b$_0.limit=t}}),Object.defineProperty($n.prototype,"endGap",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.Buffer.get_endGap",(function(){return this.capacity-this.limit|0}))}),Object.defineProperty($n.prototype,"readRemaining",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.Buffer.get_readRemaining",(function(){return this.writePosition-this.readPosition|0}))}),Object.defineProperty($n.prototype,"writeRemaining",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.Buffer.get_writeRemaining",(function(){return this.limit-this.writePosition|0}))}),Object.defineProperty($n.prototype,"attachment",{configurable:!0,get:function(){return this.bufferState_jauu7b$_0.attachment},set:function(t){this.bufferState_jauu7b$_0.attachment=t}}),$n.prototype.discardExact_za3lpa$=function(t){if(void 0===t&&(t=this.writePosition-this.readPosition|0),0!==t){var e=this.readPosition+t|0;(t<0||e>this.writePosition)&&Sn(t,this.writePosition-this.readPosition|0),this.readPosition=e}},$n.prototype.discard_za3lpa$=function(t){var e=this.writePosition-this.readPosition|0,n=g.min(t,e);return this.discardExact_za3lpa$(n),n},$n.prototype.discard_s8cxhz$=function(t){var n=e.Long.fromInt(this.writePosition-this.readPosition|0),i=(t.compareTo_11rb$(n)<=0?t:n).toInt();return this.discardExact_za3lpa$(i),e.Long.fromInt(i)},$n.prototype.commitWritten_za3lpa$=function(t){var e=this.writePosition+t|0;(t<0||e>this.limit)&&xn(t,this.limit-this.writePosition|0),this.writePosition=e},$n.prototype.commitWrittenUntilIndex_za3lpa$=function(t){var e=this.limit;if(t=e){if(t===e)return this.writePosition=t,!1;xn(t-this.writePosition|0,this.limit-this.writePosition|0)}return this.writePosition=t,!0},$n.prototype.discardUntilIndex_kcn2v3$=function(t){(t<0||t>this.writePosition)&&Sn(t-this.readPosition|0,this.writePosition-this.readPosition|0),this.readPosition!==t&&(this.readPosition=t)},$n.prototype.rewind_za3lpa$=function(t){void 0===t&&(t=this.readPosition-this.startGap|0);var e=this.readPosition-t|0;e=0||new vn((e=t,function(){return"startGap shouldn't be negative: "+e})).doFail(),!(this.readPosition>=t))return this.readPosition===this.writePosition?(t>this.limit&&Cn(this,t),this.writePosition=t,this.readPosition=t,void(this.startGap=t)):void On(this,t);this.startGap=t},$n.prototype.reserveEndGap_za3lpa$=function(t){var e;t>=0||new vn((e=t,function(){return"endGap shouldn't be negative: "+e})).doFail();var n=this.capacity-t|0;if(n>=this.writePosition)this.limit=n;else{if(n<0&&Nn(this,t),n=0||new vn((e=t,function(){return"newReadPosition shouldn't be negative: "+e})).doFail(),t<=this.readPosition||new vn(function(t,e){return function(){return"newReadPosition shouldn't be ahead of the read position: "+t+" > "+e.readPosition}}(t,this)).doFail(),this.readPosition=t,this.startGap>t&&(this.startGap=t)},$n.prototype.duplicateTo_b4g5fm$=function(t){t.limit=this.limit,t.startGap=this.startGap,t.readPosition=this.readPosition,t.writePosition=this.writePosition},$n.prototype.duplicate=function(){var t=new $n(this.memory);return t.duplicateTo_b4g5fm$(t),t},$n.prototype.tryPeekByte=function(){var t=this.readPosition;return t===this.writePosition?-1:255&this.memory.view.getInt8(t)},$n.prototype.tryReadByte=function(){var t=this.readPosition;return t===this.writePosition?-1:(this.readPosition=t+1|0,255&this.memory.view.getInt8(t))},$n.prototype.readByte=function(){var t=this.readPosition;if(t===this.writePosition)throw new al("No readable bytes available.");return this.readPosition=t+1|0,this.memory.view.getInt8(t)},$n.prototype.writeByte_s8j3t7$=function(t){var e=this.writePosition;if(e===this.limit)throw new Pn("No free space in the buffer to write a byte");this.memory.view.setInt8(e,t),this.writePosition=e+1|0},$n.prototype.reset=function(){this.releaseGaps_8be2vx$(),this.resetForWrite()},$n.prototype.toString=function(){return"Buffer("+(this.writePosition-this.readPosition|0)+" used, "+(this.limit-this.writePosition|0)+" free, "+(this.startGap+(this.capacity-this.limit|0)|0)+" reserved of "+this.capacity+")"},Object.defineProperty(gn.prototype,"Empty",{configurable:!0,get:function(){return Ys().Empty}}),gn.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var bn,wn=null;function kn(){return null===wn&&new gn,wn}function Sn(t,e){throw new al("Unable to discard "+t+" bytes: only "+e+" available for reading")}function xn(t,e){throw new al("Unable to discard "+t+" bytes: only "+e+" available for writing")}function En(t,e){throw b("Unable to rewind "+t+" bytes: only "+e+" could be rewinded")}function Cn(t,e){if(e>t.capacity)throw b("Start gap "+e+" is bigger than the capacity "+t.capacity);throw R("Unable to reserve "+e+" start gap: there are already "+(t.capacity-t.limit|0)+" bytes reserved in the end")}function On(t,e){throw R("Unable to reserve "+e+" start gap: there are already "+(t.writePosition-t.readPosition|0)+" content bytes starting at offset "+t.readPosition)}function Nn(t,e){throw b("End gap "+e+" is too big: capacity is "+t.capacity)}function zn(t,e){throw b("End gap "+e+" is too big: there are already "+t.startGap+" bytes reserved in the beginning")}function jn(t,e){throw b("Unable to reserve end gap "+e+": there are already "+(t.writePosition-t.readPosition|0)+" content bytes at offset "+t.readPosition)}function Tn(t,e){t.releaseStartGap_kcn2v3$(t.readPosition-e|0)}function Pn(t){void 0===t&&(t="Not enough free space"),K(t,this),this.name="InsufficientSpaceException"}function Rn(t,e,n,i){return i=i||Object.create(Pn.prototype),Pn.call(i,"Not enough free space to write "+t+" of "+e+" bytes, available "+n+" bytes."),i}function An(t,e,n){var i=e.writePosition-e.readPosition|0,r=g.min(i,n);(t.limit-t.writePosition|0)<=r&&function(t,e){if(((t.limit-t.writePosition|0)+(t.capacity-t.limit|0)|0)0&&t.releaseEndGap_8be2vx$()}(t,r);var o=t.memory,a=t.writePosition;t.limit;var s=e.memory,l=e.readPosition;e.writePosition,s.copyTo_ubllm2$(o,l,r,a);var c=r;e.discardExact_za3lpa$(c);var u=c;return t.commitWritten_za3lpa$(u),u}function In(t,e){var n=e.writePosition-e.readPosition|0,i=t.readPosition;if(i=0||new Mn((i=e,function(){return"times shouldn't be negative: "+i})).doFail(),e<=(t.limit-t.writePosition|0)||new Mn(function(t,e){return function(){var n=e;return"times shouldn't be greater than the write remaining space: "+t+" > "+(n.limit-n.writePosition|0)}}(e,t)).doFail(),ka(t.memory,t.writePosition,e,n),t.commitWritten_za3lpa$(e)}function Dn(t,e,n){e.toNumber()>=2147483647&&co(e,"n"),Ln(t,e.toInt(),n)}function qn(t,e,n,i){return Fn(t,new yo(e,0,e.length),n,i)}function Fn(t,e,n,i){var r={v:null},o=$o(t.memory,e,n,i,t.writePosition,t.limit);r.v=65535&new I(S(o.value>>>16)).data;var a=65535&new I(S(65535&o.value)).data;return t.commitWritten_za3lpa$(a),n+r.v|0}function Un(t,e){var n,i=t.memory,r=t.writePosition,o=t.limit,a=0|e;0<=a&&a<=127?(i.view.setInt8(r,_(a)),n=1):128<=a&&a<=2047?(i.view.setInt8(r,_(192|a>>6&31)),i.view.setInt8(r+1|0,_(128|63&a)),n=2):2048<=a&&a<=65535?(i.view.setInt8(r,_(224|a>>12&15)),i.view.setInt8(r+1|0,_(128|a>>6&63)),i.view.setInt8(r+2|0,_(128|63&a)),n=3):65536<=a&&a<=1114111?(i.view.setInt8(r,_(240|a>>18&7)),i.view.setInt8(r+1|0,_(128|a>>12&63)),i.view.setInt8(r+2|0,_(128|a>>6&63)),i.view.setInt8(r+3|0,_(128|63&a)),n=4):n=bo(a);var s=n,l=s>(o-r|0)?function(t){throw new Pi("Not enough free space available to write "+t+" character(s).")}(1):s;return t.commitWritten_za3lpa$(l),t}function Bn(t,e,n){void 0===t&&(t=4096),void 0===e&&(e=1e3),void 0===n&&(n=ya()),dl.call(this,e),this.bufferSize_0=t,this.allocator_0=n}function Hn(t){this.closure$message=t,uo.call(this)}function Vn(t,e){return function(){throw new al("Not enough bytes to read a "+t+" of size "+e+".")}}function Kn(t){this.closure$message=t,uo.call(this)}function Wn(t){var e={v:null},n=t.memory,i=t.readPosition;return(t.writePosition-i|0)>=2||new Hn(Vn("short integer",2)).doFail(),e.v=n.view.getInt16(i,!1),t.discardExact_za3lpa$(2),e.v}function Yn(t){var e={v:null},n=t.memory,i=t.readPosition;return(t.writePosition-i|0)>=4||new Hn(Vn("regular integer",4)).doFail(),e.v=n.view.getInt32(i,!1),t.discardExact_za3lpa$(4),e.v}function Gn(t){var n={v:null},i=t.memory,r=t.readPosition;(t.writePosition-r|0)>=8||new Hn(Vn("long integer",8)).doFail();var o=i,a=r;return n.v=e.Long.fromInt(o.view.getUint32(a,!1)).shiftLeft(32).or(e.Long.fromInt(o.view.getUint32(a+4|0,!1))),t.discardExact_za3lpa$(8),n.v}function Jn(t){var e={v:null},n=t.memory,i=t.readPosition;return(t.writePosition-i|0)>=4||new Hn(Vn("floating point number",4)).doFail(),e.v=n.view.getFloat32(i,!1),t.discardExact_za3lpa$(4),e.v}function Zn(t){var e={v:null},n=t.memory,i=t.readPosition;return(t.writePosition-i|0)>=8||new Hn(Vn("long floating point number",8)).doFail(),e.v=n.view.getFloat64(i,!1),t.discardExact_za3lpa$(8),e.v}function Qn(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<2)throw Rn("short integer",2,r);n.view.setInt16(i,e,!1),t.commitWritten_za3lpa$(2)}function Xn(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<4)throw Rn("regular integer",4,r);n.view.setInt32(i,e,!1),t.commitWritten_za3lpa$(4)}function ti(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<8)throw Rn("long integer",8,r);var o=n,a=i;o.view.setInt32(a,e.shiftRight(32).toInt(),!1),o.view.setInt32(a+4|0,e.and(Y).toInt(),!1),t.commitWritten_za3lpa$(8)}function ei(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<4)throw Rn("floating point number",4,r);n.view.setFloat32(i,e,!1),t.commitWritten_za3lpa$(4)}function ni(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<8)throw Rn("long floating point number",8,r);n.view.setFloat64(i,e,!1),t.commitWritten_za3lpa$(8)}function ii(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:null},o=t.memory,a=t.readPosition;(t.writePosition-a|0)>=i||new Hn(Vn("byte array",i)).doFail(),wa(o,e,a,i,n),r.v=u;var s=i;t.discardExact_za3lpa$(s),r.v}function ri(t,e,n,i){var r,o;if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Kn((r=n,function(){return"offset shouldn't be negative: "+r})).doFail(),i>=0||new Kn((o=i,function(){return"length shouldn't be negative: "+o})).doFail(),(n+i|0)<=e.length||new Kn(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var a=t.writePosition-t.readPosition|0,s=g.min(i,a);return ii(t,e,n,s),s}function oi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=t.memory,o=t.writePosition,a=t.limit-o|0;if(a=r||new Hn(Vn("short integers array",r)).doFail(),Oa(a,s,e,n,i),o.v=u;var l=r;t.discardExact_za3lpa$(l),o.v}function si(t,e,n,i){var r,o;if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Kn((r=n,function(){return"offset shouldn't be negative: "+r})).doFail(),i>=0||new Kn((o=i,function(){return"length shouldn't be negative: "+o})).doFail(),(n+i|0)<=e.length||new Kn(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var a=i/2|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return ai(t,e,n,l),l}function li(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=2*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=r||new Hn(Vn("integers array",r)).doFail(),Na(a,s,e,n,i),o.v=u;var l=r;t.discardExact_za3lpa$(l),o.v}function ui(t,e,n,i){var r,o;if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Kn((r=n,function(){return"offset shouldn't be negative: "+r})).doFail(),i>=0||new Kn((o=i,function(){return"length shouldn't be negative: "+o})).doFail(),(n+i|0)<=e.length||new Kn(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var a=i/4|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return ci(t,e,n,l),l}function pi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=4*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=r||new Hn(Vn("long integers array",r)).doFail(),za(a,s,e,n,i),o.v=u;var l=r;t.discardExact_za3lpa$(l),o.v}function fi(t,e,n,i){var r,o;if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Kn((r=n,function(){return"offset shouldn't be negative: "+r})).doFail(),i>=0||new Kn((o=i,function(){return"length shouldn't be negative: "+o})).doFail(),(n+i|0)<=e.length||new Kn(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var a=i/8|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return hi(t,e,n,l),l}function di(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=8*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=r||new Hn(Vn("floating point numbers array",r)).doFail(),ja(a,s,e,n,i),o.v=u;var l=r;t.discardExact_za3lpa$(l),o.v}function yi(t,e,n,i){var r,o;if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Kn((r=n,function(){return"offset shouldn't be negative: "+r})).doFail(),i>=0||new Kn((o=i,function(){return"length shouldn't be negative: "+o})).doFail(),(n+i|0)<=e.length||new Kn(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var a=i/4|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return _i(t,e,n,l),l}function mi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=4*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=r||new Hn(Vn("floating point numbers array",r)).doFail(),Ta(a,s,e,n,i),o.v=u;var l=r;t.discardExact_za3lpa$(l),o.v}function $i(t,e,n,i){var r,o;if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Kn((r=n,function(){return"offset shouldn't be negative: "+r})).doFail(),i>=0||new Kn((o=i,function(){return"length shouldn't be negative: "+o})).doFail(),(n+i|0)<=e.length||new Kn(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var a=i/8|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return vi(t,e,n,l),l}function gi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=8*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=0))throw b("Failed requirement.".toString());if(!(n<=(e.limit-e.writePosition|0)))throw b("Failed requirement.".toString());var i={v:null},r=t.memory,o=t.readPosition;(t.writePosition-o|0)>=n||new Hn(Vn("buffer content",n)).doFail(),r.copyTo_ubllm2$(e.memory,o,n,e.writePosition),e.commitWritten_za3lpa$(n),i.v=u;var a=n;return t.discardExact_za3lpa$(a),i.v,n}function wi(t,e,n){if(void 0===n&&(n=e.limit-e.writePosition|0),!(t.writePosition>t.readPosition))return-1;var i=e.limit-e.writePosition|0,r=t.writePosition-t.readPosition|0,o=g.min(i,r,n),a={v:null},s=t.memory,l=t.readPosition;(t.writePosition-l|0)>=o||new Hn(Vn("buffer content",o)).doFail(),s.copyTo_ubllm2$(e.memory,l,o,e.writePosition),e.commitWritten_za3lpa$(o),a.v=u;var c=o;return t.discardExact_za3lpa$(c),a.v,o}function ki(t,e,n){var i;n>=0||new Kn((i=n,function(){return"length shouldn't be negative: "+i})).doFail(),n<=(e.writePosition-e.readPosition|0)||new Kn(function(t,e){return function(){var n=e;return"length shouldn't be greater than the source read remaining: "+t+" > "+(n.writePosition-n.readPosition|0)}}(n,e)).doFail(),n<=(t.limit-t.writePosition|0)||new Kn(function(t,e){return function(){var n=e;return"length shouldn't be greater than the destination write remaining space: "+t+" > "+(n.limit-n.writePosition|0)}}(n,t)).doFail();var r=t.memory,o=t.writePosition,a=t.limit-o|0;if(a=0||new Ii((n=this,function(){return"shouldn't be negative: headerSizeHint = "+n.headerSizeHint_0})).doFail()}function Li(t,e,n){Fi(),Bi.call(this,t,e,n),this.markNoMoreChunksAvailable()}function Di(){qi=this,this.Empty=new Li(ao().Empty,f,ao().EmptyPool)}Pi.$metadata$={kind:h,simpleName:"BufferLimitExceededException",interfaces:[W]},Ri.$metadata$={kind:h,simpleName:"BytePacketBuilderPlatformBase",interfaces:[Ai]},Ai.$metadata$={kind:h,simpleName:"BytePacketBuilderBase",interfaces:[yn]},Ii.prototype=Object.create(uo.prototype),Ii.prototype.constructor=Ii,Ii.prototype.doFail=function(){throw b(this.closure$message())},Ii.$metadata$={kind:h,interfaces:[uo]},Object.defineProperty(Mi.prototype,"size",{configurable:!0,get:function(){return this._size}}),Object.defineProperty(Mi.prototype,"isEmpty",{configurable:!0,get:function(){return 0===this._size}}),Object.defineProperty(Mi.prototype,"isNotEmpty",{configurable:!0,get:function(){return this._size>0}}),Object.defineProperty(Mi.prototype,"_pool",{configurable:!0,get:function(){return this.pool}}),Mi.prototype.closeDestination=function(){},Mi.prototype.flush_9etqdk$=function(t,e,n){},Mi.prototype.append_s8itvh$=function(t){var n;return e.isType(n=Ri.prototype.append_s8itvh$.call(this,t),Mi)?n:p()},Mi.prototype.append_gw00v9$=function(t){var n;return e.isType(n=Ri.prototype.append_gw00v9$.call(this,t),Mi)?n:p()},Mi.prototype.append_ezbsdh$=function(t,n,i){var r;return e.isType(r=Ri.prototype.append_ezbsdh$.call(this,t,n,i),Mi)?r:p()},Mi.prototype.appendOld_s8itvh$=function(t){return this.append_s8itvh$(t)},Mi.prototype.appendOld_gw00v9$=function(t){return this.append_gw00v9$(t)},Mi.prototype.appendOld_ezbsdh$=function(t,e,n){return this.append_ezbsdh$(t,e,n)},Mi.prototype.preview_chaoki$=function(t){var e,n=qr(this);try{e=t(n)}finally{n.release()}return e},Mi.prototype.build=function(){var t=this.size,n=this.stealAll_8be2vx$();return null==n?Fi().Empty:new Li(n,e.Long.fromInt(t),this.pool)},Mi.prototype.reset=function(){this.release()},Mi.prototype.preview=function(){return qr(this)},Mi.prototype.toString=function(){return"BytePacketBuilder("+this.size+" bytes written)"},Mi.$metadata$={kind:h,simpleName:"BytePacketBuilder",interfaces:[Ri]},Li.prototype.copy=function(){return new Li(Ni(this.head),this.remaining,this.pool)},Li.prototype.fill=function(){return null},Li.prototype.fill_9etqdk$=function(t,e,n){return 0},Li.prototype.closeSource=function(){},Li.prototype.toString=function(){return"ByteReadPacket("+this.remaining.toString()+" bytes remaining)"},Object.defineProperty(Di.prototype,"ReservedSize",{configurable:!0,get:function(){return 8}}),Di.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var qi=null;function Fi(){return null===qi&&new Di,qi}function Ui(t,e,n){return n=n||Object.create(Li.prototype),Li.call(n,t,ji(t),e),n}function Bi(t,e,n){Ar.call(this,t,e,n)}function Hi(t,e){var n=t.discard_s8cxhz$(e);if(!d(n,e))throw R("Only "+n.toString()+" bytes were discarded of "+e.toString()+" requested")}function Vi(t,n){Hi(t,e.Long.fromInt(n))}function Ki(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a;try{for(;;){var u=c,p=r.v,h=u.writePosition-u.readPosition|0,f=g.min(p,h);if(ii(u,e,o.v,f),r.v=r.v-f|0,o.v=o.v+f|0,!(r.v>0))break;if(l=!1,null==(s=jo(t,c)))break;c=s,l=!0}}finally{l&&zo(t,c)}}while(0);var d=r.v;d>0&&Kr(d)}function Wi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/2|0,m=g.min(_,y);ai(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?2:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);var k=r.v;k>0&&Kr(k)}function Yi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/4|0,m=g.min(_,y);ci(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?4:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);var k=r.v;k>0&&Kr(k)}function Gi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/8|0,m=g.min(_,y);hi(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?8:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);var k=r.v;k>0&&Kr(k)}function Ji(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/4|0,m=g.min(_,y);_i(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?4:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);var k=r.v;k>0&&Kr(k)}function Zi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/8|0,m=g.min(_,y);vi(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?8:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);var k=r.v;k>0&&Kr(k)}function Qi(t,e,n){void 0===n&&(n=e.limit-e.writePosition|0);var i={v:n},r={v:0};t:do{var o,a,s=!0;if(null==(o=No(t,1)))break t;var l=o;try{for(;;){var c=l,u=i.v,p=c.writePosition-c.readPosition|0,h=g.min(u,p);if(bi(c,e,h),i.v=i.v-h|0,r.v=r.v+h|0,!(i.v>0))break;if(s=!1,null==(a=jo(t,l)))break;l=a,s=!0}}finally{s&&zo(t,l)}}while(0);var f=i.v;f>0&&Kr(f)}function Xi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a;try{for(;;){var u=c,p=r.v,h=u.writePosition-u.readPosition|0,f=g.min(p,h);if(ii(u,e,o.v,f),r.v=r.v-f|0,o.v=o.v+f|0,!(r.v>0))break;if(l=!1,null==(s=jo(t,c)))break;c=s,l=!0}}finally{l&&zo(t,c)}}while(0);return i-r.v|0}function tr(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/2|0,m=g.min(_,y);ai(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?2:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);return i-r.v|0}function er(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/4|0,m=g.min(_,y);ci(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?4:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);return i-r.v|0}function nr(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/8|0,m=g.min(_,y);hi(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?8:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);return i-r.v|0}function ir(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/4|0,m=g.min(_,y);_i(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?4:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);return i-r.v|0}function rr(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/8|0,m=g.min(_,y);vi(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?8:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);return i-r.v|0}function or(t,e,n){void 0===n&&(n=e.limit-e.writePosition|0);var i={v:n},r={v:0};t:do{var o,a,s=!0;if(null==(o=No(t,1)))break t;var l=o;try{for(;;){var c=l,u=i.v,p=c.writePosition-c.readPosition|0,h=g.min(u,p);if(bi(c,e,h),i.v=i.v-h|0,r.v=r.v+h|0,!(i.v>0))break;if(s=!1,null==(a=jo(t,l)))break;l=a,s=!0}}finally{s&&zo(t,l)}}while(0);return n-i.v|0}function ar(t,n,i,r,o){void 0===i&&(i=0),void 0===r&&(r=1),void 0===o&&(o=2147483647),Ao(n,i,r,o);var a=t.peekTo_afjyek$(n.memory,e.Long.fromInt(n.writePosition),e.Long.fromInt(i),e.Long.fromInt(r),e.Long.fromInt(P(o,n.limit-n.writePosition|0))).toInt();return n.commitWritten_za3lpa$(a),a}function sr(t){var n;t:do{var i=e.isType(t,un);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>2),i){var r=t.headPosition;t.headPosition=r+2|0,n=t.headMemory.view.getInt16(r,!1);break t}n=lr(t)}while(0);return n}function lr(t){var e,n=null!=(e=No(t,2))?e:Kr(2),i=Wn(n);return zo(t,n),i}function cr(t){var n;t:do{var i=e.isType(t,un);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>4),i){var r=t.headPosition;t.headPosition=r+4|0,n=t.headMemory.view.getInt32(r,!1);break t}n=ur(t)}while(0);return n}function ur(t){var e,n=null!=(e=No(t,4))?e:Kr(4),i=Yn(n);return zo(t,n),i}function pr(t){var n;t:do{var i=e.isType(t,un);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>8),i){var r=t.headPosition;t.headPosition=r+8|0;var o=t.headMemory;n=e.Long.fromInt(o.view.getUint32(r,!1)).shiftLeft(32).or(e.Long.fromInt(o.view.getUint32(r+4|0,!1)));break t}n=hr(t)}while(0);return n}function hr(t){var e,n=null!=(e=No(t,8))?e:Kr(8),i=Gn(n);return zo(t,n),i}function fr(t){var n;t:do{var i=e.isType(t,un);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>4),i){var r=t.headPosition;t.headPosition=r+4|0,n=t.headMemory.view.getFloat32(r,!1);break t}n=dr(t)}while(0);return n}function dr(t){var e,n=null!=(e=No(t,4))?e:Kr(4),i=Jn(n);return zo(t,n),i}function _r(t){var n;t:do{var i=e.isType(t,un);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>8),i){var r=t.headPosition;t.headPosition=r+8|0,n=t.headMemory.view.getFloat64(r,!1);break t}n=yr(t)}while(0);return n}function yr(t){var e,n=null!=(e=No(t,8))?e:Kr(8),i=Zn(n);return zo(t,n),i}function mr(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:n},o={v:i},a=To(t,1,null);try{for(;;){var s=a,l=o.v,c=s.limit-s.writePosition|0,u=g.min(l,c);if(oi(s,e,r.v,u),r.v=r.v+u|0,o.v=o.v-u|0,!(o.v>0))break;a=To(t,1,a)}}finally{Po(t,a)}}function vr(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=To(t,2,null);try{for(var l;;){var c=s,u=a.v,p=c.limit-c.writePosition|0,h=g.min(u,p);if(li(c,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,2))<=0)break;s=To(t,l,s)}}finally{Po(t,s)}}function $r(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=To(t,4,null);try{for(var l;;){var c=s,u=a.v,p=c.limit-c.writePosition|0,h=g.min(u,p);if(pi(c,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,4))<=0)break;s=To(t,l,s)}}finally{Po(t,s)}}function gr(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=To(t,8,null);try{for(var l;;){var c=s,u=a.v,p=c.limit-c.writePosition|0,h=g.min(u,p);if(di(c,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,8))<=0)break;s=To(t,l,s)}}finally{Po(t,s)}}function br(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=To(t,4,null);try{for(var l;;){var c=s,u=a.v,p=c.limit-c.writePosition|0,h=g.min(u,p);if(mi(c,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,4))<=0)break;s=To(t,l,s)}}finally{Po(t,s)}}function wr(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=To(t,8,null);try{for(var l;;){var c=s,u=a.v,p=c.limit-c.writePosition|0,h=g.min(u,p);if(gi(c,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,8))<=0)break;s=To(t,l,s)}}finally{Po(t,s)}}function kr(t,e,n){void 0===n&&(n=e.writePosition-e.readPosition|0);var i={v:0},r={v:n},o=To(t,1,null);try{for(;;){var a=o,s=r.v,l=a.limit-a.writePosition|0,c=g.min(s,l);if(ki(a,e,c),i.v=i.v+c|0,r.v=r.v-c|0,!(r.v>0))break;o=To(t,1,o)}}finally{Po(t,o)}}function Sr(t,n,i,r){xr(t,n,e.Long.fromInt(i),e.Long.fromInt(r))}function xr(t,n,i,r){var o={v:i},a={v:r},s=To(t,1,null);try{for(;;){var l=s,c=a.v,u=e.Long.fromInt(l.limit-l.writePosition|0),p=c.compareTo_11rb$(u)<=0?c:u;if(n.copyTo_q2ka7j$(l.memory,o.v,p,e.Long.fromInt(l.writePosition)),l.commitWritten_za3lpa$(p.toInt()),o.v=o.v.add(p),a.v=a.v.subtract(p),!(a.v.toNumber()>0))break;s=To(t,1,s)}}finally{Po(t,s)}}function Er(t,n,i){if(void 0===i&&(i=0),e.isType(t,yn)){var r={v:f},o=To(t,1,null);try{for(;;){var a=o,s=e.Long.fromInt(a.limit-a.writePosition|0),l=n.subtract(r.v),c=(s.compareTo_11rb$(l)<=0?s:l).toInt();if(Ln(a,c,i),r.v=r.v.add(e.Long.fromInt(c)),!(r.v.compareTo_11rb$(n)<0))break;o=To(t,1,o)}}finally{Po(t,o)}}else!function(t,e,n){var i;for(i=J(0,e).iterator();i.hasNext();)i.next(),t.writeByte_s8j3t7$(n)}(t,n,i)}function Cr(t,n){var i;t:do{if(e.isType(t,yn)){var r=t.tailPosition_8be2vx$;if((t.tailEndExclusive_8be2vx$-r|0)>2){t.tailPosition_8be2vx$=r+2|0,t.tailMemory_8be2vx$.view.setInt16(r,n,!1),i=!0;break t}}i=!1}while(0);i||function(t,n){var i;t:do{if(e.isType(t,yn)){Qn(t.prepareWriteHead_za3lpa$(2),n),t.afterHeadWrite(),i=!0;break t}i=!1}while(0);i||(t.writeByte_s8j3t7$(_(n>>>8)),t.writeByte_s8j3t7$(_(255&n)))}(t,n)}function Or(t,n){var i;t:do{if(e.isType(t,yn)){var r=t.tailPosition_8be2vx$;if((t.tailEndExclusive_8be2vx$-r|0)>4){t.tailPosition_8be2vx$=r+4|0,t.tailMemory_8be2vx$.view.setInt32(r,n,!1),i=!0;break t}}i=!1}while(0);i||Nr(t,n)}function Nr(t,n){var i;t:do{if(e.isType(t,yn)){Xn(t.prepareWriteHead_za3lpa$(4),n),t.afterHeadWrite(),i=!0;break t}i=!1}while(0);i||zr(t,n)}function zr(t,e){var n=S(e>>>16);t.writeByte_s8j3t7$(_(n>>>8)),t.writeByte_s8j3t7$(_(255&n));var i=S(65535&e);t.writeByte_s8j3t7$(_(i>>>8)),t.writeByte_s8j3t7$(_(255&i))}function jr(t,n){var i;t:do{if(e.isType(t,yn)){var r=t.tailPosition_8be2vx$;if((t.tailEndExclusive_8be2vx$-r|0)>8){t.tailPosition_8be2vx$=r+8|0;var o=t.tailMemory_8be2vx$;o.view.setInt32(r,n.shiftRight(32).toInt(),!1),o.view.setInt32(r+4|0,n.and(Y).toInt(),!1),i=!0;break t}}i=!1}while(0);i||Tr(t,n)}function Tr(t,n){var i;t:do{if(e.isType(t,yn)){ti(t.prepareWriteHead_za3lpa$(8),n),t.afterHeadWrite(),i=!0;break t}i=!1}while(0);i||(zr(t,n.shiftRightUnsigned(32).toInt()),zr(t,n.and(Y).toInt()))}function Pr(t,n){var i;t:do{if(e.isType(t,yn)){var r=t.tailPosition_8be2vx$;if((t.tailEndExclusive_8be2vx$-r|0)>4){t.tailPosition_8be2vx$=r+4|0,t.tailMemory_8be2vx$.view.setFloat32(r,n,!1),i=!0;break t}}i=!1}while(0);i||Nr(t,Z(n))}function Rr(t,n){var i;t:do{if(e.isType(t,yn)){var r=t.tailPosition_8be2vx$;if((t.tailEndExclusive_8be2vx$-r|0)>8){t.tailPosition_8be2vx$=r+8|0,t.tailMemory_8be2vx$.view.setFloat64(r,n,!1),i=!0;break t}}i=!1}while(0);i||Tr(t,Q(n))}function Ar(t,e,n){Lr(),un.call(this,t,e,n)}function Ir(){Mr=this}Li.$metadata$={kind:h,simpleName:"ByteReadPacket",interfaces:[Bi,Rs]},Bi.$metadata$={kind:h,simpleName:"ByteReadPacketPlatformBase",interfaces:[Ar]},Object.defineProperty(Ir.prototype,"Empty",{configurable:!0,get:function(){return Fi().Empty}}),Ir.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var Mr=null;function Lr(){return null===Mr&&new Ir,Mr}function Dr(t){var e;return!t.endOfInput&&null!=(e=No(t,1))&&(zo(t,e),!0)}function qr(t){var e=t.head_8be2vx$;return e===ao().Empty?Fi().Empty:Ui(Ni(e),t._pool)}function Fr(t,e){if(void 0===e){var n=t.remaining;if(n.compareTo_11rb$(X)>0)throw b("Unable to convert to a ByteArray: packet is too big");e=n.toInt()}if(0!==e){var i=new Int8Array(e);return Ki(t,i,0,e),i}return ro}function Ur(t,e,n){return void 0===n&&(n=is().UTF_8),Qa(n.newDecoder(),t,e)}function Br(t,e,n,i,r){if(void 0===n&&(n=0),void 0===i&&(i=e.length),void 0===r&&(r=is().UTF_8),r===is().UTF_8)return Vr(t,e,n,i);ln(r.newEncoder(),t,e,n,i)}function Hr(t,e,n,i,r){if(void 0===n&&(n=0),void 0===i&&(i=e.length),void 0===r&&(r=is().UTF_8),r===is().UTF_8)return Vr(t,new yo(e,0,e.length),n,i);en(r.newEncoder(),e,n,i,t)}function Vr(t,e,n,i){var r={v:n},o=To(t,1,null);try{for(var a;;){var s=o,l=s.memory,c=s.writePosition,u=s.limit,p=$o(l,e,r.v,i,c,u),h=new I(S(p.value>>>16)),f=new I(S(65535&p.value));if(r.v=r.v+(65535&h.data)|0,s.commitWritten_za3lpa$(65535&f.data),(a=0==(65535&h.data)&&r.v0)throw R("This instance is already in use but somehow appeared in the pool.");if((t=this).refCount_yk3bl6$_0===e&&(t.refCount_yk3bl6$_0=1,1))break t}}while(0)},Gr.prototype.release_8be2vx$=function(){var t,e;this.refCount_yk3bl6$_0;t:do{for(;;){var n=this.refCount_yk3bl6$_0;if(n<=0)throw R("Unable to release: it is already released.");var i=n-1|0;if((e=this).refCount_yk3bl6$_0===n&&(e.refCount_yk3bl6$_0=i,1)){t=i;break t}}}while(0);return 0===t},Gr.prototype.reset=function(){null!=this.origin&&new Wr(Zr).doFail(),$n.prototype.reset.call(this),this.attachment=null,this.nextRef_43oo9e$_0=null},Object.defineProperty(Qr.prototype,"Empty",{configurable:!0,get:function(){return Ys().Empty}}),Object.defineProperty(Xr.prototype,"capacity",{configurable:!0,get:function(){return bn.capacity}}),Xr.prototype.borrow=function(){return bn.borrow()},Xr.prototype.recycle_trkh7z$=function(t){if(!e.isType(t,Is))throw b("Only IoBuffer instances can be recycled.");bn.recycle_trkh7z$(t)},Xr.prototype.dispose=function(){bn.dispose()},Xr.$metadata$={kind:h,interfaces:[Uo]},Object.defineProperty(to.prototype,"capacity",{configurable:!0,get:function(){return 1}}),to.prototype.borrow=function(){return ao().Empty},to.prototype.recycle_trkh7z$=function(t){t!==ao().Empty&&new Wr(eo).doFail()},to.prototype.dispose=function(){},to.$metadata$={kind:h,interfaces:[Uo]},no.prototype.borrow=function(){return new Is(ya().alloc_za3lpa$(4096),null)},no.prototype.recycle_trkh7z$=function(t){if(!e.isType(t,Is))throw b("Only IoBuffer instances can be recycled.");ya().free_vn6nzs$(t.memory)},no.$metadata$={kind:h,interfaces:[Bo]},io.prototype.borrow=function(){throw A("This pool doesn't support borrow")},io.prototype.recycle_trkh7z$=function(t){},io.$metadata$={kind:h,interfaces:[Bo]},Qr.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var ro,oo=null;function ao(){return null===oo&&new Qr,oo}function so(){return"A chunk couldn't be a view of itself."}function lo(t){return 1===t.referenceCount}function co(t,e){throw b("Long value "+t.toString()+" of "+e+" doesn't fit into 32-bit integer")}function uo(){}function po(t){this.closure$message=t,uo.call(this)}function ho(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.local$tmp$=void 0,this.local$decoded=void 0,this.local$size=void 0,this.local$cr=void 0,this.local$end=void 0,this.local$out=t,this.local$limit=e,this.local$nextChunk=n}function fo(t,e,n,i,r){var o=new ho(t,e,n,i);return r?o:o.doResume(null)}function _o(t){throw new al("Premature end of stream: expected "+t+" bytes to decode UTF-8 char")}function yo(t,e,n){this.array_0=t,this.offset_0=e,this.length_xy9hzd$_0=n}function mo(t){this.value=t}function vo(t,e,n){return n=n||Object.create(mo.prototype),mo.call(n,(65535&t.data)<<16|65535&e.data),n}function $o(t,e,n,i,r,o){for(var a,s,l=n+(65535&I.Companion.MAX_VALUE.data)|0,c=g.min(i,l),u=P(o,65535&I.Companion.MAX_VALUE.data),p=r,h=n;;){if(p>=u||h>=c)return vo(new I(S(h-n|0)),new I(S(p-r|0)));var f=65535&(0|e.charCodeAt((h=(a=h)+1|0,a)));if(0!=(65408&f))break;t.view.setInt8((p=(s=p)+1|0,s),_(f))}return function(t,e,n,i,r,o,a,s){for(var l,c,u=n,p=o,h=a-3|0;!((h-p|0)<=0||u>=i);){var f,d=e.charCodeAt((u=(l=u)+1|0,l)),y=ot(d)?u!==i&&rt(e.charCodeAt(u))?Eo(d,e.charCodeAt((u=(c=u)+1|0,c))):63:0|d,m=p;0<=y&&y<=127?(t.view.setInt8(m,_(y)),f=1):128<=y&&y<=2047?(t.view.setInt8(m,_(192|y>>6&31)),t.view.setInt8(m+1|0,_(128|63&y)),f=2):2048<=y&&y<=65535?(t.view.setInt8(m,_(224|y>>12&15)),t.view.setInt8(m+1|0,_(128|y>>6&63)),t.view.setInt8(m+2|0,_(128|63&y)),f=3):65536<=y&&y<=1114111?(t.view.setInt8(m,_(240|y>>18&7)),t.view.setInt8(m+1|0,_(128|y>>12&63)),t.view.setInt8(m+2|0,_(128|y>>6&63)),t.view.setInt8(m+3|0,_(128|63&y)),f=4):f=bo(y),p=p+f|0}return p===h?function(t,e,n,i,r,o,a,s){for(var l,c,u=n,p=o;;){var h=a-p|0;if(h<=0||u>=i)break;var f=e.charCodeAt((u=(l=u)+1|0,l)),d=ot(f)?u!==i&&rt(e.charCodeAt(u))?Eo(f,e.charCodeAt((u=(c=u)+1|0,c))):63:0|f;if((1<=d&&d<=127?1:128<=d&&d<=2047?2:2048<=d&&d<=65535?3:65536<=d&&d<=1114111?4:bo(d))>h){u=u-1|0;break}var y,m=p;0<=d&&d<=127?(t.view.setInt8(m,_(d)),y=1):128<=d&&d<=2047?(t.view.setInt8(m,_(192|d>>6&31)),t.view.setInt8(m+1|0,_(128|63&d)),y=2):2048<=d&&d<=65535?(t.view.setInt8(m,_(224|d>>12&15)),t.view.setInt8(m+1|0,_(128|d>>6&63)),t.view.setInt8(m+2|0,_(128|63&d)),y=3):65536<=d&&d<=1114111?(t.view.setInt8(m,_(240|d>>18&7)),t.view.setInt8(m+1|0,_(128|d>>12&63)),t.view.setInt8(m+2|0,_(128|d>>6&63)),t.view.setInt8(m+3|0,_(128|63&d)),y=4):y=bo(d),p=p+y|0}return vo(new I(S(u-r|0)),new I(S(p-s|0)))}(t,e,u,i,r,p,a,s):vo(new I(S(u-r|0)),new I(S(p-s|0)))}(t,e,h=h-1|0,c,n,p,u,r)}function go(t){throw new Co("Expected "+t+" more character bytes")}function bo(t){throw b("Malformed code-point "+t+" found")}function wo(t){return t>>>16==0}function ko(t){return t<=1114111}function So(t){return 56320+(1023&t)|0}function xo(t){return 55232+(t>>>10)|0}function Eo(t,e){return((0|t)-55232|0)<<10|(0|e)-56320|0}function Co(t){K(t,this),this.name="MalformedUTF8InputException"}function Oo(t,e){var n,i=e.size;if(null==(n=e.stealAll_8be2vx$()))return 0;var r=n;return i<=Bs&&null==r.next&&t.tryWriteAppend_pvnryh$(r)?(e.afterBytesStolen_8be2vx$(),i):(t.append_pvnryh$(r),i)}function No(t,n){return e.isType(t,un)?t.prepareReadHead_za3lpa$(n):e.isType(t,Gr)?t.writePosition>t.readPosition?t:null:function(t,n){if(t.endOfInput)return null;var i=ao().Pool.borrow(),r=t.peekTo_afjyek$(i.memory,e.Long.fromInt(i.writePosition),f,e.Long.fromInt(n),e.Long.fromInt(i.limit-i.writePosition|0)).toInt();return i.commitWritten_za3lpa$(r),rn.readPosition?(n.capacity-n.limit|0)<8?t.fixGapAfterRead_j2u0py$(n):t.headPosition=n.readPosition:t.ensureNext_j2u0py$(n):function(t,e){var n=e.capacity-(e.limit-e.writePosition|0)-(e.writePosition-e.readPosition|0)|0;Vi(t,n),e.release_2bs5fo$(ao().Pool)}(t,n))}function jo(t,n){return n===t?t.writePosition>t.readPosition?t:null:e.isType(t,un)?t.ensureNextHead_j2u0py$(n):function(t,e){var n=e.capacity-(e.limit-e.writePosition|0)-(e.writePosition-e.readPosition|0)|0;return Vi(t,n),e.resetForWrite(),t.endOfInput||ar(t,e)<=0?(e.release_2bs5fo$(ao().Pool),null):e}(t,n)}function To(t,n,i){return e.isType(t,yn)?(null!=i&&t.afterHeadWrite(),t.prepareWriteHead_za3lpa$(n)):function(t,e){return null!=e?(kr(t,e),e.resetForWrite(),e):ao().Pool.borrow()}(t,i)}function Po(t,n){if(e.isType(t,yn))return t.afterHeadWrite();!function(t,e){kr(t,e),e.release_2bs5fo$(ao().Pool)}(t,n)}function Ro(t){this.closure$message=t,uo.call(this)}function Ao(t,e,n,i){var r,o;e>=0||new Ro((r=e,function(){return"offset shouldn't be negative: "+r+"."})).doFail(),n>=0||new Ro((o=n,function(){return"min shouldn't be negative: "+o+"."})).doFail(),i>=n||new Ro(function(t,e){return function(){return"max should't be less than min: max = "+t+", min = "+e+"."}}(i,n)).doFail(),n<=(t.limit-t.writePosition|0)||new Ro(function(t,e){return function(){var n=e;return"Not enough free space in the destination buffer to write the specified minimum number of bytes: min = "+t+", free = "+(n.limit-n.writePosition|0)+"."}}(n,t)).doFail()}function Io(){this.suspension_0=null}function Mo(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Lo(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$suspended=void 0}function Do(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.local$tmp$=void 0,this.local$remainingLimit=void 0,this.local$transferred=void 0,this.local$tail=void 0,this.local$$receiver=t,this.local$dst=e,this.local$limit=n}function qo(t,e,n,i,r){var o=new Do(t,e,n,i);return r?o:o.doResume(null)}function Fo(t,e,n,i){a.call(this,i),this.exceptionState_0=9,this.local$lastPiece=void 0,this.local$rc=void 0,this.local$$receiver=t,this.local$dst=e,this.local$limit=n}function Uo(){}function Bo(){}function Ho(){this.borrowed_m1d2y6$_0=0,this.disposed_rxrbhb$_0=!1,this.instance_vlsx8v$_0=null}function Vo(t){return void 0===t&&(t=!1),new Yo(Ys().Empty,t)}function Ko(t,n,i){var r;if(0===t.length)return ia().Empty;for(var o=Ys().Pool.borrow(),a=o,s=n,l=s+i|0;;){a.reserveEndGap_za3lpa$(8);var c=l-s|0,u=a,h=u.limit-u.writePosition|0,f=g.min(c,h);if(oi(e.isType(r=a,$n)?r:p(),t,s,f),(s=s+f|0)===l)break;var d=a;a=Ys().Pool.borrow(),d.next=a}var _=new Yo(o,!1);return je(_),_}function Wo(t,n,i,r){var o,a;return qo(e.isType(o=t,wt)?o:p(),e.isType(a=n,wt)?a:p(),i,r)}function Yo(t,e){wt.call(this,t,e),this.attachedJob_0=null}function Go(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$tmp$_0=void 0,this.local$dst=e,this.local$offset=n,this.local$length=i}function Jo(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$dst=e,this.local$offset=n,this.local$length=i}function Zo(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$start=void 0,this.local$end=void 0,this.local$remaining=void 0,this.local$dst=e,this.local$offset=n,this.local$length=i}function Qo(){this.closed=!1,this.readByteOrder=_s(),this.writeByteOrder=_s(),this.totalBytesRead=f,this.totalBytesWritten=f,this.closedCause=null,this.lastReadAvailable=0,this.lastReadView=ao().Empty}function Xo(){ia()}function ta(){na=this,this.Empty_wsx8uv$_0=ut(ea)}function ea(){var t=new Yo(Ys().Empty,!1);return t.close_dbl4no$(null),t}Gr.$metadata$={kind:h,simpleName:"ChunkBuffer",interfaces:[$n]},uo.$metadata$={kind:h,simpleName:"RequireFailureCapture",interfaces:[]},po.prototype=Object.create(uo.prototype),po.prototype.constructor=po,po.prototype.doFail=function(){throw b(this.closure$message())},po.$metadata$={kind:h,interfaces:[uo]},ho.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ho.prototype=Object.create(a.prototype),ho.prototype.constructor=ho,ho.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$decoded={v:0},this.local$size={v:1},this.local$cr={v:!1},this.local$end={v:!1},this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$end.v||0===this.local$size.v){this.state_0=5;continue}if(this.state_0=3,this.result_0=this.local$nextChunk(this.local$size.v,this),this.result_0===o)return o;continue;case 3:if(this.local$tmp$=this.result_0,null==this.local$tmp$){this.state_0=5;continue}this.state_0=4;continue;case 4:var t=this.local$tmp$;t:do{var e,n,i=!0;if(null==(e=No(t,1)))break t;var r=e,a=1;try{e:do{var s,l=r,c=l.writePosition-l.readPosition|0;if(c>=a)try{var u,p=r,h={v:0};n:do{for(var f={v:0},d={v:0},_={v:0},y=p.memory,m=p.readPosition,v=p.writePosition,$=m;$>=1,f.v=f.v+1|0;if(_.v=f.v,f.v=f.v-1|0,_.v>(v-$|0)){p.discardExact_za3lpa$($-m|0),u=_.v;break n}}else if(d.v=d.v<<6|127&g,f.v=f.v-1|0,0===f.v){if(wo(d.v)){var x,E=V(H(d.v));i:do{switch(U(E)){case 13:if(this.local$cr.v){this.local$end.v=!0,x=!1;break i}this.local$cr.v=!0,x=!0;break i;case 10:this.local$end.v=!0,h.v=1,x=!1;break i;default:if(this.local$cr.v){this.local$end.v=!0,x=!1;break i}if(this.local$decoded.v===this.local$limit)throw new Pi("Too many characters in line: limit "+this.local$limit+" exceeded");this.local$decoded.v=this.local$decoded.v+1|0,this.local$out.append_s8itvh$(U(E)),x=!0;break i}}while(0);if(!x){p.discardExact_za3lpa$($-m-_.v+1|0),u=-1;break n}}else if(ko(d.v)){var C,O=V(H(xo(d.v)));i:do{switch(U(O)){case 13:if(this.local$cr.v){this.local$end.v=!0,C=!1;break i}this.local$cr.v=!0,C=!0;break i;case 10:this.local$end.v=!0,h.v=1,C=!1;break i;default:if(this.local$cr.v){this.local$end.v=!0,C=!1;break i}if(this.local$decoded.v===this.local$limit)throw new Pi("Too many characters in line: limit "+this.local$limit+" exceeded");this.local$decoded.v=this.local$decoded.v+1|0,this.local$out.append_s8itvh$(U(O)),C=!0;break i}}while(0);var N=!C;if(!N){var z,j=V(H(So(d.v)));i:do{switch(U(j)){case 13:if(this.local$cr.v){this.local$end.v=!0,z=!1;break i}this.local$cr.v=!0,z=!0;break i;case 10:this.local$end.v=!0,h.v=1,z=!1;break i;default:if(this.local$cr.v){this.local$end.v=!0,z=!1;break i}if(this.local$decoded.v===this.local$limit)throw new Pi("Too many characters in line: limit "+this.local$limit+" exceeded");this.local$decoded.v=this.local$decoded.v+1|0,this.local$out.append_s8itvh$(U(j)),z=!0;break i}}while(0);N=!z}if(N){p.discardExact_za3lpa$($-m-_.v+1|0),u=-1;break n}}else bo(d.v);d.v=0}}var T=v-m|0;p.discardExact_za3lpa$(T),u=0}while(0);this.local$size.v=u,h.v>0&&p.discardExact_za3lpa$(h.v),this.local$size.v=this.local$end.v?0:F(this.local$size.v,1),a=this.local$size.v}finally{var P=r;s=P.writePosition-P.readPosition|0}else s=c;if(i=!1,0===s)n=jo(t,r);else{var R=s0)}finally{i&&zo(t,r)}}while(0);this.state_0=2;continue;case 5:return this.local$size.v>1&&_o(this.local$size.v),this.local$cr.v&&(this.local$end.v=!0),this.local$decoded.v>0||this.local$end.v;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(yo.prototype,"length",{get:function(){return this.length_xy9hzd$_0}}),yo.prototype.charCodeAt=function(t){return t>=this.length&&this.indexOutOfBounds_0(t),this.array_0[t+this.offset_0|0]},yo.prototype.subSequence_vux9f0$=function(t,e){var n,i,r;return t>=0||new po((n=t,function(){return"startIndex shouldn't be negative: "+n})).doFail(),t<=this.length||new po(function(t,e){return function(){return"startIndex is too large: "+t+" > "+e.length}}(t,this)).doFail(),(t+e|0)<=this.length||new po((i=e,r=this,function(){return"endIndex is too large: "+i+" > "+r.length})).doFail(),e>=t||new po(function(t,e){return function(){return"endIndex should be greater or equal to startIndex: "+t+" > "+e}}(t,e)).doFail(),new yo(this.array_0,this.offset_0+t|0,e-t|0)},yo.prototype.indexOutOfBounds_0=function(t){throw new nt("String index out of bounds: "+t+" > "+this.length)},yo.$metadata$={kind:h,simpleName:"CharArraySequence",interfaces:[it]},Object.defineProperty(mo.prototype,"characters",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.internal.EncodeResult.get_characters",k((function(){var t=e.toShort,n=e.kotlin.UShort;return function(){return new n(t(this.value>>>16))}})))}),Object.defineProperty(mo.prototype,"bytes",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.internal.EncodeResult.get_bytes",k((function(){var t=e.toShort,n=e.kotlin.UShort;return function(){return new n(t(65535&this.value))}})))}),mo.prototype.component1=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.internal.EncodeResult.component1",k((function(){var t=e.toShort,n=e.kotlin.UShort;return function(){return new n(t(this.value>>>16))}}))),mo.prototype.component2=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.internal.EncodeResult.component2",k((function(){var t=e.toShort,n=e.kotlin.UShort;return function(){return new n(t(65535&this.value))}}))),mo.$metadata$={kind:h,simpleName:"EncodeResult",interfaces:[]},mo.prototype.unbox=function(){return this.value},mo.prototype.toString=function(){return"EncodeResult(value="+e.toString(this.value)+")"},mo.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.value)|0},mo.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.value,t.value)},Co.$metadata$={kind:h,simpleName:"MalformedUTF8InputException",interfaces:[W]},Ro.prototype=Object.create(uo.prototype),Ro.prototype.constructor=Ro,Ro.prototype.doFail=function(){throw b(this.closure$message())},Ro.$metadata$={kind:h,interfaces:[uo]},Mo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Mo.prototype=Object.create(a.prototype),Mo.prototype.constructor=Mo,Mo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.trySuspend_0(this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.result_0)return;this.state_0=3;continue;case 3:return void this.$this.resume();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Io.prototype.sleep=function(t,e){var n=new Mo(this,t);return e?n:n.doResume(null)},Io.prototype.resume=function(){var t,e,n;null!=(n=(e=this).suspension_0,e.suspension_0=null,t=n)&&t.complete()},Io.prototype.cancel_dbl4no$=function(t){var e,n,i;if(i=(n=this).suspension_0,n.suspension_0=null,null!=(e=i)){var r=e;null!=t?r.completeExceptionally_tcv7n7$(t):r.complete()}},Lo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Lo.prototype=Object.create(a.prototype),Lo.prototype.constructor=Lo,Lo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$suspended=!1;var t=at();if(null==(e=this).$this.suspension_0&&(e.$this.suspension_0=t,1)){if(this.local$suspended=!0,this.state_0=2,this.result_0=t.join(this),this.result_0===o)return o;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.state_0=3;continue;case 3:return this.local$suspended;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var e},Io.prototype.trySuspend_0=function(t,e){var n=new Lo(this,t);return e?n:n.doResume(null)},Io.$metadata$={kind:h,simpleName:"AwaitingSlot",interfaces:[]},Do.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Do.prototype=Object.create(a.prototype),Do.prototype.constructor=Do,Do.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$$receiver===this.local$dst)throw b("Failed requirement.".toString());if(null!=this.local$$receiver.closedCause)return this.local$dst.close_dbl4no$(this.local$$receiver.closedCause),f;this.state_0=2;continue;case 1:throw this.exception_0;case 2:this.local$remainingLimit=this.local$limit,this.state_0=3;continue;case 3:if(this.local$remainingLimit.toNumber()<=0){this.state_0=11;continue}if(this.state_0=4,this.result_0=this.local$$receiver.awaitInternalAtLeast1_8be2vx$(this),this.result_0===o)return o;continue;case 4:if(this.result_0){this.state_0=5;continue}this.state_0=11;continue;case 5:if(this.local$transferred=this.local$$receiver.transferTo_pxvbjg$(this.local$dst,this.local$remainingLimit),d(this.local$transferred,f)){if(this.state_0=8,this.result_0=(e=this.local$$receiver,n=this.local$dst,i=this.local$remainingLimit,r=void 0,a=void 0,a=new Fo(e,n,i,this),r?a:a.doResume(null)),this.result_0===o)return o;continue}if(0===this.local$dst.availableForWrite){if(this.state_0=6,this.result_0=this.local$dst.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue}this.state_0=7;continue;case 6:this.state_0=7;continue;case 7:this.local$tmp$=this.local$transferred,this.state_0=10;continue;case 8:if(this.local$tail=this.result_0,d(this.local$tail,f)){this.state_0=11;continue}this.state_0=9;continue;case 9:this.local$tmp$=this.local$tail,this.state_0=10;continue;case 10:var t=this.local$tmp$;this.local$remainingLimit=this.local$remainingLimit.subtract(t),this.state_0=3;continue;case 11:return this.local$limit.subtract(this.local$remainingLimit);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var e,n,i,r,a},Fo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Fo.prototype=Object.create(a.prototype),Fo.prototype.constructor=Fo,Fo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$lastPiece=ao().Pool.borrow(),this.exceptionState_0=7,this.local$lastPiece.resetForWrite_za3lpa$(v(this.local$limit,e.Long.fromInt(this.local$lastPiece.capacity)).toInt()),this.state_0=1,this.result_0=this.local$$receiver.readAvailable_lh221x$(this.local$lastPiece,this),this.result_0===o)return o;continue;case 1:if(this.local$rc=this.result_0,-1===this.local$rc){this.local$lastPiece.release_2bs5fo$(ao().Pool),this.exceptionState_0=9,this.finallyPath_0=[2],this.state_0=8,this.$returnValue=f;continue}this.state_0=3;continue;case 2:return this.$returnValue;case 3:if(this.state_0=4,this.result_0=this.local$dst.writeFully_b4g5fm$(this.local$lastPiece,this),this.result_0===o)return o;continue;case 4:this.exceptionState_0=9,this.finallyPath_0=[5],this.state_0=8,this.$returnValue=e.Long.fromInt(this.local$rc);continue;case 5:return this.$returnValue;case 6:return;case 7:this.finallyPath_0=[9],this.state_0=8;continue;case 8:this.exceptionState_0=9,this.local$lastPiece.release_2bs5fo$(ao().Pool),this.state_0=this.finallyPath_0.shift();continue;case 9:throw this.exception_0;default:throw this.state_0=9,new Error("State Machine Unreachable execution")}}catch(t){if(9===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Uo.prototype.close=function(){this.dispose()},Uo.$metadata$={kind:r,simpleName:"ObjectPool",interfaces:[gs]},Object.defineProperty(Bo.prototype,"capacity",{configurable:!0,get:function(){return 0}}),Bo.prototype.recycle_trkh7z$=function(t){},Bo.prototype.dispose=function(){},Bo.$metadata$={kind:h,simpleName:"NoPoolImpl",interfaces:[Uo]},Yo.prototype.attachJob_dqr1mp$=function(t){var e,n;null!=(e=this.attachedJob_0)&&e.cancel_m4sck1$(),this.attachedJob_0=t,t.invokeOnCompletion_ct2b2z$(!0,void 0,(n=this,function(t){return n.attachedJob_0=null,null!=t&&n.cancel_dbl4no$(t),u}))},Go.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Go.prototype=Object.create(a.prototype),Go.prototype.constructor=Go,Go.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.$this.readable.endOfInput){if(this.state_0=2,this.result_0=this.$this.readAvailableSuspend_0(this.local$dst,this.local$offset,this.local$length,this),this.result_0===o)return o;continue}if(null!=(t=this.$this.closedCause))throw t;this.local$tmp$_0=Ts(this.$this.readable,this.local$dst,this.local$offset,this.local$length),this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.local$tmp$_0=this.result_0,this.state_0=3;continue;case 3:return this.local$tmp$_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Yo.prototype.readAvailable_qmgm5g$=function(t,e,n,i,r){var o=new Go(this,t,e,n,i);return r?o:o.doResume(null)},Jo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Jo.prototype=Object.create(a.prototype),Jo.prototype.constructor=Jo,Jo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.await_za3lpa$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.result_0){this.state_0=3;continue}return-1;case 3:if(this.state_0=4,this.result_0=this.$this.readAvailable_qmgm5g$(this.local$dst,this.local$offset,this.local$length,this),this.result_0===o)return o;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Yo.prototype.readAvailableSuspend_0=function(t,e,n,i,r){var o=new Jo(this,t,e,n,i);return r?o:o.doResume(null)},Yo.prototype.readFully_qmgm5g$=function(t,e,n,i){var r;if(!(this.availableForRead>=n))return this.readFullySuspend_0(t,e,n,i);if(null!=(r=this.closedCause))throw r;Ns(this.readable,t,e,n)},Zo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Zo.prototype=Object.create(a.prototype),Zo.prototype.constructor=Zo,Zo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$start=this.local$offset,this.local$end=this.local$offset+this.local$length|0,this.local$remaining=this.local$length,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$start>=this.local$end){this.state_0=4;continue}if(this.state_0=3,this.result_0=this.$this.readAvailable_qmgm5g$(this.local$dst,this.local$start,this.local$remaining,this),this.result_0===o)return o;continue;case 3:var t=this.result_0;if(-1===t)throw new al("Premature end of stream: required "+this.local$remaining+" more bytes");this.local$start=this.local$start+t|0,this.local$remaining=this.local$remaining-t|0,this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Yo.prototype.readFullySuspend_0=function(t,e,n,i,r){var o=new Zo(this,t,e,n,i);return r?o:o.doResume(null)},Yo.prototype.toString=function(){return"ByteChannel["+st(this.attachedJob_0)+", "+lt(this)+"]"},Yo.$metadata$={kind:h,simpleName:"ByteChannelJS",interfaces:[wt]},Qo.$metadata$={kind:h,simpleName:"ByteChannelSequentialBaseSharedState",interfaces:[]},Xo.prototype.peekTo_afjyek$=function(t,e,n,i,r,o,a){return void 0===n&&(n=f),void 0===i&&(i=ct),void 0===r&&(r=s),a?a(t,e,n,i,r,o):this.peekTo_afjyek$$default(t,e,n,i,r,o)},Object.defineProperty(ta.prototype,"Empty",{configurable:!0,get:function(){return this.Empty_wsx8uv$_0.value}}),ta.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var na=null;function ia(){return null===na&&new ta,na}function ra(){}function oa(t){}function aa(t){return S((255&t)<<8|(65535&t)>>>8)}function sa(t){var e=S(65535&t),n=S((255&e)<<8|(65535&e)>>>8)<<16,i=S(t>>>16);return n|65535&S((255&i)<<8|(65535&i)>>>8)}function la(t){var n=t.and(Y).toInt(),i=S(65535&n),r=S((255&i)<<8|(65535&i)>>>8)<<16,o=S(n>>>16),a=e.Long.fromInt(r|65535&S((255&o)<<8|(65535&o)>>>8)).shiftLeft(32),s=t.shiftRightUnsigned(32).toInt(),l=S(65535&s),c=S((255&l)<<8|(65535&l)>>>8)<<16,u=S(s>>>16);return a.or(e.Long.fromInt(c|65535&S((255&u)<<8|(65535&u)>>>8)).and(Y))}function ca(t){var n=Z(t),i=S(65535&n),r=S((255&i)<<8|(65535&i)>>>8)<<16,o=S(n>>>16),a=r|65535&S((255&o)<<8|(65535&o)>>>8);return e.floatFromBits(a)}function ua(t){var n=Q(t),i=n.and(Y).toInt(),r=S(65535&i),o=S((255&r)<<8|(65535&r)>>>8)<<16,a=S(i>>>16),s=e.Long.fromInt(o|65535&S((255&a)<<8|(65535&a)>>>8)).shiftLeft(32),l=n.shiftRightUnsigned(32).toInt(),c=S(65535&l),u=S((255&c)<<8|(65535&c)>>>8)<<16,p=S(l>>>16),h=s.or(e.Long.fromInt(u|65535&S((255&p)<<8|(65535&p)>>>8)).and(Y));return e.doubleFromBits(h)}function pa(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=e;return fa(ba(),r,n,i)}function ha(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.byteLength-n|0),new ma(new DataView(e,n,i))}function fa(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.byteLength),ha(ba(),e.buffer,e.byteOffset+n|0,i)}function da(){_a=this}Xo.$metadata$={kind:r,simpleName:"ByteReadChannel",interfaces:[]},ra.$metadata$={kind:r,simpleName:"ByteWriteChannel",interfaces:[]},da.prototype.alloc_za3lpa$=function(t){return new ma(new DataView(new ArrayBuffer(t)))},da.prototype.alloc_s8cxhz$=function(t){return t.toNumber()>=2147483647&&co(t,"size"),new ma(new DataView(new ArrayBuffer(t.toInt())))},da.prototype.free_vn6nzs$=function(t){},da.$metadata$={kind:B,simpleName:"DefaultAllocator",interfaces:[tn]};var _a=null;function ya(){return null===_a&&new da,_a}function ma(t){ba(),this.view=t}function va(){ga=this,this.Empty=new ma(new DataView(new ArrayBuffer(0)))}Object.defineProperty(ma.prototype,"size",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.bits.Memory.get_size",(function(){return e.Long.fromInt(this.view.byteLength)}))}),Object.defineProperty(ma.prototype,"size32",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.bits.Memory.get_size32",(function(){return this.view.byteLength}))}),ma.prototype.loadAt_za3lpa$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.bits.Memory.loadAt_za3lpa$",(function(t){return this.view.getInt8(t)})),ma.prototype.loadAt_s8cxhz$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.bits.Memory.loadAt_s8cxhz$",k((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t){var n=this.view;return t.toNumber()>=2147483647&&e(t,"index"),n.getInt8(t.toInt())}}))),ma.prototype.storeAt_6t1wet$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.bits.Memory.storeAt_6t1wet$",(function(t,e){this.view.setInt8(t,e)})),ma.prototype.storeAt_3pq026$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.bits.Memory.storeAt_3pq026$",k((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n){var i=this.view;t.toNumber()>=2147483647&&e(t,"index"),i.setInt8(t.toInt(),n)}}))),ma.prototype.slice_vux9f0$=function(t,n){if(!(t>=0))throw b(("offset shouldn't be negative: "+t).toString());if(!(n>=0))throw b(("length shouldn't be negative: "+n).toString());if((t+n|0)>e.Long.fromInt(this.view.byteLength).toNumber())throw new nt("offset + length > size: "+t+" + "+n+" > "+e.Long.fromInt(this.view.byteLength).toString());return new ma(new DataView(this.view.buffer,this.view.byteOffset+t|0,n))},ma.prototype.slice_3pjtqy$=function(t,e){t.toNumber()>=2147483647&&co(t,"offset");var n=t.toInt();return e.toNumber()>=2147483647&&co(e,"length"),this.slice_vux9f0$(n,e.toInt())},ma.prototype.copyTo_ubllm2$=function(t,e,n,i){var r=new Int8Array(this.view.buffer,this.view.byteOffset+e|0,n);new Int8Array(t.view.buffer,t.view.byteOffset+i|0,n).set(r)},ma.prototype.copyTo_q2ka7j$=function(t,e,n,i){e.toNumber()>=2147483647&&co(e,"offset");var r=e.toInt();n.toNumber()>=2147483647&&co(n,"length");var o=n.toInt();i.toNumber()>=2147483647&&co(i,"destinationOffset"),this.copyTo_ubllm2$(t,r,o,i.toInt())},va.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var $a,ga=null;function ba(){return null===ga&&new va,ga}function wa(t,e,n,i,r){var o=e,a=new Int8Array(t.view.buffer,t.view.byteOffset+n|0,i);o.set(a,r)}function ka(t,e,n,i){var r;r=e+n|0;for(var o=e;o0;){var c=r-s|0,u=l/6|0,p=F(g.min(c,u),1),h=ot(n.charCodeAt(s+p-1|0)),f=h&&1===p?s+2|0:h?s+p-1|0:s+p|0,_=s,y=a.encode(e.subSequence(n,_,f).toString());if(y.length>l)break;Xs(o,y),s=f,l=l-y.length|0}return s-i|0}function Wa(t,e){return!0}function Ya(t){this._charset_8be2vx$=t}function Ga(t){Ya.call(this,t),this.charset_0=t}function Ja(t){return t._charset_8be2vx$}function Za(t,n,i,r){var o=sl(Ua(Ja(t)),!0),a={v:0};t:do{var s,l,c=!0;if(null==(s=No(n,1)))break t;var u=s,p=1;try{e:do{var h,f=u,d=f.writePosition-f.readPosition|0;if(d>=p)try{var _,y=u;n:do{var m,v=r-a.v|0,$=y.writePosition-y.readPosition|0;if(v<$){_=0;break n}var g,b=y.memory,w=y.readPosition,k=y.writePosition,S=new ht(b.view.buffer,b.view.byteOffset+w|0,k-w|0);try{var x,C;try{x=o.decode_g2l45e$(S,cl(!0))}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(C=t.message)?C:"no cause provided")):t}}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(g=t.message)?g:"no cause provided")):t}var O=x;i.append_gw00v9$(O),a.v=a.v+O.length|0;var N=S.byteLength;if(y.discardExact_za3lpa$(N),a.v===r){try{m=o.decode()}catch(t){m=""}m.length>0&&y.rewind_za3lpa$($),_=0}else _=a.v0)}finally{c&&zo(n,u)}}while(0);if(a.v=D)try{var B=L,H=B.memory,V=B.readPosition,K=B.writePosition,W=ss(new ht(H.view.buffer,H.view.byteOffset+V|0,K-V|0),o,r-a.v|0);i.append_gw00v9$(W.charactersDecoded),a.v=a.v+W.charactersDecoded.length|0;var Y=W.bytesConsumed;B.discardExact_za3lpa$(Y),Y>0?R.v=1:8===R.v?R.v=0:R.v=R.v+1|0,D=R.v}finally{var G=L;q=G.writePosition-G.readPosition|0}else q=U;if(M=!1,0===q)I=jo(n,L);else{var J=q0)}finally{M&&zo(n,L)}}while(0)}return a.v}function Qa(t,n,i){if(0===i)return"";var r=e.isType(n,un);if(r&&(r=(n.headEndExclusive-n.headPosition|0)>=i),r){var o,a,s=sl(Ja(t)._name_8be2vx$,!0),l=n.head,c=n.headMemory.view;try{var u=0===l.readPosition&&i===c.byteLength?c:new DataView(c.buffer,c.byteOffset+l.readPosition|0,i);o=s.decode_c2mund$(u)}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(a=t.message)?a:"no cause provided")):t}var p=o;return n.discardExact_za3lpa$(i),p}return function(t,n,i){var r,o=sl(Ua(Ja(t)),!0),a={v:i},s=L(i);try{t:do{var l,c,u=!0;if(null==(l=No(n,6)))break t;var p=l,h=6;try{do{var f,d=p,_=d.writePosition-d.readPosition|0;if(_>=h)try{var y,m=p,v=m.writePosition-m.readPosition|0,$=a.v,b=g.min(v,$);if(0===m.readPosition&&m.memory.view.byteLength===b){var w,k,S=m.memory.view;try{w=o.decode_g2l45e$(S,cl(!0))}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(k=t.message)?k:"no cause provided")):t}y=w}else{var x,C,O=new Int8Array(m.memory.view.buffer,m.memory.view.byteOffset+m.readPosition|0,b);try{x=o.decode_g2l45e$(O,cl(!0))}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(C=t.message)?C:"no cause provided")):t}y=x}var N=y;s.append_pdl1vj$(N),m.discardExact_za3lpa$(b),a.v=a.v-b|0,h=a.v>0?6:0}finally{var z=p;f=z.writePosition-z.readPosition|0}else f=_;if(u=!1,0===f)c=jo(n,p);else{var j=f0)}finally{u&&zo(n,p)}}while(0);if(a.v>0)t:do{var R,A,I=!0;if(null==(R=No(n,1)))break t;var M=R;try{for(;;){var D,q=M,F=q.writePosition-q.readPosition|0,U=a.v,B=g.min(F,U);if(0===q.readPosition&&q.memory.view.byteLength===B)D=o.decode_c2mund$(q.memory.view);else{var H,V,K=new Int8Array(q.memory.view.buffer,q.memory.view.byteOffset+q.readPosition|0,B);try{H=o.decode_g2l45e$(K,cl(!0))}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(V=t.message)?V:"no cause provided")):t}D=H}var W=D;if(s.append_pdl1vj$(W),q.discardExact_za3lpa$(B),a.v=a.v-B|0,I=!1,null==(A=jo(n,M)))break;M=A,I=!0}}finally{I&&zo(n,M)}}while(0);s.append_pdl1vj$(o.decode())}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(r=t.message)?r:"no cause provided")):t}if(a.v>0)throw new al("Not enough bytes available: had only "+(i-a.v|0)+" instead of "+i);return s.toString()}(t,n,i)}function Xa(){ns=this,this.UTF_8=new rs("UTF-8"),this.ISO_8859_1=new rs("ISO-8859-1")}La.$metadata$={kind:h,simpleName:"Charset",interfaces:[]},Ba.$metadata$={kind:h,simpleName:"CharsetEncoder",interfaces:[]},Ha.$metadata$={kind:h,simpleName:"CharsetEncoderImpl",interfaces:[Ba]},Ha.prototype.component1_0=function(){return this.charset_0},Ha.prototype.copy_6ypavq$=function(t){return new Ha(void 0===t?this.charset_0:t)},Ha.prototype.toString=function(){return"CharsetEncoderImpl(charset="+e.toString(this.charset_0)+")"},Ha.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.charset_0)|0},Ha.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.charset_0,t.charset_0)},Ya.$metadata$={kind:h,simpleName:"CharsetDecoder",interfaces:[]},Ga.$metadata$={kind:h,simpleName:"CharsetDecoderImpl",interfaces:[Ya]},Ga.prototype.component1_0=function(){return this.charset_0},Ga.prototype.copy_6ypavq$=function(t){return new Ga(void 0===t?this.charset_0:t)},Ga.prototype.toString=function(){return"CharsetDecoderImpl(charset="+e.toString(this.charset_0)+")"},Ga.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.charset_0)|0},Ga.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.charset_0,t.charset_0)},Xa.$metadata$={kind:B,simpleName:"Charsets",interfaces:[]};var ts,es,ns=null;function is(){return null===ns&&new Xa,ns}function rs(t){La.call(this,t),this.name=t}function os(t){E.call(this),this.message_dl21pz$_0=t,this.cause_5de4tn$_0=null,e.captureStack(E,this),this.name="MalformedInputException"}function as(t,e){this.charactersDecoded=t,this.bytesConsumed=e}function ss(t,n,i){if(0===i)return new as("",0);try{var r=P(i,t.byteLength),o=n.decode_c2mund$(t.subarray(0,r));if(o.length<=i)return new as(o,r)}catch(t){}return function(t,n,i){for(var r,o=P(i>=268435455?2147483647:8*i|0,t.byteLength);o>8;){try{var a=n.decode_c2mund$(t.subarray(0,o));if(a.length<=i)return new as(a,o)}catch(t){}o=o/2|0}for(o=8;o>0;){try{var s=n.decode_c2mund$(t.subarray(0,o));if(s.length<=i)return new as(s,o)}catch(t){}o=o-1|0}try{n.decode_c2mund$(t)}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(r=t.message)?r:"no cause provided")):t}throw new os("Unable to decode buffer")}(t,n,i)}function ls(t,e,n,i){if(e>=n)return 0;for(var r,o=i.memory,a=i.writePosition,s=o.slice_vux9f0$(a,i.limit-a|0).view,l=new Int8Array(s.buffer,s.byteOffset,s.byteLength),c=0,u=e;u255&&cs(p),l[(r=c,c=r+1|0,r)]=_(p)}var h=c;return i.commitWritten_za3lpa$(h),n-e|0}function cs(t){throw new os("The character with unicode point "+t+" couldn't be mapped to ISO-8859-1 character")}function us(t,n){this.head=t,this.headMemory=this.head.memory,this.headPosition=this.head.readPosition,this.headEndExclusive=this.head.writePosition,this.tailRemaining=n.subtract(e.Long.fromInt(this.headEndExclusive-this.headPosition|0))}function ps(){this.head=null,this.tail=null,this.tailMemory=ba().Empty,this.tailPosition=0,this.tailEndExclusive=0,this.tailInitialPosition=0,this.chainedSize=0}function hs(t){this.limit=t,this.readPosition=0,this.writePosition=0,this.startGap=0,this.attachment=null}function fs(t,e){dt.call(this),this.name$=t,this.ordinal$=e}function ds(){ds=function(){},ts=new fs("BIG_ENDIAN",0),es=new fs("LITTLE_ENDIAN",1),$s()}function _s(){return ds(),ts}function ys(){return ds(),es}function ms(){vs=this,this.native_0=null;var t=new ArrayBuffer(4),e=new Int32Array(t),n=new DataView(t);e[0]=287454020,this.native_0=287454020===n.getInt32(0,!0)?ys():_s()}rs.prototype.newEncoder=function(){return new Ha(this)},rs.prototype.newDecoder=function(){return new Ga(this)},rs.$metadata$={kind:h,simpleName:"CharsetImpl",interfaces:[La]},rs.prototype.component1=function(){return this.name},rs.prototype.copy_61zpoe$=function(t){return new rs(void 0===t?this.name:t)},rs.prototype.toString=function(){return"CharsetImpl(name="+e.toString(this.name)+")"},rs.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.name)|0},rs.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.name,t.name)},Object.defineProperty(os.prototype,"message",{get:function(){return this.message_dl21pz$_0}}),Object.defineProperty(os.prototype,"cause",{get:function(){return this.cause_5de4tn$_0}}),os.$metadata$={kind:h,simpleName:"MalformedInputException",interfaces:[E]},as.$metadata$={kind:h,simpleName:"DecodeBufferResult",interfaces:[]},as.prototype.component1=function(){return this.charactersDecoded},as.prototype.component2=function(){return this.bytesConsumed},as.prototype.copy_bm4lxs$=function(t,e){return new as(void 0===t?this.charactersDecoded:t,void 0===e?this.bytesConsumed:e)},as.prototype.toString=function(){return"DecodeBufferResult(charactersDecoded="+e.toString(this.charactersDecoded)+", bytesConsumed="+e.toString(this.bytesConsumed)+")"},as.prototype.hashCode=function(){var t=0;return t=31*(t=31*t+e.hashCode(this.charactersDecoded)|0)+e.hashCode(this.bytesConsumed)|0},as.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.charactersDecoded,t.charactersDecoded)&&e.equals(this.bytesConsumed,t.bytesConsumed)},us.$metadata$={kind:h,simpleName:"AbstractInputSharedState",interfaces:[]},ps.$metadata$={kind:h,simpleName:"AbstractOutputSharedState",interfaces:[]},hs.$metadata$={kind:h,simpleName:"BufferSharedState",interfaces:[]},ms.prototype.nativeOrder=function(){return this.native_0},ms.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var vs=null;function $s(){return ds(),null===vs&&new ms,vs}function gs(){}function bs(t){this.closure$message=t,uo.call(this)}function ws(t,n,i,r){if(void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.isType(t,un))return Os(t,n,i,r);xs(t,n,i,r)!==r&&Kr(r)}function ks(t,n,i,r){if(void 0===i&&(i=0),void 0===r&&(r=n.byteLength-i|0),e.isType(t,un))return Ns(t,n,i,r);Es(t,n,i,r)!==r&&Kr(r)}function Ss(t,n,i,r){if(void 0===i&&(i=0),void 0===r&&(r=n.byteLength-i|0),e.isType(t,un))return zs(t,n,i,r);Cs(t,n,i,r)!==r&&Kr(r)}function xs(t,n,i,r){var o;return void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.isType(t,un)?js(t,n,i,r):Cs(t,e.isType(o=n,Object)?o:p(),i,r)}function Es(t,n,i,r){if(void 0===i&&(i=0),void 0===r&&(r=n.byteLength-i|0),e.isType(t,un))return Ts(t,n,i,r);var o={v:0};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a;try{for(;;){var u=c,p=u.writePosition-u.readPosition|0,h=r-o.v|0,f=g.min(p,h);if(Sa(u.memory,n,u.readPosition,f,o.v),o.v=o.v+f|0,!(o.v0&&(r.v=r.v+c|0),!(r.vt.byteLength)throw b("Destination buffer overflow: length = "+i+", buffer capacity "+t.byteLength);n>=0||new As(Ms).doFail(),(n+i|0)<=t.byteLength||new As(Ls).doFail(),Gs(e.isType(this,$n)?this:p(),t.buffer,t.byteOffset+n|0,i)},Is.prototype.readAvailable_p0d4q1$=function(t,n,i){var r=this.writePosition-this.readPosition|0;if(0===r)return-1;var o=g.min(i,r);return Js(e.isType(this,$n)?this:p(),t,n,o),o},Is.prototype.readFully_gsnag5$=function(t,n,i){Js(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readAvailable_gsnag5$=function(t,n,i){return Qs(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readFully_qr0era$=function(t,n){bi(e.isType(this,$n)?this:p(),t,n)},Is.prototype.append_ezbsdh$=function(t,e,n){if(Fn(this,null!=t?t:"null",e,n)!==n)throw R("Not enough free space to append char sequence");return this},Is.prototype.append_gw00v9$=function(t){return null==t?this.append_gw00v9$("null"):this.append_ezbsdh$(t,0,t.length)},Is.prototype.append_8chfmy$=function(t,e,n){if(qn(this,t,e,n)!==n)throw R("Not enough free space to append char sequence");return this},Is.prototype.append_s8itvh$=function(t){return Un(e.isType(this,$n)?this:p(),t),this},Is.prototype.write_mj6st8$=function(t,n,i){oi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.write_gsnag5$=function(t,n,i){Xs(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readShort=function(){return Wn(e.isType(this,$n)?this:p())},Is.prototype.readInt=function(){return Yn(e.isType(this,$n)?this:p())},Is.prototype.readFloat=function(){return Jn(e.isType(this,$n)?this:p())},Is.prototype.readDouble=function(){return Zn(e.isType(this,$n)?this:p())},Is.prototype.readFully_mj6st8$=function(t,n,i){ii(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readFully_359eei$=function(t,n,i){ai(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readFully_nd5v6f$=function(t,n,i){ci(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readFully_rfv6wg$=function(t,n,i){hi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readFully_kgymra$=function(t,n,i){_i(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readFully_6icyh1$=function(t,n,i){vi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readAvailable_mj6st8$=function(t,n,i){return ri(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readAvailable_359eei$=function(t,n,i){return si(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readAvailable_nd5v6f$=function(t,n,i){return ui(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readAvailable_rfv6wg$=function(t,n,i){return fi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readAvailable_kgymra$=function(t,n,i){return yi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readAvailable_6icyh1$=function(t,n,i){return $i(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.peekTo_99qa0s$=function(t){return ar(e.isType(this,Rs)?this:p(),t)},Is.prototype.readLong=function(){return Gn(e.isType(this,$n)?this:p())},Is.prototype.writeShort_mq22fl$=function(t){Qn(e.isType(this,$n)?this:p(),t)},Is.prototype.writeInt_za3lpa$=function(t){Xn(e.isType(this,$n)?this:p(),t)},Is.prototype.writeFloat_mx4ult$=function(t){ei(e.isType(this,$n)?this:p(),t)},Is.prototype.writeDouble_14dthe$=function(t){ni(e.isType(this,$n)?this:p(),t)},Is.prototype.writeFully_mj6st8$=function(t,n,i){oi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.writeFully_359eei$=function(t,n,i){li(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.writeFully_nd5v6f$=function(t,n,i){pi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.writeFully_rfv6wg$=function(t,n,i){di(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.writeFully_kgymra$=function(t,n,i){mi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.writeFully_6icyh1$=function(t,n,i){gi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.writeFully_qr0era$=function(t,n){ki(e.isType(this,$n)?this:p(),t,n)},Is.prototype.fill_3pq026$=function(t,n){Dn(e.isType(this,$n)?this:p(),t,n)},Is.prototype.writeLong_s8cxhz$=function(t){ti(e.isType(this,$n)?this:p(),t)},Is.prototype.writeBuffer_qr0era$=function(t,n){return ki(e.isType(this,$n)?this:p(),t,n),n},Is.prototype.flush=function(){},Is.prototype.readableView=function(){var t=this.readPosition,e=this.writePosition;return t===e?Ys().EmptyDataView_0:0===t&&e===this.content_0.byteLength?this.memory.view:new DataView(this.content_0,t,e-t|0)},Is.prototype.writableView=function(){var t=this.writePosition,e=this.limit;return t===e?Ys().EmptyDataView_0:0===t&&e===this.content_0.byteLength?this.memory.view:new DataView(this.content_0,t,e-t|0)},Is.prototype.readDirect_5b066c$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.IoBuffer.readDirect_5b066c$",k((function(){var t=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e){var n=e(this.readableView());if(!(n>=0))throw t(("The returned value from block function shouldn't be negative: "+n).toString());return this.discard_za3lpa$(n),n}}))),Is.prototype.writeDirect_5b066c$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.IoBuffer.writeDirect_5b066c$",k((function(){var t=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e){var n=e(this.writableView());if(!(n>=0))throw t(("The returned value from block function shouldn't be negative: "+n).toString());if(!(n<=(this.limit-this.writePosition|0))){var i="The returned value from block function is too big: "+n+" > "+(this.limit-this.writePosition|0);throw t(i.toString())}return this.commitWritten_za3lpa$(n),n}}))),Is.prototype.release_duua06$=function(t){Si(this,t)},Is.prototype.close=function(){throw A("close for buffer view is not supported")},Is.prototype.toString=function(){return"Buffer[readable = "+(this.writePosition-this.readPosition|0)+", writable = "+(this.limit-this.writePosition|0)+", startGap = "+this.startGap+", endGap = "+(this.capacity-this.limit|0)+"]"},Object.defineProperty(Ds.prototype,"ReservedSize",{configurable:!0,get:function(){return 8}}),qs.prototype.produceInstance=function(){return new Is(ya().alloc_za3lpa$(4096),null)},qs.prototype.clearInstance_trkh7z$=function(t){var e=dl.prototype.clearInstance_trkh7z$.call(this,t);return e.unpark_8be2vx$(),e.reset(),e},qs.prototype.validateInstance_trkh7z$=function(t){var e;dl.prototype.validateInstance_trkh7z$.call(this,t),0!==t.referenceCount&&new As((e=t,function(){return"unable to recycle buffer: buffer view is in use (refCount = "+e.referenceCount+")"})).doFail(),null!=t.origin&&new As(Fs).doFail()},qs.prototype.disposeInstance_trkh7z$=function(t){ya().free_vn6nzs$(t.memory),t.unlink_8be2vx$()},qs.$metadata$={kind:h,interfaces:[dl]},Us.prototype.borrow=function(){return new Is(ya().alloc_za3lpa$(4096),null)},Us.prototype.recycle_trkh7z$=function(t){ya().free_vn6nzs$(t.memory)},Us.$metadata$={kind:h,interfaces:[Bo]},Ds.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var Bs,Hs,Vs,Ks,Ws=null;function Ys(){return null===Ws&&new Ds,Ws}function Gs(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.byteLength-n|0);var r=t.memory,o=t.readPosition;if((t.writePosition-o|0)t.readPosition))return-1;var r=t.writePosition-t.readPosition|0,o=g.min(i,r);return Gs(t,e,n,o),o}function Qs(t,e,n,i){if(void 0===n&&(n=0),void 0===i&&(i=e.byteLength-n|0),!(t.writePosition>t.readPosition))return-1;var r=t.writePosition-t.readPosition|0,o=g.min(i,r);return Js(t,e,n,o),o}function Xs(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.byteLength-n|0);var r=t.memory,o=t.writePosition;if((t.limit-o|0)=0))throw new nt("offset ("+t+") shouldn't be negative");if(!(e>=0))throw new nt("length ("+e+") shouldn't be negative");if(!((t+e|0)<=n.length))throw new nt("offset ("+t+") + length ("+e+") > bytes.size ("+n.length+")");throw yt()}function il(t,e,n){var i,r=t.length;if(!((n+r|0)<=e.length))throw b("Failed requirement.".toString());for(var o=n,a=0;a255&&r.writeByte_s8j3t7$(_(u>>8)),r.writeByte_s8j3t7$(_(255&u))}n=r.build()}catch(t){throw e.isType(t,E)?(r.release(),t):t}return vt(Fr(n))},fl.prototype.decode_g2l45e$=function(t,e){return this.decode_c2mund$(t)},fl.$metadata$={kind:h,simpleName:"TextDecoderFallback",interfaces:[ll]},Object.defineProperty(dl.prototype,"capacity",{get:function(){return this.capacity_7nvyry$_0}}),dl.prototype.disposeInstance_trkh7z$=function(t){},dl.prototype.clearInstance_trkh7z$=function(t){return t},dl.prototype.validateInstance_trkh7z$=function(t){},dl.prototype.borrow=function(){var t;if(0===this.size_p9jgx3$_0)return this.produceInstance();var n=(this.size_p9jgx3$_0=this.size_p9jgx3$_0-1|0,this.size_p9jgx3$_0),i=e.isType(t=this.instances_j5hzgy$_0[n],$)?t:p();return this.instances_j5hzgy$_0[n]=null,this.clearInstance_trkh7z$(i)},dl.prototype.recycle_trkh7z$=function(t){var e;this.validateInstance_trkh7z$(t),this.size_p9jgx3$_0===this.capacity?this.disposeInstance_trkh7z$(t):this.instances_j5hzgy$_0[(e=this.size_p9jgx3$_0,this.size_p9jgx3$_0=e+1|0,e)]=t},dl.prototype.dispose=function(){var t,n;t=this.size_p9jgx3$_0;for(var i=0;i0))break;if(c=!1,null==(l=jo(t,u)))break;u=l,c=!0}}finally{c&&zo(t,u)}}while(0);var g=o.v,b=r.subtract(g);return d(b,f)&&t.endOfInput?G:b},$l.peekTo_6v858t$=ar,$l.readShort_7wsnj1$=sr,$l.readInt_7wsnj1$=cr,$l.readLong_7wsnj1$=pr,$l.readFloat_7wsnj1$=fr,$l.readFloatFallback_7wsnj1$=dr,$l.readDouble_7wsnj1$=_r,$l.readDoubleFallback_7wsnj1$=yr,$l.writeFully_i6snlg$=mr,$l.writeFully_d18giu$=vr,$l.writeFully_yw8055$=$r,$l.writeFully_2v9eo0$=gr,$l.writeFully_ydnkai$=br,$l.writeFully_avy7cl$=wr,$l.writeFully_apj91c$=kr,$l.writeFully_35rta0$=Sr,$l.writeFully_bch96q$=xr,$l.fill_g2e272$=Er,wl.prepareWriteHead_6z8r11$=To,wl.afterHeadWrite_z1cqja$=Po,$l.writeShort_9kfkzl$=Cr,$l.writeInt_qu9kum$=Or,$l.writeLong_kb5mzd$=jr,$l.writeFloat_9rid5t$=Pr,$l.writeDouble_jgp4k2$=Rr,Object.defineProperty(Ar,"Companion",{get:Lr}),$l.ByteReadPacketBase=Ar,$l.get_isNotEmpty_7wsnj1$=Dr,$l.prematureEndOfStream_za3lpa$=Kr,$l.preview_en5wxq$=qr,bl.encodeToByteArray_fj4osb$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.length),on(t,e,n,i)},$l.readBytes_xc9h3n$=Fr,$l.readText_1lnizf$=function(t,e,n){return void 0===e&&(e=is().UTF_8),void 0===n&&(n=2147483647),nn(e.newDecoder(),t,n)},$l.readTextExactBytes_yqne27$=Ur,$l.writeText_t153jy$=Br,$l.writeText_t7k8z4$=Hr,Object.defineProperty(Gr,"Companion",{get:ao}),wl.ChunkBuffer=Gr,wl.isExclusivelyOwned_kx8gx4$=lo,wl.failLongToIntConversion_a4hdmt$=co,wl.RequireFailureCapture=uo,wl.decodeUTF8LineLoopSuspend_f8x9lf$=fo,wl.malformedByteCount_za3lpa$=go,wl.isBmpCodePoint_za3lpa$=wo,wl.isValidCodePoint_za3lpa$=ko,wl.malformedCodePoint_za3lpa$=bo,wl.highSurrogate_za3lpa$=xo,wl.lowSurrogate_za3lpa$=So,wl.CharArraySequence=yo,wl.EncodeResult_init_2ahd1g$=vo,wl.EncodeResult=mo,wl.encodeUTF8_yjoz4m$=$o,wl.codePoint_fdkhi5$=Eo,wl.MalformedUTF8InputException=Co,wl.unsafeAppend_z83jwh$=Oo;var kl=vl.errors||(vl.errors={});kl.checkPeekTo_swsbrn$=Ao;var Sl=vl.internal||(vl.internal={});Sl.AwaitingSlot=Io,Sl.copyToSequentialImpl_6ii227$=qo;var xl=vl.pool||(vl.pool={});xl.ObjectPool=Uo,xl.NoPoolImpl=Bo,xl.SingleInstancePool=Ho,vl.ByteChannel_6taknv$=Vo,vl.ByteReadChannel_mj6st8$=Ko,vl.copyTo_47ygvz$=Wo,vl.ByteChannelJS=Yo,vl.ByteChannelSequentialBaseSharedState=Qo,Object.defineProperty(Xo,"Companion",{get:ia}),vl.ByteReadChannel=Xo,vl.ByteWriteChannel=ra,vl.preventFreeze_s8jyvk$=function(t){},vl.makeShared_s8jyvk$=oa,gl.Memory=ma,gl.of_2z595v$=pa,gl.of_3qjk6t$=ha,gl.of_d2rc7k$=fa,Object.defineProperty(gl,"DefaultAllocator",{get:ya}),Object.defineProperty(ma,"Companion",{get:ba}),gl.fill_yaef32$=ka,gl.copyTo_1uvjz5$=Sa,gl.copyTo_duys70$=xa,gl.copyTo_3wm8wl$=Ea,gl.copyTo_vnj7g0$=Ca,gl.loadFloatArray_f2kqdl$=ja,gl.loadDoubleArray_itdtda$=Ta,gl.storeFloatArray_f2kqdl$=Ia,gl.storeDoubleArray_itdtda$=Ma,Object.defineProperty(La,"Companion",{get:Fa}),bl.Charset=La,bl.get_name_2sg7fd$=Ua,bl.CharsetEncoder=Ba,bl.get_charset_x4isqx$=Va,bl.encodeImpl_edsj0y$=Ka,bl.encodeComplete_5txte2$=Wa,bl.CharsetDecoder=Ya,bl.get_charset_e9jvmp$=Ja,bl.decode_eyhcpn$=Za,bl.decodeExactBytes_lb8wo3$=Qa,Object.defineProperty(bl,"Charsets",{get:is}),bl.MalformedInputException=os,bl.DecodeBufferResult=as,bl.decodeBufferImpl_g8dwr5$=ss,bl.encodeISO88591_4e1bz1$=ls,(vl.concurrent||(vl.concurrent={})).threadLocal_issdgt$=function(t){return new ft((e=t,function(t,n){return e}));var e},$l.AbstractInputSharedState=us,$l.AbstractOutputSharedState=ps,$l.BufferSharedState=hs,Object.defineProperty(fs,"BIG_ENDIAN",{get:_s}),Object.defineProperty(fs,"LITTLE_ENDIAN",{get:ys}),Object.defineProperty(fs,"Companion",{get:$s}),$l.Closeable=gs,$l.readFully_nu5h60$=ws,$l.readFully_7dohgh$=ks,$l.readFully_hqska$=Ss,$l.readAvailable_nu5h60$=xs,$l.readAvailable_7dohgh$=Es,$l.readAvailable_hqska$=Cs,$l.readFully_56hr53$=Os,$l.readFully_xvjntq$=Ns,$l.readFully_28a27b$=zs,$l.readAvailable_56hr53$=js,$l.readAvailable_xvjntq$=Ts,$l.readAvailable_28a27b$=Ps,$l.Input=Rs,Object.defineProperty(Is,"Companion",{get:Ys}),$l.IoBuffer=Is,$l.readFully_xbe0h9$=Gs,$l.readFully_agdgmg$=Js,$l.readAvailable_xbe0h9$=Zs,$l.readAvailable_agdgmg$=Qs,$l.writeFully_agdgmg$=Xs,$l.Output=tl,$l.String_xge8xe$=function(t,e,n,i){void 0===e&&(e=0),void 0===n&&(n=t.length),void 0===i&&(i=is().UTF_8),(e<0||n<0||(e+n|0)>t.length)&&nl(e,n,t);var r=t,o=r.byteOffset+e|0,a=r.buffer.slice(o,o+n|0),s=new Is(ha(ba(),a),null);s.resetForRead();var l=Ui(s,ao().NoPoolManuallyManaged_8be2vx$);return nn(i.newDecoder(),l,2147483647)},$l.checkIndices_khgzz8$=nl,$l.getCharsInternal_8t7fl6$=il,kl.IOException_init_61zpoe$=ol,kl.IOException=rl,kl.EOFException=al;var El=vl.js||(vl.js={});return El.Decoder_t8jjq2$=sl,El.Decoder=ll,El.decodeOptions_vft4zs$=cl,El.toKtor_y2kull$=pl,El.textDecoderOptions_vft4zs$=hl,El.TextDecoderFallback=fl,xl.DefaultPool=dl,gt.prototype.peekTo_afjyek$=Xo.prototype.peekTo_afjyek$,Fe.prototype.request_za3lpa$=qe.prototype.request_za3lpa$,wt.prototype.await_za3lpa$=Fe.prototype.await_za3lpa$,wt.prototype.request_za3lpa$=Fe.prototype.request_za3lpa$,wt.prototype.peekTo_afjyek$=gt.prototype.peekTo_afjyek$,Pe.prototype.cancel=C.prototype.cancel,Pe.prototype.fold_3cc69b$=C.prototype.fold_3cc69b$,Pe.prototype.get_j3r2sn$=C.prototype.get_j3r2sn$,Pe.prototype.minusKey_yeqjby$=C.prototype.minusKey_yeqjby$,Pe.prototype.plus_dqr1mp$=C.prototype.plus_dqr1mp$,Pe.prototype.plus_1fupul$=C.prototype.plus_1fupul$,Pe.prototype.cancel_dbl4no$=C.prototype.cancel_dbl4no$,Pe.prototype.cancel_m4sck1$=C.prototype.cancel_m4sck1$,Pe.prototype.invokeOnCompletion_ct2b2z$=C.prototype.invokeOnCompletion_ct2b2z$,Re.prototype.cancel=C.prototype.cancel,Re.prototype.fold_3cc69b$=C.prototype.fold_3cc69b$,Re.prototype.get_j3r2sn$=C.prototype.get_j3r2sn$,Re.prototype.minusKey_yeqjby$=C.prototype.minusKey_yeqjby$,Re.prototype.plus_dqr1mp$=C.prototype.plus_dqr1mp$,Re.prototype.plus_1fupul$=C.prototype.plus_1fupul$,Re.prototype.cancel_dbl4no$=C.prototype.cancel_dbl4no$,Re.prototype.cancel_m4sck1$=C.prototype.cancel_m4sck1$,Re.prototype.invokeOnCompletion_ct2b2z$=C.prototype.invokeOnCompletion_ct2b2z$,De.prototype.cancel_m4sck1$=Pe.prototype.cancel_m4sck1$,De.prototype.cancel_dbl4no$=Pe.prototype.cancel_dbl4no$,De.prototype.invokeOnCompletion_ct2b2z$=Pe.prototype.invokeOnCompletion_ct2b2z$,un.prototype.readFully_359eei$=Rs.prototype.readFully_359eei$,un.prototype.readFully_nd5v6f$=Rs.prototype.readFully_nd5v6f$,un.prototype.readFully_rfv6wg$=Rs.prototype.readFully_rfv6wg$,un.prototype.readFully_kgymra$=Rs.prototype.readFully_kgymra$,un.prototype.readFully_6icyh1$=Rs.prototype.readFully_6icyh1$,un.prototype.readFully_qr0era$=Rs.prototype.readFully_qr0era$,un.prototype.readFully_gsnag5$=Rs.prototype.readFully_gsnag5$,un.prototype.readFully_qmgm5g$=Rs.prototype.readFully_qmgm5g$,un.prototype.readFully_p0d4q1$=Rs.prototype.readFully_p0d4q1$,un.prototype.readAvailable_mj6st8$=Rs.prototype.readAvailable_mj6st8$,un.prototype.readAvailable_359eei$=Rs.prototype.readAvailable_359eei$,un.prototype.readAvailable_nd5v6f$=Rs.prototype.readAvailable_nd5v6f$,un.prototype.readAvailable_rfv6wg$=Rs.prototype.readAvailable_rfv6wg$,un.prototype.readAvailable_kgymra$=Rs.prototype.readAvailable_kgymra$,un.prototype.readAvailable_6icyh1$=Rs.prototype.readAvailable_6icyh1$,un.prototype.readAvailable_qr0era$=Rs.prototype.readAvailable_qr0era$,un.prototype.readAvailable_gsnag5$=Rs.prototype.readAvailable_gsnag5$,un.prototype.readAvailable_qmgm5g$=Rs.prototype.readAvailable_qmgm5g$,un.prototype.readAvailable_p0d4q1$=Rs.prototype.readAvailable_p0d4q1$,un.prototype.peekTo_afjyek$=Rs.prototype.peekTo_afjyek$,yn.prototype.writeShort_mq22fl$=tl.prototype.writeShort_mq22fl$,yn.prototype.writeInt_za3lpa$=tl.prototype.writeInt_za3lpa$,yn.prototype.writeLong_s8cxhz$=tl.prototype.writeLong_s8cxhz$,yn.prototype.writeFloat_mx4ult$=tl.prototype.writeFloat_mx4ult$,yn.prototype.writeDouble_14dthe$=tl.prototype.writeDouble_14dthe$,yn.prototype.writeFully_mj6st8$=tl.prototype.writeFully_mj6st8$,yn.prototype.writeFully_359eei$=tl.prototype.writeFully_359eei$,yn.prototype.writeFully_nd5v6f$=tl.prototype.writeFully_nd5v6f$,yn.prototype.writeFully_rfv6wg$=tl.prototype.writeFully_rfv6wg$,yn.prototype.writeFully_kgymra$=tl.prototype.writeFully_kgymra$,yn.prototype.writeFully_6icyh1$=tl.prototype.writeFully_6icyh1$,yn.prototype.writeFully_qr0era$=tl.prototype.writeFully_qr0era$,yn.prototype.fill_3pq026$=tl.prototype.fill_3pq026$,dl.prototype.close=Uo.prototype.close,Bo.prototype.close=Uo.prototype.close,Xr.prototype.close=Uo.prototype.close,to.prototype.close=Uo.prototype.close,Ho.prototype.close=Uo.prototype.close,Is.prototype.peekTo_afjyek$=Rs.prototype.peekTo_afjyek$,i=l,bn=new Bn,ro=new Int8Array(0),$a=$s().nativeOrder()===ys(),Bs=200,Hs=mt(["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"]),Vs=new Int8Array([_(239),_(191),_(189)]),Ks=new Int32Array([8364,-1,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,-1,381,-1,-1,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,-1,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]),t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){var i=n(2).Buffer,r=n(165).Transform,o=n(16).StringDecoder;function a(t){r.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}n(0)(a,r),a.prototype.update=function(t,e,n){"string"==typeof t&&(t=i.from(t,e));var r=this._update(t);return this.hashMode?this:(n&&(r=this._toString(r,n)),r)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(t,e,n){var i;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){i=t}finally{n(i)}},a.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},a.prototype._finalOrDigest=function(t){var e=this.__final()||i.alloc(0);return t&&(e=this._toString(e,t,!0)),e},a.prototype._toString=function(t,e,n){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var i=this._decoder.write(t);return n&&(i+=this._decoder.end()),i},t.exports=a},function(t,e,n){"use strict";var i,r="object"==typeof Reflect?Reflect:null,o=r&&"function"==typeof r.apply?r.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};i=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(n,i){function r(n){t.removeListener(e,o),i(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",r),n([].slice.call(arguments))}m(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&m(t,"error",e,n)}(t,r,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function p(t,e,n,i){var r,o,a,s;if(c(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=u(t))>0&&a.length>r&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(t,e,n){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},r=h.bind(i);return r.listener=n,i.wrapFn=r,r}function d(t,e,n){var i=t._events;if(void 0===i)return[];var r=i[e];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=r[t];if(void 0===l)return!1;if("function"==typeof l)o(l,this,e);else{var c=l.length,u=y(l,c);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):_.call(t,e)},s.prototype.listenerCount=_,s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,n){"use strict";var i=n(2).Buffer,r=i.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===r||!r(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=l,this.end=c,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=u,this.end=p,e=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function l(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function u(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function p(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return r>0&&(t.lastNeed=r-1),r;if(--i=0)return r>0&&(t.lastNeed=r-2),r;if(--i=0)return r>0&&(2===r?r=0:t.lastNeed=r-3),r;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var i=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";var i=n(37),r=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=p;var o=Object.create(n(30));o.inherits=n(0);var a=n(86),s=n(52);o.inherits(p,a);for(var l=r(s.prototype),c=0;c255?l/3|0:l);r>n&&c.append_ezbsdh$(t,n,r);for(var u=r,p=null;u=i){var d,_=u;throw d=t.length,new Me("Incomplete trailing HEX escape: "+e.subSequence(t,_,d).toString()+", in "+t+" at "+u)}var y=De(t.charCodeAt(u+1|0)),m=De(t.charCodeAt(u+2|0));if(-1===y||-1===m)throw new Me("Wrong HEX escape: %"+String.fromCharCode(t.charCodeAt(u+1|0))+String.fromCharCode(t.charCodeAt(u+2|0))+", in "+t+", at "+u);p[(s=f,f=s+1|0,s)]=x((16*y|0)+m|0),u=u+3|0}c.append_pdl1vj$(M(p,0,f,a))}else c.append_s8itvh$(h),u=u+1|0}return c.toString()}function Me(t){L(t,this),this.name="URLDecodeException"}function Le(t){var e=I(3),n=255&t;return e.append_s8itvh$(37),e.append_s8itvh$(qe(n>>4)),e.append_s8itvh$(qe(15&n)),e.toString()}function De(t){return new b(48,57).contains_mef7kx$(t)?t-48:new b(65,70).contains_mef7kx$(t)?t-65+10|0:new b(97,102).contains_mef7kx$(t)?t-97+10|0:-1}function qe(t){return P(t>=0&&t<=9?48+t:P(65+t)-10)}function Fe(t,e){t:do{var n,i,r=!0;if(null==(n=F(t,1)))break t;var o=n;try{for(;;){for(var a=o;a.writePosition>a.readPosition;)e(a.readByte());if(r=!1,null==(i=U(t,o)))break;o=i,r=!0}}finally{r&&B(t,o)}}while(0)}function Ue(t,e){Ve(),void 0===e&&(e=W()),wn.call(this,t,e)}function Be(){He=this,this.File=new Ue("file"),this.Mixed=new Ue("mixed"),this.Attachment=new Ue("attachment"),this.Inline=new Ue("inline")}i.io.ktor.util.encodeBase64_964n91$,Me.prototype=Object.create(D.prototype),Me.prototype.constructor=Me,Ue.prototype=Object.create(wn.prototype),Ue.prototype.constructor=Ue,Je.prototype=Object.create(wn.prototype),Je.prototype.constructor=Je,mn.prototype=Object.create(D.prototype),mn.prototype.constructor=mn,Pn.prototype=Object.create(qt.prototype),Pn.prototype.constructor=Pn,Mn.prototype=Object.create(Ht.prototype),Mn.prototype.constructor=Mn,Xn.prototype=Object.create(Rt.prototype),Xn.prototype.constructor=Xn,ti.prototype=Object.create(Rt.prototype),ti.prototype.constructor=ti,ei.prototype=Object.create(Rt.prototype),ei.prototype.constructor=ei,Ai.prototype=Object.create(qt.prototype),Ai.prototype.constructor=Ai,Di.prototype=Object.create(Ht.prototype),Di.prototype.constructor=Di,sr.prototype=Object.create(Ct.prototype),sr.prototype.constructor=sr,zr.prototype=Object.create(f.prototype),zr.prototype.constructor=zr,Ir.prototype=Object.create(Ar.prototype),Ir.prototype.constructor=Ir,Mr.prototype=Object.create(Ar.prototype),Mr.prototype.constructor=Mr,no.prototype=Object.create(Zr.prototype),no.prototype.constructor=no,Yr.prototype=Object.create(Wr.prototype),Yr.prototype.constructor=Yr,Gr.prototype=Object.create(Wr.prototype),Gr.prototype.constructor=Gr,Jr.prototype=Object.create(Wr.prototype),Jr.prototype.constructor=Jr,Qr.prototype=Object.create(Zr.prototype),Qr.prototype.constructor=Qr,Xr.prototype=Object.create(Zr.prototype),Xr.prototype.constructor=Xr,eo.prototype=Object.create(Zr.prototype),eo.prototype.constructor=eo,io.prototype=Object.create(Zr.prototype),io.prototype.constructor=io,ro.prototype=Object.create(no.prototype),ro.prototype.constructor=ro,oo.prototype=Object.create(Rt.prototype),oo.prototype.constructor=oo,po.prototype=Object.create(lo.prototype),po.prototype.constructor=po,ho.prototype=Object.create(lo.prototype),ho.prototype.constructor=ho,fo.prototype=Object.create(lo.prototype),fo.prototype.constructor=fo,_o.prototype=Object.create(lo.prototype),_o.prototype.constructor=_o,yo.prototype=Object.create(lo.prototype),yo.prototype.constructor=yo,mo.prototype=Object.create(lo.prototype),mo.prototype.constructor=mo,vo.prototype=Object.create(lo.prototype),vo.prototype.constructor=vo,$o.prototype=Object.create(lo.prototype),$o.prototype.constructor=$o,go.prototype=Object.create(lo.prototype),go.prototype.constructor=go,bo.prototype=Object.create(lo.prototype),bo.prototype.constructor=bo,Me.$metadata$={kind:d,simpleName:"URLDecodeException",interfaces:[D]},Object.defineProperty(Ue.prototype,"disposition",{configurable:!0,get:function(){return this.content}}),Object.defineProperty(Ue.prototype,"name",{configurable:!0,get:function(){return this.parameter_61zpoe$(Ye().Name)}}),Ue.prototype.withParameter_puj7f4$=function(t,e){return new Ue(this.disposition,V(this.parameters,new Ln(t,e)))},Ue.prototype.withParameters_1wyvw$=function(t){return new Ue(this.disposition,k(this.parameters,t))},Ue.prototype.equals=function(t){return e.isType(t,Ue)&&y(this.disposition,t.disposition)&&y(this.parameters,t.parameters)},Ue.prototype.hashCode=function(){return(31*g(this.disposition)|0)+g(this.parameters)|0},Be.prototype.parse_61zpoe$=function(t){var e=Y(qn(t));return new Ue(e.value,e.params)},Be.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var He=null;function Ve(){return null===He&&new Be,He}function Ke(){We=this,this.FileName="filename",this.FileNameAsterisk="filename*",this.Name="name",this.CreationDate="creation-date",this.ModificationDate="modification-date",this.ReadDate="read-date",this.Size="size",this.Handling="handling"}Ke.$metadata$={kind:K,simpleName:"Parameters",interfaces:[]};var We=null;function Ye(){return null===We&&new Ke,We}function Ge(){}function Je(t,e,n,i){Xe(),void 0===i&&(i=W()),wn.call(this,n,i),this.contentType=t,this.contentSubtype=e}function Ze(){Qe=this,this.Any=yn("*","*")}Ue.$metadata$={kind:d,simpleName:"ContentDisposition",interfaces:[wn]},Ge.$metadata$={kind:G,simpleName:"ContentTypeMatcher",interfaces:[]},Je.prototype.withParameter_puj7f4$=function(t,e){return this.hasParameter_0(t,e)?this:new Je(this.contentType,this.contentSubtype,this.content,V(this.parameters,new Ln(t,e)))},Je.prototype.hasParameter_0=function(t,n){switch(this.parameters.size){case 0:return!1;case 1:var i=this.parameters.get_za3lpa$(0);return J(i.name,t,!0)&&J(i.value,n,!0);default:var r,o=this.parameters;t:do{var a;if(e.isType(o,nt)&&o.isEmpty()){r=!1;break t}for(a=o.iterator();a.hasNext();){var s=a.next();if(J(s.name,t,!0)&&J(s.value,n,!0)){r=!0;break t}}r=!1}while(0);return r}},Je.prototype.withoutParameters=function(){return this.parameters.isEmpty()?this:yn(this.contentType,this.contentSubtype)},Je.prototype.match_9v5yzd$=function(t){var n,i;if(!y(t.contentType,"*")&&!J(t.contentType,this.contentType,!0))return!1;if(!y(t.contentSubtype,"*")&&!J(t.contentSubtype,this.contentSubtype,!0))return!1;for(n=t.parameters.iterator();n.hasNext();){var r=n.next(),o=r.component1(),a=r.component2();if(y(o,"*"))if(y(a,"*"))i=!0;else{var s,l=this.parameters;t:do{var c;if(e.isType(l,nt)&&l.isEmpty()){s=!1;break t}for(c=l.iterator();c.hasNext();){var u=c.next();if(J(u.value,a,!0)){s=!0;break t}}s=!1}while(0);i=s}else{var p=this.parameter_61zpoe$(o);i=y(a,"*")?null!=p:J(p,a,!0)}if(!i)return!1}return!0},Je.prototype.match_61zpoe$=function(t){return this.match_9v5yzd$(Xe().parse_61zpoe$(t))},Je.prototype.equals=function(t){return e.isType(t,Je)&&J(this.contentType,t.contentType,!0)&&J(this.contentSubtype,t.contentSubtype,!0)&&y(this.parameters,t.parameters)},Je.prototype.hashCode=function(){var t=g(this.contentType.toLowerCase());return t=(t=t+((31*t|0)+g(this.contentSubtype.toLowerCase()))|0)+(31*g(this.parameters)|0)|0},Ze.prototype.parse_61zpoe$=function(t){if(Z(t))return this.Any;var n=Y(qn(t)),i=n.value,r=n.params,o=Q(i,47);if(-1===o){var a;if(y(rt(e.isCharSequence(a=i)?a:it()).toString(),"*"))return this.Any;throw new mn(t)}var s,l=i.substring(0,o),c=rt(e.isCharSequence(s=l)?s:it()).toString();if(0===c.length)throw new mn(t);var u,p=o+1|0,h=i.substring(p),f=rt(e.isCharSequence(u=h)?u:it()).toString();if(0===f.length||X(f,47))throw new mn(t);return yn(c,f,r)},Ze.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var Qe=null;function Xe(){return null===Qe&&new Ze,Qe}function tn(){en=this,this.Any=yn("application","*"),this.Atom=yn("application","atom+xml"),this.Cbor=yn("application","cbor"),this.Json=yn("application","json"),this.HalJson=yn("application","hal+json"),this.JavaScript=yn("application","javascript"),this.OctetStream=yn("application","octet-stream"),this.FontWoff=yn("application","font-woff"),this.Rss=yn("application","rss+xml"),this.Xml=yn("application","xml"),this.Xml_Dtd=yn("application","xml-dtd"),this.Zip=yn("application","zip"),this.GZip=yn("application","gzip"),this.FormUrlEncoded=yn("application","x-www-form-urlencoded"),this.Pdf=yn("application","pdf"),this.ProtoBuf=yn("application","protobuf"),this.Wasm=yn("application","wasm"),this.ProblemJson=yn("application","problem+json"),this.ProblemXml=yn("application","problem+xml")}tn.$metadata$={kind:K,simpleName:"Application",interfaces:[]};var en=null;function nn(){rn=this,this.Any=yn("audio","*"),this.MP4=yn("audio","mp4"),this.MPEG=yn("audio","mpeg"),this.OGG=yn("audio","ogg")}nn.$metadata$={kind:K,simpleName:"Audio",interfaces:[]};var rn=null;function on(){an=this,this.Any=yn("image","*"),this.GIF=yn("image","gif"),this.JPEG=yn("image","jpeg"),this.PNG=yn("image","png"),this.SVG=yn("image","svg+xml"),this.XIcon=yn("image","x-icon")}on.$metadata$={kind:K,simpleName:"Image",interfaces:[]};var an=null;function sn(){ln=this,this.Any=yn("message","*"),this.Http=yn("message","http")}sn.$metadata$={kind:K,simpleName:"Message",interfaces:[]};var ln=null;function cn(){un=this,this.Any=yn("multipart","*"),this.Mixed=yn("multipart","mixed"),this.Alternative=yn("multipart","alternative"),this.Related=yn("multipart","related"),this.FormData=yn("multipart","form-data"),this.Signed=yn("multipart","signed"),this.Encrypted=yn("multipart","encrypted"),this.ByteRanges=yn("multipart","byteranges")}cn.$metadata$={kind:K,simpleName:"MultiPart",interfaces:[]};var un=null;function pn(){hn=this,this.Any=yn("text","*"),this.Plain=yn("text","plain"),this.CSS=yn("text","css"),this.CSV=yn("text","csv"),this.Html=yn("text","html"),this.JavaScript=yn("text","javascript"),this.VCard=yn("text","vcard"),this.Xml=yn("text","xml"),this.EventStream=yn("text","event-stream")}pn.$metadata$={kind:K,simpleName:"Text",interfaces:[]};var hn=null;function fn(){_n=this,this.Any=yn("video","*"),this.MPEG=yn("video","mpeg"),this.MP4=yn("video","mp4"),this.OGG=yn("video","ogg"),this.QuickTime=yn("video","quicktime")}fn.$metadata$={kind:K,simpleName:"Video",interfaces:[]};var dn,_n=null;function yn(t,e,n,i){return void 0===n&&(n=W()),i=i||Object.create(Je.prototype),Je.call(i,t,e,t+"/"+e,n),i}function mn(t){L("Bad Content-Type format: "+t,this),this.name="BadContentTypeFormatException"}function vn(t){var e;return null!=(e=t.parameter_61zpoe$("charset"))?et.Companion.forName_61zpoe$(e):null}function $n(t){var e=t.component1(),n=t.component2();return lt(n,e)}function gn(t){var e,n=mt();for(e=t.iterator();e.hasNext();){var i,r=e.next(),o=r.first,a=n.get_11rb$(o);if(null==a){var s=vt();n.put_xwzc9p$(o,s),i=s}else i=a;i.add_11rb$(r)}var l,c=_t(dt(n.size));for(l=n.entries.iterator();l.hasNext();){var u,p=l.next(),h=c.put_xwzc9p$,f=p.key,d=p.value,_=m(H(d,10));for(u=d.iterator();u.hasNext();){var y=u.next();_.add_11rb$(y.second)}h.call(c,f,_)}return c}function bn(t){try{return Xe().parse_61zpoe$(t)}catch(n){throw e.isType(n,At)?new Rt("Failed to parse "+t,n):n}}function wn(t,e){xn(),void 0===e&&(e=W()),this.content=t,this.parameters=e}function kn(){Sn=this}Je.$metadata$={kind:d,simpleName:"ContentType",interfaces:[wn]},mn.$metadata$={kind:d,simpleName:"BadContentTypeFormatException",interfaces:[D]},wn.prototype.parameter_61zpoe$=function(t){var e,n,i=this.parameters;t:do{var r;for(r=i.iterator();r.hasNext();){var o=r.next();if(J(o.name,t,!0)){n=o;break t}}n=null}while(0);return null!=(e=n)?e.value:null},wn.prototype.toString=function(){if(this.parameters.isEmpty())return this.content;var t,e=this.content.length,n=0;for(t=this.parameters.iterator();t.hasNext();){var i=t.next();n=n+(i.name.length+i.value.length+3|0)|0}var r,o=I(e+n|0);o.append_pdl1vj$(this.content),r=this.parameters.size;for(var a=0;a?@[\\]{}',t)}function ii(){}function ri(){}function oi(t){var e;return null!=(e=t.headers.get_61zpoe$(Qn().ContentType))?Xe().parse_61zpoe$(e):null}function ai(t){ci(),this.value=t}function si(){li=this,this.Get=new ai("GET"),this.Post=new ai("POST"),this.Put=new ai("PUT"),this.Patch=new ai("PATCH"),this.Delete=new ai("DELETE"),this.Head=new ai("HEAD"),this.Options=new ai("OPTIONS"),this.DefaultMethods=C([this.Get,this.Post,this.Put,this.Patch,this.Delete,this.Head,this.Options])}Xn.$metadata$={kind:d,simpleName:"UnsafeHeaderException",interfaces:[Rt]},ti.$metadata$={kind:d,simpleName:"IllegalHeaderNameException",interfaces:[Rt]},ei.$metadata$={kind:d,simpleName:"IllegalHeaderValueException",interfaces:[Rt]},ii.$metadata$={kind:G,simpleName:"HttpMessage",interfaces:[]},ri.$metadata$={kind:G,simpleName:"HttpMessageBuilder",interfaces:[]},si.prototype.parse_61zpoe$=function(t){return y(t,this.Get.value)?this.Get:y(t,this.Post.value)?this.Post:y(t,this.Put.value)?this.Put:y(t,this.Patch.value)?this.Patch:y(t,this.Delete.value)?this.Delete:y(t,this.Head.value)?this.Head:y(t,this.Options.value)?this.Options:new ai(t)},si.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var li=null;function ci(){return null===li&&new si,li}function ui(t,e,n){fi(),this.name=t,this.major=e,this.minor=n}function pi(){hi=this,this.HTTP_2_0=new ui("HTTP",2,0),this.HTTP_1_1=new ui("HTTP",1,1),this.HTTP_1_0=new ui("HTTP",1,0),this.SPDY_3=new ui("SPDY",3,0),this.QUIC=new ui("QUIC",1,0)}ai.$metadata$={kind:d,simpleName:"HttpMethod",interfaces:[]},ai.prototype.component1=function(){return this.value},ai.prototype.copy_61zpoe$=function(t){return new ai(void 0===t?this.value:t)},ai.prototype.toString=function(){return"HttpMethod(value="+e.toString(this.value)+")"},ai.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.value)|0},ai.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.value,t.value)},pi.prototype.fromValue_3m52m6$=function(t,e,n){return y(t,"HTTP")&&1===e&&1===n?this.HTTP_1_1:y(t,"HTTP")&&2===e&&0===n?this.HTTP_2_0:new ui(t,e,n)},pi.prototype.parse_6bul2c$=function(t){var e=Gt(t,["/","."]);if(3!==e.size)throw Et(("Failed to parse HttpProtocolVersion. Expected format: protocol/major.minor, but actual: "+t).toString());var n=e.get_za3lpa$(0),i=e.get_za3lpa$(1),r=e.get_za3lpa$(2);return this.fromValue_3m52m6$(n,St(i),St(r))},pi.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var hi=null;function fi(){return null===hi&&new pi,hi}function di(t,e){gi(),this.value=t,this.description=e}function _i(){$i=this,this.Continue=new di(100,"Continue"),this.SwitchingProtocols=new di(101,"Switching Protocols"),this.Processing=new di(102,"Processing"),this.OK=new di(200,"OK"),this.Created=new di(201,"Created"),this.Accepted=new di(202,"Accepted"),this.NonAuthoritativeInformation=new di(203,"Non-Authoritative Information"),this.NoContent=new di(204,"No Content"),this.ResetContent=new di(205,"Reset Content"),this.PartialContent=new di(206,"Partial Content"),this.MultiStatus=new di(207,"Multi-Status"),this.MultipleChoices=new di(300,"Multiple Choices"),this.MovedPermanently=new di(301,"Moved Permanently"),this.Found=new di(302,"Found"),this.SeeOther=new di(303,"See Other"),this.NotModified=new di(304,"Not Modified"),this.UseProxy=new di(305,"Use Proxy"),this.SwitchProxy=new di(306,"Switch Proxy"),this.TemporaryRedirect=new di(307,"Temporary Redirect"),this.PermanentRedirect=new di(308,"Permanent Redirect"),this.BadRequest=new di(400,"Bad Request"),this.Unauthorized=new di(401,"Unauthorized"),this.PaymentRequired=new di(402,"Payment Required"),this.Forbidden=new di(403,"Forbidden"),this.NotFound=new di(404,"Not Found"),this.MethodNotAllowed=new di(405,"Method Not Allowed"),this.NotAcceptable=new di(406,"Not Acceptable"),this.ProxyAuthenticationRequired=new di(407,"Proxy Authentication Required"),this.RequestTimeout=new di(408,"Request Timeout"),this.Conflict=new di(409,"Conflict"),this.Gone=new di(410,"Gone"),this.LengthRequired=new di(411,"Length Required"),this.PreconditionFailed=new di(412,"Precondition Failed"),this.PayloadTooLarge=new di(413,"Payload Too Large"),this.RequestURITooLong=new di(414,"Request-URI Too Long"),this.UnsupportedMediaType=new di(415,"Unsupported Media Type"),this.RequestedRangeNotSatisfiable=new di(416,"Requested Range Not Satisfiable"),this.ExpectationFailed=new di(417,"Expectation Failed"),this.UnprocessableEntity=new di(422,"Unprocessable Entity"),this.Locked=new di(423,"Locked"),this.FailedDependency=new di(424,"Failed Dependency"),this.UpgradeRequired=new di(426,"Upgrade Required"),this.TooManyRequests=new di(429,"Too Many Requests"),this.RequestHeaderFieldTooLarge=new di(431,"Request Header Fields Too Large"),this.InternalServerError=new di(500,"Internal Server Error"),this.NotImplemented=new di(501,"Not Implemented"),this.BadGateway=new di(502,"Bad Gateway"),this.ServiceUnavailable=new di(503,"Service Unavailable"),this.GatewayTimeout=new di(504,"Gateway Timeout"),this.VersionNotSupported=new di(505,"HTTP Version Not Supported"),this.VariantAlsoNegotiates=new di(506,"Variant Also Negotiates"),this.InsufficientStorage=new di(507,"Insufficient Storage"),this.allStatusCodes=bi();var t,e=Zt(1e3);t=e.length-1|0;for(var n=0;n<=t;n++){var i,r=this.allStatusCodes;t:do{var o;for(o=r.iterator();o.hasNext();){var a=o.next();if(a.value===n){i=a;break t}}i=null}while(0);e[n]=i}this.byValue_0=e}ui.prototype.toString=function(){return this.name+"/"+this.major+"."+this.minor},ui.$metadata$={kind:d,simpleName:"HttpProtocolVersion",interfaces:[]},ui.prototype.component1=function(){return this.name},ui.prototype.component2=function(){return this.major},ui.prototype.component3=function(){return this.minor},ui.prototype.copy_3m52m6$=function(t,e,n){return new ui(void 0===t?this.name:t,void 0===e?this.major:e,void 0===n?this.minor:n)},ui.prototype.hashCode=function(){var t=0;return t=31*(t=31*(t=31*t+e.hashCode(this.name)|0)+e.hashCode(this.major)|0)+e.hashCode(this.minor)|0},ui.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.name,t.name)&&e.equals(this.major,t.major)&&e.equals(this.minor,t.minor)},di.prototype.toString=function(){return this.value.toString()+" "+this.description},di.prototype.equals=function(t){return e.isType(t,di)&&t.value===this.value},di.prototype.hashCode=function(){return g(this.value)},di.prototype.description_61zpoe$=function(t){return this.copy_19mbxw$(void 0,t)},_i.prototype.fromValue_za3lpa$=function(t){var e=1<=t&&t<1e3?this.byValue_0[t]:null;return null!=e?e:new di(t,"Unknown Status Code")},_i.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var yi,mi,vi,$i=null;function gi(){return null===$i&&new _i,$i}function bi(){return C([gi().Continue,gi().SwitchingProtocols,gi().Processing,gi().OK,gi().Created,gi().Accepted,gi().NonAuthoritativeInformation,gi().NoContent,gi().ResetContent,gi().PartialContent,gi().MultiStatus,gi().MultipleChoices,gi().MovedPermanently,gi().Found,gi().SeeOther,gi().NotModified,gi().UseProxy,gi().SwitchProxy,gi().TemporaryRedirect,gi().PermanentRedirect,gi().BadRequest,gi().Unauthorized,gi().PaymentRequired,gi().Forbidden,gi().NotFound,gi().MethodNotAllowed,gi().NotAcceptable,gi().ProxyAuthenticationRequired,gi().RequestTimeout,gi().Conflict,gi().Gone,gi().LengthRequired,gi().PreconditionFailed,gi().PayloadTooLarge,gi().RequestURITooLong,gi().UnsupportedMediaType,gi().RequestedRangeNotSatisfiable,gi().ExpectationFailed,gi().UnprocessableEntity,gi().Locked,gi().FailedDependency,gi().UpgradeRequired,gi().TooManyRequests,gi().RequestHeaderFieldTooLarge,gi().InternalServerError,gi().NotImplemented,gi().BadGateway,gi().ServiceUnavailable,gi().GatewayTimeout,gi().VersionNotSupported,gi().VariantAlsoNegotiates,gi().InsufficientStorage])}function wi(t){var e=q();return Si(t,e),e.toString()}function ki(t){var e=je(t.first,!0);return null==t.second?e:e+"="+Te(v(t.second))}function Si(t,e){Qt(t,e,"&",void 0,void 0,void 0,void 0,ki)}function xi(t,e){Ci(t.entries(),e)}function Ei(t,e){Ci(t.entries(),e)}function Ci(t,e){var n,i=vt();for(n=t.iterator();n.hasNext();){var r,o=n.next(),a=o.key,s=o.value;if(s.isEmpty())r=Ut(lt(a,null));else{var l,c=m(H(s,10));for(l=s.iterator();l.hasNext();){var u=l.next();c.add_11rb$(lt(a,u))}r=c}Jt(i,r)}Si(i,e)}function Oi(t){var n,i=rt(e.isCharSequence(n=t)?n:it()).toString();if(0===i.length)return null;var r=Q(i,44),o=i.substring(0,r),a=r+1|0,s=i.substring(a);return lt(st(Nt(o,".")),bn(s))}function Ni(){return ee(te(Xt("\n.123,application/vnd.lotus-1-2-3\n.3dmf,x-world/x-3dmf\n.3dml,text/vnd.in3d.3dml\n.3dm,x-world/x-3dmf\n.3g2,video/3gpp2\n.3gp,video/3gpp\n.7z,application/x-7z-compressed\n.aab,application/x-authorware-bin\n.aac,audio/aac\n.aam,application/x-authorware-map\n.a,application/octet-stream\n.aas,application/x-authorware-seg\n.abc,text/vnd.abc\n.abw,application/x-abiword\n.ac,application/pkix-attr-cert\n.acc,application/vnd.americandynamics.acc\n.ace,application/x-ace-compressed\n.acgi,text/html\n.acu,application/vnd.acucobol\n.adp,audio/adpcm\n.aep,application/vnd.audiograph\n.afl,video/animaflex\n.afp,application/vnd.ibm.modcap\n.ahead,application/vnd.ahead.space\n.ai,application/postscript\n.aif,audio/aiff\n.aifc,audio/aiff\n.aiff,audio/aiff\n.aim,application/x-aim\n.aip,text/x-audiosoft-intra\n.air,application/vnd.adobe.air-application-installer-package+zip\n.ait,application/vnd.dvb.ait\n.ami,application/vnd.amiga.ami\n.ani,application/x-navi-animation\n.aos,application/x-nokia-9000-communicator-add-on-software\n.apk,application/vnd.android.package-archive\n.application,application/x-ms-application\n,application/pgp-encrypted\n.apr,application/vnd.lotus-approach\n.aps,application/mime\n.arc,application/octet-stream\n.arj,application/arj\n.arj,application/octet-stream\n.art,image/x-jg\n.asf,video/x-ms-asf\n.asm,text/x-asm\n.aso,application/vnd.accpac.simply.aso\n.asp,text/asp\n.asx,application/x-mplayer2\n.asx,video/x-ms-asf\n.asx,video/x-ms-asf-plugin\n.atc,application/vnd.acucorp\n.atomcat,application/atomcat+xml\n.atomsvc,application/atomsvc+xml\n.atom,application/atom+xml\n.atx,application/vnd.antix.game-component\n.au,audio/basic\n.au,audio/x-au\n.avi,video/avi\n.avi,video/msvideo\n.avi,video/x-msvideo\n.avs,video/avs-video\n.aw,application/applixware\n.azf,application/vnd.airzip.filesecure.azf\n.azs,application/vnd.airzip.filesecure.azs\n.azw,application/vnd.amazon.ebook\n.bcpio,application/x-bcpio\n.bdf,application/x-font-bdf\n.bdm,application/vnd.syncml.dm+wbxml\n.bed,application/vnd.realvnc.bed\n.bh2,application/vnd.fujitsu.oasysprs\n.bin,application/macbinary\n.bin,application/mac-binary\n.bin,application/octet-stream\n.bin,application/x-binary\n.bin,application/x-macbinary\n.bmi,application/vnd.bmi\n.bm,image/bmp\n.bmp,image/bmp\n.bmp,image/x-windows-bmp\n.boo,application/book\n.book,application/book\n.box,application/vnd.previewsystems.box\n.boz,application/x-bzip2\n.bsh,application/x-bsh\n.btif,image/prs.btif\n.bz2,application/x-bzip2\n.bz,application/x-bzip\n.c11amc,application/vnd.cluetrust.cartomobile-config\n.c11amz,application/vnd.cluetrust.cartomobile-config-pkg\n.c4g,application/vnd.clonk.c4group\n.cab,application/vnd.ms-cab-compressed\n.car,application/vnd.curl.car\n.cat,application/vnd.ms-pki.seccat\n.ccad,application/clariscad\n.cco,application/x-cocoa\n.cc,text/plain\n.cc,text/x-c\n.ccxml,application/ccxml+xml,\n.cdbcmsg,application/vnd.contact.cmsg\n.cdf,application/cdf\n.cdf,application/x-cdf\n.cdf,application/x-netcdf\n.cdkey,application/vnd.mediastation.cdkey\n.cdmia,application/cdmi-capability\n.cdmic,application/cdmi-container\n.cdmid,application/cdmi-domain\n.cdmio,application/cdmi-object\n.cdmiq,application/cdmi-queue\n.cdx,chemical/x-cdx\n.cdxml,application/vnd.chemdraw+xml\n.cdy,application/vnd.cinderella\n.cer,application/pkix-cert\n.cgm,image/cgm\n.cha,application/x-chat\n.chat,application/x-chat\n.chm,application/vnd.ms-htmlhelp\n.chrt,application/vnd.kde.kchart\n.cif,chemical/x-cif\n.cii,application/vnd.anser-web-certificate-issue-initiation\n.cil,application/vnd.ms-artgalry\n.cla,application/vnd.claymore\n.class,application/java\n.class,application/java-byte-code\n.class,application/java-vm\n.class,application/x-java-class\n.clkk,application/vnd.crick.clicker.keyboard\n.clkp,application/vnd.crick.clicker.palette\n.clkt,application/vnd.crick.clicker.template\n.clkw,application/vnd.crick.clicker.wordbank\n.clkx,application/vnd.crick.clicker\n.clp,application/x-msclip\n.cmc,application/vnd.cosmocaller\n.cmdf,chemical/x-cmdf\n.cml,chemical/x-cml\n.cmp,application/vnd.yellowriver-custom-menu\n.cmx,image/x-cmx\n.cod,application/vnd.rim.cod\n.com,application/octet-stream\n.com,text/plain\n.conf,text/plain\n.cpio,application/x-cpio\n.cpp,text/x-c\n.cpt,application/mac-compactpro\n.cpt,application/x-compactpro\n.cpt,application/x-cpt\n.crd,application/x-mscardfile\n.crl,application/pkcs-crl\n.crl,application/pkix-crl\n.crt,application/pkix-cert\n.crt,application/x-x509-ca-cert\n.crt,application/x-x509-user-cert\n.cryptonote,application/vnd.rig.cryptonote\n.csh,application/x-csh\n.csh,text/x-script.csh\n.csml,chemical/x-csml\n.csp,application/vnd.commonspace\n.css,text/css\n.csv,text/csv\n.c,text/plain\n.c++,text/plain\n.c,text/x-c\n.cu,application/cu-seeme\n.curl,text/vnd.curl\n.cww,application/prs.cww\n.cxx,text/plain\n.dat,binary/octet-stream\n.dae,model/vnd.collada+xml\n.daf,application/vnd.mobius.daf\n.davmount,application/davmount+xml\n.dcr,application/x-director\n.dcurl,text/vnd.curl.dcurl\n.dd2,application/vnd.oma.dd2+xml\n.ddd,application/vnd.fujixerox.ddd\n.deb,application/x-debian-package\n.deepv,application/x-deepv\n.def,text/plain\n.der,application/x-x509-ca-cert\n.dfac,application/vnd.dreamfactory\n.dif,video/x-dv\n.dir,application/x-director\n.dis,application/vnd.mobius.dis\n.djvu,image/vnd.djvu\n.dl,video/dl\n.dl,video/x-dl\n.dna,application/vnd.dna\n.doc,application/msword\n.docm,application/vnd.ms-word.document.macroenabled.12\n.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document\n.dot,application/msword\n.dotm,application/vnd.ms-word.template.macroenabled.12\n.dotx,application/vnd.openxmlformats-officedocument.wordprocessingml.template\n.dp,application/commonground\n.dp,application/vnd.osgi.dp\n.dpg,application/vnd.dpgraph\n.dra,audio/vnd.dra\n.drw,application/drafting\n.dsc,text/prs.lines.tag\n.dssc,application/dssc+der\n.dtb,application/x-dtbook+xml\n.dtd,application/xml-dtd\n.dts,audio/vnd.dts\n.dtshd,audio/vnd.dts.hd\n.dump,application/octet-stream\n.dvi,application/x-dvi\n.dv,video/x-dv\n.dwf,drawing/x-dwf (old)\n.dwf,model/vnd.dwf\n.dwg,application/acad\n.dwg,image/vnd.dwg\n.dwg,image/x-dwg\n.dxf,application/dxf\n.dxf,image/vnd.dwg\n.dxf,image/vnd.dxf\n.dxf,image/x-dwg\n.dxp,application/vnd.spotfire.dxp\n.dxr,application/x-director\n.ecelp4800,audio/vnd.nuera.ecelp4800\n.ecelp7470,audio/vnd.nuera.ecelp7470\n.ecelp9600,audio/vnd.nuera.ecelp9600\n.edm,application/vnd.novadigm.edm\n.edx,application/vnd.novadigm.edx\n.efif,application/vnd.picsel\n.ei6,application/vnd.pg.osasli\n.elc,application/x-bytecode.elisp (compiled elisp)\n.elc,application/x-elc\n.el,text/x-script.elisp\n.eml,message/rfc822\n.emma,application/emma+xml\n.env,application/x-envoy\n.eol,audio/vnd.digital-winds\n.eot,application/vnd.ms-fontobject\n.eps,application/postscript\n.epub,application/epub+zip\n.es3,application/vnd.eszigno3+xml\n.es,application/ecmascript\n.es,application/x-esrehber\n.esf,application/vnd.epson.esf\n.etx,text/x-setext\n.evy,application/envoy\n.evy,application/x-envoy\n.exe,application/octet-stream\n.exe,application/x-msdownload\n.exi,application/exi\n.ext,application/vnd.novadigm.ext\n.ez2,application/vnd.ezpix-album\n.ez3,application/vnd.ezpix-package\n.f4v,video/x-f4v\n.f77,text/x-fortran\n.f90,text/plain\n.f90,text/x-fortran\n.fbs,image/vnd.fastbidsheet\n.fcs,application/vnd.isac.fcs\n.fdf,application/vnd.fdf\n.fe_launch,application/vnd.denovo.fcselayout-link\n.fg5,application/vnd.fujitsu.oasysgp\n.fh,image/x-freehand\n.fif,application/fractals\n.fif,image/fif\n.fig,application/x-xfig\n.fli,video/fli\n.fli,video/x-fli\n.flo,application/vnd.micrografx.flo\n.flo,image/florian\n.flv,video/x-flv\n.flw,application/vnd.kde.kivio\n.flx,text/vnd.fmi.flexstor\n.fly,text/vnd.fly\n.fm,application/vnd.framemaker\n.fmf,video/x-atomic3d-feature\n.fnc,application/vnd.frogans.fnc\n.for,text/plain\n.for,text/x-fortran\n.fpx,image/vnd.fpx\n.fpx,image/vnd.net-fpx\n.frl,application/freeloader\n.fsc,application/vnd.fsc.weblaunch\n.fst,image/vnd.fst\n.ftc,application/vnd.fluxtime.clip\n.f,text/plain\n.f,text/x-fortran\n.fti,application/vnd.anser-web-funds-transfer-initiation\n.funk,audio/make\n.fvt,video/vnd.fvt\n.fxp,application/vnd.adobe.fxp\n.fzs,application/vnd.fuzzysheet\n.g2w,application/vnd.geoplan\n.g3,image/g3fax\n.g3w,application/vnd.geospace\n.gac,application/vnd.groove-account\n.gdl,model/vnd.gdl\n.geo,application/vnd.dynageo\n.gex,application/vnd.geometry-explorer\n.ggb,application/vnd.geogebra.file\n.ggt,application/vnd.geogebra.tool\n.ghf,application/vnd.groove-help\n.gif,image/gif\n.gim,application/vnd.groove-identity-message\n.gl,video/gl\n.gl,video/x-gl\n.gmx,application/vnd.gmx\n.gnumeric,application/x-gnumeric\n.gph,application/vnd.flographit\n.gqf,application/vnd.grafeq\n.gram,application/srgs\n.grv,application/vnd.groove-injector\n.grxml,application/srgs+xml\n.gsd,audio/x-gsm\n.gsf,application/x-font-ghostscript\n.gsm,audio/x-gsm\n.gsp,application/x-gsp\n.gss,application/x-gss\n.gtar,application/x-gtar\n.g,text/plain\n.gtm,application/vnd.groove-tool-message\n.gtw,model/vnd.gtw\n.gv,text/vnd.graphviz\n.gxt,application/vnd.geonext\n.gz,application/x-compressed\n.gz,application/x-gzip\n.gzip,application/x-gzip\n.gzip,multipart/x-gzip\n.h261,video/h261\n.h263,video/h263\n.h264,video/h264\n.hal,application/vnd.hal+xml\n.hbci,application/vnd.hbci\n.hdf,application/x-hdf\n.help,application/x-helpfile\n.hgl,application/vnd.hp-hpgl\n.hh,text/plain\n.hh,text/x-h\n.hlb,text/x-script\n.hlp,application/hlp\n.hlp,application/winhlp\n.hlp,application/x-helpfile\n.hlp,application/x-winhelp\n.hpg,application/vnd.hp-hpgl\n.hpgl,application/vnd.hp-hpgl\n.hpid,application/vnd.hp-hpid\n.hps,application/vnd.hp-hps\n.hqx,application/binhex\n.hqx,application/binhex4\n.hqx,application/mac-binhex\n.hqx,application/mac-binhex40\n.hqx,application/x-binhex40\n.hqx,application/x-mac-binhex40\n.hta,application/hta\n.htc,text/x-component\n.h,text/plain\n.h,text/x-h\n.htke,application/vnd.kenameaapp\n.htmls,text/html\n.html,text/html\n.htm,text/html\n.htt,text/webviewhtml\n.htx,text/html\n.hvd,application/vnd.yamaha.hv-dic\n.hvp,application/vnd.yamaha.hv-voice\n.hvs,application/vnd.yamaha.hv-script\n.i2g,application/vnd.intergeo\n.icc,application/vnd.iccprofile\n.ice,x-conference/x-cooltalk\n.ico,image/x-icon\n.ics,text/calendar\n.idc,text/plain\n.ief,image/ief\n.iefs,image/ief\n.iff,application/iff\n.ifm,application/vnd.shana.informed.formdata\n.iges,application/iges\n.iges,model/iges\n.igl,application/vnd.igloader\n.igm,application/vnd.insors.igm\n.igs,application/iges\n.igs,model/iges\n.igx,application/vnd.micrografx.igx\n.iif,application/vnd.shana.informed.interchange\n.ima,application/x-ima\n.imap,application/x-httpd-imap\n.imp,application/vnd.accpac.simply.imp\n.ims,application/vnd.ms-ims\n.inf,application/inf\n.ins,application/x-internett-signup\n.ip,application/x-ip2\n.ipfix,application/ipfix\n.ipk,application/vnd.shana.informed.package\n.irm,application/vnd.ibm.rights-management\n.irp,application/vnd.irepository.package+xml\n.isu,video/x-isvideo\n.it,audio/it\n.itp,application/vnd.shana.informed.formtemplate\n.iv,application/x-inventor\n.ivp,application/vnd.immervision-ivp\n.ivr,i-world/i-vrml\n.ivu,application/vnd.immervision-ivu\n.ivy,application/x-livescreen\n.jad,text/vnd.sun.j2me.app-descriptor\n.jam,application/vnd.jam\n.jam,audio/x-jam\n.jar,application/java-archive\n.java,text/plain\n.java,text/x-java-source\n.jav,text/plain\n.jav,text/x-java-source\n.jcm,application/x-java-commerce\n.jfif,image/jpeg\n.jfif,image/pjpeg\n.jfif-tbnl,image/jpeg\n.jisp,application/vnd.jisp\n.jlt,application/vnd.hp-jlyt\n.jnlp,application/x-java-jnlp-file\n.joda,application/vnd.joost.joda-archive\n.jpeg,image/jpeg\n.jpe,image/jpeg\n.jpg,image/jpeg\n.jpgv,video/jpeg\n.jpm,video/jpm\n.jps,image/x-jps\n.js,application/javascript\n.json,application/json\n.jut,image/jutvision\n.kar,audio/midi\n.karbon,application/vnd.kde.karbon\n.kar,music/x-karaoke\n.key,application/pgp-keys\n.keychain,application/octet-stream\n.kfo,application/vnd.kde.kformula\n.kia,application/vnd.kidspiration\n.kml,application/vnd.google-earth.kml+xml\n.kmz,application/vnd.google-earth.kmz\n.kne,application/vnd.kinar\n.kon,application/vnd.kde.kontour\n.kpr,application/vnd.kde.kpresenter\n.ksh,application/x-ksh\n.ksh,text/x-script.ksh\n.ksp,application/vnd.kde.kspread\n.ktx,image/ktx\n.ktz,application/vnd.kahootz\n.kwd,application/vnd.kde.kword\n.la,audio/nspaudio\n.la,audio/x-nspaudio\n.lam,audio/x-liveaudio\n.lasxml,application/vnd.las.las+xml\n.latex,application/x-latex\n.lbd,application/vnd.llamagraphics.life-balance.desktop\n.lbe,application/vnd.llamagraphics.life-balance.exchange+xml\n.les,application/vnd.hhe.lesson-player\n.lha,application/lha\n.lha,application/x-lha\n.link66,application/vnd.route66.link66+xml\n.list,text/plain\n.lma,audio/nspaudio\n.lma,audio/x-nspaudio\n.log,text/plain\n.lrm,application/vnd.ms-lrm\n.lsp,application/x-lisp\n.lsp,text/x-script.lisp\n.lst,text/plain\n.lsx,text/x-la-asf\n.ltf,application/vnd.frogans.ltf\n.ltx,application/x-latex\n.lvp,audio/vnd.lucent.voice\n.lwp,application/vnd.lotus-wordpro\n.lzh,application/octet-stream\n.lzh,application/x-lzh\n.lzx,application/lzx\n.lzx,application/octet-stream\n.lzx,application/x-lzx\n.m1v,video/mpeg\n.m21,application/mp21\n.m2a,audio/mpeg\n.m2v,video/mpeg\n.m3u8,application/vnd.apple.mpegurl\n.m3u,audio/x-mpegurl\n.m4a,audio/mp4\n.m4v,video/mp4\n.ma,application/mathematica\n.mads,application/mads+xml\n.mag,application/vnd.ecowin.chart\n.man,application/x-troff-man\n.map,application/x-navimap\n.mar,text/plain\n.mathml,application/mathml+xml\n.mbd,application/mbedlet\n.mbk,application/vnd.mobius.mbk\n.mbox,application/mbox\n.mc1,application/vnd.medcalcdata\n.mc$,application/x-magic-cap-package-1.0\n.mcd,application/mcad\n.mcd,application/vnd.mcd\n.mcd,application/x-mathcad\n.mcf,image/vasa\n.mcf,text/mcf\n.mcp,application/netmc\n.mcurl,text/vnd.curl.mcurl\n.mdb,application/x-msaccess\n.mdi,image/vnd.ms-modi\n.me,application/x-troff-me\n.meta4,application/metalink4+xml\n.mets,application/mets+xml\n.mfm,application/vnd.mfmp\n.mgp,application/vnd.osgeo.mapguide.package\n.mgz,application/vnd.proteus.magazine\n.mht,message/rfc822\n.mhtml,message/rfc822\n.mid,application/x-midi\n.mid,audio/midi\n.mid,audio/x-mid\n.midi,application/x-midi\n.midi,audio/midi\n.midi,audio/x-mid\n.midi,audio/x-midi\n.midi,music/crescendo\n.midi,x-music/x-midi\n.mid,music/crescendo\n.mid,x-music/x-midi\n.mif,application/vnd.mif\n.mif,application/x-frame\n.mif,application/x-mif\n.mime,message/rfc822\n.mime,www/mime\n.mj2,video/mj2\n.mjf,audio/x-vnd.audioexplosion.mjuicemediafile\n.mjpg,video/x-motion-jpeg\n.mkv,video/x-matroska\n.mkv,audio/x-matroska\n.mlp,application/vnd.dolby.mlp\n.mm,application/base64\n.mm,application/x-meme\n.mmd,application/vnd.chipnuts.karaoke-mmd\n.mme,application/base64\n.mmf,application/vnd.smaf\n.mmr,image/vnd.fujixerox.edmics-mmr\n.mny,application/x-msmoney\n.mod,audio/mod\n.mod,audio/x-mod\n.mods,application/mods+xml\n.moov,video/quicktime\n.movie,video/x-sgi-movie\n.mov,video/quicktime\n.mp2,audio/mpeg\n.mp2,audio/x-mpeg\n.mp2,video/mpeg\n.mp2,video/x-mpeg\n.mp2,video/x-mpeq2a\n.mp3,audio/mpeg\n.mp3,audio/mpeg3\n.mp4a,audio/mp4\n.mp4,video/mp4\n.mp4,application/mp4\n.mpa,audio/mpeg\n.mpc,application/vnd.mophun.certificate\n.mpc,application/x-project\n.mpeg,video/mpeg\n.mpe,video/mpeg\n.mpga,audio/mpeg\n.mpg,video/mpeg\n.mpg,audio/mpeg\n.mpkg,application/vnd.apple.installer+xml\n.mpm,application/vnd.blueice.multipass\n.mpn,application/vnd.mophun.application\n.mpp,application/vnd.ms-project\n.mpt,application/x-project\n.mpv,application/x-project\n.mpx,application/x-project\n.mpy,application/vnd.ibm.minipay\n.mqy,application/vnd.mobius.mqy\n.mrc,application/marc\n.mrcx,application/marcxml+xml\n.ms,application/x-troff-ms\n.mscml,application/mediaservercontrol+xml\n.mseq,application/vnd.mseq\n.msf,application/vnd.epson.msf\n.msg,application/vnd.ms-outlook\n.msh,model/mesh\n.msl,application/vnd.mobius.msl\n.msty,application/vnd.muvee.style\n.m,text/plain\n.m,text/x-m\n.mts,model/vnd.mts\n.mus,application/vnd.musician\n.musicxml,application/vnd.recordare.musicxml+xml\n.mvb,application/x-msmediaview\n.mv,video/x-sgi-movie\n.mwf,application/vnd.mfer\n.mxf,application/mxf\n.mxl,application/vnd.recordare.musicxml\n.mxml,application/xv+xml\n.mxs,application/vnd.triscape.mxs\n.mxu,video/vnd.mpegurl\n.my,audio/make\n.mzz,application/x-vnd.audioexplosion.mzz\n.n3,text/n3\nN/A,application/andrew-inset\n.nap,image/naplps\n.naplps,image/naplps\n.nbp,application/vnd.wolfram.player\n.nc,application/x-netcdf\n.ncm,application/vnd.nokia.configuration-message\n.ncx,application/x-dtbncx+xml\n.n-gage,application/vnd.nokia.n-gage.symbian.install\n.ngdat,application/vnd.nokia.n-gage.data\n.niff,image/x-niff\n.nif,image/x-niff\n.nix,application/x-mix-transfer\n.nlu,application/vnd.neurolanguage.nlu\n.nml,application/vnd.enliven\n.nnd,application/vnd.noblenet-directory\n.nns,application/vnd.noblenet-sealer\n.nnw,application/vnd.noblenet-web\n.npx,image/vnd.net-fpx\n.nsc,application/x-conference\n.nsf,application/vnd.lotus-notes\n.nvd,application/x-navidoc\n.oa2,application/vnd.fujitsu.oasys2\n.oa3,application/vnd.fujitsu.oasys3\n.o,application/octet-stream\n.oas,application/vnd.fujitsu.oasys\n.obd,application/x-msbinder\n.oda,application/oda\n.odb,application/vnd.oasis.opendocument.database\n.odc,application/vnd.oasis.opendocument.chart\n.odf,application/vnd.oasis.opendocument.formula\n.odft,application/vnd.oasis.opendocument.formula-template\n.odg,application/vnd.oasis.opendocument.graphics\n.odi,application/vnd.oasis.opendocument.image\n.odm,application/vnd.oasis.opendocument.text-master\n.odp,application/vnd.oasis.opendocument.presentation\n.ods,application/vnd.oasis.opendocument.spreadsheet\n.odt,application/vnd.oasis.opendocument.text\n.oga,audio/ogg\n.ogg,audio/ogg\n.ogv,video/ogg\n.ogx,application/ogg\n.omc,application/x-omc\n.omcd,application/x-omcdatamaker\n.omcr,application/x-omcregerator\n.onetoc,application/onenote\n.opf,application/oebps-package+xml\n.org,application/vnd.lotus-organizer\n.osf,application/vnd.yamaha.openscoreformat\n.osfpvg,application/vnd.yamaha.openscoreformat.osfpvg+xml\n.otc,application/vnd.oasis.opendocument.chart-template\n.otf,application/x-font-otf\n.otg,application/vnd.oasis.opendocument.graphics-template\n.oth,application/vnd.oasis.opendocument.text-web\n.oti,application/vnd.oasis.opendocument.image-template\n.otp,application/vnd.oasis.opendocument.presentation-template\n.ots,application/vnd.oasis.opendocument.spreadsheet-template\n.ott,application/vnd.oasis.opendocument.text-template\n.oxt,application/vnd.openofficeorg.extension\n.p10,application/pkcs10\n.p12,application/pkcs-12\n.p7a,application/x-pkcs7-signature\n.p7b,application/x-pkcs7-certificates\n.p7c,application/pkcs7-mime\n.p7m,application/pkcs7-mime\n.p7r,application/x-pkcs7-certreqresp\n.p7s,application/pkcs7-signature\n.p8,application/pkcs8\n.pages,application/vnd.apple.pages\n.part,application/pro_eng\n.par,text/plain-bas\n.pas,text/pascal\n.paw,application/vnd.pawaafile\n.pbd,application/vnd.powerbuilder6\n.pbm,image/x-portable-bitmap\n.pcf,application/x-font-pcf\n.pcl,application/vnd.hp-pcl\n.pcl,application/x-pcl\n.pclxl,application/vnd.hp-pclxl\n.pct,image/x-pict\n.pcurl,application/vnd.curl.pcurl\n.pcx,image/x-pcx\n.pdb,application/vnd.palm\n.pdb,chemical/x-pdb\n.pdf,application/pdf\n.pem,application/x-pem-file\n.pfa,application/x-font-type1\n.pfr,application/font-tdpfr\n.pfunk,audio/make\n.pfunk,audio/make.my.funk\n.pfx,application/x-pkcs12\n.pgm,image/x-portable-graymap\n.pgn,application/x-chess-pgn\n.pgp,application/pgp-signature\n.pic,image/pict\n.pict,image/pict\n.pkg,application/x-newton-compatible-pkg\n.pki,application/pkixcmp\n.pkipath,application/pkix-pkipath\n.pko,application/vnd.ms-pki.pko\n.plb,application/vnd.3gpp.pic-bw-large\n.plc,application/vnd.mobius.plc\n.plf,application/vnd.pocketlearn\n.pls,application/pls+xml\n.pl,text/plain\n.pl,text/x-script.perl\n.plx,application/x-pixclscript\n.pm4,application/x-pagemaker\n.pm5,application/x-pagemaker\n.pm,image/x-xpixmap\n.pml,application/vnd.ctc-posml\n.pm,text/x-script.perl-module\n.png,image/png\n.pnm,application/x-portable-anymap\n.pnm,image/x-portable-anymap\n.portpkg,application/vnd.macports.portpkg\n.pot,application/mspowerpoint\n.pot,application/vnd.ms-powerpoint\n.potm,application/vnd.ms-powerpoint.template.macroenabled.12\n.potx,application/vnd.openxmlformats-officedocument.presentationml.template\n.pov,model/x-pov\n.ppa,application/vnd.ms-powerpoint\n.ppam,application/vnd.ms-powerpoint.addin.macroenabled.12\n.ppd,application/vnd.cups-ppd\n.ppm,image/x-portable-pixmap\n.pps,application/mspowerpoint\n.pps,application/vnd.ms-powerpoint\n.ppsm,application/vnd.ms-powerpoint.slideshow.macroenabled.12\n.ppsx,application/vnd.openxmlformats-officedocument.presentationml.slideshow\n.ppt,application/mspowerpoint\n.ppt,application/powerpoint\n.ppt,application/vnd.ms-powerpoint\n.ppt,application/x-mspowerpoint\n.pptm,application/vnd.ms-powerpoint.presentation.macroenabled.12\n.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation\n.ppz,application/mspowerpoint\n.prc,application/x-mobipocket-ebook\n.pre,application/vnd.lotus-freelance\n.pre,application/x-freelance\n.prf,application/pics-rules\n.prt,application/pro_eng\n.ps,application/postscript\n.psb,application/vnd.3gpp.pic-bw-small\n.psd,application/octet-stream\n.psd,image/vnd.adobe.photoshop\n.psf,application/x-font-linux-psf\n.pskcxml,application/pskc+xml\n.p,text/x-pascal\n.ptid,application/vnd.pvi.ptid1\n.pub,application/x-mspublisher\n.pvb,application/vnd.3gpp.pic-bw-var\n.pvu,paleovu/x-pv\n.pwn,application/vnd.3m.post-it-notes\n.pwz,application/vnd.ms-powerpoint\n.pya,audio/vnd.ms-playready.media.pya\n.pyc,application/x-bytecode.python\n.py,text/x-script.python\n.pyv,video/vnd.ms-playready.media.pyv\n.qam,application/vnd.epson.quickanime\n.qbo,application/vnd.intu.qbo\n.qcp,audio/vnd.qcelp\n.qd3d,x-world/x-3dmf\n.qd3,x-world/x-3dmf\n.qfx,application/vnd.intu.qfx\n.qif,image/x-quicktime\n.qps,application/vnd.publishare-delta-tree\n.qtc,video/x-qtc\n.qtif,image/x-quicktime\n.qti,image/x-quicktime\n.qt,video/quicktime\n.qxd,application/vnd.quark.quarkxpress\n.ra,audio/x-pn-realaudio\n.ra,audio/x-pn-realaudio-plugin\n.ra,audio/x-realaudio\n.ram,audio/x-pn-realaudio\n.rar,application/x-rar-compressed\n.ras,application/x-cmu-raster\n.ras,image/cmu-raster\n.ras,image/x-cmu-raster\n.rast,image/cmu-raster\n.rcprofile,application/vnd.ipunplugged.rcprofile\n.rdf,application/rdf+xml\n.rdz,application/vnd.data-vision.rdz\n.rep,application/vnd.businessobjects\n.res,application/x-dtbresource+xml\n.rexx,text/x-script.rexx\n.rf,image/vnd.rn-realflash\n.rgb,image/x-rgb\n.rif,application/reginfo+xml\n.rip,audio/vnd.rip\n.rl,application/resource-lists+xml\n.rlc,image/vnd.fujixerox.edmics-rlc\n.rld,application/resource-lists-diff+xml\n.rm,application/vnd.rn-realmedia\n.rm,audio/x-pn-realaudio\n.rmi,audio/mid\n.rmm,audio/x-pn-realaudio\n.rmp,audio/x-pn-realaudio\n.rmp,audio/x-pn-realaudio-plugin\n.rms,application/vnd.jcp.javame.midlet-rms\n.rnc,application/relax-ng-compact-syntax\n.rng,application/ringing-tones\n.rng,application/vnd.nokia.ringing-tone\n.rnx,application/vnd.rn-realplayer\n.roff,application/x-troff\n.rp9,application/vnd.cloanto.rp9\n.rp,image/vnd.rn-realpix\n.rpm,audio/x-pn-realaudio-plugin\n.rpm,application/x-rpm\n.rpss,application/vnd.nokia.radio-presets\n.rpst,application/vnd.nokia.radio-preset\n.rq,application/sparql-query\n.rs,application/rls-services+xml\n.rsd,application/rsd+xml\n.rss,application/rss+xml\n.rtf,application/rtf\n.rtf,text/rtf\n.rt,text/richtext\n.rt,text/vnd.rn-realtext\n.rtx,application/rtf\n.rtx,text/richtext\n.rv,video/vnd.rn-realvideo\n.s3m,audio/s3m\n.saf,application/vnd.yamaha.smaf-audio\n.saveme,application/octet-stream\n.sbk,application/x-tbook\n.sbml,application/sbml+xml\n.sc,application/vnd.ibm.secure-container\n.scd,application/x-msschedule\n.scm,application/vnd.lotus-screencam\n.scm,application/x-lotusscreencam\n.scm,text/x-script.guile\n.scm,text/x-script.scheme\n.scm,video/x-scm\n.scq,application/scvp-cv-request\n.scs,application/scvp-cv-response\n.scurl,text/vnd.curl.scurl\n.sda,application/vnd.stardivision.draw\n.sdc,application/vnd.stardivision.calc\n.sdd,application/vnd.stardivision.impress\n.sdf,application/octet-stream\n.sdkm,application/vnd.solent.sdkm+xml\n.sdml,text/plain\n.sdp,application/sdp\n.sdp,application/x-sdp\n.sdr,application/sounder\n.sdw,application/vnd.stardivision.writer\n.sea,application/sea\n.sea,application/x-sea\n.see,application/vnd.seemail\n.seed,application/vnd.fdsn.seed\n.sema,application/vnd.sema\n.semd,application/vnd.semd\n.semf,application/vnd.semf\n.ser,application/java-serialized-object\n.set,application/set\n.setpay,application/set-payment-initiation\n.setreg,application/set-registration-initiation\n.sfd-hdstx,application/vnd.hydrostatix.sof-data\n.sfs,application/vnd.spotfire.sfs\n.sgl,application/vnd.stardivision.writer-global\n.sgml,text/sgml\n.sgml,text/x-sgml\n.sgm,text/sgml\n.sgm,text/x-sgml\n.sh,application/x-bsh\n.sh,application/x-sh\n.sh,application/x-shar\n.shar,application/x-bsh\n.shar,application/x-shar\n.shf,application/shf+xml\n.sh,text/x-script.sh\n.shtml,text/html\n.shtml,text/x-server-parsed-html\n.sid,audio/x-psid\n.sis,application/vnd.symbian.install\n.sit,application/x-sit\n.sit,application/x-stuffit\n.sitx,application/x-stuffitx\n.skd,application/x-koan\n.skm,application/x-koan\n.skp,application/vnd.koan\n.skp,application/x-koan\n.skt,application/x-koan\n.sl,application/x-seelogo\n.sldm,application/vnd.ms-powerpoint.slide.macroenabled.12\n.sldx,application/vnd.openxmlformats-officedocument.presentationml.slide\n.slt,application/vnd.epson.salt\n.sm,application/vnd.stepmania.stepchart\n.smf,application/vnd.stardivision.math\n.smi,application/smil\n.smi,application/smil+xml\n.smil,application/smil\n.snd,audio/basic\n.snd,audio/x-adpcm\n.snf,application/x-font-snf\n.sol,application/solids\n.spc,application/x-pkcs7-certificates\n.spc,text/x-speech\n.spf,application/vnd.yamaha.smaf-phrase\n.spl,application/futuresplash\n.spl,application/x-futuresplash\n.spot,text/vnd.in3d.spot\n.spp,application/scvp-vp-response\n.spq,application/scvp-vp-request\n.spr,application/x-sprite\n.sprite,application/x-sprite\n.src,application/x-wais-source\n.srt,text/srt\n.sru,application/sru+xml\n.srx,application/sparql-results+xml\n.sse,application/vnd.kodak-descriptor\n.ssf,application/vnd.epson.ssf\n.ssi,text/x-server-parsed-html\n.ssm,application/streamingmedia\n.ssml,application/ssml+xml\n.sst,application/vnd.ms-pki.certstore\n.st,application/vnd.sailingtracker.track\n.stc,application/vnd.sun.xml.calc.template\n.std,application/vnd.sun.xml.draw.template\n.step,application/step\n.s,text/x-asm\n.stf,application/vnd.wt.stf\n.sti,application/vnd.sun.xml.impress.template\n.stk,application/hyperstudio\n.stl,application/sla\n.stl,application/vnd.ms-pki.stl\n.stl,application/x-navistyle\n.stp,application/step\n.str,application/vnd.pg.format\n.stw,application/vnd.sun.xml.writer.template\n.sub,image/vnd.dvb.subtitle\n.sus,application/vnd.sus-calendar\n.sv4cpio,application/x-sv4cpio\n.sv4crc,application/x-sv4crc\n.svc,application/vnd.dvb.service\n.svd,application/vnd.svd\n.svf,image/vnd.dwg\n.svf,image/x-dwg\n.svg,image/svg+xml\n.svr,application/x-world\n.svr,x-world/x-svr\n.swf,application/x-shockwave-flash\n.swi,application/vnd.aristanetworks.swi\n.sxc,application/vnd.sun.xml.calc\n.sxd,application/vnd.sun.xml.draw\n.sxg,application/vnd.sun.xml.writer.global\n.sxi,application/vnd.sun.xml.impress\n.sxm,application/vnd.sun.xml.math\n.sxw,application/vnd.sun.xml.writer\n.talk,text/x-speech\n.tao,application/vnd.tao.intent-module-archive\n.t,application/x-troff\n.tar,application/x-tar\n.tbk,application/toolbook\n.tbk,application/x-tbook\n.tcap,application/vnd.3gpp2.tcap\n.tcl,application/x-tcl\n.tcl,text/x-script.tcl\n.tcsh,text/x-script.tcsh\n.teacher,application/vnd.smart.teacher\n.tei,application/tei+xml\n.tex,application/x-tex\n.texi,application/x-texinfo\n.texinfo,application/x-texinfo\n.text,text/plain\n.tfi,application/thraud+xml\n.tfm,application/x-tex-tfm\n.tgz,application/gnutar\n.tgz,application/x-compressed\n.thmx,application/vnd.ms-officetheme\n.tiff,image/tiff\n.tif,image/tiff\n.tmo,application/vnd.tmobile-livetv\n.torrent,application/x-bittorrent\n.tpl,application/vnd.groove-tool-template\n.tpt,application/vnd.trid.tpt\n.tra,application/vnd.trueapp\n.tr,application/x-troff\n.trm,application/x-msterminal\n.tsd,application/timestamped-data\n.tsi,audio/tsp-audio\n.tsp,application/dsptype\n.tsp,audio/tsplayer\n.tsv,text/tab-separated-values\n.t,text/troff\n.ttf,application/x-font-ttf\n.ttl,text/turtle\n.turbot,image/florian\n.twd,application/vnd.simtech-mindmapper\n.txd,application/vnd.genomatix.tuxedo\n.txf,application/vnd.mobius.txf\n.txt,text/plain\n.ufd,application/vnd.ufdl\n.uil,text/x-uil\n.umj,application/vnd.umajin\n.unis,text/uri-list\n.uni,text/uri-list\n.unityweb,application/vnd.unity\n.unv,application/i-deas\n.uoml,application/vnd.uoml+xml\n.uris,text/uri-list\n.uri,text/uri-list\n.ustar,application/x-ustar\n.ustar,multipart/x-ustar\n.utz,application/vnd.uiq.theme\n.uu,application/octet-stream\n.uue,text/x-uuencode\n.uu,text/x-uuencode\n.uva,audio/vnd.dece.audio\n.uvh,video/vnd.dece.hd\n.uvi,image/vnd.dece.graphic\n.uvm,video/vnd.dece.mobile\n.uvp,video/vnd.dece.pd\n.uvs,video/vnd.dece.sd\n.uvu,video/vnd.uvvu.mp4\n.uvv,video/vnd.dece.video\n.vcd,application/x-cdlink\n.vcf,text/x-vcard\n.vcg,application/vnd.groove-vcard\n.vcs,text/x-vcalendar\n.vcx,application/vnd.vcx\n.vda,application/vda\n.vdo,video/vdo\n.vew,application/groupwise\n.vis,application/vnd.visionary\n.vivo,video/vivo\n.vivo,video/vnd.vivo\n.viv,video/vivo\n.viv,video/vnd.vivo\n.vmd,application/vocaltec-media-desc\n.vmf,application/vocaltec-media-file\n.vob,video/dvd\n.voc,audio/voc\n.voc,audio/x-voc\n.vos,video/vosaic\n.vox,audio/voxware\n.vqe,audio/x-twinvq-plugin\n.vqf,audio/x-twinvq\n.vql,audio/x-twinvq-plugin\n.vrml,application/x-vrml\n.vrml,model/vrml\n.vrml,x-world/x-vrml\n.vrt,x-world/x-vrt\n.vsd,application/vnd.visio\n.vsd,application/x-visio\n.vsf,application/vnd.vsf\n.vst,application/x-visio\n.vsw,application/x-visio\n.vtt,text/vtt\n.vtu,model/vnd.vtu\n.vxml,application/voicexml+xml\n.w60,application/wordperfect6.0\n.w61,application/wordperfect6.1\n.w6w,application/msword\n.wad,application/x-doom\n.war,application/zip\n.wasm,application/wasm\n.wav,audio/wav\n.wax,audio/x-ms-wax\n.wb1,application/x-qpro\n.wbmp,image/vnd.wap.wbmp\n.wbs,application/vnd.criticaltools.wbs+xml\n.wbxml,application/vnd.wap.wbxml\n.weba,audio/webm\n.web,application/vnd.xara\n.webm,video/webm\n.webp,image/webp\n.wg,application/vnd.pmi.widget\n.wgt,application/widget\n.wiz,application/msword\n.wk1,application/x-123\n.wma,audio/x-ms-wma\n.wmd,application/x-ms-wmd\n.wmf,application/x-msmetafile\n.wmf,windows/metafile\n.wmlc,application/vnd.wap.wmlc\n.wmlsc,application/vnd.wap.wmlscriptc\n.wmls,text/vnd.wap.wmlscript\n.wml,text/vnd.wap.wml\n.wm,video/x-ms-wm\n.wmv,video/x-ms-wmv\n.wmx,video/x-ms-wmx\n.wmz,application/x-ms-wmz\n.woff,application/x-font-woff\n.word,application/msword\n.wp5,application/wordperfect\n.wp5,application/wordperfect6.0\n.wp6,application/wordperfect\n.wp,application/wordperfect\n.wpd,application/vnd.wordperfect\n.wpd,application/wordperfect\n.wpd,application/x-wpwin\n.wpl,application/vnd.ms-wpl\n.wps,application/vnd.ms-works\n.wq1,application/x-lotus\n.wqd,application/vnd.wqd\n.wri,application/mswrite\n.wri,application/x-mswrite\n.wri,application/x-wri\n.wrl,application/x-world\n.wrl,model/vrml\n.wrl,x-world/x-vrml\n.wrz,model/vrml\n.wrz,x-world/x-vrml\n.wsc,text/scriplet\n.wsdl,application/wsdl+xml\n.wspolicy,application/wspolicy+xml\n.wsrc,application/x-wais-source\n.wtb,application/vnd.webturbo\n.wtk,application/x-wintalk\n.wvx,video/x-ms-wvx\n.x3d,application/vnd.hzn-3d-crossword\n.xap,application/x-silverlight-app\n.xar,application/vnd.xara\n.xbap,application/x-ms-xbap\n.xbd,application/vnd.fujixerox.docuworks.binder\n.xbm,image/xbm\n.xbm,image/x-xbitmap\n.xbm,image/x-xbm\n.xdf,application/xcap-diff+xml\n.xdm,application/vnd.syncml.dm+xml\n.xdp,application/vnd.adobe.xdp+xml\n.xdr,video/x-amt-demorun\n.xdssc,application/dssc+xml\n.xdw,application/vnd.fujixerox.docuworks\n.xenc,application/xenc+xml\n.xer,application/patch-ops-error+xml\n.xfdf,application/vnd.adobe.xfdf\n.xfdl,application/vnd.xfdl\n.xgz,xgl/drawing\n.xhtml,application/xhtml+xml\n.xif,image/vnd.xiff\n.xla,application/excel\n.xla,application/x-excel\n.xla,application/x-msexcel\n.xlam,application/vnd.ms-excel.addin.macroenabled.12\n.xl,application/excel\n.xlb,application/excel\n.xlb,application/vnd.ms-excel\n.xlb,application/x-excel\n.xlc,application/excel\n.xlc,application/vnd.ms-excel\n.xlc,application/x-excel\n.xld,application/excel\n.xld,application/x-excel\n.xlk,application/excel\n.xlk,application/x-excel\n.xll,application/excel\n.xll,application/vnd.ms-excel\n.xll,application/x-excel\n.xlm,application/excel\n.xlm,application/vnd.ms-excel\n.xlm,application/x-excel\n.xls,application/excel\n.xls,application/vnd.ms-excel\n.xls,application/x-excel\n.xls,application/x-msexcel\n.xlsb,application/vnd.ms-excel.sheet.binary.macroenabled.12\n.xlsm,application/vnd.ms-excel.sheet.macroenabled.12\n.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\n.xlt,application/excel\n.xlt,application/x-excel\n.xltm,application/vnd.ms-excel.template.macroenabled.12\n.xltx,application/vnd.openxmlformats-officedocument.spreadsheetml.template\n.xlv,application/excel\n.xlv,application/x-excel\n.xlw,application/excel\n.xlw,application/vnd.ms-excel\n.xlw,application/x-excel\n.xlw,application/x-msexcel\n.xm,audio/xm\n.xml,application/xml\n.xml,text/xml\n.xmz,xgl/movie\n.xo,application/vnd.olpc-sugar\n.xop,application/xop+xml\n.xpi,application/x-xpinstall\n.xpix,application/x-vnd.ls-xpix\n.xpm,image/xpm\n.xpm,image/x-xpixmap\n.x-png,image/png\n.xpr,application/vnd.is-xpr\n.xps,application/vnd.ms-xpsdocument\n.xpw,application/vnd.intercon.formnet\n.xslt,application/xslt+xml\n.xsm,application/vnd.syncml+xml\n.xspf,application/xspf+xml\n.xsr,video/x-amt-showrun\n.xul,application/vnd.mozilla.xul+xml\n.xwd,image/x-xwd\n.xwd,image/x-xwindowdump\n.xyz,chemical/x-pdb\n.xyz,chemical/x-xyz\n.xz,application/x-xz\n.yaml,text/yaml\n.yang,application/yang\n.yin,application/yin+xml\n.z,application/x-compress\n.z,application/x-compressed\n.zaz,application/vnd.zzazz.deck+xml\n.zip,application/zip\n.zip,application/x-compressed\n.zip,application/x-zip-compressed\n.zip,multipart/x-zip\n.zir,application/vnd.zul\n.zmm,application/vnd.handheld-entertainment+xml\n.zoo,application/octet-stream\n.zsh,text/x-script.zsh\n"),Oi))}function zi(){return vi.value}function ji(){Ri()}function Ti(){Pi=this,this.Empty=Li()}di.$metadata$={kind:d,simpleName:"HttpStatusCode",interfaces:[]},di.prototype.component1=function(){return this.value},di.prototype.component2=function(){return this.description},di.prototype.copy_19mbxw$=function(t,e){return new di(void 0===t?this.value:t,void 0===e?this.description:e)},Ti.prototype.build_itqcaa$=wt("ktor-ktor-http-jsLegacy.io.ktor.http.Parameters.Companion.build_itqcaa$",kt((function(){var e=t.io.ktor.http.ParametersBuilder;return function(t){var n=new e;return t(n),n.build()}}))),Ti.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var Pi=null;function Ri(){return null===Pi&&new Ti,Pi}function Ai(t){void 0===t&&(t=8),qt.call(this,!0,t)}function Ii(){Mi=this}ji.$metadata$={kind:G,simpleName:"Parameters",interfaces:[Dt]},Ai.prototype.build=function(){if(this.built)throw pt("ParametersBuilder can only build a single Parameters instance".toString());return this.built=!0,new Di(this.values)},Ai.$metadata$={kind:d,simpleName:"ParametersBuilder",interfaces:[qt]},Object.defineProperty(Ii.prototype,"caseInsensitiveName",{configurable:!0,get:function(){return!0}}),Ii.prototype.getAll_61zpoe$=function(t){return null},Ii.prototype.names=function(){return Ft()},Ii.prototype.entries=function(){return Ft()},Ii.prototype.isEmpty=function(){return!0},Ii.prototype.toString=function(){return"Parameters "+this.entries()},Ii.prototype.equals=function(t){return e.isType(t,ji)&&t.isEmpty()},Ii.$metadata$={kind:K,simpleName:"EmptyParameters",interfaces:[ji]};var Mi=null;function Li(){return null===Mi&&new Ii,Mi}function Di(t){void 0===t&&(t=ot()),Ht.call(this,!0,t)}function qi(t,e,n){var i;if(void 0===e&&(e=0),void 0===n&&(n=1e3),e>Lt(t))i=Ri().Empty;else{var r=new Ai;!function(t,e,n,i){var r,o=0,a=n,s=-1;r=Lt(e);for(var l=n;l<=r;l++){if(o===i)return;switch(e.charCodeAt(l)){case 38:Fi(t,e,a,s,l),a=l+1|0,s=-1,o=o+1|0;break;case 61:-1===s&&(s=l)}}o!==i&&Fi(t,e,a,s,e.length)}(r,t,e,n),i=r.build()}return i}function Fi(t,e,n,i,r){if(-1===i){var o=Bi(n,r,e),a=Ui(o,r,e);if(a>o){var s=Pe(e,o,a);t.appendAll_poujtz$(s,W())}}else{var l=Bi(n,i,e),c=Ui(l,i,e);if(c>l){var u=Pe(e,l,c),p=Bi(i+1|0,r,e),h=Pe(e,p,Ui(p,r,e),!0);t.append_puj7f4$(u,h)}}}function Ui(t,e,n){for(var i=e;i>t&&ht(n.charCodeAt(i-1|0));)i=i-1|0;return i}function Bi(t,e,n){for(var i=t;i0&&(t.append_s8itvh$(35),t.append_gw00v9$(Oe(this.fragment))),t},Hi.prototype.buildString=function(){return this.appendTo_0(I(256)).toString()},Hi.prototype.build=function(){return new Gi(this.protocol,this.host,this.port,this.encodedPath,this.parameters.build(),this.fragment,this.user,this.password,this.trailingQuery)},Ki.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var Wi=null;function Yi(){return null===Wi&&new Ki,Wi}function Gi(t,e,n,i,r,o,a,s,l){var c;if(Qi(),this.protocol=t,this.host=e,this.specifiedPort=n,this.encodedPath=i,this.parameters=r,this.fragment=o,this.user=a,this.password=s,this.trailingQuery=l,!(1<=(c=this.specifiedPort)&&c<=65536||0===this.specifiedPort))throw pt("port must be between 1 and 65536, or 0 if not set".toString())}function Ji(){Zi=this}Hi.$metadata$={kind:d,simpleName:"URLBuilder",interfaces:[]},Object.defineProperty(Gi.prototype,"port",{configurable:!0,get:function(){var t,e=this.specifiedPort;return null!=(t=0!==e?e:null)?t:this.protocol.defaultPort}}),Gi.prototype.toString=function(){var t=q();t:do{var e;switch(t.append_pdl1vj$(this.protocol.name),this.protocol.name){case"file":tr(t,this.host,this.encodedPath);break t;case"mailto":if(null==(e=this.user))throw Et("User can't be empty.".toString());Xi(t,e,this.host);break t}t.append_pdl1vj$("://"),t.append_pdl1vj$(rr(this)),t.append_pdl1vj$(yr(this)),this.fragment.length>0&&(t.append_s8itvh$(35),t.append_pdl1vj$(this.fragment))}while(0);return t.toString()},Ji.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var Zi=null;function Qi(){return null===Zi&&new Ji,Zi}function Xi(t,e,n){t.append_gw00v9$(":"),t.append_gw00v9$(je(e)),t.append_s8itvh$(64),t.append_gw00v9$(n)}function tr(t,e,n){t.append_gw00v9$("://"),t.append_gw00v9$(e),t.append_gw00v9$(n)}function er(t){var e=q();return ir(e,t.user,t.password),e.toString()}function nr(t){var e=q();return ir(e,t.user,t.password),e.toString()}function ir(t,e,n){null!=e&&(t.append_pdl1vj$(je(e)),null!=n&&(t.append_s8itvh$(58),t.append_pdl1vj$(je(n))),t.append_pdl1vj$("@"))}function rr(t){var e=q();return e.append_pdl1vj$(er(t)),0===t.specifiedPort?e.append_pdl1vj$(t.host):e.append_pdl1vj$(mr(t)),e.toString()}function or(t){var e=q();return e.append_pdl1vj$(nr(t)),e.append_pdl1vj$(t.host),0!==t.port&&t.port!==t.protocol.defaultPort&&(e.append_pdl1vj$(":"),e.append_pdl1vj$(t.port.toString())),e.toString()}function ar(t,n){var i;try{i=lr(t,n)}catch(t){throw e.isType(t,At)?new sr(n,t):t}return i}function sr(t,e){Ct.call(this,"Fail to parse url: "+t,e),this.name="URLParserException"}function lr(t,e){var n,i,r,o;t:do{var a,s,l,c;s=(a=re(e)).first,l=a.last,c=a.step;for(var u=s;u<=l;u+=c)if(!ht(S(E(e.charCodeAt(u))))){o=u;break t}o=-1}while(0);var p,h=o;t:do{var f;for(f=se(re(e)).iterator();f.hasNext();){var d=f.next();if(!ht(S(E(e.charCodeAt(d))))){p=d;break t}}p=-1}while(0);var _=p+1|0,m=function(t,e,n){var i=e,r=-1,o=t.charCodeAt(i);for(new b(97,122).contains_mef7kx$(o)||new b(65,90).contains_mef7kx$(o)||(r=i);i0){var v=h,$=h+m|0,g=e.substring(v,$);t.protocol=dr().createOrDefault_61zpoe$(g),h=h+(m+1)|0}var w=function(t,e,n,i){for(var r=0;(e+r|0)=2)t:for(;;){var k=oe(e,Ot("@/\\?#"),h),x=null!=(n=k>0?k:null)?n:_;if(!(x<_&&64===e.charCodeAt(x))){cr(t,e,h,x),h=x;break t}var C=ur(e,h,x);if(-1!==C){var O=h;t.user=Re(e.substring(O,C));var N=C+1|0;t.password=Re(e.substring(N,x))}else{var z=h;t.user=Re(e.substring(z,x))}h=x+1|0}if(h>=_)return t.encodedPath=47===e.charCodeAt(_-1|0)?"/":"",t;if(0===w){var j=ae(t.encodedPath,47);if(j!==(t.encodedPath.length-1|0))if(-1!==j){var T=j+1|0;i=t.encodedPath.substring(0,T)}else i="/";else i=t.encodedPath}else i="";t.encodedPath=i;var P=oe(e,Ot("?#"),h),A=null!=(r=P>0?P:null)?r:_,I=h,M=e.substring(I,A);return t.encodedPath+=ze(M),(h=A)<_&&63===e.charCodeAt(h)&&(h=function(t,e,n,i){var r;if((n+1|0)===i)return t.trailingQuery=!0,i;var o,a=Q(e,35,n+1|0),s=null!=(r=a>0?a:null)?r:i,l=n+1|0;return qi(e.substring(l,s)).forEach_ubvtmq$((o=t,function(t,e){return o.parameters.appendAll_poujtz$(t,e),R})),s}(t,e,h,_)),function(t,e,n,i){if(n0?o:null)?r:i;if(t.host=e.substring(n,a),(a+1|0)@;:/\\\\"\\[\\]\\?=\\{\\}\\s]+)\\s*(=\\s*("[^"]*"|[^;]*))?'),z([E(59),E(44),E(34)]),C(["***, dd MMM YYYY hh:mm:ss zzz","****, dd-MMM-YYYY hh:mm:ss zzz","*** MMM d hh:mm:ss YYYY","***, dd-MMM-YYYY hh:mm:ss zzz","***, dd-MMM-YYYY hh-mm-ss zzz","***, dd MMM YYYY hh:mm:ss zzz","*** dd-MMM-YYYY hh:mm:ss zzz","*** dd MMM YYYY hh:mm:ss zzz","*** dd-MMM-YYYY hh-mm-ss zzz","***,dd-MMM-YYYY hh:mm:ss zzz","*** MMM d YYYY hh:mm:ss zzz"]),Tt((function(){var t=zt();return t.putAll_a2k3zr$(gn(jt(zi()))),t})),Tt((function(){return gn(ct(jt(zi()),$n))})),dn=z([E(40),E(41),E(60),E(62),E(64),E(44),E(59),E(58),E(92),E(34),E(47),E(91),E(93),E(63),E(61),E(123),E(125),E(32),E(9),E(10),E(13)]),yi=ko(So(ko(So(ko(So(jo(),"."),jo()),"."),jo()),"."),jo()),mi=So(wo("[",Co(Eo(zo(),":"))),"]"),Po(xo(yi,mi)),vi=Tt((function(){return Ni()})),Sr=bt("[a-zA-Z0-9\\-._~+/]+=*"),xr=bt("\\S+"),Er=bt("\\s*,?\\s*("+Sr+')\\s*=\\s*(("((\\\\.)|[^\\\\"])*")|[^\\s,]*)\\s*,?\\s*'),Cr=bt("\\\\."),new ye("Caching"),t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){"use strict";(function(e,i){var r=n(2).Buffer,o=e.crypto||e.msCrypto;o&&o.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var n=r.allocUnsafe(t);if(t>0)if(t>65536)for(var a=0;a2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}r("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(t,e,n){var i,r,a,s;if("string"==typeof e&&(r="not ",e.substr(!a||a<0?0:+a,r.length)===r)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(o(e,"type"));else{var l=function(t,e,n){return"number"!=typeof n&&(n=0),!(n+e.length>t.length)&&-1!==t.indexOf(e,n)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(l," ").concat(i," ").concat(o(e,"type"))}return s+=". Received type ".concat(typeof n)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},function(t,e,n){"use strict";(function(e){var i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=c;var r=n(78),o=n(82);n(0)(c,r);for(var a=i(o.prototype),s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var i=(4294967295&n)>>>0,r=(n-i)/4294967296;this._block.writeUInt32BE(r,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=r},function(t,e,n){"use strict";var i={};function r(t,e,n){n||(n=Error);var r=function(t){var n,i;function r(n,i,r){return t.call(this,function(t,n,i){return"string"==typeof e?e:e(t,n,i)}(n,i,r))||this}return i=t,(n=r).prototype=Object.create(i.prototype),n.prototype.constructor=n,n.__proto__=i,r}(n);r.prototype.name=n.name,r.prototype.code=t,i[t]=r}function o(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}r("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(t,e,n){var i,r,a,s;if("string"==typeof e&&(r="not ",e.substr(!a||a<0?0:+a,r.length)===r)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(o(e,"type"));else{var l=function(t,e,n){return"number"!=typeof n&&(n=0),!(n+e.length>t.length)&&-1!==t.indexOf(e,n)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(l," ").concat(i," ").concat(o(e,"type"))}return s+=". Received type ".concat(typeof n)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},function(t,e,n){"use strict";(function(e){var i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=c;var r=n(107),o=n(111);n(0)(c,r);for(var a=i(o.prototype),s=0;s0;){var i=v(t,n);de(n,i);for(var r=(8*(n.length-i|0)|0)/6|0,o=(255&n[0])<<16|(255&n[1])<<8|255&n[2],a=n.length;a>=r;a--){var l=o>>(6*a|0)&63;e.append_s8itvh$(_e(l))}for(var c=0;c>4],r[(i=o,o=i+1|0,i)]=a[15&l]}return rt(r)}function Re(t,e,n){this.delegate_0=t,this.convertTo_0=e,this.convert_0=n,this.size_uukmxx$_0=this.delegate_0.size}function Ae(t){this.this$DelegatingMutableSet=t,this.delegateIterator=t.delegate_0.iterator()}function Ie(){Me=this}e.kotlin.IllegalArgumentException_init,e.kotlin.IllegalArgumentException,cn.prototype=Object.create(qt.prototype),cn.prototype.constructor=cn,qn.prototype=Object.create(Kt.prototype),qn.prototype.constructor=qn,pi.prototype=Object.create(Kt.prototype),pi.prototype.constructor=pi,Qi.prototype=Object.create(w.prototype),Qi.prototype.constructor=Qi,tr.prototype=Object.create(Xi.prototype),tr.prototype.constructor=tr,er.prototype=Object.create(Xi.prototype),er.prototype.constructor=er,nr.prototype=Object.create(Xi.prototype),nr.prototype.constructor=nr,Cr.prototype=Object.create(Gt.prototype),Cr.prototype.constructor=Cr,pe.prototype.toString=function(){return 0===this.name.length?h.prototype.toString.call(this):"AttributeKey: "+this.name},pe.$metadata$={kind:p,simpleName:"AttributeKey",interfaces:[]},he.prototype.get_yzaw86$=function(t){var e;if(null==(e=this.getOrNull_yzaw86$(t)))throw f("No instance for key "+t);return e},he.prototype.take_yzaw86$=function(t){var e=this.get_yzaw86$(t);return this.remove_yzaw86$(t),e},he.prototype.takeOrNull_yzaw86$=function(t){var e=this.getOrNull_yzaw86$(t);return this.remove_yzaw86$(t),e},he.$metadata$={kind:d,simpleName:"Attributes",interfaces:[]},ye.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[j]},ye.prototype=Object.create(j.prototype),ye.prototype.constructor=ye,ye.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$first.writePacket_3uq2w4$(this.local$closure$chunk.copy(),this),this.result_0===z)return z;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ve.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[j]},ve.prototype=Object.create(j.prototype),ve.prototype.constructor=ve,ve.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$second.writePacket_3uq2w4$(this.local$closure$chunk.copy(),this),this.result_0===z)return z;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ge.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[j]},ge.prototype=Object.create(j.prototype),ge.prototype.constructor=ge,ge.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;this.exceptionState_0=10,this.state_0=1;continue;case 1:if(this.local$this$split.isClosedForRead){this.state_0=7;continue}if(this.state_0=2,this.result_0=O(this.local$this$split,l,this),this.result_0===z)return z;continue;case 2:this.local$$receiver=this.result_0,this.exceptionState_0=5;var n=this.local$closure$first,i=this.local$closure$second;if(this.state_0=3,this.result_0=R(P([T(this.local$$receiver_0,void 0,void 0,me(n,this.local$$receiver)),T(this.local$$receiver_0,void 0,void 0,$e(i,this.local$$receiver))]),this),this.result_0===z)return z;continue;case 3:this.result_0,this.exceptionState_0=10,this.finallyPath_0=[4],this.state_0=6;continue;case 4:this.state_0=1;continue;case 5:this.finallyPath_0=[10],this.state_0=6;continue;case 6:this.exceptionState_0=10,this.local$$receiver.close(),this.state_0=this.finallyPath_0.shift();continue;case 7:if(e.isType(this.local$$receiver_0,A)){if(null!=(t=this.local$$receiver_0.closedCause))throw t;this.exceptionState_0=15,this.finallyPath_0=[8],this.state_0=13,this.$returnValue=N;continue}this.state_0=9;continue;case 8:return this.$returnValue;case 9:this.exceptionState_0=15,this.finallyPath_0=[14],this.state_0=13;continue;case 10:this.finallyPath_0=[15],this.exceptionState_0=13;var r=this.exception_0;if(e.isType(r,w)){this.local$this$split.cancel_dbl4no$(r),this.local$closure$first.cancel_dbl4no$(r),this.exceptionState_0=15,this.finallyPath_0=[11],this.state_0=13,this.$returnValue=this.local$closure$second.cancel_dbl4no$(r);continue}throw r;case 11:return this.$returnValue;case 12:this.finallyPath_0=[14],this.state_0=13;continue;case 13:this.exceptionState_0=15,I(this.local$closure$first),I(this.local$closure$second),this.state_0=this.finallyPath_0.shift();continue;case 14:return N;case 15:throw this.exception_0;default:throw this.state_0=15,new Error("State Machine Unreachable execution")}}catch(t){if(15===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},be.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[j]},be.prototype=Object.create(j.prototype),be.prototype.constructor=be,be.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;this.exceptionState_0=16,this.state_0=1;continue;case 1:if(this.local$this$copyToBoth.isClosedForRead||this.local$closure$first.isClosedForWrite&&this.local$closure$second.isClosedForWrite){this.state_0=13;continue}if(this.state_0=2,this.result_0=O(this.local$this$copyToBoth,l,this),this.result_0===z)return z;continue;case 2:this.local$$receiver=this.result_0,this.exceptionState_0=11,this.local$closure$first_0=this.local$closure$first,this.local$closure$second_0=this.local$closure$second,this.local$this$copyToBoth_0=this.local$this$copyToBoth,this.state_0=3;continue;case 3:if(this.exceptionState_0=6,this.state_0=4,this.result_0=this.local$closure$first_0.writePacket_3uq2w4$(this.local$$receiver.copy(),this),this.result_0===z)return z;continue;case 4:if(this.state_0=5,this.result_0=this.local$closure$second_0.writePacket_3uq2w4$(this.local$$receiver.copy(),this),this.result_0===z)return z;continue;case 5:this.local$block$result=this.result_0,this.exceptionState_0=11,this.state_0=8;continue;case 6:this.exceptionState_0=11;var n=this.exception_0;if(e.isType(n,w)){this.local$this$copyToBoth_0.cancel_dbl4no$(n),this.local$closure$first_0.close_dbl4no$(n),this.local$block$result=this.local$closure$second_0.close_dbl4no$(n),this.exceptionState_0=6,this.state_0=9;continue}throw n;case 7:this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:this.local$block$result,this.exceptionState_0=16,this.finallyPath_0=[10],this.state_0=12;continue;case 10:this.state_0=1;continue;case 11:this.finallyPath_0=[16],this.state_0=12;continue;case 12:this.exceptionState_0=16,this.local$$receiver.close(),this.state_0=this.finallyPath_0.shift();continue;case 13:if(e.isType(this.local$$receiver_0,A)){if(null!=(t=this.local$$receiver_0.closedCause))throw t;this.exceptionState_0=21,this.finallyPath_0=[14],this.state_0=19,this.$returnValue=N;continue}this.state_0=15;continue;case 14:return this.$returnValue;case 15:this.exceptionState_0=21,this.finallyPath_0=[20],this.state_0=19;continue;case 16:this.finallyPath_0=[21],this.exceptionState_0=19;var i=this.exception_0;if(e.isType(i,w)){this.local$closure$first.close_dbl4no$(i),this.exceptionState_0=21,this.finallyPath_0=[17],this.state_0=19,this.$returnValue=this.local$closure$second.close_dbl4no$(i);continue}throw i;case 17:return this.$returnValue;case 18:this.finallyPath_0=[20],this.state_0=19;continue;case 19:this.exceptionState_0=21,I(this.local$closure$first),I(this.local$closure$second),this.state_0=this.finallyPath_0.shift();continue;case 20:return N;case 21:throw this.exception_0;default:throw this.state_0=21,new Error("State Machine Unreachable execution")}}catch(t){if(21===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},we.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[j]},we.prototype=Object.create(j.prototype),we.prototype.constructor=we,we.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=q(this.local$$receiver,this),this.result_0===z)return z;continue;case 1:throw this.exception_0;case 2:return F(this.result_0);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(ke.prototype,"size",{configurable:!0,get:function(){return this.delegate_0.size}}),ke.prototype.containsKey_11rb$=function(t){return this.delegate_0.containsKey_11rb$(new We(t))},ke.prototype.containsValue_11rc$=function(t){return this.delegate_0.containsValue_11rc$(t)},ke.prototype.get_11rb$=function(t){return this.delegate_0.get_11rb$(Ke(t))},ke.prototype.isEmpty=function(){return this.delegate_0.isEmpty()},ke.prototype.clear=function(){this.delegate_0.clear()},ke.prototype.put_xwzc9p$=function(t,e){return this.delegate_0.put_xwzc9p$(Ke(t),e)},ke.prototype.putAll_a2k3zr$=function(t){var e;for(e=t.entries.iterator();e.hasNext();){var n=e.next(),i=n.key,r=n.value;this.put_xwzc9p$(i,r)}},ke.prototype.remove_11rb$=function(t){return this.delegate_0.remove_11rb$(Ke(t))},Object.defineProperty(ke.prototype,"keys",{configurable:!0,get:function(){return new Re(this.delegate_0.keys,Se,xe)}}),Object.defineProperty(ke.prototype,"entries",{configurable:!0,get:function(){return new Re(this.delegate_0.entries,Ee,Ce)}}),Object.defineProperty(ke.prototype,"values",{configurable:!0,get:function(){return this.delegate_0.values}}),ke.prototype.equals=function(t){return!(null==t||!e.isType(t,ke))&&U(t.delegate_0,this.delegate_0)},ke.prototype.hashCode=function(){return B(this.delegate_0)},ke.$metadata$={kind:p,simpleName:"CaseInsensitiveMap",interfaces:[H]},Object.defineProperty(Oe.prototype,"key",{get:function(){return this.key_3iz5qv$_0}}),Object.defineProperty(Oe.prototype,"value",{get:function(){return this.value_p1xw47$_0},set:function(t){this.value_p1xw47$_0=t}}),Oe.prototype.setValue_11rc$=function(t){return this.value=t,this.value},Oe.prototype.hashCode=function(){return 527+B(V(this.key))+B(V(this.value))|0},Oe.prototype.equals=function(t){return!(null==t||!e.isType(t,K))&&U(t.key,this.key)&&U(t.value,this.value)},Oe.prototype.toString=function(){return this.key.toString()+"="+this.value},Oe.$metadata$={kind:p,simpleName:"Entry",interfaces:[W]},je.prototype=Object.create(nt.prototype),je.prototype.constructor=je,je.prototype.handleException_1ur55u$=function(t,e){this.closure$handler(t,e)},je.$metadata$={kind:p,interfaces:[it,nt]},Re.prototype.convert_9xhtru$=function(t){var e,n=lt(st(t,10));for(e=t.iterator();e.hasNext();){var i=e.next();n.add_11rb$(this.convert_0(i))}return n},Re.prototype.convertTo_9xhuij$=function(t){var e,n=lt(st(t,10));for(e=t.iterator();e.hasNext();){var i=e.next();n.add_11rb$(this.convertTo_0(i))}return n},Object.defineProperty(Re.prototype,"size",{configurable:!0,get:function(){return this.size_uukmxx$_0}}),Re.prototype.add_11rb$=function(t){return this.delegate_0.add_11rb$(this.convert_0(t))},Re.prototype.addAll_brywnq$=function(t){return this.delegate_0.addAll_brywnq$(this.convert_9xhtru$(t))},Re.prototype.clear=function(){this.delegate_0.clear()},Re.prototype.remove_11rb$=function(t){return this.delegate_0.remove_11rb$(this.convert_0(t))},Re.prototype.removeAll_brywnq$=function(t){return this.delegate_0.removeAll_brywnq$(this.convert_9xhtru$(t))},Re.prototype.retainAll_brywnq$=function(t){return this.delegate_0.retainAll_brywnq$(this.convert_9xhtru$(t))},Re.prototype.contains_11rb$=function(t){return this.delegate_0.contains_11rb$(this.convert_0(t))},Re.prototype.containsAll_brywnq$=function(t){return this.delegate_0.containsAll_brywnq$(this.convert_9xhtru$(t))},Re.prototype.isEmpty=function(){return this.delegate_0.isEmpty()},Ae.prototype.hasNext=function(){return this.delegateIterator.hasNext()},Ae.prototype.next=function(){return this.this$DelegatingMutableSet.convertTo_0(this.delegateIterator.next())},Ae.prototype.remove=function(){this.delegateIterator.remove()},Ae.$metadata$={kind:p,interfaces:[ot]},Re.prototype.iterator=function(){return new Ae(this)},Re.prototype.hashCode=function(){return B(this.delegate_0)},Re.prototype.equals=function(t){if(null==t||!e.isType(t,at))return!1;var n=this.convertTo_9xhuij$(this.delegate_0),i=t.containsAll_brywnq$(n);return i&&(i=n.containsAll_brywnq$(t)),i},Re.prototype.toString=function(){return this.convertTo_9xhuij$(this.delegate_0).toString()},Re.$metadata$={kind:p,simpleName:"DelegatingMutableSet",interfaces:[G]},Ie.prototype.combine_jiburq$=function(t){return B(ut(t))},Ie.$metadata$={kind:ct,simpleName:"Hash",interfaces:[]};var Me=null;function Le(){return null===Me&&new Ie,Me}function De(){Ue()}function qe(){Fe=this,this.Empty=new Be}qe.prototype.build_o7hlrk$=pt("ktor-ktor-utils-jsLegacy.io.ktor.util.StringValues.Companion.build_o7hlrk$",ft((function(){var e=t.io.ktor.util.StringValuesBuilder;return function(t,n){void 0===t&&(t=!1);var i=new e(t);return n(i),i.build()}}))),qe.$metadata$={kind:ct,simpleName:"Companion",interfaces:[]};var Fe=null;function Ue(){return null===Fe&&new qe,Fe}function Be(t,e){var n,i;void 0===t&&(t=!1),void 0===e&&(e=yt()),this.caseInsensitiveName_w2tiaf$_0=t,this.values_x1t64x$_0=vt((n=this,i=e,function(){var t;if(n.caseInsensitiveName){var e=ze();e.putAll_a2k3zr$(i),t=e}else t=mt(i);return t}))}function He(t,e){void 0===t&&(t=!1),void 0===e&&(e=8),this.caseInsensitiveName=t,this.values=this.caseInsensitiveName?ze():wt(e),this.built=!1}function Ve(t){return new Et(65,90).contains_mef7kx$(t)?_(t+32):new Et(0,127).contains_mef7kx$(t)?t:_(String.fromCharCode(t).toLowerCase().charCodeAt(0))}function Ke(t){return new We(t)}function We(t){this.content=t,this.hash_0=B(this.content.toLowerCase())}function Ye(t){if(kr().IS_NATIVE){var e=new Je;return Nt(e,t),e}var n,i=lt(t.length);for(n=0;n!==t.length;++n){var r=t[n];i.add_11rb$(r)}return i}function Ge(t){this.value_0=t}function Je(){this.data_euorsu$_0=new Ge(new Ln(32)),this.size_emamgl$_0=new Ge(0),this.lock_0=new h,It(this)}De.prototype.get_61zpoe$=function(t){var e;return null!=(e=this.getAll_61zpoe$(t))?dt(e):null},De.prototype.contains_61zpoe$=function(t){return null!=this.getAll_61zpoe$(t)},De.prototype.contains_puj7f4$=function(t,e){var n,i;return null!=(i=null!=(n=this.getAll_61zpoe$(t))?n.contains_11rb$(e):null)&&i},De.prototype.forEach_ubvtmq$=function(t){var e;for(e=this.entries().iterator();e.hasNext();){var n=e.next();t(n.key,n.value)}},De.$metadata$={kind:d,simpleName:"StringValues",interfaces:[]},Object.defineProperty(Be.prototype,"caseInsensitiveName",{get:function(){return this.caseInsensitiveName_w2tiaf$_0}}),Object.defineProperty(Be.prototype,"values",{configurable:!0,get:function(){return this.values_x1t64x$_0.value}}),Be.prototype.get_61zpoe$=function(t){var e;return null!=(e=this.listForKey_6rkiov$_0(t))?dt(e):null},Be.prototype.getAll_61zpoe$=function(t){return this.listForKey_6rkiov$_0(t)},Be.prototype.contains_61zpoe$=function(t){return null!=this.listForKey_6rkiov$_0(t)},Be.prototype.contains_puj7f4$=function(t,e){var n,i;return null!=(i=null!=(n=this.listForKey_6rkiov$_0(t))?n.contains_11rb$(e):null)&&i},Be.prototype.names=function(){return this.values.keys},Be.prototype.isEmpty=function(){return this.values.isEmpty()},Be.prototype.entries=function(){return this.values.entries},Be.prototype.forEach_ubvtmq$=function(t){var e;for(e=this.values.entries.iterator();e.hasNext();){var n=e.next();t(n.key,n.value)}},Be.prototype.listForKey_6rkiov$_0=function(t){return this.values.get_11rb$(t)},Be.prototype.toString=function(){return"StringValues(case="+!this.caseInsensitiveName+") "+this.entries()},Be.prototype.equals=function(t){return this===t||!!e.isType(t,De)&&this.caseInsensitiveName===t.caseInsensitiveName&&(n=this.entries(),i=t.entries(),U(n,i));var n,i},Be.prototype.hashCode=function(){return t=this.entries(),(31*(31*B(this.caseInsensitiveName)|0)|0)+B(t)|0;var t},Be.$metadata$={kind:p,simpleName:"StringValuesImpl",interfaces:[De]},He.prototype.getAll_61zpoe$=function(t){return this.values.get_11rb$(t)},He.prototype.contains_61zpoe$=function(t){var n,i=this.values;return(e.isType(n=i,Z)?n:Q()).containsKey_11rb$(t)},He.prototype.contains_puj7f4$=function(t,e){var n,i;return null!=(i=null!=(n=this.values.get_11rb$(t))?n.contains_11rb$(e):null)&&i},He.prototype.names=function(){return this.values.keys},He.prototype.isEmpty=function(){return this.values.isEmpty()},He.prototype.entries=function(){return this.values.entries},He.prototype.set_puj7f4$=function(t,e){this.validateValue_61zpoe$(e);var n=this.ensureListForKey_fsrbb4$_0(t,1);n.clear(),n.add_11rb$(e)},He.prototype.get_61zpoe$=function(t){var e;return null!=(e=this.getAll_61zpoe$(t))?dt(e):null},He.prototype.append_puj7f4$=function(t,e){this.validateValue_61zpoe$(e),this.ensureListForKey_fsrbb4$_0(t,1).add_11rb$(e)},He.prototype.appendAll_hb0ubp$=function(t){var e;t.forEach_ubvtmq$((e=this,function(t,n){return e.appendAll_poujtz$(t,n),N}))},He.prototype.appendMissing_hb0ubp$=function(t){var e;t.forEach_ubvtmq$((e=this,function(t,n){return e.appendMissing_poujtz$(t,n),N}))},He.prototype.appendAll_poujtz$=function(t,n){var i,r,o,a,s=this.ensureListForKey_fsrbb4$_0(t,null!=(o=null!=(r=e.isType(i=n,$t)?i:null)?r.size:null)?o:2);for(a=n.iterator();a.hasNext();){var l=a.next();this.validateValue_61zpoe$(l),s.add_11rb$(l)}},He.prototype.appendMissing_poujtz$=function(t,e){var n,i,r,o=null!=(i=null!=(n=this.values.get_11rb$(t))?gt(n):null)?i:bt(),a=St();for(r=e.iterator();r.hasNext();){var s=r.next();o.contains_11rb$(s)||a.add_11rb$(s)}this.appendAll_poujtz$(t,a)},He.prototype.remove_61zpoe$=function(t){this.values.remove_11rb$(t)},He.prototype.removeKeysWithNoEntries=function(){var t,e,n=this.values,i=Y();for(e=n.entries.iterator();e.hasNext();){var r=e.next();r.value.isEmpty()&&i.put_xwzc9p$(r.key,r.value)}for(t=i.entries.iterator();t.hasNext();){var o=t.next().key;this.remove_61zpoe$(o)}},He.prototype.remove_puj7f4$=function(t,e){var n,i;return null!=(i=null!=(n=this.values.get_11rb$(t))?n.remove_11rb$(e):null)&&i},He.prototype.clear=function(){this.values.clear()},He.prototype.build=function(){if(this.built)throw xt("ValueMapBuilder can only build a single ValueMap".toString());return this.built=!0,new Be(this.caseInsensitiveName,this.values)},He.prototype.validateName_61zpoe$=function(t){},He.prototype.validateValue_61zpoe$=function(t){},He.prototype.ensureListForKey_fsrbb4$_0=function(t,e){var n,i;if(this.built)throw f("Cannot modify a builder when final structure has already been built");if(null!=(n=this.values.get_11rb$(t)))i=n;else{var r=lt(e);this.validateName_61zpoe$(t),this.values.put_xwzc9p$(t,r),i=r}return i},He.$metadata$={kind:p,simpleName:"StringValuesBuilder",interfaces:[]},We.prototype.equals=function(t){var n,i,r;return!0===(null!=(r=null!=(i=e.isType(n=t,We)?n:null)?i.content:null)?_t(r,this.content,!0):null)},We.prototype.hashCode=function(){return this.hash_0},We.prototype.toString=function(){return this.content},We.$metadata$={kind:p,simpleName:"CaseInsensitiveString",interfaces:[]},Ge.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},Ge.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},Ge.$metadata$={kind:p,interfaces:[Lt]};var Ze=new jt("data");Object.defineProperty(Je.prototype,"data_0",{configurable:!0,get:function(){return this.data_euorsu$_0.getValue_lrcp0p$(this,Ze)},set:function(t){this.data_euorsu$_0.setValue_9rddgb$(this,Ze,t)}});var Qe=new jt("size");function Xe(t,e){this.this$ConcurrentList=t,this.current_cc9gdq$_0=new Ge(e)}Object.defineProperty(Je.prototype,"size",{configurable:!0,get:function(){return this.size_emamgl$_0.getValue_lrcp0p$(this,Qe)},set:function(t){this.size_emamgl$_0.setValue_9rddgb$(this,Qe,t)}}),Je.prototype.hashCode=function(){var t,e=7;for(t=this.iterator();t.hasNext();){var n,i=t.next(),r=e;e=Le().combine_jiburq$([r,null!=(n=null!=i?B(i):null)?n:0])}return e},Je.prototype.equals=function(t){var n;t:do{if(null==t||!e.isType(t,Tt)||t.size!==this.size){n=!1;break t}var i,r,o=0;for(i=this.iterator();i.hasNext();){var a=i.next();if(!U(t.get_za3lpa$(Dt((r=o,o=r+1|0,r))),a)){n=!1;break t}}n=!0}while(0);return n},Je.prototype.toString=function(){var t,e,n=k();n.append_s8itvh$(91);var i=0;for(t=this.iterator();t.hasNext();){var r=t.next(),o=Dt((i=(e=i)+1|0,e));n.append_pdl1vj$(r.toString()),(o+1|0)=0},Je.prototype.containsAll_brywnq$=function(t){var n;t:do{var i;if(e.isType(t,$t)&&t.isEmpty()){n=!0;break t}for(i=t.iterator();i.hasNext();){var r=i.next();if(!this.contains_11rb$(r)){n=!1;break t}}n=!0}while(0);return n},Je.prototype.get_za3lpa$=function(t){if(t>=this.size)throw Pt();return V(this.data_0.get_za3lpa$(t))},Je.prototype.indexOf_11rb$=function(t){var e;e=this.size;for(var n=0;n=0;e--)if(U(this.data_0.get_za3lpa$(e),t))return e;return-1},Je.prototype.add_11rb$=function(t){return this.size>=this.data_0.size&&this.increaseCapacity_0(),this.data_0.set_wxm5ur$(this.size,t),this.size=this.size+1|0,!0},Je.prototype.add_wxm5ur$=function(t,e){this.reserve_0(t,1),this.data_0.set_wxm5ur$(t,e)},Je.prototype.addAll_u57x28$=function(t,e){var n;this.reserve_0(t,e.size);var i=t;for(n=e.iterator();n.hasNext();){var r=n.next();this.data_0.set_wxm5ur$(i,r),i=i+1|0}return!e.isEmpty()},Je.prototype.addAll_brywnq$=function(t){t:do{var n;if(e.isType(t,$t)&&t.isEmpty())break t;for(n=t.iterator();n.hasNext();){var i=n.next();if(!this.add_11rb$(i))break t}}while(0);return!t.isEmpty()},Je.prototype.clear=function(){this.data_0=new Ln(32),this.size=0},Je.prototype.iterator=function(){return this.listIterator()},Je.prototype.listIterator=function(){return this.listIterator_za3lpa$(0)};var tn,en=new jt("current");function nn(t){this.value_0=t}function rn(t,e){void 0===t&&(t=new gr),void 0===e&&(e=32),this.lock_0=t,this.table_7ekke8$_0=new nn(new Ln(e)),this.insertionOrder_w7s5d3$_0=new nn(new On),this._size_0=0,It(this)}Object.defineProperty(Xe.prototype,"current",{configurable:!0,get:function(){return this.current_cc9gdq$_0.getValue_lrcp0p$(this,en)},set:function(t){this.current_cc9gdq$_0.setValue_9rddgb$(this,en,t)}}),Xe.prototype.hasNext=function(){return this.current0},Xe.prototype.nextIndex=function(){return this.current+1|0},Xe.prototype.previous=function(){var t;return this.this$ConcurrentList.get_za3lpa$((t=this.current,this.current=t-1|0,t))},Xe.prototype.previousIndex=function(){return this.current-1|0},Xe.prototype.add_11rb$=function(t){this.this$ConcurrentList.add_wxm5ur$(this.current,t)},Xe.prototype.set_11rb$=function(t){this.this$ConcurrentList.set_wxm5ur$(this.current-1|0,t)},Xe.$metadata$={kind:p,interfaces:[Rt]},Je.prototype.listIterator_za3lpa$=function(t){return new Xe(this,t)},Je.prototype.subList_vux9f0$=function(t,e){return new cn(this,t,e)},Je.prototype.remove_11rb$=function(t){var e=this.indexOf_11rb$(t);return!(e<0||(this.removeAt_za3lpa$(e),0))},Je.prototype.removeAll_brywnq$=function(t){var e,n={v:!1};for(e=t.iterator();e.hasNext();){var i=e.next();n.v=this.remove_11rb$(i)||n.v}return n.v},Je.prototype.removeAt_za3lpa$=function(t){this.checkIndex_0(t);var e=this.data_0.get_za3lpa$(t);return this.data_0.set_wxm5ur$(t,null),this.sweep_0(t),V(e)},Je.prototype.retainAll_brywnq$=function(t){var e,n=!1,i=-1;e=this.size;for(var r=0;r=this.size||t<0)throw At()},Je.prototype.increaseCapacity_0=function(t){var e;void 0===t&&(t=2*this.data_0.size|0);var n=new Ln(t);e=this.data_0.size;for(var i=0;i=t;)this.data_0.set_wxm5ur$(r+e|0,this.data_0.get_za3lpa$(r)),r=r-1|0;n=t+e|0;for(var o=t;otn&&n.upsize_0();var t,e=n.findOrCreateBucket_0(i);t:do{var o;for(o=e.iterator();o.hasNext();){var a=o.next(),s=i;if(U(a.key,s)){t=a;break t}}t=null}while(0);var l=t;if(null!=l){var c=l.value;return l.value=r,c}var u=new wn(i,r),p=n.insertionOrder_0.appendLast_trkh7z$(u);return u.backReference_8be2vx$=p,e.appendFirst_trkh7z$(u),++n._size_0,null}));var n,i,r},rn.prototype.putAll_a2k3zr$=function(t){var e;for(e=t.entries.iterator();e.hasNext();){var n=e.next(),i=n.key,r=n.value;this.put_xwzc9p$(i,r)}},rn.prototype.remove_11rb$=function(t){return this.locked_0((e=t,n=this,function(){var t;if(null==(t=n.findBucket_0(e)))return null;for(var i=t.iterator(),r=e,o=n;i.hasNext();){var a=i.next();if(U(a.key,r)){var s=a.value;return--o._size_0,a.remove_8be2vx$(),i.remove(),s}}return null}));var e,n},Object.defineProperty(rn.prototype,"entries",{configurable:!0,get:function(){return new xn(this)}}),Object.defineProperty(rn.prototype,"keys",{configurable:!0,get:function(){return new un(this)}}),Object.defineProperty(rn.prototype,"values",{configurable:!0,get:function(){return new hn(this)}}),rn.prototype.equals=function(t){return this.locked_0((n=t,i=this,function(){var t;if(null==n||!e.isType(n,Z)||n.size!==i.size)return!1;for(t=n.entries.iterator();t.hasNext();){var r,o=t.next(),a=o.key,s=o.value,l=i;if(!U((e.isType(r=l,Z)?r:Q()).get_11rb$(a),s))return!1}return!0}));var n,i},rn.prototype.hashCode=function(){return this.locked_0((t=this,function(){var e,n=7;for(e=t.entries.iterator();e.hasNext();){var i=e.next(),r=i.key,o=i.value;n=Le().combine_jiburq$([B(r),B(o),n])}return n}));var t},rn.prototype.toString=function(){return this.locked_0((t=this,function(){var e,n,i=k(),r=t;i.append_pdl1vj$("{");var o=0;for(e=r.entries.iterator();e.hasNext();){var a=e.next(),s=Dt((o=(n=o)+1|0,n)),l=a.key,c=a.value;i.append_pdl1vj$(l.toString()+"="+c),s!==(r.size-1|0)&&i.append_pdl1vj$(", ")}return i.append_pdl1vj$("}"),i.toString()}));var t};var ln=new jt("current");function cn(t,e,n){qt.call(this),this.origin_0=t,this.fromIndex_0=e,this.toIndex_0=n}function un(t){this.delegate_0=t,It(this)}function pn(t){this.delegateIterator_0=t.delegate_0.iterator_8be2vx$(),It(this)}function hn(t){this.delegate_0=t,It(this)}function fn(t){this.delegateIterator=t.delegate_0.iterator_8be2vx$(),It(this)}function dn(t){this.value_0=t}function _n(t){this.previous_anlnpc$_0=new dn(t)}Object.defineProperty(sn.prototype,"current_0",{configurable:!0,get:function(){return this.current_cx5bh6$_0.getValue_lrcp0p$(this,ln)},set:function(t){this.current_cx5bh6$_0.setValue_9rddgb$(this,ln,t)}}),Object.defineProperty(sn.prototype,"previous_0",{configurable:!0,get:function(){var t;return null!=(t=this.current_0)?t.previous:null}}),sn.prototype.hasNext=function(){return null!=this.current_0},sn.prototype.next=function(){var t,e=V(V(this.current_0).item);return this.current_0=null!=(t=this.current_0)?t.next:null,e},sn.prototype.remove=function(){var t=V(V(this.previous_0).item);this.this$ConcurrentMap.remove_11rb$(t.key)},sn.$metadata$={kind:p,interfaces:[ot]},rn.prototype.iterator_8be2vx$=function(){return new sn(this)},rn.prototype.getOrDefault_c5ybai$=function(t,e){var n,i,r,o,a=this.lock_0;try{a.lock(),n=(i=t,r=e,o=this,function(){return o.computeIfAbsent_c5ybai$(i,r)})()}finally{a.unlock()}return n},rn.prototype.computeIfAbsent_c5ybai$=function(t,e){return this.locked_0((n=t,i=this,r=e,function(){var t=i.get_11rb$(n);if(null!=t)return t;var e=r();return i.put_xwzc9p$(n,e),e}));var n,i,r},rn.prototype.findBucket_0=function(t){var e=B(t)&this.table_0.size-1;return this.table_0.get_za3lpa$(e)},rn.prototype.findOrCreateBucket_0=function(t){var e=B(t)&this.table_0.size-1,n=this.table_0.get_za3lpa$(e);if(null==n){var i=new On;return this.table_0.set_wxm5ur$(e,i),i}return n},rn.prototype.upsize_0=function(){var t=new rn(void 0,2*this.table_0.size|0);t.putAll_a2k3zr$(this),this.table_0=t.table_0},rn.prototype.locked_0=function(t){var e,n,i=this.lock_0;try{i.lock(),e=(n=t,function(){return n()})()}finally{i.unlock()}return e},rn.$metadata$={kind:p,simpleName:"ConcurrentMap",interfaces:[H]},Object.defineProperty(cn.prototype,"size",{configurable:!0,get:function(){var t=this.origin_0.size,e=this.toIndex_0-this.fromIndex_0|0;return Ft.min(t,e)}}),cn.prototype.get_za3lpa$=function(t){return this.origin_0.get_za3lpa$(this.fromIndex_0+t|0)},cn.prototype.add_wxm5ur$=function(t,e){throw f("Unsupported append in ConcurrentList slice".toString())},cn.prototype.removeAt_za3lpa$=function(t){throw f("Unsupported remove in ConcurrentList slice".toString())},cn.prototype.set_wxm5ur$=function(t,e){return this.origin_0.set_wxm5ur$(this.fromIndex_0+t|0,e)},cn.$metadata$={kind:p,simpleName:"ConcurrentListSlice",interfaces:[qt]},un.prototype.add_11rb$=function(t){throw Ut()},un.prototype.addAll_brywnq$=function(t){throw Ut()},un.prototype.clear=function(){this.delegate_0.clear()},pn.prototype.hasNext=function(){return this.delegateIterator_0.hasNext()},pn.prototype.next=function(){return this.delegateIterator_0.next().key},pn.prototype.remove=function(){this.delegateIterator_0.remove()},pn.$metadata$={kind:p,interfaces:[ot]},un.prototype.iterator=function(){return new pn(this)},un.prototype.remove_11rb$=function(t){return null!=this.delegate_0.remove_11rb$(t)},un.prototype.removeAll_brywnq$=function(t){var e,n={v:!1};for(e=t.iterator();e.hasNext();){var i=e.next();n.v=this.remove_11rb$(i)||n.v}return n.v},un.prototype.retainAll_brywnq$=function(t){for(var e={v:!1},n=this.iterator();n.hasNext();)t.contains_11rb$(n.next())||(e.v=!0,n.remove());return e.v},Object.defineProperty(un.prototype,"size",{configurable:!0,get:function(){return this.delegate_0.size}}),un.prototype.contains_11rb$=function(t){var n,i=this.delegate_0;return(e.isType(n=i,Z)?n:Q()).containsKey_11rb$(t)},un.prototype.containsAll_brywnq$=function(t){var n;t:do{var i;if(e.isType(t,$t)&&t.isEmpty()){n=!0;break t}for(i=t.iterator();i.hasNext();){var r=i.next();if(!this.contains_11rb$(r)){n=!1;break t}}n=!0}while(0);return n},un.prototype.isEmpty=function(){return 0===this.size},un.$metadata$={kind:p,simpleName:"ConcurrentMapKeys",interfaces:[G]},Object.defineProperty(hn.prototype,"size",{configurable:!0,get:function(){return this.delegate_0.size}}),hn.prototype.contains_11rb$=function(t){return this.delegate_0.containsValue_11rc$(t)},hn.prototype.containsAll_brywnq$=function(t){var n;t:do{var i;if(e.isType(t,$t)&&t.isEmpty()){n=!0;break t}for(i=t.iterator();i.hasNext();){var r=i.next();if(!this.contains_11rb$(r)){n=!1;break t}}n=!0}while(0);return n},hn.prototype.isEmpty=function(){return 0===this.delegate_0.size},hn.prototype.add_11rb$=function(t){throw Ut()},hn.prototype.addAll_brywnq$=function(t){throw Ut()},hn.prototype.clear=function(){this.delegate_0.clear()},fn.prototype.hasNext=function(){return this.delegateIterator.hasNext()},fn.prototype.next=function(){return this.delegateIterator.next().value},fn.prototype.remove=function(){this.delegateIterator.remove()},fn.$metadata$={kind:p,interfaces:[ot]},hn.prototype.iterator=function(){return new fn(this)},hn.prototype.remove_11rb$=function(t){for(var e={v:!1},n=this.iterator();n.hasNext();)U(n.next(),t)||(e.v=!0,n.remove());return e.v},hn.prototype.removeAll_brywnq$=function(t){for(var e={v:!1},n=this.iterator();n.hasNext();)t.contains_11rb$(n.next())&&(e.v=!0,n.remove());return e.v},hn.prototype.retainAll_brywnq$=function(t){throw f("Common concurrent map doesn't support this operation yet.".toString())},hn.$metadata$={kind:p,simpleName:"ConcurrentMapValues",interfaces:[zt]},dn.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},dn.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},dn.$metadata$={kind:p,interfaces:[Lt]};var yn=new jt("previous");function mn(t){this.value_0=t}function vn(t,e,n,i){this.list_0=t,this.item=n,this.next_lyuus8$_0=new mn(e),this.previous_mhuox8$_0=new mn(i),It(this)}Object.defineProperty(_n.prototype,"previous",{configurable:!0,get:function(){return this.previous_anlnpc$_0.getValue_lrcp0p$(this,yn)},set:function(t){this.previous_anlnpc$_0.setValue_9rddgb$(this,yn,t)}}),Object.defineProperty(_n.prototype,"current",{configurable:!0,get:function(){var t;return null!=(t=this.previous)?t.next:null}}),_n.prototype.hasNext=function(){var t;return null!=(null!=(t=this.current)?t.item:null)},_n.prototype.next=function(){var t,e;if(this.previous=this.current,null==(e=null!=(t=this.previous)?t.item:null))throw Pt();return e},_n.prototype.remove=function(){var t;if(null==(null!=(t=this.previous)?(t.remove(),N):null))throw f("Fail to remove element before iteration".toString())},_n.$metadata$={kind:p,simpleName:"ForwardListIterator",interfaces:[ot]},mn.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},mn.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},mn.$metadata$={kind:p,interfaces:[Lt]};var $n=new jt("next");Object.defineProperty(vn.prototype,"next",{configurable:!0,get:function(){return this.next_lyuus8$_0.getValue_lrcp0p$(this,$n)},set:function(t){this.next_lyuus8$_0.setValue_9rddgb$(this,$n,t)}});var gn=new jt("previous");function bn(t){this.value_0=t}function wn(t,e){this.key_q49qr5$_0=t,this.backReference_8be2vx$_ku6rvk$_0=new bn(null),this.value_v8fgin$_0=new bn(e);var n,i=this.key;this.hash=null!=(n=null!=i?B(i):null)?n:0,It(this)}Object.defineProperty(vn.prototype,"previous",{configurable:!0,get:function(){return this.previous_mhuox8$_0.getValue_lrcp0p$(this,gn)},set:function(t){this.previous_mhuox8$_0.setValue_9rddgb$(this,gn,t)}}),vn.prototype.insertAfter_trkh7z$=function(t){var e=new vn(this.list_0,this.next,t,this);return this.next=e,e},vn.prototype.removeNext=function(){var t,e;U(this.next,this.list_0.tail_8be2vx$)&&(this.list_0.tail_8be2vx$=this),this.next=null!=(t=this.next)?t.next:null,null!=(e=this.next)&&(e.previous=this)},vn.prototype.remove=function(){V(this.previous).removeNext()},vn.$metadata$={kind:p,simpleName:"ForwardListNode",interfaces:[]},bn.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},bn.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},bn.$metadata$={kind:p,interfaces:[Lt]},Object.defineProperty(wn.prototype,"key",{get:function(){return this.key_q49qr5$_0}});var kn=new jt("backReference");Object.defineProperty(wn.prototype,"backReference_8be2vx$",{configurable:!0,get:function(){return this.backReference_8be2vx$_ku6rvk$_0.getValue_lrcp0p$(this,kn)},set:function(t){this.backReference_8be2vx$_ku6rvk$_0.setValue_9rddgb$(this,kn,t)}});var Sn=new jt("value");function xn(t){this.delegate_0=t,It(this)}function En(t){this.origin_0=t.delegate_0.iterator_8be2vx$()}function Cn(t){this.value_0=t}function On(){this.head_8be2vx$_7kv0go$_0=new Cn(null),this.tail_8be2vx$_w7xtpk$_0=new Cn(this.head_8be2vx$),It(this),this.head_8be2vx$=new vn(this,null,null,null),this.tail_8be2vx$=this.head_8be2vx$}Object.defineProperty(wn.prototype,"value",{configurable:!0,get:function(){return this.value_v8fgin$_0.getValue_lrcp0p$(this,Sn)},set:function(t){this.value_v8fgin$_0.setValue_9rddgb$(this,Sn,t)}}),wn.prototype.setValue_11rc$=function(t){var e=this.value;return this.value=t,e},wn.prototype.remove_8be2vx$=function(){V(this.backReference_8be2vx$).remove(),this.backReference_8be2vx$=null},wn.prototype.toString=function(){return"MapItem["+this.key+", "+this.value+"]"},wn.$metadata$={kind:p,simpleName:"MapNode",interfaces:[W]},xn.prototype.add_11rb$=function(t){return!U(this.delegate_0.put_xwzc9p$(t.key,t.value),t.value)},xn.prototype.addAll_brywnq$=function(t){var e,n={v:!1};for(e=t.iterator();e.hasNext();){var i=e.next();n.v=this.add_11rb$(i)||n.v}return n.v},xn.prototype.clear=function(){this.delegate_0.clear()},En.prototype.hasNext=function(){return this.origin_0.hasNext()},En.prototype.next=function(){return this.origin_0.next()},En.prototype.remove=function(){this.origin_0.remove()},En.$metadata$={kind:p,interfaces:[ot]},xn.prototype.iterator=function(){return new En(this)},xn.prototype.remove_11rb$=function(t){return null!=this.delegate_0.remove_11rb$(t.key)},xn.prototype.removeAll_brywnq$=function(t){var e,n={v:!1};for(e=t.iterator();e.hasNext();){var i=e.next();n.v=this.remove_11rb$(i)||n.v}return n.v},xn.prototype.retainAll_brywnq$=function(t){for(var e={v:!1},n=this.iterator();n.hasNext();)t.contains_11rb$(n.next())||(e.v=!0,n.remove());return e.v},Object.defineProperty(xn.prototype,"size",{configurable:!0,get:function(){return this.delegate_0.size}}),xn.prototype.contains_11rb$=function(t){return U(this.delegate_0.get_11rb$(t.key),t.value)},xn.prototype.containsAll_brywnq$=function(t){var n;t:do{var i;if(e.isType(t,$t)&&t.isEmpty()){n=!0;break t}for(i=t.iterator();i.hasNext();){var r=i.next();if(!this.contains_11rb$(r)){n=!1;break t}}n=!0}while(0);return n},xn.prototype.isEmpty=function(){return this.delegate_0.isEmpty()},xn.$metadata$={kind:p,simpleName:"MutableMapEntries",interfaces:[G]},Cn.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},Cn.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},Cn.$metadata$={kind:p,interfaces:[Lt]};var Nn=new jt("head");Object.defineProperty(On.prototype,"head_8be2vx$",{configurable:!0,get:function(){return this.head_8be2vx$_7kv0go$_0.getValue_lrcp0p$(this,Nn)},set:function(t){this.head_8be2vx$_7kv0go$_0.setValue_9rddgb$(this,Nn,t)}});var zn,jn,Tn,Pn,Rn,An,In,Mn=new jt("tail");function Ln(t){this.size_4if4fg$_0=t,this.data_0=Array(this.size),It(this)}function Dn(t,e){this.this$SharedList=t,this.currentIndex_0=e,It(this)}function qn(t,e,n){Kt.call(this),this.value=n,this.name$=t,this.ordinal$=e}function Fn(){Fn=function(){},zn=new qn("MONDAY",0,"Mon"),jn=new qn("TUESDAY",1,"Tue"),Tn=new qn("WEDNESDAY",2,"Wed"),Pn=new qn("THURSDAY",3,"Thu"),Rn=new qn("FRIDAY",4,"Fri"),An=new qn("SATURDAY",5,"Sat"),In=new qn("SUNDAY",6,"Sun"),ci()}function Un(){return Fn(),zn}function Bn(){return Fn(),jn}function Hn(){return Fn(),Tn}function Vn(){return Fn(),Pn}function Kn(){return Fn(),Rn}function Wn(){return Fn(),An}function Yn(){return Fn(),In}function Gn(){li=this}Object.defineProperty(On.prototype,"tail_8be2vx$",{configurable:!0,get:function(){return this.tail_8be2vx$_w7xtpk$_0.getValue_lrcp0p$(this,Mn)},set:function(t){this.tail_8be2vx$_w7xtpk$_0.setValue_9rddgb$(this,Mn,t)}}),On.prototype.first=function(){return V(this.head_8be2vx$).next},On.prototype.last=function(){return U(this.head_8be2vx$,this.tail_8be2vx$)?null:this.tail_8be2vx$},On.prototype.appendFirst_trkh7z$=function(t){var e=V(this.head_8be2vx$).insertAfter_trkh7z$(t);return U(this.head_8be2vx$,this.tail_8be2vx$)&&(this.tail_8be2vx$=e),e},On.prototype.appendLast_trkh7z$=function(t){return this.tail_8be2vx$=V(this.tail_8be2vx$).insertAfter_trkh7z$(t),V(this.tail_8be2vx$)},On.prototype.iterator=function(){return new _n(V(this.head_8be2vx$))},On.$metadata$={kind:p,simpleName:"SharedForwardList",interfaces:[Bt]},Object.defineProperty(Ln.prototype,"size",{get:function(){return this.size_4if4fg$_0}}),Ln.prototype.set_wxm5ur$=function(t,e){this.data_0[t]=e},Ln.prototype.contains_11rb$=function(t){var e;e=this.size;for(var n=0;n0},Dn.prototype.next=function(){if(!this.hasNext())throw f("Check failed.".toString());var t=this.currentIndex_0++;return this.this$SharedList.data_0[t]},Dn.prototype.nextIndex=function(){if(!this.hasNext())throw f("Check failed.".toString());return this.currentIndex_0+1|0},Dn.prototype.previous=function(){if(!this.hasPrevious())throw f("Check failed.".toString());var t=this.currentIndex_0--;return this.this$SharedList.data_0[t]},Dn.prototype.previousIndex=function(){if(!this.hasPrevious())throw f("Check failed.".toString());return this.currentIndex_0-1|0},Dn.$metadata$={kind:p,interfaces:[Vt]},Ln.prototype.listIterator_za3lpa$=function(t){return new Dn(this,t)},Ln.prototype.subList_vux9f0$=function(t,e){for(var n=new Ln(e-t|0),i=t;i=this.interceptors_0.size?(this.finish(),this.subject):this.proceedLoop_0(t)},Pi.prototype.execute_11rb$=function(t,e){return this.index_0=0,this.subject=t,this.proceed(e)},Ri.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[j]},Ri.prototype=Object.create(j.prototype),Ri.prototype.constructor=Ri,Ri.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$index=this.$this.index_0,-1===this.local$index){this.state_0=6;continue}this.state_0=3;continue;case 3:if(this.local$interceptors=this.$this.interceptors_0,this.local$index>=this.local$interceptors.size){this.$this.finish(),this.state_0=6;continue}this.state_0=4;continue;case 4:var t=this.local$interceptors.get_za3lpa$(this.local$index);if(this.$this.index_0=this.local$index+1|0,this.state_0=5,this.result_0=t(this.$this,this.$this.subject,this),this.result_0===z)return z;continue;case 5:this.state_0=2;continue;case 6:return this.$this.subject;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Pi.prototype.proceedLoop_0=function(t,e){var n=new Ri(this,t);return e?n:n.doResume(null)},Pi.$metadata$={kind:p,simpleName:"DebugPipelineContext",interfaces:[Gi,Yi]},Ai.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},Ai.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},Ai.$metadata$={kind:p,interfaces:[Lt]};var Mi=new jt("interceptors");Object.defineProperty(Ii.prototype,"interceptors_0",{configurable:!0,get:function(){return this.interceptors_7b9p4m$_0.getValue_lrcp0p$(this,Mi)},set:function(t){this.interceptors_7b9p4m$_0.setValue_9rddgb$(this,Mi,t)}});var Li=new jt("shared");function Di(){qi=this,this.SharedArrayList=Ye([])}Object.defineProperty(Ii.prototype,"shared",{configurable:!0,get:function(){return this.shared_t2yicf$_0.getValue_lrcp0p$(this,Li)},set:function(t){this.shared_t2yicf$_0.setValue_9rddgb$(this,Li,t)}}),Object.defineProperty(Ii.prototype,"isEmpty",{configurable:!0,get:function(){return this.interceptors_0.isEmpty()}}),Object.defineProperty(Ii.prototype,"size",{configurable:!0,get:function(){return this.interceptors_0.size}}),Ii.prototype.addInterceptor_mx8w25$=function(t){this.shared&&this.copyInterceptors_0(),this.interceptors_0.add_11rb$(t)},Ii.prototype.addTo_m9oilt$=function(t){var n,i=this.interceptors_0;e.isType(t,Jt)&&t.ensureCapacity_za3lpa$(t.size+i.size|0),n=i.size;for(var r=0;r=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-n,this.endian);for(var r=0;r>>24&255,i[r++]=t>>>16&255,i[r++]=t>>>8&255,i[r++]=255&t}else for(i[r++]=255&t,i[r++]=t>>>8&255,i[r++]=t>>>16&255,i[r++]=t>>>24&255,i[r++]=0,i[r++]=0,i[r++]=0,i[r++]=0,o=8;o=0&&t.onCreate(),e.compareTo_11rb$(_t())>=0&&t.onStart(),e.compareTo_11rb$(yt())>=0&&t.onResume()},Ct.prototype.unsubscribe_cj0qf$=function(t){if(!this.callbacks_0.contains_11rb$(t))throw w("Not subscribed".toString());this.callbacks_0=d(this.callbacks_0,t)},Ct.prototype.onCreate=function(){var t;for(this.checkState_0(ft()),this._state_0=dt(),t=this.callbacks_0.iterator();t.hasNext();)t.next().onCreate()},Ct.prototype.onStart=function(){var t;for(this.checkState_0(dt()),this._state_0=_t(),t=this.callbacks_0.iterator();t.hasNext();)t.next().onStart()},Ct.prototype.onResume=function(){var t;for(this.checkState_0(_t()),this._state_0=yt(),t=this.callbacks_0.iterator();t.hasNext();)t.next().onResume()},Ct.prototype.onPause=function(){var t;for(this.checkState_0(yt()),this._state_0=_t(),t=_(this.callbacks_0).iterator();t.hasNext();)t.next().onPause()},Ct.prototype.onStop=function(){var t;for(this.checkState_0(_t()),this._state_0=dt(),t=_(this.callbacks_0).iterator();t.hasNext();)t.next().onStop()},Ct.prototype.onDestroy=function(){var t;for(this.checkState_0(dt()),this._state_0=ht(),t=_(this.callbacks_0).iterator();t.hasNext();)t.next().onDestroy()},Ct.prototype.checkState_0=function(t){if(this._state_0!==t){var e="Expected state "+t+" but was "+this._state_0;throw w(e.toString())}},Ct.$metadata$={kind:s,simpleName:"LifecycleRegistryImpl",interfaces:[$t]},Nt.prototype.onCreate=function(){this.onUp_0(dt(),c("onCreate",function(t){return t.onCreate(),k}.bind(null,this.$outer.registry_0)))},Nt.prototype.onStart=function(){this.onUp_0(_t(),c("onStart",function(t){return t.onStart(),k}.bind(null,this.$outer.registry_0)))},Nt.prototype.onResume=function(){this.onUp_0(yt(),c("onResume",function(t){return t.onResume(),k}.bind(null,this.$outer.registry_0)))},Nt.prototype.onPause=function(){this.onDown_0(_t(),c("onPause",function(t){return t.onPause(),k}.bind(null,this.$outer.registry_0)))},Nt.prototype.onStop=function(){this.onDown_0(dt(),c("onStop",function(t){return t.onStop(),k}.bind(null,this.$outer.registry_0)))},Nt.prototype.onDestroy=function(){this.onDown_0(ft(),c("onDestroy",function(t){return t.onDestroy(),k}.bind(null,this.$outer.registry_0)))},Nt.prototype.onUp_0=function(t,e){this.onStateChanged_0(t),t.compareTo_11rb$(this.otherState_0())<=0&&e()},Nt.prototype.onDown_0=function(t,e){t.compareTo_11rb$(this.otherState_0())<0&&e(),this.onStateChanged_0(t)},Nt.$metadata$={kind:s,simpleName:"LifecycleObserverImpl",interfaces:[lt]},Object.defineProperty(Ot.prototype,"state",{configurable:!0,get:function(){return this.registry_0.state}}),Ot.prototype.subscribe_cj0qf$=function(t){return this.registry_0.subscribe_cj0qf$(t)},Ot.prototype.unsubscribe_cj0qf$=function(t){return this.registry_0.unsubscribe_cj0qf$(t)},Ot.$metadata$={kind:s,simpleName:"MergedLifecycle",interfaces:[ct]},Object.defineProperty(Tt.prototype,"configuration",{get:function(){return this.configuration_xkcunr$_0}}),Object.defineProperty(Tt.prototype,"savedState",{get:function(){return this.savedState_j09t7n$_0}}),Tt.$metadata$={kind:s,simpleName:"Created",interfaces:[jt]},Tt.prototype.component1=function(){return this.configuration},Tt.prototype.component2=function(){return this.savedState},Tt.prototype.component3=function(){return this.component},Tt.prototype.component4=function(){return this.lifecycleRegistry},Tt.prototype.component5=function(){return this.stateKeeperDispatcher},Tt.prototype.component6=function(){return this.instanceKeeperDispatcher},Tt.prototype.component7=function(){return this.backPressedDispatcher},Tt.prototype.copy_go6qks$=function(t,e,n,i,r,o,a){return new Tt(void 0===t?this.configuration:t,void 0===e?this.savedState:e,void 0===n?this.component:n,void 0===i?this.lifecycleRegistry:i,void 0===r?this.stateKeeperDispatcher:r,void 0===o?this.instanceKeeperDispatcher:o,void 0===a?this.backPressedDispatcher:a)},Tt.prototype.toString=function(){return"Created(configuration="+e.toString(this.configuration)+", savedState="+e.toString(this.savedState)+", component="+e.toString(this.component)+", lifecycleRegistry="+e.toString(this.lifecycleRegistry)+", stateKeeperDispatcher="+e.toString(this.stateKeeperDispatcher)+", instanceKeeperDispatcher="+e.toString(this.instanceKeeperDispatcher)+", backPressedDispatcher="+e.toString(this.backPressedDispatcher)+")"},Tt.prototype.hashCode=function(){var t=0;return t=31*(t=31*(t=31*(t=31*(t=31*(t=31*(t=31*t+e.hashCode(this.configuration)|0)+e.hashCode(this.savedState)|0)+e.hashCode(this.component)|0)+e.hashCode(this.lifecycleRegistry)|0)+e.hashCode(this.stateKeeperDispatcher)|0)+e.hashCode(this.instanceKeeperDispatcher)|0)+e.hashCode(this.backPressedDispatcher)|0},Tt.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.configuration,t.configuration)&&e.equals(this.savedState,t.savedState)&&e.equals(this.component,t.component)&&e.equals(this.lifecycleRegistry,t.lifecycleRegistry)&&e.equals(this.stateKeeperDispatcher,t.stateKeeperDispatcher)&&e.equals(this.instanceKeeperDispatcher,t.instanceKeeperDispatcher)&&e.equals(this.backPressedDispatcher,t.backPressedDispatcher)},Object.defineProperty(Pt.prototype,"configuration",{get:function(){return this.configuration_vufsfa$_0}}),Object.defineProperty(Pt.prototype,"savedState",{get:function(){return this.savedState_lesury$_0}}),Pt.$metadata$={kind:s,simpleName:"Destroyed",interfaces:[jt]},Pt.prototype.component1=function(){return this.configuration},Pt.prototype.component2=function(){return this.savedState},Pt.prototype.copy_1zc6lu$=function(t,e){return new Pt(void 0===t?this.configuration:t,void 0===e?this.savedState:e)},Pt.prototype.toString=function(){return"Destroyed(configuration="+e.toString(this.configuration)+", savedState="+e.toString(this.savedState)+")"},Pt.prototype.hashCode=function(){var t=0;return t=31*(t=31*t+e.hashCode(this.configuration)|0)+e.hashCode(this.savedState)|0},Pt.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.configuration,t.configuration)&&e.equals(this.savedState,t.savedState)},jt.$metadata$={kind:s,simpleName:"RouterEntry",interfaces:[]},At.prototype.invoke_6glczf$=function(t,e,n,i){return void 0===e&&(e=null),void 0===n&&(n=null),i?i(t,e,n):this.invoke_6glczf$$default(t,e,n)},At.$metadata$={kind:l,simpleName:"RouterEntryFactory",interfaces:[]},It.prototype.invoke_6glczf$$default=function(t,e,n){var i=gt(),r=zt(this.lifecycle_0,i),o=pe(e),a=null!=n?n:ot(),s=Z();return new Tt(t,void 0,this.componentFactory_0(t,D(r,o,a,s)),i,o,a,s)},It.$metadata$={kind:s,simpleName:"RouterEntryFactoryImpl",interfaces:[At]},Ut.prototype.onCreate=function(){this.closure$onCreate()},Ut.prototype.onStart=function(){this.closure$onStart()},Ut.prototype.onResume=function(){this.closure$onResume()},Ut.prototype.onPause=function(){this.closure$onPause()},Ut.prototype.onStop=function(){this.closure$onStop()},Ut.prototype.onDestroy=function(){this.closure$onDestroy()},Ut.$metadata$={kind:s,interfaces:[lt]},Object.defineProperty(Bt.prototype,"state",{configurable:!0,get:function(){return this.state_o71ct6$_0}}),Bt.prototype.destroy_0=function(){this.backPressedRegistry_0.unregister_u332lz$(this.onBackPressedHandler_0)},Bt.prototype.navigate_lbeuw8$=function(t){this.queue_0.addLast_11rb$(t),1===this.queue_0.size&&this.drainQueue_0()},Bt.prototype.drainQueue_0=function(){do{var t,e=this.navigator_0.navigate_uutfxm$(this.stackHolder_0.stack,this.queue_0.first());this.stackHolder_0.stack=e,this.state.value=this.toState_0(e),this.queue_0.removeFirst(),t=!this.queue_0.isEmpty()}while(t)},Bt.prototype.onBackPressed_0=function(){if(this.stackHolder_0.stack.active.backPressedDispatcher.onBackPressed())return!0;var t=this.popOnBackPressed_0;return t&&(t=!this.stackHolder_0.stack.backStack.isEmpty()),!!t&&(B(this),!0)},Bt.prototype.toState_0=function(t){var e,n=new Y(t.active.configuration,t.active.component),i=t.backStack,r=O(C(i,10));for(e=i.iterator();e.hasNext();){var o=e.next();r.add_11rb$(this.toRouterStateEntry_0(o))}return new K(n,r)},Bt.prototype.toRouterStateEntry_0=function(t){return e.isType(t,Tt)?new Y(t.configuration,t.component):e.isType(t,Pt)?new G(t.configuration):e.noWhenBranchMatched()},Bt.$metadata$={kind:s,simpleName:"RouterImpl",interfaces:[H]},Ht.$metadata$={kind:s,simpleName:"RouterStack",interfaces:[]},Ht.prototype.component1=function(){return this.active},Ht.prototype.component2=function(){return this.backStack},Ht.prototype.copy_pejrpx$=function(t,e){return new Ht(void 0===t?this.active:t,void 0===e?this.backStack:e)},Ht.prototype.toString=function(){return"RouterStack(active="+e.toString(this.active)+", backStack="+e.toString(this.backStack)+")"},Ht.prototype.hashCode=function(){var t=0;return t=31*(t=31*t+e.hashCode(this.active)|0)+e.hashCode(this.backStack)|0},Ht.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.active,t.active)&&e.equals(this.backStack,t.backStack)},Vt.$metadata$={kind:l,simpleName:"StackHolder",interfaces:[]},Kt.prototype=Object.create(j.prototype),Kt.prototype.constructor=Kt,Kt.prototype.afterChange_jxtfl0$=function(t,e,n){this.closure$onChange(t,e,n)},Kt.$metadata$={kind:s,interfaces:[j]},Qt.prototype.onCreate=function(){this.closure$onCreate()},Qt.prototype.onStart=function(){this.closure$onStart()},Qt.prototype.onResume=function(){this.closure$onResume()},Qt.prototype.onPause=function(){this.closure$onPause()},Qt.prototype.onStop=function(){this.closure$onStop()},Qt.prototype.onDestroy=function(){this.closure$onDestroy()},Qt.$metadata$={kind:s,interfaces:[lt]};var te=new N("stack");function ee(t,e){this.active=t,this.backStack=e}function ne(t,e){this.configuration=t,this.state=e}function ie(){this.activeEntry=null}function re(){}function oe(t){this.routerEntryFactory_0=t}function ae(){}function se(t){void 0===t&&(t=null);var e=new we;return null!=t&&e.set_xb6vv0$(t),e}function le(t,e){var n=t.consume_6kwwkl$(e);if(null==n)throw A("Required value was null.".toString());return n}function ce(){}function ue(){}function pe(t){return void 0===t&&(t=null),new he(t)}function he(t){var e;this.savedState_0=null!=(e=null!=t?t.consume_6kwwkl$(z(fe)):null)?e.map:null,this.suppliers_0=$()}function fe(t){this.map=t}function de(){}function _e(){ge.call(this)}function ye(t,e){this.closure$onChange=t,j.call(this,e)}function me(t){return new ve(t)}function ve(t){var e;_e.call(this),this.observers_0=y(),this.value_ui44qa$_0=new ye((e=this,function(t,n,i){var r;for(r=e.observers_0.iterator();r.hasNext();)r.next()(i);return k}),t)}Object.defineProperty(Xt.prototype,"stack",{configurable:!0,get:function(){return this.stack_hia3lg$_0.getValue_lrcp0p$(this,te)},set:function(t){this.stack_hia3lg$_0.setValue_9rddgb$(this,te,t)}}),Xt.prototype.destroy_0=function(){this.stateKeeper_0.unregister_61zpoe$(this.key_0);var t=this.stack;Et(t.active.lifecycleRegistry),Rt(t.backStack)},Xt.prototype.initialStack_0=function(t,e){var n,i=this.routerEntryFactory_0.invoke_6glczf$(t),r=O(C(e,10));for(n=e.iterator();n.hasNext();){var o=n.next();r.add_11rb$(new Pt(o))}return new Ht(i,r)},Xt.prototype.restoreStack_0=function(){var t,e;if(null==(t=this.stateKeeper_0.consume_xk4jb$(this.key_0,z(ee))))return null;var n,i=t,r=i.active,o=le(r.configuration,this.configurationClass_0),a=r.state,s=null!=(e=this.retainedInstance_0.activeEntry)?e.instanceKeeperDispatcher:null,l=this.routerEntryFactory_0.invoke_6glczf$(o,a,s),c=i.backStack,u=O(C(c,10));for(n=c.iterator();n.hasNext();){var p=n.next();u.add_11rb$(new Pt(le(p.configuration,this.configurationClass_0),p.state))}return new Ht(l,u)},Xt.prototype.save_0=function(t){var e,n=new ne(this.parcelableContainerFactory_0(t.active.configuration),t.active.stateKeeperDispatcher.save()),i=t.backStack,r=O(C(i,10));for(e=i.iterator();e.hasNext();){var o=e.next();r.add_11rb$(new ne(this.parcelableContainerFactory_0(o.configuration),o.savedState))}return new ee(n,r)},ne.$metadata$={kind:s,simpleName:"Entry",interfaces:[be]},ee.$metadata$={kind:s,simpleName:"SavedState",interfaces:[be]},ie.prototype.onDestroy=function(){var t,e;null!=(e=null!=(t=this.activeEntry)?t.instanceKeeperDispatcher:null)&&e.destroy()},ie.$metadata$={kind:s,simpleName:"RetainedInstance",interfaces:[it]},Xt.$metadata$={kind:s,simpleName:"StackHolderImpl",interfaces:[Vt]},re.$metadata$={kind:l,simpleName:"StackNavigator",interfaces:[]},oe.prototype.navigate_uutfxm$=function(t,n){var i,r=u(t.backStack,t.active),o=S("configuration",1,(function(t){return t.configuration})),a=O(C(r,10));for(i=r.iterator();i.hasNext();){var s=i.next();a.add_11rb$(o(s))}var l=n(a);if(l.isEmpty())throw w("Configuration stack can not be empty".toString());var c,h=T(l);if(h===t.active.configuration)c=t.active;else{var f,d=t.backStack;t:do{var _;for(_=d.iterator();_.hasNext();){var y=_.next();if(y.configuration===h){f=y;break t}}f=null}while(0);var v,$=f;c=e.isType($,Tt)?$.copy_go6qks$(void 0,null):e.isType($,Pt)?this.routerEntryFactory_0.invoke_6glczf$($.configuration,$.savedState):null==$?this.routerEntryFactory_0.invoke_6glczf$(h,null):e.noWhenBranchMatched(),St(t.active.lifecycleRegistry),kt(c.lifecycleRegistry),xt(t.active.lifecycleRegistry);t:do{var g;if(e.isType(l,m)&&l.isEmpty()){v=!0;break t}for(g=l.iterator();g.hasNext();)if(g.next()===t.active.configuration){v=!1;break t}v=!0}while(0);v&&(t.active.instanceKeeperDispatcher.destroy(),Et(t.active.lifecycleRegistry))}var b,k=p(l,1),x=O(C(k,10));for(b=k.iterator();b.hasNext();){var E,N,z=b.next(),j=x.add_11rb$;if(t.active.configuration===z)E=t.active.copy_go6qks$(void 0,t.active.stateKeeperDispatcher.save());else{var R,A=t.backStack;t:do{var I;for(I=A.iterator();I.hasNext();){var M=I.next();if(M.configuration===z){R=M;break t}}R=null}while(0);E=null!=(N=R)?N:new Pt(z)}j.call(x,E)}var L,D=x,q=t.backStack,F=P();for(L=q.iterator();L.hasNext();){var U,B=L.next();t:do{var H;if(e.isType(l,m)&&l.isEmpty()){U=!0;break t}for(H=l.iterator();H.hasNext();)if(H.next()===B.configuration){U=!1;break t}U=!0}while(0);U&&F.add_11rb$(B)}return Rt(F),new Ht(c,D)},oe.$metadata$={kind:s,simpleName:"StackNavigatorImpl",interfaces:[re]},ae.$metadata$={kind:l,simpleName:"ParcelableContainer",interfaces:[be]},ce.$metadata$={kind:l,simpleName:"StateKeeper",interfaces:[]},ue.$metadata$={kind:l,simpleName:"StateKeeperDispatcher",interfaces:[ce]},he.prototype.save=function(){try{var t,n=this.suppliers_0,i=$();for(t=n.entries.iterator();t.hasNext();){var r=t.next();i.put_xwzc9p$(r.key,se(r.value()))}return se(new fe(i))}catch(t){if(e.isType(t,I))return null;throw t}},he.prototype.consume_xk4jb$=function(t,e){var n,i;return null!=(i=null!=(n=this.savedState_0)?n.remove_11rb$(t):null)?i.consume_6kwwkl$(e):null},he.prototype.register_kh27gz$=function(t,n){var i,r=this.suppliers_0;if((e.isType(i=r,R)?i:v()).containsKey_11rb$(t))throw w("Check failed.".toString());this.suppliers_0.put_xwzc9p$(t,n)},he.prototype.unregister_61zpoe$=function(t){var n,i=this.suppliers_0;if(!(e.isType(n=i,R)?n:v()).containsKey_11rb$(t))throw w("Check failed.".toString());this.suppliers_0.remove_11rb$(t)},fe.$metadata$={kind:s,simpleName:"SavedState",interfaces:[be]},he.$metadata$={kind:s,simpleName:"StateKeeperDispatcherImpl",interfaces:[ue]},de.$metadata$={kind:l,simpleName:"StateKeeperOwner",interfaces:[]},_e.$metadata$={kind:s,simpleName:"MutableValue",interfaces:[ge]},ye.prototype=Object.create(j.prototype),ye.prototype.constructor=ye,ye.prototype.afterChange_jxtfl0$=function(t,e,n){this.closure$onChange(t,e,n)},ye.$metadata$={kind:s,interfaces:[j]};var $e=new N("value");function ge(){}function be(){}function we(){this.value_0=null}function ke(t){}Object.defineProperty(ve.prototype,"value",{configurable:!0,get:function(){return this.value_ui44qa$_0.getValue_lrcp0p$(this,$e)},set:function(t){this.value_ui44qa$_0.setValue_9rddgb$(this,$e,t)}}),ve.prototype.subscribe_oh3mgy$=function(t){this.observers_0=f(this.observers_0,t),t(this.value)},ve.prototype.unsubscribe_oh3mgy$=function(t){this.observers_0=d(this.observers_0,t)},ve.$metadata$={kind:s,simpleName:"MutableValueImpl",interfaces:[_e]},ge.$metadata$={kind:s,simpleName:"Value",interfaces:[]},be.$metadata$={kind:l,simpleName:"Parcelable",interfaces:[]},we.prototype.consume_6kwwkl$=function(t){var n,i=null==(n=this.value_0)||e.isType(n,be)?n:v();return this.value_0=null,i},we.prototype.set_xb6vv0$=function(t){this.value_0=t},we.$metadata$={kind:s,simpleName:"ParcelableContainerImpl",interfaces:[ae]};var Se=t.com||(t.com={}),xe=Se.arkivanov||(Se.arkivanov={}),Ee=xe.decompose||(xe.decompose={});Ee.ComponentContext=M,Ee.DefaultComponentContext_init_d83sal$=D,Ee.DefaultComponentContext_init_qi2zqv$=function(t,e){return e=e||Object.create(L.prototype),D(t,pe(),ot(),Z(),e),e},Ee.DefaultComponentContext=L,Ee.DefaultRouterFactory=q,Ee.Navigator=F,Ee.push_35ddl4$=function(t,e){var n;t.navigate_lbeuw8$((n=e,function(t){return u(t,n)}))},Ee.pop_er20gs$=B,Ee.Router=H,Ee.RouterFactory=V,W.Created=Y,W.Destroyed=G,K.Entry=W,Ee.RouterState=K;var Ce=Ee.backpressed||(Ee.backpressed={});Ce.BackPressedDispatcher=J,Ce.backPressedDispatcher=Z,Ce.BackPressedDispatcherImpl=Q,Ce.BackPressedDispatcherOwner=X,Ce.BackPressedHandler=tt,Ce.BackPressedRegistry=et;var Oe=Ee.instancekeeper||(Ee.instancekeeper={});nt.Instance=it,Oe.InstanceKeeper=nt,Oe.InstanceKeeperDispatcher=rt,Oe.instanceKeeperDispatcher=ot,Oe.InstanceKeeperDispatcherImpl=at,Oe.InstanceKeeperOwner=st;var Ne=Ee.lifecycle||(Ee.lifecycle={});Ne.DefaultLifecycleCallbacks=lt,Object.defineProperty(ut,"DESTROYED",{get:ht}),Object.defineProperty(ut,"INITIALIZED",{get:ft}),Object.defineProperty(ut,"CREATED",{get:dt}),Object.defineProperty(ut,"STARTED",{get:_t}),Object.defineProperty(ut,"RESUMED",{get:yt}),ct.State=ut,ct.Callbacks=mt,Ne.Lifecycle=ct,Ne.LifecycleOwner=vt,Ne.LifecycleRegistry=$t,Ne.lifecycleRegistry=gt,Ne.create_ozja4p$=bt,Ne.start_ozja4p$=wt,Ne.resume_ozja4p$=kt,Ne.pause_ozja4p$=St,Ne.stop_ozja4p$=xt,Ne.destroy_ozja4p$=Et,Ne.LifecycleRegistryImpl=Ct,Ne.MergedLifecycle_init_9j7eg6$=zt,Ne.MergedLifecycle=Ot,jt.Created=Tt,jt.Destroyed=Pt;var ze=Ee.router||(Ee.router={});ze.RouterEntry=jt,ze.destroy_1g9gks$=Rt,ze.RouterEntryFactory=At,ze.RouterEntryFactoryImpl=It,ze.RouterImpl=Bt,ze.RouterStack=Ht,ze.StackHolder=Vt,ze.StackHolderImpl=Xt,ze.StackNavigator=re,ze.StackNavigatorImpl=oe;var je=Ee.statekeeper||(Ee.statekeeper={});je.ParcelableContainer=ae,je.ParcelableContainer_xb6vv0$=se,je.consumeRequired_9osh7w$=le,je.StateKeeper=ce,je.StateKeeperDispatcher=ue,je.stateKeeperDispatcher=pe,je.StateKeeperDispatcherImpl=he,je.StateKeeperOwner=de;var Te=Ee.value||(Ee.value={});return Te.MutableValue=_e,Te.MutableValue_issdgt$=me,Te.Value=ge,je.Parcelable=be,je.ParcelableContainerImpl=we,Ee.ensureNeverFrozen_s8jyvk$=ke,M.prototype.router_t9b34l$=V.prototype.router_t9b34l$,L.prototype.router_t9b34l$=M.prototype.router_t9b34l$,q.prototype.router_t9b34l$=V.prototype.router_t9b34l$,It.prototype.invoke_6glczf$=At.prototype.invoke_6glczf$,t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){var i,r,o;r=[e,n(1),n(8),n(28),n(13),n(18),n(245),n(246),n(128),n(247),n(128)],void 0===(o="function"==typeof(i=function(t,e,n,i,r,o,a,s,l,c,u){"use strict";var p=t.$$importsForInline$$||(t.$$importsForInline$$={}),h=e.kotlin.Unit,f=n.kotlinx.coroutines.Job,d=e.ensureNotNull,_=e.PropertyMetadata,y=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,m=e.kotlin.coroutines.CoroutineImpl,v=e.throwCCE,$=i.io.ktor.util.AttributeKey,g=r.io.ktor.utils.io.core.Closeable,b=n.kotlinx.coroutines.Job_5dx9e$,w=i.io.ktor.util.AttributesJsFn,k=n.kotlinx.coroutines.cancel_jnvdxk$,S=r.io.ktor.utils.io.makeShared_s8jyvk$,x=e.Kind.CLASS,E=n.kotlinx.coroutines.CoroutineScope,C=e.kotlin.properties.ReadWriteProperty,O=e.kotlin.IllegalStateException_init_pdl1vj$,N=Object,z=i.io.ktor.util,j=(e.kotlin.Annotation,r.io.ktor.utils.io.ByteReadChannel),T=e.throwUPAE,P=n.kotlinx.coroutines.cancel_n4wjt3$,R=Error,A=e.Kind.OBJECT,I=r.io.ktor.utils.io.concurrent.threadLocal_issdgt$,M=e.defineInlineFunction,L=e.wrapFunction,D=e.kotlin.IllegalStateException_init,q=e.kotlin.IllegalStateException,F=e.kotlin.UnsupportedOperationException_init,U=i.io.ktor.util.flattenEntries_vr6bp2$,B=e.kotlin.collections.joinToString_fmv235$,H=e.kotlin.text.trimMargin_rjktp$,V=e.kotlin.UnsupportedOperationException,K=e.getReifiedTypeParameterKType,W=e.getKClass,Y=i.io.ktor.util.toByteArray_3dmw3p$,G=r.io.ktor.utils.io.ByteReadChannel_fqrh44$,J=r.io.ktor.utils.io.readRemaining_3dmw3p$,Z=r.io.ktor.utils.io.core.readBytes_xc9h3n$,Q=e.kotlin.IllegalArgumentException_init_pdl1vj$,X=e.kotlin.IllegalArgumentException,tt=n.kotlinx.coroutines.CoroutineName,et=e.kotlin.collections.emptySet_287e2$,nt=n.kotlinx.coroutines.async_pda6u4$,it=e.Kind.INTERFACE,rt=o.io.ktor.http,ot=o.io.ktor.http.UnsafeHeaderException,at=e.kotlin.collections.ArrayList_init_287e2$,st=n.kotlinx.coroutines.CompletableJob,lt=i.io.ktor.util.SilentSupervisor_5dx9e$,ct=e.kotlin.lazy_klfg04$,ut=e.kotlin.collections.setOf_mh5how$,pt=(e.kotlin.Enum,e.throwISE,e.equals),ht=e.kotlin.coroutines.CoroutineContext.Key,ft=e.kotlin.coroutines.CoroutineContext.Element,dt=n.kotlinx.coroutines.CancellationException_init_pdl1vj$,_t=o.io.ktor.http.ContentType,yt=o.io.ktor.http.content.TextContent,mt=o.io.ktor.http.content.OutgoingContent.ByteArrayContent,vt=o.io.ktor.http.content.OutgoingContent.ReadChannelContent,$t=e.kotlin.text.toLong_pdl1vz$,gt=e.Long.MAX_VALUE,bt=r.io.ktor.utils.io.cancel_3dmw3p$,wt=e.kotlin,kt=e.kotlin.text.toInt_pdl1vz$,St=e.kotlin.reflect.js.internal.PrimitiveClasses.intClass,xt=r.io.ktor.utils.io.core.ByteReadPacket,Et=r.io.ktor.utils.io.core.Input,Ct=r.io.ktor.utils.io.readRemaining_b56lbm$,Ot=e.kotlin.reflect.js.internal.PrimitiveClasses.byteArrayClass,Nt=r.io.ktor.utils.io.copyTo_47ygvz$,zt=n.kotlinx.coroutines.CancellationException,jt=r.io.ktor.utils.io.writer_x9a1ni$,Tt=o.io.ktor.http.HttpStatusCode,Pt=e.kotlin.collections.reversed_7wnvza$,Rt=i.io.ktor.util.pipeline.PipelinePhase,At=e.kotlin.ranges.rangeTo_38ydlf$,It=e.kotlin.ranges.contains_u6rtyw$,Mt=r.io.ktor.utils.io.charsets,Lt=o.io.ktor.http.contentType_jzzg3d$,Dt=o.io.ktor.http.charset_10ldo9$,qt=e.kotlin.reflect.js.internal.PrimitiveClasses.stringClass,Ft=o.io.ktor.http.withCharset_73qf4i$,Ut=o.io.ktor.http.charset_v1wgmc$,Bt=r.io.ktor.utils.io.core.readText_1lnizf$,Ht=e.kotlin.collections.toList_abgq59$,Vt=r.io.ktor.utils.io.charsets.get_name_2sg7fd$,Kt=e.kotlin.collections.firstOrNull_2p1efm$,Wt=e.kotlin.collections.sortedWith_eknfly$,Yt=e.kotlin.Comparator,Gt=e.kotlin.text.StringBuilder_init,Jt=e.kotlin.math.roundToInt_yrwdxr$,Zt=e.kotlin.collections.LinkedHashSet_init_287e2$,Qt=e.kotlin.collections.LinkedHashMap_init_q3lmfv$,Xt=o.io.ktor.http.HttpMethod,te=e.kotlin.collections.setOf_i5x0yv$,ee=o.io.ktor.http.get_authority_5y8s0c$,ne=o.io.ktor.http.takeFrom_jl1sg7$,ie=o.io.ktor.http.isSecure_v5fpbg$,re=o.io.ktor.http.get_authority_3q1sfd$,oe=n.kotlinx.coroutines.cancel_6dgle8$,ae=o.io.ktor.http.content.OutgoingContent,se=e.hashCode,le=e.Long.ZERO,ce=n.kotlinx.coroutines.delay_s8cxhz$,ue=n.kotlinx.coroutines.launch_s496o7$,pe=(o.io.ktor.http.HeaderValue,o.io.ktor.http.content.OutgoingContent.NoContent),he=(o.io.ktor.http.isSuccess_b3he4c$,e.getCallableRef,o.io.ktor.http.Url_pboq08$,e.kotlin.collections.plus_khz7k3$,e.kotlin.collections.emptyList_287e2$),fe=(e.kotlin.collections.emptyMap_q3lmfv$,i.io.ktor.util.date.GMTDate_mts6q2$),de=(e.kotlin.text.startsWith_7epoxm$,e.kotlin.text.split_ip8yn$,e.Long.fromInt(1e3),e.kotlin.text.isBlank_gw00vp$),_e=(o.io.ktor.http.parseHeaderValue_pdl1vj$,o.io.ktor.http.HeadersBuilder),ye=i.io.ktor.util.collections.ConcurrentMap,me=(e.kotlin.collections.removeAll_qafx1e$,n.kotlinx.coroutines.sync.Mutex_6taknv$,o.io.ktor.http.URLBuilder),ve=(e.kotlin.collections.toList_7wnvza$,e.kotlin.collections.ArrayList_init_ww73n8$),$e=(i.io.ktor.util.toLowerCasePreservingASCIIRules_pdl1vz$,e.kotlin.text.trimStart_wqw3xr$,e.kotlin.text.endsWith_sgbm27$,e.toString,e.kotlin.text.endsWith_7epoxm$,n.kotlinx.coroutines),ge=i.io.ktor.util.split_o3z30d$,be=r.io.ktor.utils.io.discard_3dmw3p$,we=a.io.ktor.http.cio.websocket.WebSocketSession,ke=a.io.ktor.http.cio.websocket.DefaultWebSocketSession,Se=(i.io.ktor.util.encodeBase64_964n91$,e.Long.NEG_ONE,e.Long.fromInt(2147483647),e.kotlin.collections.addAll_ipc267$,o.io.ktor.http.URLProtocol),xe=e.createKType,Ee=r.io.ktor.utils.io.copyAndClose_47ygvz$,Ce=r.io.ktor.utils.io.ByteChannel_6taknv$,Oe=o.io.ktor.http.HttpMessage,Ne=o.io.ktor.http.takeFrom_rs9g2p$,ze=i.io.ktor.util.appendAll_k10e8h$,je=n.kotlinx.coroutines.SupervisorJob_5dx9e$,Te=o.io.ktor.http.HttpMessageBuilder,Pe=o.io.ktor.http.takeFrom_wol2ee$,Re=i.io.ktor.util.pipeline.Pipeline,Ae=o.io.ktor.http.formUrlEncode_invt95$,Ie=r.io.ktor.utils.io.writeFully_4scpqu$,Me=r.io.ktor.utils.io.close_x5qia6$,Le=o.io.ktor.http.content.OutgoingContent.WriteChannelContent,De=r.io.ktor.utils.io.core.BytePacketBuilder_za3lpa$,qe=r.io.ktor.utils.io.core.writeText_t153jy$,Fe=r.io.ktor.utils.io.core.writeFully_i6snlg$,Ue=o.io.ktor.http.content.PartData.FileItem,Be=o.io.ktor.http.content.PartData.BinaryItem,He=o.io.ktor.http.content.PartData.FormItem,Ve=e.kotlin.random.Random,Ke=e.kotlin.text.toString_dqglrj$,We=e.kotlin.text.take_6ic1pp$,Ye=r.io.ktor.utils.io.core.readAvailable_czhrh1$,Ge=r.io.ktor.utils.io.charsets.encodeToByteArray_fj4osb$,Je=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,Ze=r.io.ktor.utils.io.requestWriteBuffer_9tm6dw$,Qe=r.io.ktor.utils.io.core.Buffer,Xe=r.io.ktor.utils.io.completeWriting_oczduq$,tn=(o.io.ktor.http.Parameters,o.io.ktor.http.Headers),en=(o.io.ktor.http.escapeIfNeeded_pdl1vz$,e.kotlin.collections.copyToArray,r.io.ktor.utils.io.charsets.decode_lb8wo3$),nn=o.io.ktor.http.content.OutgoingContent.ProtocolUpgrade,rn=i.io.ktor.util.collections.ConcurrentList,on=o.io.ktor.http.HttpProtocolVersion,an=n.kotlinx.coroutines.CoroutineScope_1fupul$,sn=n.kotlinx.coroutines.cancel_x105z1$,ln=e.kotlin.Result,cn=e.kotlin.createFailure_tcv7n7$,un=e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,pn=n.kotlinx.coroutines.CancellableContinuationImpl,hn=l.Headers,fn=e.kotlin.collections.toTypedArray_964n91$,dn=e.kotlin.Error,_n=n.kotlinx.coroutines.channels.Channel_lsve6m$,yn=a.io.ktor.http.cio.websocket.CloseReason.Codes,mn=n.kotlinx.coroutines.CompletableDeferred_xptg6w$,vn=a.io.ktor.http.cio.websocket.Frame.Binary_init_3eyok5$,$n=a.io.ktor.http.cio.websocket.Frame.Text_init_61zpoe$,gn=a.io.ktor.http.cio.websocket.CloseReason,bn=a.io.ktor.http.cio.websocket.Frame.Close_init_p695es$,wn=r.io.ktor.utils.io.core.String_xge8xe$,kn=r.io.ktor.utils.io.core.readShort_7wsnj1$,Sn=n.kotlinx.coroutines.channels.cancelConsumed_v57n85$;function xn(t){this.value_0=t}function En(t){return h}function Cn(t,e){void 0===e&&(e=En);var n=new An;e(n);var i,r=n,o=t.create_dxyxif$(r.engineConfig_8be2vx$),a=Pn(o,r,!0);return d(a.coroutineContext.get_j3r2sn$(f.Key)).invokeOnCompletion_f05bi3$((i=o,function(t){return i.close(),h})),a}function On(t,e){var n,i;void 0===e&&(e=new An),this.engine=t,this.userConfig_0=e,this.manageEngine_ry3wwv$_0=new xn(!1),this.closed_0=!1,this.clientJob_0=b(this.engine.coroutineContext.get_j3r2sn$(f.Key)),this.coroutineContext_94yqr5$_0=this.engine.coroutineContext.plus_1fupul$(this.clientJob_0),this.requestPipeline=new la(this.userConfig_0.developmentMode),this.responsePipeline=new Ca(this.userConfig_0.developmentMode),this.sendPipeline=new ha(this.userConfig_0.developmentMode),this.receivePipeline=new ja(this.userConfig_0.developmentMode),this.attributes=w(!0),this.engineConfig=this.engine.config,this.config_8be2vx$=new An,this.manageEngine_0&&this.clientJob_0.invokeOnCompletion_f05bi3$((n=this,function(t){return null!=t&&k(n.engine),h})),this.engine.install_k5i6f8$(this),this.sendPipeline.intercept_h71y74$(ya().Receive,(i=this,function(t,e,n,r){var o=new jn(i,t,e,this,n);return r?o:o.doResume(null)}));var r=this.userConfig_0;this.config_8be2vx$.install_xlxg29$(Gr()),r.useDefaultTransformers&&(this.config_8be2vx$.install_xlxg29$(Ar()),this.config_8be2vx$.install_q2ual$("DefaultTransformers",Tn)),this.config_8be2vx$.install_xlxg29$(oo()),r.followRedirects&&this.config_8be2vx$.install_xlxg29$(Br()),this.config_8be2vx$.plusAssign_bi476h$(r),Wi(this.config_8be2vx$),this.config_8be2vx$.install_k5i6f8$(this),S(this)}r.io.ktor.utils.io.errors.IOException,ii.prototype=Object.create(q.prototype),ii.prototype.constructor=ii,ri.prototype=Object.create(q.prototype),ri.prototype.constructor=ri,oi.prototype=Object.create(V.prototype),oi.prototype.constructor=oi,si.prototype=Object.create(Vn.prototype),si.prototype.constructor=si,ui.prototype=Object.create(Sa.prototype),ui.prototype.constructor=ui,di.prototype=Object.create(q.prototype),di.prototype.constructor=di,_i.prototype=Object.create(X.prototype),_i.prototype.constructor=_i,zi.prototype=Object.create(q.prototype),zi.prototype.constructor=zi,Yi.prototype=Object.create(q.prototype),Yi.prototype.constructor=Yi,Ji.prototype=Object.create(Yi.prototype),Ji.prototype.constructor=Ji,Zi.prototype=Object.create(Yi.prototype),Zi.prototype.constructor=Zi,Qi.prototype=Object.create(Yi.prototype),Qi.prototype.constructor=Qi,Xi.prototype=Object.create(mt.prototype),Xi.prototype.constructor=Xi,tr.prototype=Object.create(vt.prototype),tr.prototype.constructor=tr,lo.prototype=Object.create(q.prototype),lo.prototype.constructor=lo,Co.prototype=Object.create(zt.prototype),Co.prototype.constructor=Co,No.prototype=Object.create(Vn.prototype),No.prototype.constructor=No,jo.prototype=Object.create(Sa.prototype),jo.prototype.constructor=jo,Yo.prototype=Object.create(pe.prototype),Yo.prototype.constructor=Yo,Wo.prototype=Object.create(q.prototype),Wo.prototype.constructor=Wo,la.prototype=Object.create(Re.prototype),la.prototype.constructor=la,ha.prototype=Object.create(Re.prototype),ha.prototype.constructor=ha,ma.prototype=Object.create(mt.prototype),ma.prototype.constructor=ma,va.prototype=Object.create(Le.prototype),va.prototype.constructor=va,ka.prototype=Object.create(Sa.prototype),ka.prototype.constructor=ka,Ca.prototype=Object.create(Re.prototype),Ca.prototype.constructor=Ca,ja.prototype=Object.create(Re.prototype),ja.prototype.constructor=ja,Ja.prototype=Object.create(pe.prototype),Ja.prototype.constructor=Ja,Xa.prototype=Object.create(pe.prototype),Xa.prototype.constructor=Xa,ts.prototype=Object.create(vt.prototype),ts.prototype.constructor=ts,es.prototype=Object.create(Le.prototype),es.prototype.constructor=es,ns.prototype=Object.create(mt.prototype),ns.prototype.constructor=ns,is.prototype=Object.create(nn.prototype),is.prototype.constructor=is,bs.prototype=Object.create(Oi.prototype),bs.prototype.constructor=bs,Cs.prototype=Object.create(R.prototype),Cs.prototype.constructor=Cs,xn.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},xn.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},xn.$metadata$={kind:x,interfaces:[C]};var Nn=new _("manageEngine");function zn(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$builder=e}function jn(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$this$HttpClient=t,this.local$$receiver=e,this.local$call=n}function Tn(t){return sr(t),h}function Pn(t,e,n,i){return i=i||Object.create(On.prototype),On.call(i,t,e),i.manageEngine_0=n,i}function Rn(t){this.value_0=t}function An(){this.features_0=rs(),this.featureConfigurations_0=rs(),this.customInterceptors_0=rs(),this.engineConfig_8be2vx$_8hwuhy$_0=new Rn(Bn),this.followRedirects_u64lb0$_0=new Rn(!0),this.useDefaultTransformers_4nse22$_0=new Rn(!0),this.expectSuccess_kppdwg$_0=new Rn(!0),this.developmentMode_umcv04$_0=new Rn(z.PlatformUtils.IS_DEVELOPMENT_MODE)}Object.defineProperty(On.prototype,"manageEngine_0",{configurable:!0,get:function(){return this.manageEngine_ry3wwv$_0.getValue_lrcp0p$(this,Nn)},set:function(t){this.manageEngine_ry3wwv$_0.setValue_9rddgb$(this,Nn,t)}}),Object.defineProperty(On.prototype,"coroutineContext",{configurable:!0,get:function(){return this.coroutineContext_94yqr5$_0}}),Object.defineProperty(On.prototype,"dispatcher",{configurable:!0,get:function(){return this.engine.dispatcher}}),zn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},zn.prototype=Object.create(m.prototype),zn.prototype.constructor=zn,zn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.requestPipeline.execute_8pmvt0$(this.local$builder,this.local$builder.body,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return e.isType(t=this.result_0,Vn)?t:v();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},On.prototype.execute_s9rlw$=function(t,e,n){var i=new zn(this,t,e);return n?i:i.doResume(null)},On.prototype.isSupported_tlxpog$=function(t){return this.engine.supportedCapabilities.contains_11rb$(t)},On.prototype.config_f0veat$=function(t){var e=this.engine,n=new An;return n.plusAssign_bi476h$(this.userConfig_0),t(n),Pn(e,n,this.manageEngine_0)},On.prototype.close=function(){var t;if(!1===(t=this).closed_0&&(t.closed_0=!0,1)){var n;for(n=this.attributes.allKeys.iterator();n.hasNext();){var i,r=n.next(),o=this.attributes.get_yzaw86$(e.isType(i=r,$)?i:v());e.isType(o,g)&&o.close()}this.clientJob_0.complete(),this.manageEngine_0&&this.engine.close()}},On.prototype.toString=function(){return"HttpClient["+this.engine+"]"},jn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},jn.prototype=Object.create(m.prototype),jn.prototype.constructor=jn,jn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(!e.isType(this.local$call,Vn)){var t="Error: HttpClientCall expected, but found "+this.local$call.toString()+"("+e.getKClassFromExpression(this.local$call)+").";throw O(t.toString())}if(this.state_0=2,this.result_0=this.local$this$HttpClient.receivePipeline.execute_8pmvt0$(this.local$call,this.local$call.response,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:var n=this.result_0.call;if(this.state_0=3,this.result_0=this.local$$receiver.proceedWith_trkh7z$(n,this),this.result_0===y)return y;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},On.$metadata$={kind:x,simpleName:"HttpClient",interfaces:[g,E]},Rn.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},Rn.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},Rn.$metadata$={kind:x,interfaces:[C]};var In=new _("engineConfig");Object.defineProperty(An.prototype,"engineConfig_8be2vx$",{configurable:!0,get:function(){return this.engineConfig_8be2vx$_8hwuhy$_0.getValue_lrcp0p$(this,In)},set:function(t){this.engineConfig_8be2vx$_8hwuhy$_0.setValue_9rddgb$(this,In,t)}}),An.prototype.engine_dxyxif$=function(t){var e,n,i=this.engineConfig_8be2vx$;this.engineConfig_8be2vx$=(e=i,n=t,function(t){return e(t),n(t),h})};var Mn=new _("followRedirects");Object.defineProperty(An.prototype,"followRedirects",{configurable:!0,get:function(){return this.followRedirects_u64lb0$_0.getValue_lrcp0p$(this,Mn)},set:function(t){this.followRedirects_u64lb0$_0.setValue_9rddgb$(this,Mn,t)}});var Ln=new _("useDefaultTransformers");Object.defineProperty(An.prototype,"useDefaultTransformers",{configurable:!0,get:function(){return this.useDefaultTransformers_4nse22$_0.getValue_lrcp0p$(this,Ln)},set:function(t){this.useDefaultTransformers_4nse22$_0.setValue_9rddgb$(this,Ln,t)}});var Dn=new _("expectSuccess");Object.defineProperty(An.prototype,"expectSuccess",{configurable:!0,get:function(){return this.expectSuccess_kppdwg$_0.getValue_lrcp0p$(this,Dn)},set:function(t){this.expectSuccess_kppdwg$_0.setValue_9rddgb$(this,Dn,t)}});var qn=new _("developmentMode");function Fn(t){return h}function Un(){return w(!0)}function Bn(t){return h}function Hn(t,n,i){var r=new Vn(t);return r.request=new Zo(r,n),r.response=new ka(r,i),e.isType(i.body,j)||r.attributes.put_uuntuo$(Xn().CustomResponse,i.body),r}function Vn(t){Xn(),this.received_8b75r7$_0=!1,this.client_77eog7$_0=I(t),this.request_vta333$_0=this.request_vta333$_0,this.response_zcvbsz$_0=this.response_zcvbsz$_0,this.allowDoubleReceive_c2ese3$_0=!1}Object.defineProperty(An.prototype,"developmentMode",{configurable:!0,get:function(){return this.developmentMode_umcv04$_0.getValue_lrcp0p$(this,qn)},set:function(t){this.developmentMode_umcv04$_0.setValue_9rddgb$(this,qn,t)}}),An.prototype.install_xlxg29$=function(t,n){void 0===n&&(n=Fn);var i,r,o=this.featureConfigurations_0.get_11rb$(t.key),a=this.featureConfigurations_0,s=t.key;if(a.put_xwzc9p$(s,(i=o,r=n,function(t){var n;return null!=i&&i(t),r(e.isType(n=t,N)?n:v()),h})),!this.features_0.containsKey_11rb$(t.key)){var l,c=this.features_0,u=t.key;c.put_xwzc9p$(u,(l=t,function(t){var e=t.attributes.computeIfAbsent_u4q9l2$(vr,Un),n=d(t.config_8be2vx$.featureConfigurations_0.get_11rb$(l.key)),i=l.prepare_oh3mgy$(n);return l.install_wojrb5$(i,t),e.put_uuntuo$(l.key,i),h}))}},An.prototype.install_q2ual$=function(t,e){this.customInterceptors_0.put_xwzc9p$(t,e)},An.prototype.install_k5i6f8$=function(t){var e,n;for(e=this.features_0.values.iterator();e.hasNext();)e.next()(t);for(n=this.customInterceptors_0.values.iterator();n.hasNext();)n.next()(t)},An.prototype.clone=function(){var t=new An;return t.plusAssign_bi476h$(this),t},An.prototype.plusAssign_bi476h$=function(t){this.followRedirects=t.followRedirects,this.useDefaultTransformers=t.useDefaultTransformers,this.expectSuccess=t.expectSuccess;var e=this.features_0,n=t.features_0;e.putAll_a2k3zr$(n);var i=this.featureConfigurations_0,r=t.featureConfigurations_0;i.putAll_a2k3zr$(r);var o=this.customInterceptors_0,a=t.customInterceptors_0;o.putAll_a2k3zr$(a)},An.$metadata$={kind:x,simpleName:"HttpClientConfig",interfaces:[]};var Kn=new _("client");function Wn(t,e,n){m.call(this,n),this.exceptionState_0=9,this.$this=t,this.local$tmp$=void 0,this.local$info=e}function Yn(){Qn=this,this.CustomResponse=new $("CustomResponse")}Object.defineProperty(Vn.prototype,"client",{configurable:!0,get:function(){return this.client_77eog7$_0.getValue_lrcp0p$(this,Kn)}}),Object.defineProperty(Vn.prototype,"coroutineContext",{configurable:!0,get:function(){return this.response.coroutineContext}}),Object.defineProperty(Vn.prototype,"attributes",{configurable:!0,get:function(){return this.request.attributes}}),Object.defineProperty(Vn.prototype,"request",{configurable:!0,get:function(){return null==this.request_vta333$_0?T("request"):this.request_vta333$_0},set:function(t){this.request_vta333$_0=t}}),Object.defineProperty(Vn.prototype,"response",{configurable:!0,get:function(){return null==this.response_zcvbsz$_0?T("response"):this.response_zcvbsz$_0},set:function(t){this.response_zcvbsz$_0=t}}),Object.defineProperty(Vn.prototype,"allowDoubleReceive",{configurable:!0,get:function(){return this.allowDoubleReceive_c2ese3$_0}}),Vn.prototype.getResponseContent=function(t){return this.response.content},Wn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Wn.prototype=Object.create(m.prototype),Wn.prototype.constructor=Wn,Wn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.exceptionState_0=1,hs(this.$this.response,this.local$info.type)){this.exceptionState_0=9,this.finallyPath_0=[2],this.state_0=8,this.$returnValue=this.$this.response;continue}this.state_0=3;continue;case 1:this.finallyPath_0=[9],this.exceptionState_0=8;var n=this.exception_0;throw e.isType(n,R)?(P(this.$this.response,"Receive failed",n),n):n;case 2:return this.$returnValue;case 3:if(!this.$this.allowDoubleReceive&&(!1!==(c=this).$this.received_8b75r7$_0||(c.$this.received_8b75r7$_0=!0,0)))throw new ii(this.$this);if(this.local$tmp$=this.$this.attributes.getOrNull_yzaw86$(Xn().CustomResponse),null==this.local$tmp$){if(this.state_0=4,this.result_0=this.$this.getResponseContent(this),this.result_0===y)return y;continue}this.state_0=5;continue;case 4:this.local$tmp$=this.result_0,this.state_0=5;continue;case 5:var i=this.local$tmp$,r=new Ma(this.local$info,i);if(null==(t=this.$this.client))throw O(("Failed to receive call("+this.$this+") in different native thread.").toString());var o=t;if(this.state_0=6,this.result_0=o.responsePipeline.execute_8pmvt0$(this.$this,r,this),this.result_0===y)return y;continue;case 6:var a=this.result_0.response;if(!hs(a,this.local$info.type)){var s=e.getKClassFromExpression(a),l=this.local$info.type;throw new oi(this.$this.response,s,l)}this.exceptionState_0=9,this.finallyPath_0=[7],this.state_0=8,this.$returnValue=a;continue;case 7:return this.$returnValue;case 8:this.exceptionState_0=9,Ea(this.$this.response),this.state_0=this.finallyPath_0.shift();continue;case 9:throw this.exception_0;case 10:return;default:throw this.state_0=9,new Error("State Machine Unreachable execution")}}catch(t){if(9===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var c},Vn.prototype.receive_jo9acv$=function(t,e,n){var i=new Wn(this,t,e);return n?i:i.doResume(null)},Vn.prototype.toString=function(){return"HttpClientCall["+this.request.url+", "+this.response.status+"]"},Yn.$metadata$={kind:A,simpleName:"Companion",interfaces:[]};var Gn,Jn,Zn,Qn=null;function Xn(){return null===Qn&&new Yn,Qn}function ti(t,e){this.request=t,this.response=e}function ei(t,e,n){m.call(this,n),this.$controller=e,this.exceptionState_0=1}function ni(t,e,n){var i=new ei(t,this,e);return n?i:i.doResume(null)}function ii(t){D(this),this.name="DoubleReceiveException",this.message_eo7lbx$_0="Response already received: "+t}function ri(t,e,n){O("Fail to run receive pipeline: "+n,this),this.request=t,this.info=e,this.cause_xlcv2q$_0=n,this.name="ReceivePipelineException"}function oi(t,e,n){F(this),this.name="NoTransformationFoundException",this.message_gd84kd$_0=H("No transformation found: "+e+" -> "+n+"\n |with response from "+xa(t).url+":\n |status: "+t.status+"\n |response headers: \n |"+B(U(t.headers),void 0,void 0,void 0,void 0,void 0,ai)+"\n ")}function ai(t){return t.component1()+": "+t.component2()+"\n"}function si(t){Vn.call(this,t),this.responseContent_0=null,this.allowDoubleReceive_je4pft$_0=!0}function li(t,e){m.call(this,e),this.exceptionState_0=1,this.$this=t}function ci(t,e){this.call_k7cxor$_0=t,this.$delegate_k8mkjd$_0=e}function ui(t,e,n){Sa.call(this),this.call_tbj7t5$_0=t,this.context_0=b(),this.status_i2dvkt$_0=n.status,this.version_ol3l9j$_0=n.version,this.requestTime_3msfjx$_0=n.requestTime,this.responseTime_xhbsdj$_0=n.responseTime,this.headers_w25qx3$_0=n.headers,this.coroutineContext_pwmz9e$_0=n.coroutineContext.plus_1fupul$(this.context_0),this.content_mzxkbe$_0=G(e)}function pi(t,e){m.call(this,e),this.exceptionState_0=1,this.local$$receiver_0=void 0,this.local$$receiver=t}function hi(t,e,n){var i=new pi(t,e);return n?i:i.doResume(null)}function fi(t,e,n){void 0===n&&(n=null),this.type=t,this.reifiedType=e,this.kotlinType=n}function di(t){O("Failed to write body: "+e.getKClassFromExpression(t),this),this.name="UnsupportedContentTypeException"}function _i(t){Q("Unsupported upgrade protocol exception: "+t,this),this.name="UnsupportedUpgradeProtocolException"}function yi(t,e,n){m.call(this,n),this.$controller=e,this.exceptionState_0=1}function mi(t,e,n){var i=new yi(t,this,e);return n?i:i.doResume(null)}function vi(t,e,n){m.call(this,n),this.$controller=e,this.exceptionState_0=1}function $i(t,e,n){var i=new vi(t,this,e);return n?i:i.doResume(null)}function gi(){}function bi(t,e,n,i,r,o){m.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$this$HttpClientEngine=t,this.local$closure$client=e,this.local$requestData=void 0,this.local$$receiver=n,this.local$content=i}function wi(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$this$HttpClientEngine=t,this.local$closure$requestData=e}function ki(t,e){return function(n,i,r){var o=new wi(t,e,n,this,i);return r?o:o.doResume(null)}}function Si(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$requestData=e}function xi(){}function Ei(t){return h}function Ci(t){var e,n=t.headers.names(),i=at();for(e=n.iterator();e.hasNext();){var r=e.next();rt.HttpHeaders.UnsafeHeadersList.contains_11rb$(r)&&i.add_11rb$(r)}var o=i;if(!o.isEmpty())throw new ot(o.toString())}function Oi(t){var e;this.engineName_n0bloo$_0=t,this.closed_je8r6f$_0=!1,this.coroutineContext_huxu0y$_0=ct((e=this,function(){return lt().plus_1fupul$(e.dispatcher).plus_1fupul$(new tt(e.engineName_n0bloo$_0+"-context"))}))}function Ni(t){return function(n){return function(t){var n,i;try{null!=(i=e.isType(n=t,g)?n:null)&&i.close()}catch(t){if(e.isType(t,R))return h;throw t}}(t.dispatcher),h}}function zi(t){void 0===t&&(t=null),O("Client already closed",this),this.cause_om4vf0$_0=t,this.name="ClientEngineClosedException"}function ji(){}function Ti(){this.threadsCount=4,this.pipelining=!1,this.proxy=null}function Pi(t,e,n){var i,r,o,a,s,l,c;ss((l=t,c=e,function(t){return t.appendAll_hb0ubp$(l),t.appendAll_hb0ubp$(c.headers),h})).forEach_ubvtmq$((s=n,function(t,e){if(!pt(rt.HttpHeaders.ContentLength,t)&&!pt(rt.HttpHeaders.ContentType,t))return s(t,B(e,",")),h})),null==t.get_61zpoe$(rt.HttpHeaders.UserAgent)&&null==e.headers.get_61zpoe$(rt.HttpHeaders.UserAgent)&&!z.PlatformUtils.IS_BROWSER&&n(rt.HttpHeaders.UserAgent,Zn);var u=null!=(r=null!=(i=e.contentType)?i.toString():null)?r:e.headers.get_61zpoe$(rt.HttpHeaders.ContentType),p=null!=(a=null!=(o=e.contentLength)?o.toString():null)?a:e.headers.get_61zpoe$(rt.HttpHeaders.ContentLength);null!=u&&n(rt.HttpHeaders.ContentType,u),null!=p&&n(rt.HttpHeaders.ContentLength,p)}function Ri(t){return d(t.context.get_j3r2sn$(Li())).callContext}function Ai(t){Li(),this.callContext=t}function Ii(){Mi=this}Vn.$metadata$={kind:x,simpleName:"HttpClientCall",interfaces:[E]},ti.$metadata$={kind:x,simpleName:"HttpEngineCall",interfaces:[]},ti.prototype.component1=function(){return this.request},ti.prototype.component2=function(){return this.response},ti.prototype.copy_ukxvzw$=function(t,e){return new ti(void 0===t?this.request:t,void 0===e?this.response:e)},ti.prototype.toString=function(){return"HttpEngineCall(request="+e.toString(this.request)+", response="+e.toString(this.response)+")"},ti.prototype.hashCode=function(){var t=0;return t=31*(t=31*t+e.hashCode(this.request)|0)+e.hashCode(this.response)|0},ti.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.request,t.request)&&e.equals(this.response,t.response)},ei.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},ei.prototype=Object.create(m.prototype),ei.prototype.constructor=ei,ei.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return h;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},M("ktor-ktor-client-core-jsLegacy.io.ktor.client.call.receive_8ov3cv$",L((function(){var n=e.getReifiedTypeParameterKType,i=e.throwCCE,r=e.getKClass,o=t.io.ktor.client.call,a=t.io.ktor.client.call.TypeInfo;return function(t,s,l,c){var u,p;t:do{try{p=new a(r(t),o.JsType,n(t))}catch(e){p=new a(r(t),o.JsType);break t}}while(0);return e.suspendCall(l.receive_jo9acv$(p,e.coroutineReceiver())),s(u=e.coroutineResult(e.coroutineReceiver()))?u:i()}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.call.receive_5sqbag$",L((function(){var n=e.getReifiedTypeParameterKType,i=e.throwCCE,r=e.getKClass,o=t.io.ktor.client.call,a=t.io.ktor.client.call.TypeInfo;return function(t,s,l,c){var u,p,h=l.call;t:do{try{p=new a(r(t),o.JsType,n(t))}catch(e){p=new a(r(t),o.JsType);break t}}while(0);return e.suspendCall(h.receive_jo9acv$(p,e.coroutineReceiver())),s(u=e.coroutineResult(e.coroutineReceiver()))?u:i()}}))),Object.defineProperty(ii.prototype,"message",{configurable:!0,get:function(){return this.message_eo7lbx$_0}}),ii.$metadata$={kind:x,simpleName:"DoubleReceiveException",interfaces:[q]},Object.defineProperty(ri.prototype,"cause",{get:function(){return this.cause_xlcv2q$_0}}),ri.$metadata$={kind:x,simpleName:"ReceivePipelineException",interfaces:[q]},Object.defineProperty(oi.prototype,"message",{configurable:!0,get:function(){return this.message_gd84kd$_0}}),oi.$metadata$={kind:x,simpleName:"NoTransformationFoundException",interfaces:[V]},li.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},li.prototype=Object.create(m.prototype),li.prototype.constructor=li,li.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(null==this.$this.responseContent_0&&(this.$this.responseContent_0=this.$this.response.content),this.state_0=2,this.result_0=Y(d(this.$this.responseContent_0),this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return this.$this.responseContent_0=G(t),G(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},si.prototype.getResponseContent=function(t,e){var n=new li(this,t);return e?n:n.doResume(null)},Object.defineProperty(si.prototype,"allowDoubleReceive",{configurable:!0,get:function(){return this.allowDoubleReceive_je4pft$_0}}),si.$metadata$={kind:x,simpleName:"SavedHttpCall",interfaces:[Vn]},Object.defineProperty(ci.prototype,"call",{get:function(){return this.call_k7cxor$_0}}),Object.defineProperty(ci.prototype,"attributes",{configurable:!0,get:function(){return this.$delegate_k8mkjd$_0.attributes}}),Object.defineProperty(ci.prototype,"content",{configurable:!0,get:function(){return this.$delegate_k8mkjd$_0.content}}),Object.defineProperty(ci.prototype,"coroutineContext",{configurable:!0,get:function(){return this.$delegate_k8mkjd$_0.coroutineContext}}),Object.defineProperty(ci.prototype,"executionContext",{configurable:!0,get:function(){return this.$delegate_k8mkjd$_0.executionContext}}),Object.defineProperty(ci.prototype,"headers",{configurable:!0,get:function(){return this.$delegate_k8mkjd$_0.headers}}),Object.defineProperty(ci.prototype,"method",{configurable:!0,get:function(){return this.$delegate_k8mkjd$_0.method}}),Object.defineProperty(ci.prototype,"url",{configurable:!0,get:function(){return this.$delegate_k8mkjd$_0.url}}),ci.$metadata$={kind:x,simpleName:"SavedHttpRequest",interfaces:[Qo]},Object.defineProperty(ui.prototype,"call",{get:function(){return this.call_tbj7t5$_0}}),Object.defineProperty(ui.prototype,"status",{configurable:!0,get:function(){return this.status_i2dvkt$_0}}),Object.defineProperty(ui.prototype,"version",{configurable:!0,get:function(){return this.version_ol3l9j$_0}}),Object.defineProperty(ui.prototype,"requestTime",{configurable:!0,get:function(){return this.requestTime_3msfjx$_0}}),Object.defineProperty(ui.prototype,"responseTime",{configurable:!0,get:function(){return this.responseTime_xhbsdj$_0}}),Object.defineProperty(ui.prototype,"headers",{configurable:!0,get:function(){return this.headers_w25qx3$_0}}),Object.defineProperty(ui.prototype,"coroutineContext",{configurable:!0,get:function(){return this.coroutineContext_pwmz9e$_0}}),Object.defineProperty(ui.prototype,"content",{configurable:!0,get:function(){return this.content_mzxkbe$_0}}),ui.$metadata$={kind:x,simpleName:"SavedHttpResponse",interfaces:[Sa]},pi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},pi.prototype=Object.create(m.prototype),pi.prototype.constructor=pi,pi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(null==(t=this.local$$receiver.client))throw O("Failed to save call in different native thread.".toString());var e=t;if(this.local$$receiver_0=new si(e),this.state_0=2,this.result_0=J(this.local$$receiver.response.content,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:var n=this.result_0;return this.local$$receiver_0.request=new ci(this.local$$receiver_0,this.local$$receiver.request),this.local$$receiver_0.response=new ui(this.local$$receiver_0,Z(n),this.local$$receiver.response),this.local$$receiver_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},fi.$metadata$={kind:x,simpleName:"TypeInfo",interfaces:[]},fi.prototype.component1=function(){return this.type},fi.prototype.component2=function(){return this.reifiedType},fi.prototype.component3=function(){return this.kotlinType},fi.prototype.copy_zg9ia4$=function(t,e,n){return new fi(void 0===t?this.type:t,void 0===e?this.reifiedType:e,void 0===n?this.kotlinType:n)},fi.prototype.toString=function(){return"TypeInfo(type="+e.toString(this.type)+", reifiedType="+e.toString(this.reifiedType)+", kotlinType="+e.toString(this.kotlinType)+")"},fi.prototype.hashCode=function(){var t=0;return t=31*(t=31*(t=31*t+e.hashCode(this.type)|0)+e.hashCode(this.reifiedType)|0)+e.hashCode(this.kotlinType)|0},fi.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.type,t.type)&&e.equals(this.reifiedType,t.reifiedType)&&e.equals(this.kotlinType,t.kotlinType)},di.$metadata$={kind:x,simpleName:"UnsupportedContentTypeException",interfaces:[q]},_i.$metadata$={kind:x,simpleName:"UnsupportedUpgradeProtocolException",interfaces:[X]},yi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},yi.prototype=Object.create(m.prototype),yi.prototype.constructor=yi,yi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return h;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},vi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},vi.prototype=Object.create(m.prototype),vi.prototype.constructor=vi,vi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return h;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(gi.prototype,"supportedCapabilities",{configurable:!0,get:function(){return et()}}),Object.defineProperty(gi.prototype,"closed_yj5g8o$_0",{configurable:!0,get:function(){var t,e;return!(null!=(e=null!=(t=this.coroutineContext.get_j3r2sn$(f.Key))?t.isActive:null)&&e)}}),bi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},bi.prototype=Object.create(m.prototype),bi.prototype.constructor=bi,bi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=new Xo;if(t.takeFromWithExecutionContext_s9rlw$(this.local$$receiver.context),t.body=this.local$content,this.local$requestData=t.build(),Ci(this.local$requestData),this.local$this$HttpClientEngine.checkExtensions_1320zn$_0(this.local$requestData),this.state_0=2,this.result_0=this.local$this$HttpClientEngine.executeWithinCallContext_2kaaho$_0(this.local$requestData,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:var e=this.result_0,n=Hn(this.local$closure$client,this.local$requestData,e);if(this.state_0=3,this.result_0=this.local$$receiver.proceedWith_trkh7z$(n,this),this.result_0===y)return y;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},gi.prototype.install_k5i6f8$=function(t){var e,n;t.sendPipeline.intercept_h71y74$(ya().Engine,(e=this,n=t,function(t,i,r,o){var a=new bi(e,n,t,i,this,r);return o?a:a.doResume(null)}))},wi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},wi.prototype=Object.create(m.prototype),wi.prototype.constructor=wi,wi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$this$HttpClientEngine.closed_yj5g8o$_0)throw new zi;if(this.state_0=2,this.result_0=this.local$this$HttpClientEngine.execute_dkgphz$(this.local$closure$requestData,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Si.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Si.prototype=Object.create(m.prototype),Si.prototype.constructor=Si,Si.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=_s(this.$this,this.local$requestData.executionContext,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;S(t);var e=t.plus_1fupul$(new Ai(t));if(this.state_0=3,this.result_0=nt(this.$this,e,void 0,ki(this.$this,this.local$requestData)).await(this),this.result_0===y)return y;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},gi.prototype.executeWithinCallContext_2kaaho$_0=function(t,e,n){var i=new Si(this,t,e);return n?i:i.doResume(null)},gi.prototype.checkExtensions_1320zn$_0=function(t){var e;for(e=t.requiredCapabilities_8be2vx$.iterator();e.hasNext();){var n=e.next();if(!this.supportedCapabilities.contains_11rb$(n))throw Q(("Engine doesn't support "+n).toString())}},gi.$metadata$={kind:it,simpleName:"HttpClientEngine",interfaces:[g,E]},xi.prototype.create_dxyxif$=function(t,e){return void 0===t&&(t=Ei),e?e(t):this.create_dxyxif$$default(t)},xi.$metadata$={kind:it,simpleName:"HttpClientEngineFactory",interfaces:[]},Object.defineProperty(Oi.prototype,"coroutineContext",{configurable:!0,get:function(){return this.coroutineContext_huxu0y$_0.value}}),Oi.prototype.close=function(){var t,n,i;if(!1===(i=this).closed_je8r6f$_0&&(i.closed_je8r6f$_0=!0,1)&&null!=(n=e.isType(t=this.coroutineContext.get_j3r2sn$(f.Key),st)?t:null)){var r=n;r.complete(),r.invokeOnCompletion_f05bi3$(Ni(this))}},Oi.$metadata$={kind:x,simpleName:"HttpClientEngineBase",interfaces:[gi]},Object.defineProperty(zi.prototype,"cause",{get:function(){return this.cause_om4vf0$_0}}),zi.$metadata$={kind:x,simpleName:"ClientEngineClosedException",interfaces:[q]},ji.$metadata$={kind:it,simpleName:"HttpClientEngineCapability",interfaces:[]},Object.defineProperty(Ti.prototype,"response",{configurable:!0,get:function(){throw O("Unbound [HttpClientCall] is deprecated. Consider using [request(block)] instead.".toString())}}),Ti.$metadata$={kind:x,simpleName:"HttpClientEngineConfig",interfaces:[]},Object.defineProperty(Ai.prototype,"key",{configurable:!0,get:function(){return Li()}}),Ii.$metadata$={kind:A,simpleName:"Companion",interfaces:[ht]};var Mi=null;function Li(){return null===Mi&&new Ii,Mi}function Di(t){Hi(),this.builder_0=t}function qi(){Bi=this,this.key_2n0sxh$_0=new $("DefaultRequest")}function Fi(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$feature=t,this.local$$receiver=e}Ai.$metadata$={kind:x,simpleName:"KtorCallContextElement",interfaces:[ft]},M("ktor-ktor-client-core-jsLegacy.io.ktor.client.engine.attachToUserJob_mmkme6$",L((function(){var n=t.$$importsForInline$$["kotlinx-coroutines-core"].kotlinx.coroutines.Job,i=t.$$importsForInline$$["kotlinx-coroutines-core"].kotlinx.coroutines.CancellationException_init_pdl1vj$,r=e.kotlin.Unit;return function(t,o){var a;if(null!=(a=e.coroutineReceiver().context.get_j3r2sn$(n.Key))){var s,l,c=a.invokeOnCompletion_ct2b2z$(!0,void 0,(s=t,function(t){if(null!=t)return s.cancel_m4sck1$(i(t.message)),r}));t.invokeOnCompletion_f05bi3$((l=c,function(t){return l.dispose(),r}))}}}))),Object.defineProperty(qi.prototype,"key",{configurable:!0,get:function(){return this.key_2n0sxh$_0}}),qi.prototype.prepare_oh3mgy$$default=function(t){return new Di(t)},Fi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Fi.prototype=Object.create(m.prototype),Fi.prototype.constructor=Fi,Fi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=this.local$$receiver.context;return this.local$closure$feature.builder_0(t),t;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},qi.prototype.install_wojrb5$=function(t,e){var n;e.requestPipeline.intercept_h71y74$(pa().Before,(n=t,function(t,e,i,r){var o=new Fi(n,t,e,this,i);return r?o:o.doResume(null)}))},qi.$metadata$={kind:A,simpleName:"Feature",interfaces:[wr]};var Ui,Bi=null;function Hi(){return null===Bi&&new qi,Bi}function Vi(t,e){m.call(this,e),this.exceptionState_0=1,this.local$statusCode=void 0,this.local$originCall=void 0,this.local$exceptionResponse=void 0,this.local$response=t}function Ki(t,e,n){var i=new Vi(t,e);return n?i:i.doResume(null)}function Wi(t){var e;br(t,(e=t,function(t){return t.expectSuccess=e.expectSuccess,t.validateResponse_d4bkoy$(Ki),h}))}function Yi(t,e){O("Bad response: "+t+'. Text: "'+e+'"',this),this.name="ResponseException",this._response_kjamci$_h84ynm$_0=I(t)}Di.$metadata$={kind:x,simpleName:"DefaultRequest",interfaces:[]},Vi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Vi.prototype=Object.create(m.prototype),Vi.prototype.constructor=Vi,Vi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$response.call.attributes.get_yzaw86$(mr)){this.state_0=2;continue}return;case 1:throw this.exception_0;case 2:if(this.local$statusCode=this.local$response.status.value,this.local$originCall=this.local$response.call,this.local$statusCode<300||this.local$originCall.attributes.contains_w48dwb$(Ui))return;this.state_0=3;continue;case 3:if(this.state_0=4,this.result_0=hi(this.local$originCall,this),this.result_0===y)return y;continue;case 4:var t=this.result_0;t.attributes.put_uuntuo$(Ui,h);var e=t;if(this.local$exceptionResponse=e.response,this.state_0=5,this.result_0=Wa(this.local$exceptionResponse,void 0,this),this.result_0===y)return y;continue;case 5:var n=this.result_0;throw this.local$statusCode>=300&&this.local$statusCode<=399?new Ji(this.local$exceptionResponse,n):this.local$statusCode>=400&&this.local$statusCode<=499?new Qi(this.local$exceptionResponse,n):this.local$statusCode>=500&&this.local$statusCode<=599?new Zi(this.local$exceptionResponse,n):new Yi(this.local$exceptionResponse,n);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}};var Gi=new _("_response");function Ji(t,e){Yi.call(this,t,e),this.name="RedirectResponseException",this.message_rcd2w9$_0="Unhandled redirect: "+t.call.request.url+". Status: "+t.status+'. Text: "'+e+'"'}function Zi(t,e){Yi.call(this,t,e),this.name="ServerResponseException",this.message_3dyog2$_0="Server error("+t.call.request.url+": "+t.status.toString()+'. Text: "'+e+'"'}function Qi(t,e){Yi.call(this,t,e),this.name="ClientRequestException",this.message_mrabda$_0="Client request("+t.call.request.url+") invalid: "+t.status+'. Text: "'+e+'"'}function Xi(t,n){this.closure$body=t,mt.call(this),this.contentType_4t2c6o$_0=null!=n?n:_t.Application.OctetStream,this.contentLength_ca0n1g$_0=e.Long.fromInt(t.length)}function tr(t,e){this.closure$body=t,vt.call(this),this.contentType_4t2c6o$_0=null!=e?e:_t.Application.OctetStream}function er(t,e,n,i){m.call(this,i),this.$controller=n,this.exceptionState_0=1,this.local$$receiver=t,this.local$body=e}function nr(t,e,n,i){var r=new er(t,e,this,n);return i?r:r.doResume(null)}function ir(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=6,this.local$closure$body=t,this.local$closure$response=e,this.local$$receiver=n}function rr(t,e){return function(n,i,r){var o=new ir(t,e,n,this,i);return r?o:o.doResume(null)}}function or(t){return function(e){return t.complete(),h}}function ar(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$client=t,this.local$info=void 0,this.local$body=void 0,this.local$contentLength=void 0,this.local$$receiver=e,this.local$f=n}function sr(t){var e,n=t;t.requestPipeline.intercept_h71y74$(pa().Render,nr),t.responsePipeline.intercept_h71y74$(za().Parse,(e=n,function(t,n,i,r){var o=new ar(e,t,n,this,i);return r?o:o.doResume(null)}))}function lr(t,e,n){gr(),this.responseValidators_0=t,this.callExceptionHandlers_0=e,this.expectSuccess_0=n}function cr(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$response=e}function ur(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$cause=e}function pr(){this.responseValidators_8be2vx$=at(),this.responseExceptionHandlers_8be2vx$=at(),this.expectSuccess=!0}function hr(){$r=this,this.key_uukd7r$_0=new $("HttpResponseValidator")}function fr(t){return function(){return t.expectSuccess_0}}function dr(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=6,this.local$closure$feature=t,this.local$unwrappedCause=void 0,this.local$$receiver=e,this.local$it=n}function _r(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=6,this.local$closure$feature=t,this.local$unwrappedCause=void 0,this.local$$receiver=e,this.local$container=n}function yr(t,e,n,i,r,o){m.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$feature=t,this.local$call=n}Object.defineProperty(Yi.prototype,"_response_kjamci$_0",{configurable:!0,get:function(){return this._response_kjamci$_h84ynm$_0.getValue_lrcp0p$(this,Gi)}}),Object.defineProperty(Yi.prototype,"response",{configurable:!0,get:function(){var t;if(null==(t=this._response_kjamci$_0))throw O("Failed to access response from a different native thread".toString());return t}}),Yi.$metadata$={kind:x,simpleName:"ResponseException",interfaces:[q]},Object.defineProperty(Ji.prototype,"message",{configurable:!0,get:function(){return this.message_rcd2w9$_0}}),Ji.$metadata$={kind:x,simpleName:"RedirectResponseException",interfaces:[Yi]},Object.defineProperty(Zi.prototype,"message",{configurable:!0,get:function(){return this.message_3dyog2$_0}}),Zi.$metadata$={kind:x,simpleName:"ServerResponseException",interfaces:[Yi]},Object.defineProperty(Qi.prototype,"message",{configurable:!0,get:function(){return this.message_mrabda$_0}}),Qi.$metadata$={kind:x,simpleName:"ClientRequestException",interfaces:[Yi]},Object.defineProperty(Xi.prototype,"contentType",{configurable:!0,get:function(){return this.contentType_4t2c6o$_0}}),Object.defineProperty(Xi.prototype,"contentLength",{configurable:!0,get:function(){return this.contentLength_ca0n1g$_0}}),Xi.prototype.bytes=function(){return this.closure$body},Xi.$metadata$={kind:x,interfaces:[mt]},Object.defineProperty(tr.prototype,"contentType",{configurable:!0,get:function(){return this.contentType_4t2c6o$_0}}),tr.prototype.readFrom=function(){return this.closure$body},tr.$metadata$={kind:x,interfaces:[vt]},er.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},er.prototype=Object.create(m.prototype),er.prototype.constructor=er,er.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;null==this.local$$receiver.context.headers.get_61zpoe$(rt.HttpHeaders.Accept)&&this.local$$receiver.context.headers.append_puj7f4$(rt.HttpHeaders.Accept,"*/*");var n=null!=(t=this.local$$receiver.context.headers.get_61zpoe$(rt.HttpHeaders.ContentType))?_t.Companion.parse_61zpoe$(t):null,i="string"==typeof this.local$body?new yt(this.local$body,null!=n?n:_t.Text.Plain):e.isByteArray(this.local$body)?new Xi(this.local$body,n):e.isType(this.local$body,j)?new tr(this.local$body,n):null;if(null!=i){if(this.local$$receiver.context.headers.remove_61zpoe$(rt.HttpHeaders.ContentType),this.state_0=2,this.result_0=this.local$$receiver.proceedWith_trkh7z$(i,this),this.result_0===y)return y;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:case 3:return h;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ir.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},ir.prototype=Object.create(m.prototype),ir.prototype.constructor=ir,ir.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=3,this.state_0=1,this.result_0=Nt(this.local$closure$body,this.local$$receiver.channel,gt,this),this.result_0===y)return y;continue;case 1:this.exceptionState_0=6,this.finallyPath_0=[2],this.state_0=4,this.$returnValue=this.result_0;continue;case 2:return this.$returnValue;case 3:this.finallyPath_0=[6],this.exceptionState_0=4;var t=this.exception_0;throw e.isType(t,zt)?(k(this.local$closure$response,t),t):e.isType(t,R)?(P(this.local$closure$response,"Receive failed",t),t):t;case 4:this.exceptionState_0=6,Ea(this.local$closure$response),this.state_0=this.finallyPath_0.shift();continue;case 5:return;case 6:throw this.exception_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ar.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},ar.prototype=Object.create(m.prototype),ar.prototype.constructor=ar,ar.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n,i;if(this.local$info=this.local$f.component1(),this.local$body=this.local$f.component2(),e.isType(this.local$body,j)){this.state_0=2;continue}return;case 1:throw this.exception_0;case 2:var r=this.local$$receiver.context.response;if(this.local$contentLength=null!=(n=null!=(t=r.headers.get_61zpoe$(rt.HttpHeaders.ContentLength))?$t(t):null)?n:gt,i=this.local$info.type,pt(i,W(Object.getPrototypeOf(wt.Unit).constructor))){if(bt(this.local$body),this.state_0=16,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ma(this.local$info,h),this),this.result_0===y)return y;continue}if(pt(i,St)){if(this.state_0=13,this.result_0=J(this.local$body,this),this.result_0===y)return y;continue}if(pt(i,W(xt))||pt(i,W(Et))){if(this.state_0=10,this.result_0=J(this.local$body,this),this.result_0===y)return y;continue}if(pt(i,Ot)){if(this.state_0=7,this.result_0=Ct(this.local$body,this.local$contentLength,this),this.result_0===y)return y;continue}if(pt(i,W(j))){var o=b(r.coroutineContext.get_j3r2sn$(f.Key)),a=jt(this.local$$receiver,this.local$closure$client.coroutineContext,void 0,rr(this.local$body,r));a.invokeOnCompletion_f05bi3$(or(o));var s=a.channel;if(this.state_0=5,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ma(this.local$info,s),this),this.result_0===y)return y;continue}if(pt(i,W(Tt))){if(bt(this.local$body),this.state_0=3,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ma(this.local$info,r.status),this),this.result_0===y)return y;continue}this.state_0=4;continue;case 3:return this.result_0;case 4:this.state_0=6;continue;case 5:return this.result_0;case 6:this.state_0=9;continue;case 7:var l=this.result_0;if(this.local$contentLength.compareTo_11rb$(gt)<0&&!pt(l.remaining,this.local$contentLength)){var c="Expected "+this.local$contentLength.toString()+", actual "+l.remaining.toString();throw O(c.toString())}if(this.state_0=8,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ma(this.local$info,Z(l)),this),this.result_0===y)return y;continue;case 8:return this.result_0;case 9:this.state_0=12;continue;case 10:if(this.state_0=11,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ma(this.local$info,this.result_0),this),this.result_0===y)return y;continue;case 11:return this.result_0;case 12:this.state_0=15;continue;case 13:if(this.state_0=14,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ma(this.local$info,kt(this.result_0.readText_vux9f0$())),this),this.result_0===y)return y;continue;case 14:return this.result_0;case 15:this.state_0=17;continue;case 16:return this.result_0;case 17:return h;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},cr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},cr.prototype=Object.create(m.prototype),cr.prototype.constructor=cr,cr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$tmp$=this.$this.responseValidators_0.iterator(),this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(!this.local$tmp$.hasNext()){this.state_0=4;continue}var t=this.local$tmp$.next();if(this.state_0=3,this.result_0=t(this.local$response,this),this.result_0===y)return y;continue;case 3:this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},lr.prototype.validateResponse_0=function(t,e,n){var i=new cr(this,t,e);return n?i:i.doResume(null)},ur.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},ur.prototype=Object.create(m.prototype),ur.prototype.constructor=ur,ur.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$tmp$=this.$this.callExceptionHandlers_0.iterator(),this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(!this.local$tmp$.hasNext()){this.state_0=4;continue}var t=this.local$tmp$.next();if(this.state_0=3,this.result_0=t(this.local$cause,this),this.result_0===y)return y;continue;case 3:this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},lr.prototype.processException_0=function(t,e,n){var i=new ur(this,t,e);return n?i:i.doResume(null)},pr.prototype.handleResponseException_9rdja$=function(t){this.responseExceptionHandlers_8be2vx$.add_11rb$(t)},pr.prototype.validateResponse_d4bkoy$=function(t){this.responseValidators_8be2vx$.add_11rb$(t)},pr.$metadata$={kind:x,simpleName:"Config",interfaces:[]},Object.defineProperty(hr.prototype,"key",{configurable:!0,get:function(){return this.key_uukd7r$_0}}),hr.prototype.prepare_oh3mgy$$default=function(t){var e=new pr;t(e);var n=e;return new lr(Pt(n.responseValidators_8be2vx$),Pt(n.responseExceptionHandlers_8be2vx$),n.expectSuccess)},dr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},dr.prototype=Object.create(m.prototype),dr.prototype.constructor=dr,dr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=2,this.local$$receiver.context.attributes.computeIfAbsent_u4q9l2$(mr,fr(this.local$closure$feature)),this.state_0=1,this.result_0=this.local$$receiver.proceedWith_trkh7z$(this.local$it,this),this.result_0===y)return y;continue;case 1:return this.result_0;case 2:this.exceptionState_0=6;var t=this.exception_0;if(e.isType(t,R)){if(this.local$unwrappedCause=t,this.state_0=3,this.result_0=this.local$closure$feature.processException_0(this.local$unwrappedCause,this),this.result_0===y)return y;continue}throw t;case 3:throw this.local$unwrappedCause;case 4:this.state_0=5;continue;case 5:return;case 6:throw this.exception_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},_r.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},_r.prototype=Object.create(m.prototype),_r.prototype.constructor=_r,_r.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=2,this.state_0=1,this.result_0=this.local$$receiver.proceedWith_trkh7z$(this.local$container,this),this.result_0===y)return y;continue;case 1:return this.result_0;case 2:this.exceptionState_0=6;var t=this.exception_0;if(e.isType(t,R)){if(this.local$unwrappedCause=t,this.state_0=3,this.result_0=this.local$closure$feature.processException_0(this.local$unwrappedCause,this),this.result_0===y)return y;continue}throw t;case 3:throw this.local$unwrappedCause;case 4:this.state_0=5;continue;case 5:return;case 6:throw this.exception_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},yr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},yr.prototype=Object.create(m.prototype),yr.prototype.constructor=yr,yr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$feature.validateResponse_0(this.local$call.response,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.local$call;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},hr.prototype.install_wojrb5$=function(t,e){var n;e.requestPipeline.intercept_h71y74$(pa().Before,(n=t,function(t,e,i,r){var o=new dr(n,t,e,this,i);return r?o:o.doResume(null)}));var i=new Rt("BeforeReceive");e.responsePipeline.insertPhaseBefore_b9zzbm$(za().Receive,i),e.responsePipeline.intercept_h71y74$(i,function(t){return function(e,n,i,r){var o=new _r(t,e,n,this,i);return r?o:o.doResume(null)}}(t)),xr(e,oo()).intercept_vsqnz3$(function(t){return function(e,n,i,r,o){var a=new yr(t,e,n,i,this,r);return o?a:a.doResume(null)}}(t))},hr.$metadata$={kind:A,simpleName:"Companion",interfaces:[wr]};var mr,vr,$r=null;function gr(){return null===$r&&new hr,$r}function br(t,e){t.install_xlxg29$(gr(),e)}function wr(){}function kr(t){return h}function Sr(t,e){var n;return null!=(n=t.attributes.getOrNull_yzaw86$(vr))?n.getOrNull_yzaw86$(e.key):null}function xr(t,e){var n=Sr(t,e);if(null!=n)return n;var i="Feature "+e+" is not installed. Consider using `install("+e.key+")` in client config first.";throw O(i.toString())}lr.$metadata$={kind:x,simpleName:"HttpCallValidator",interfaces:[]},wr.prototype.prepare_oh3mgy$=function(t,e){return void 0===t&&(t=kr),e?e(t):this.prepare_oh3mgy$$default(t)},wr.$metadata$={kind:it,simpleName:"HttpClientFeature",interfaces:[]};var Er=L((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(i),r(n))}}})),Cr=L((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(n),r(i))}}}));function Or(t,e,n,i){var r,o,a;Ar(),this.responseCharsetFallback_0=i,this.requestCharset_0=null,this.acceptCharsetHeader_0=null;var s,l=Wt(Ht(e),new Yt(Er(Ir))),c=at();for(s=t.iterator();s.hasNext();){var u=s.next();e.containsKey_11rb$(u)||c.add_11rb$(u)}var p,h,f=Wt(c,new Yt(Cr(Mr))),d=Gt();for(p=f.iterator();p.hasNext();){var _=p.next();d.length>0&&d.append_pdl1vj$(","),d.append_pdl1vj$(Vt(_))}for(h=l.iterator();h.hasNext();){var y=h.next(),m=y.component1(),v=y.component2();if(d.length>0&&d.append_pdl1vj$(","),!It(At(0,1),v))throw O("Check failed.".toString());var $=Jt(100*v)/100;d.append_pdl1vj$(Vt(m)+";q="+$)}0===d.length&&d.append_pdl1vj$(Vt(this.responseCharsetFallback_0)),this.acceptCharsetHeader_0=d.toString(),this.requestCharset_0=null!=(a=null!=(o=null!=n?n:Kt(f))?o:null!=(r=Kt(l))?r.first:null)?a:Mt.Charsets.UTF_8}function Nr(){this.charsets_8be2vx$=Zt(),this.charsetQuality_8be2vx$=Qt(),this.sendCharset=null,this.responseCharsetFallback=Mt.Charsets.UTF_8,this.defaultCharset=Mt.Charsets.UTF_8}function zr(){Rr=this,this.key_wkh146$_0=new $("HttpPlainText")}function jr(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$feature=t,this.local$contentType=void 0,this.local$$receiver=e,this.local$content=n}function Tr(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$feature=t,this.local$info=void 0,this.local$body=void 0,this.local$$receiver=e,this.local$f=n}Nr.prototype.register_qv516$=function(t,e){if(void 0===e&&(e=null),null!=e&&!It(At(0,1),e))throw O("Check failed.".toString());this.charsets_8be2vx$.add_11rb$(t),null==e?this.charsetQuality_8be2vx$.remove_11rb$(t):this.charsetQuality_8be2vx$.put_xwzc9p$(t,e)},Nr.$metadata$={kind:x,simpleName:"Config",interfaces:[]},Object.defineProperty(zr.prototype,"key",{configurable:!0,get:function(){return this.key_wkh146$_0}}),zr.prototype.prepare_oh3mgy$$default=function(t){var e=new Nr;t(e);var n=e;return new Or(n.charsets_8be2vx$,n.charsetQuality_8be2vx$,n.sendCharset,n.responseCharsetFallback)},jr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},jr.prototype=Object.create(m.prototype),jr.prototype.constructor=jr,jr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$closure$feature.addCharsetHeaders_jc2hdt$(this.local$$receiver.context),"string"!=typeof this.local$content)return;this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$contentType=Lt(this.local$$receiver.context),null==this.local$contentType||pt(this.local$contentType.contentType,_t.Text.Plain.contentType)){this.state_0=3;continue}return;case 3:var t=null!=this.local$contentType?Dt(this.local$contentType):null;if(this.state_0=4,this.result_0=this.local$$receiver.proceedWith_trkh7z$(this.local$closure$feature.wrapContent_0(this.local$content,t),this),this.result_0===y)return y;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Tr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Tr.prototype=Object.create(m.prototype),Tr.prototype.constructor=Tr,Tr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.local$info=this.local$f.component1(),this.local$body=this.local$f.component2(),null!=(t=this.local$info.type)&&t.equals(qt)&&e.isType(this.local$body,j)){this.state_0=2;continue}return;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=J(this.local$body,this),this.result_0===y)return y;continue;case 3:var n=this.result_0,i=this.local$closure$feature.read_r18uy3$(this.local$$receiver.context,n);if(this.state_0=4,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ma(this.local$info,i),this),this.result_0===y)return y;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},zr.prototype.install_wojrb5$=function(t,e){var n;e.requestPipeline.intercept_h71y74$(pa().Render,(n=t,function(t,e,i,r){var o=new jr(n,t,e,this,i);return r?o:o.doResume(null)})),e.responsePipeline.intercept_h71y74$(za().Parse,function(t){return function(e,n,i,r){var o=new Tr(t,e,n,this,i);return r?o:o.doResume(null)}}(t))},zr.$metadata$={kind:A,simpleName:"Feature",interfaces:[wr]};var Pr,Rr=null;function Ar(){return null===Rr&&new zr,Rr}function Ir(t){return t.second}function Mr(t){return Vt(t)}function Lr(){Br(),this._checkHttpMethod_0=!0,this._allowHttpsDowngrade_0=!1}function Dr(){Ur=this,this.key_oxn36d$_0=new $("HttpRedirect")}function qr(t,e,n,i,r,o,a){m.call(this,a),this.$controller=o,this.exceptionState_0=1,this.local$closure$feature=t,this.local$this$HttpRedirect$=e,this.local$$receiver=n,this.local$origin=i,this.local$context=r}function Fr(t,e,n,i,r,o){m.call(this,o),this.exceptionState_0=1,this.$this=t,this.local$call=void 0,this.local$requestBuilder=void 0,this.local$originProtocol=void 0,this.local$originAuthority=void 0,this.local$$receiver=void 0,this.local$$receiver_0=e,this.local$context=n,this.local$origin=i,this.local$allowHttpsDowngrade=r}Or.prototype.wrapContent_0=function(t,e){var n=null!=e?e:this.requestCharset_0;return new yt(t,Ft(_t.Text.Plain,n))},Or.prototype.read_r18uy3$=function(t,e){var n,i=null!=(n=Ut(t.response))?n:this.responseCharsetFallback_0;return Bt(e,i)},Or.prototype.addCharsetHeaders_jc2hdt$=function(t){null==t.headers.get_61zpoe$(rt.HttpHeaders.AcceptCharset)&&t.headers.set_puj7f4$(rt.HttpHeaders.AcceptCharset,this.acceptCharsetHeader_0)},Object.defineProperty(Or.prototype,"defaultCharset",{configurable:!0,get:function(){throw O("defaultCharset is deprecated".toString())},set:function(t){throw O("defaultCharset is deprecated".toString())}}),Or.$metadata$={kind:x,simpleName:"HttpPlainText",interfaces:[]},Object.defineProperty(Lr.prototype,"checkHttpMethod",{configurable:!0,get:function(){return this._checkHttpMethod_0},set:function(t){this._checkHttpMethod_0=t}}),Object.defineProperty(Lr.prototype,"allowHttpsDowngrade",{configurable:!0,get:function(){return this._allowHttpsDowngrade_0},set:function(t){this._allowHttpsDowngrade_0=t}}),Object.defineProperty(Dr.prototype,"key",{configurable:!0,get:function(){return this.key_oxn36d$_0}}),Dr.prototype.prepare_oh3mgy$$default=function(t){var e=new Lr;return t(e),e},qr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},qr.prototype=Object.create(m.prototype),qr.prototype.constructor=qr,qr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$closure$feature.checkHttpMethod&&!Pr.contains_11rb$(this.local$origin.request.method))return this.local$origin;this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.local$this$HttpRedirect$.handleCall_0(this.local$$receiver,this.local$context,this.local$origin,this.local$closure$feature.allowHttpsDowngrade,this),this.result_0===y)return y;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Dr.prototype.install_wojrb5$=function(t,e){var n,i;xr(e,oo()).intercept_vsqnz3$((n=t,i=this,function(t,e,r,o,a){var s=new qr(n,i,t,e,r,this,o);return a?s:s.doResume(null)}))},Fr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Fr.prototype=Object.create(m.prototype),Fr.prototype.constructor=Fr,Fr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(Hr(this.local$origin.response.status)){this.state_0=2;continue}return this.local$origin;case 1:throw this.exception_0;case 2:this.local$call={v:this.local$origin},this.local$requestBuilder={v:this.local$context},this.local$originProtocol=this.local$origin.request.url.protocol,this.local$originAuthority=ee(this.local$origin.request.url),this.state_0=3;continue;case 3:var t=this.local$call.v.response.headers.get_61zpoe$(rt.HttpHeaders.Location);if(this.local$$receiver=new Xo,this.local$$receiver.takeFromWithExecutionContext_s9rlw$(this.local$requestBuilder.v),this.local$$receiver.url.parameters.clear(),null!=t&&ne(this.local$$receiver.url,t),this.local$allowHttpsDowngrade||!ie(this.local$originProtocol)||ie(this.local$$receiver.url.protocol)){this.state_0=4;continue}return this.local$call.v;case 4:if(pt(this.local$originAuthority,re(this.local$$receiver.url))||this.local$$receiver.headers.remove_61zpoe$(rt.HttpHeaders.Authorization),this.local$requestBuilder.v=this.local$$receiver,this.state_0=5,this.result_0=this.local$$receiver_0.execute_s9rlw$(this.local$requestBuilder.v,this),this.result_0===y)return y;continue;case 5:if(this.local$call.v=this.result_0,Hr(this.local$call.v.response.status)){this.state_0=6;continue}return this.local$call.v;case 6:this.state_0=3;continue;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Dr.prototype.handleCall_0=function(t,e,n,i,r,o){var a=new Fr(this,t,e,n,i,r);return o?a:a.doResume(null)},Dr.$metadata$={kind:A,simpleName:"Feature",interfaces:[wr]};var Ur=null;function Br(){return null===Ur&&new Dr,Ur}function Hr(t){var e;return(e=t.value)===Tt.Companion.MovedPermanently.value||e===Tt.Companion.Found.value||e===Tt.Companion.TemporaryRedirect.value||e===Tt.Companion.PermanentRedirect.value||e===Tt.Companion.SeeOther.value}function Vr(){Gr()}function Kr(){Yr=this,this.key_livr7a$_0=new $("RequestLifecycle")}function Wr(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=6,this.local$closure$scope=t,this.local$executionContext=void 0,this.local$$receiver=e}Lr.$metadata$={kind:x,simpleName:"HttpRedirect",interfaces:[]},Object.defineProperty(Kr.prototype,"key",{configurable:!0,get:function(){return this.key_livr7a$_0}}),Kr.prototype.prepare_oh3mgy$$default=function(t){return new Vr},Wr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Wr.prototype=Object.create(m.prototype),Wr.prototype.constructor=Wr,Wr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=b(this.local$$receiver.context.executionContext);if(S(t),this.local$executionContext=t,Jr(this.local$executionContext,d(this.local$closure$scope.coroutineContext.get_j3r2sn$(f.Key))),this.exceptionState_0=3,this.local$$receiver.context.executionContext=this.local$executionContext,this.state_0=1,this.result_0=this.local$$receiver.proceed(this),this.result_0===y)return y;continue;case 1:this.exceptionState_0=6,this.finallyPath_0=[2],this.state_0=4,this.$returnValue=this.result_0;continue;case 2:return this.$returnValue;case 3:this.finallyPath_0=[6],this.exceptionState_0=4;var n=this.exception_0;throw e.isType(n,R)?(this.local$executionContext.completeExceptionally_tcv7n7$(n),n):n;case 4:this.exceptionState_0=6,this.local$executionContext.complete(),this.state_0=this.finallyPath_0.shift();continue;case 5:return;case 6:throw this.exception_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Kr.prototype.install_wojrb5$=function(t,e){var n;e.requestPipeline.intercept_h71y74$(pa().Before,(n=e,function(t,e,i,r){var o=new Wr(n,t,e,this,i);return r?o:o.doResume(null)}))},Kr.$metadata$={kind:A,simpleName:"Feature",interfaces:[wr]};var Yr=null;function Gr(){return null===Yr&&new Kr,Yr}function Jr(t,e){S(e);var n,i,r=e.invokeOnCompletion_f05bi3$((n=t,function(t){return null!=t?oe(n,"Engine failed",t):n.complete(),h}));t.invokeOnCompletion_f05bi3$((i=r,function(t){return i.dispose(),h}))}function Zr(t){this.value_0=t}function Qr(){}function Xr(t){oo(),void 0===t&&(t=20),this.maxSendCount_scppen$_0=new Zr(t),this.interceptors_0=os(),S(this)}Vr.$metadata$={kind:x,simpleName:"HttpRequestLifecycle",interfaces:[]},Zr.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},Zr.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},Zr.$metadata$={kind:x,interfaces:[C]},Qr.$metadata$={kind:it,simpleName:"Sender",interfaces:[]};var to=new _("maxSendCount");function eo(t,e,n,i,r,o){m.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$block=t,this.local$$receiver=e,this.local$call=n}function no(){ro=this,this.key_x494tl$_0=new $("HttpSend")}function io(t,e,n,i,r,o){m.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$feature=t,this.local$closure$scope=e,this.local$tmp$=void 0,this.local$sender=void 0,this.local$currentCall=void 0,this.local$callChanged=void 0,this.local$transformed=void 0,this.local$$receiver=n,this.local$content=i}Object.defineProperty(Xr.prototype,"maxSendCount",{configurable:!0,get:function(){return this.maxSendCount_scppen$_0.getValue_lrcp0p$(this,to)},set:function(t){this.maxSendCount_scppen$_0.setValue_9rddgb$(this,to,t)}}),Xr.prototype.intercept_vsqnz3$=function(t){this.interceptors_0.add_11rb$(t)},eo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},eo.prototype=Object.create(m.prototype),eo.prototype.constructor=eo,eo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$block(this.local$$receiver,this.local$call,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Xr.prototype.intercept_efqc3v$=function(t){var e;this.interceptors_0.add_11rb$((e=t,function(t,n,i,r,o){var a=new eo(e,t,n,i,this,r);return o?a:a.doResume(null)}))},Object.defineProperty(no.prototype,"key",{configurable:!0,get:function(){return this.key_x494tl$_0}}),no.prototype.prepare_oh3mgy$$default=function(t){var e=new Xr;return t(e),e},io.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},io.prototype=Object.create(m.prototype),io.prototype.constructor=io,io.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(!e.isType(this.local$content,ae)){var t=H("\n|Fail to serialize body. Content has type: "+e.getKClassFromExpression(this.local$content)+", but OutgoingContent expected.\n|If you expect serialized body, please check that you have installed the corresponding feature(like `Json`) and set `Content-Type` header.");throw O(t.toString())}if(this.local$$receiver.context.body=this.local$content,this.local$sender=new ao(this.local$closure$feature.maxSendCount,this.local$closure$scope),this.state_0=2,this.result_0=this.local$sender.execute_s9rlw$(this.local$$receiver.context,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:this.local$currentCall=this.result_0,this.state_0=3;continue;case 3:this.local$callChanged=!1,this.local$tmp$=this.local$closure$feature.interceptors_0.iterator(),this.state_0=4;continue;case 4:if(!this.local$tmp$.hasNext()){this.state_0=7;continue}var n=this.local$tmp$.next();if(this.state_0=5,this.result_0=n(this.local$sender,this.local$currentCall,this.local$$receiver.context,this),this.result_0===y)return y;continue;case 5:if(this.local$transformed=this.result_0,this.local$transformed===this.local$currentCall){this.state_0=4;continue}this.state_0=6;continue;case 6:this.local$currentCall=this.local$transformed,this.local$callChanged=!0,this.state_0=7;continue;case 7:if(!this.local$callChanged){this.state_0=8;continue}this.state_0=3;continue;case 8:if(this.state_0=9,this.result_0=this.local$$receiver.proceedWith_trkh7z$(this.local$currentCall,this),this.result_0===y)return y;continue;case 9:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},no.prototype.install_wojrb5$=function(t,e){var n,i;e.requestPipeline.intercept_h71y74$(pa().Send,(n=t,i=e,function(t,e,r,o){var a=new io(n,i,t,e,this,r);return o?a:a.doResume(null)}))},no.$metadata$={kind:A,simpleName:"Feature",interfaces:[wr]};var ro=null;function oo(){return null===ro&&new no,ro}function ao(t,e){this.maxSendCount_0=t,this.client_0=e,this.sentCount_0=0,this.currentCall_0=null}function so(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$requestBuilder=e}function lo(t){O(t,this),this.name="SendCountExceedException"}function co(t){this.value_0=t}function uo(t,e,n){Eo(),this.requestTimeoutMillis_0=t,this.connectTimeoutMillis_0=e,this.socketTimeoutMillis_0=n}function po(){vo(),this._requestTimeoutMillis_4dr633$_0=new co(le),this._connectTimeoutMillis_yp3bu2$_0=new co(le),this._socketTimeoutMillis_d8nrb$_0=new co(le)}so.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},so.prototype=Object.create(m.prototype),so.prototype.constructor=so,so.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n,i;if(null!=(t=this.$this.currentCall_0)&&k(t),this.$this.sentCount_0>=this.$this.maxSendCount_0)throw new lo("Max send count "+this.$this.maxSendCount_0+" exceeded");if(this.$this.sentCount_0=this.$this.sentCount_0+1|0,this.state_0=2,this.result_0=this.$this.client_0.sendPipeline.execute_8pmvt0$(this.local$requestBuilder,this.local$requestBuilder.body,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:var r=this.result_0;if(null==(i=e.isType(n=r,Vn)?n:null))throw O(("Failed to execute send pipeline. Expected to got [HttpClientCall], but received "+r.toString()).toString());var o=i;return this.$this.currentCall_0=o,o;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ao.prototype.execute_s9rlw$=function(t,e,n){var i=new so(this,t,e);return n?i:i.doResume(null)},ao.$metadata$={kind:x,simpleName:"DefaultSender",interfaces:[Qr]},Xr.$metadata$={kind:x,simpleName:"HttpSend",interfaces:[]},lo.$metadata$={kind:x,simpleName:"SendCountExceedException",interfaces:[q]},co.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},co.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},co.$metadata$={kind:x,interfaces:[C]};var ho=new _("_requestTimeoutMillis");Object.defineProperty(po.prototype,"_requestTimeoutMillis_0",{configurable:!0,get:function(){return this._requestTimeoutMillis_4dr633$_0.getValue_lrcp0p$(this,ho)},set:function(t){this._requestTimeoutMillis_4dr633$_0.setValue_9rddgb$(this,ho,t)}});var fo=new _("_connectTimeoutMillis");Object.defineProperty(po.prototype,"_connectTimeoutMillis_0",{configurable:!0,get:function(){return this._connectTimeoutMillis_yp3bu2$_0.getValue_lrcp0p$(this,fo)},set:function(t){this._connectTimeoutMillis_yp3bu2$_0.setValue_9rddgb$(this,fo,t)}});var _o=new _("_socketTimeoutMillis");function yo(){mo=this,this.key=new $("TimeoutConfiguration")}Object.defineProperty(po.prototype,"_socketTimeoutMillis_0",{configurable:!0,get:function(){return this._socketTimeoutMillis_d8nrb$_0.getValue_lrcp0p$(this,_o)},set:function(t){this._socketTimeoutMillis_d8nrb$_0.setValue_9rddgb$(this,_o,t)}}),Object.defineProperty(po.prototype,"requestTimeoutMillis",{configurable:!0,get:function(){return this._requestTimeoutMillis_0},set:function(t){this._requestTimeoutMillis_0=this.checkTimeoutValue_0(t)}}),Object.defineProperty(po.prototype,"connectTimeoutMillis",{configurable:!0,get:function(){return this._connectTimeoutMillis_0},set:function(t){this._connectTimeoutMillis_0=this.checkTimeoutValue_0(t)}}),Object.defineProperty(po.prototype,"socketTimeoutMillis",{configurable:!0,get:function(){return this._socketTimeoutMillis_0},set:function(t){this._socketTimeoutMillis_0=this.checkTimeoutValue_0(t)}}),po.prototype.build_8be2vx$=function(){return new uo(this.requestTimeoutMillis,this.connectTimeoutMillis,this.socketTimeoutMillis)},po.prototype.checkTimeoutValue_0=function(t){if(!(null==t||t.toNumber()>0))throw Q("Only positive timeout values are allowed, for infinite timeout use HttpTimeout.INFINITE_TIMEOUT_MS".toString());return t},po.prototype.equals=function(t){var n;return!!(this===t||null!=t&&null!=(n=e.getKClassFromExpression(this))&&n.equals(e.getKClassFromExpression(t))&&(e.isType(t,po)||v(),pt(this._requestTimeoutMillis_0,t._requestTimeoutMillis_0)&&pt(this._connectTimeoutMillis_0,t._connectTimeoutMillis_0)&&pt(this._socketTimeoutMillis_0,t._socketTimeoutMillis_0)))},po.prototype.hashCode=function(){var t,e,n,i,r,o,a=null!=(e=null!=(t=this._requestTimeoutMillis_0)?se(t):null)?e:0;return a=(31*(a=(31*a|0)+(null!=(i=null!=(n=this._connectTimeoutMillis_0)?se(n):null)?i:0)|0)|0)+(null!=(o=null!=(r=this._socketTimeoutMillis_0)?se(r):null)?o:0)|0},yo.$metadata$={kind:A,simpleName:"Companion",interfaces:[]};var mo=null;function vo(){return null===mo&&new yo,mo}function $o(t,e,n,i){return void 0===t&&(t=null),void 0===e&&(e=null),void 0===n&&(n=null),i=i||Object.create(po.prototype),po.call(i),i.requestTimeoutMillis=t,i.connectTimeoutMillis=e,i.socketTimeoutMillis=n,i}function go(){xo=this,this.key_g1vqj4$_0=new $("TimeoutFeature"),this.INFINITE_TIMEOUT_MS=gt}function bo(t,e,n,i,r,o){m.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$requestTimeout=t,this.local$closure$executionContext=e,this.local$this$=n}function wo(t,e,n){return function(i,r,o){var a=new bo(t,e,n,i,this,r);return o?a:a.doResume(null)}}function ko(t){return function(e){return t.cancel_m4sck1$(),h}}function So(t,e,n,i,r,o,a){m.call(this,a),this.$controller=o,this.exceptionState_0=1,this.local$closure$feature=t,this.local$this$HttpTimeout$=e,this.local$closure$scope=n,this.local$$receiver=i}po.$metadata$={kind:x,simpleName:"HttpTimeoutCapabilityConfiguration",interfaces:[]},uo.prototype.hasNotNullTimeouts_0=function(){return null!=this.requestTimeoutMillis_0||null!=this.connectTimeoutMillis_0||null!=this.socketTimeoutMillis_0},Object.defineProperty(go.prototype,"key",{configurable:!0,get:function(){return this.key_g1vqj4$_0}}),go.prototype.prepare_oh3mgy$$default=function(t){var e=$o();return t(e),e.build_8be2vx$()},bo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},bo.prototype=Object.create(m.prototype),bo.prototype.constructor=bo,bo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=ce(this.local$closure$requestTimeout,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.local$closure$executionContext.cancel_m4sck1$(new Co(this.local$this$.context)),h;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},So.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},So.prototype=Object.create(m.prototype),So.prototype.constructor=So,So.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e=this.local$$receiver.context.getCapabilityOrNull_i25mbv$(Eo());if(null==e&&this.local$closure$feature.hasNotNullTimeouts_0()&&(e=$o(),this.local$$receiver.context.setCapability_wfl2px$(Eo(),e)),null!=e){var n=e,i=this.local$closure$feature,r=this.local$this$HttpTimeout$,o=this.local$closure$scope;t:do{var a,s,l,c;n.connectTimeoutMillis=null!=(a=n.connectTimeoutMillis)?a:i.connectTimeoutMillis_0,n.socketTimeoutMillis=null!=(s=n.socketTimeoutMillis)?s:i.socketTimeoutMillis_0,n.requestTimeoutMillis=null!=(l=n.requestTimeoutMillis)?l:i.requestTimeoutMillis_0;var u=null!=(c=n.requestTimeoutMillis)?c:i.requestTimeoutMillis_0;if(null==u||pt(u,r.INFINITE_TIMEOUT_MS))break t;var p=this.local$$receiver.context.executionContext,h=ue(o,void 0,void 0,wo(u,p,this.local$$receiver));this.local$$receiver.context.executionContext.invokeOnCompletion_f05bi3$(ko(h))}while(0);t=n}else t=null;return t;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},go.prototype.install_wojrb5$=function(t,e){var n,i,r;e.requestPipeline.intercept_h71y74$(pa().Before,(n=t,i=this,r=e,function(t,e,o,a){var s=new So(n,i,r,t,e,this,o);return a?s:s.doResume(null)}))},go.$metadata$={kind:A,simpleName:"Feature",interfaces:[ji,wr]};var xo=null;function Eo(){return null===xo&&new go,xo}function Co(t){var e,n;dt("Request timeout has been expired [url="+t.url.buildString()+", request_timeout="+(null!=(n=null!=(e=t.getCapabilityOrNull_i25mbv$(Eo()))?e.requestTimeoutMillis:null)?n:"unknown").toString()+" ms]",this),this.name="HttpRequestTimeoutException"}function Oo(t,e){var n;if(null==(n=t.client))throw O("Fail to create response observer in different native thread.".toString());return new No(n,e,t)}function No(t,e,n){Vn.call(this,t),this.request=new zo(this,n.request),this.response=new jo(this,e,n.response)}function zo(t,e){this.call_lxy36a$_0=t,this.$delegate_pysw8w$_0=e}function jo(t,e,n){Sa.call(this),this.call_c6mvxe$_0=t,this.content_luf9up$_0=e,this.origin_0=n,this.coroutineContext_62th7f$_0=this.origin_0.coroutineContext}function To(t){Fo(),this.responseHandler_0=t}function Po(){this.responseHandler_8be2vx$=Ao}function Ro(t,e){m.call(this,e),this.exceptionState_0=1}function Ao(t,e,n){var i=new Ro(t,e);return n?i:i.doResume(null)}function Io(){qo=this,this.key_1kjwna$_0=new $("BodyInterceptor")}function Mo(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=6,this.local$closure$feature=t,this.local$closure$sideCall=e}function Lo(t,e){return function(n,i,r){var o=new Mo(t,e,n,this,i);return r?o:o.doResume(null)}}function Do(t,e,n,i,r,o){m.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$scope=t,this.local$closure$feature=e,this.local$$receiver=n,this.local$response=i}uo.$metadata$={kind:x,simpleName:"HttpTimeout",interfaces:[]},Co.$metadata$={kind:x,simpleName:"HttpRequestTimeoutException",interfaces:[zt]},No.$metadata$={kind:x,simpleName:"DelegatedCall",interfaces:[Vn]},Object.defineProperty(zo.prototype,"call",{get:function(){return this.call_lxy36a$_0}}),Object.defineProperty(zo.prototype,"attributes",{configurable:!0,get:function(){return this.$delegate_pysw8w$_0.attributes}}),Object.defineProperty(zo.prototype,"content",{configurable:!0,get:function(){return this.$delegate_pysw8w$_0.content}}),Object.defineProperty(zo.prototype,"coroutineContext",{configurable:!0,get:function(){return this.$delegate_pysw8w$_0.coroutineContext}}),Object.defineProperty(zo.prototype,"executionContext",{configurable:!0,get:function(){return this.$delegate_pysw8w$_0.executionContext}}),Object.defineProperty(zo.prototype,"headers",{configurable:!0,get:function(){return this.$delegate_pysw8w$_0.headers}}),Object.defineProperty(zo.prototype,"method",{configurable:!0,get:function(){return this.$delegate_pysw8w$_0.method}}),Object.defineProperty(zo.prototype,"url",{configurable:!0,get:function(){return this.$delegate_pysw8w$_0.url}}),zo.$metadata$={kind:x,simpleName:"DelegatedRequest",interfaces:[Qo]},Object.defineProperty(jo.prototype,"call",{get:function(){return this.call_c6mvxe$_0}}),Object.defineProperty(jo.prototype,"content",{get:function(){return this.content_luf9up$_0}}),Object.defineProperty(jo.prototype,"coroutineContext",{configurable:!0,get:function(){return this.coroutineContext_62th7f$_0}}),Object.defineProperty(jo.prototype,"status",{configurable:!0,get:function(){return this.origin_0.status}}),Object.defineProperty(jo.prototype,"version",{configurable:!0,get:function(){return this.origin_0.version}}),Object.defineProperty(jo.prototype,"requestTime",{configurable:!0,get:function(){return this.origin_0.requestTime}}),Object.defineProperty(jo.prototype,"responseTime",{configurable:!0,get:function(){return this.origin_0.responseTime}}),Object.defineProperty(jo.prototype,"headers",{configurable:!0,get:function(){return this.origin_0.headers}}),jo.$metadata$={kind:x,simpleName:"DelegatedResponse",interfaces:[Sa]},Po.prototype.onResponse_d4bkoy$=function(t){this.responseHandler_8be2vx$=t},Ro.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Ro.prototype=Object.create(m.prototype),Ro.prototype.constructor=Ro,Ro.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return h;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Po.$metadata$={kind:x,simpleName:"Config",interfaces:[]},Object.defineProperty(Io.prototype,"key",{configurable:!0,get:function(){return this.key_1kjwna$_0}}),Io.prototype.prepare_oh3mgy$$default=function(t){var e=new Po;return t(e),new To(e.responseHandler_8be2vx$)},Mo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Mo.prototype=Object.create(m.prototype),Mo.prototype.constructor=Mo,Mo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=2,this.state_0=1,this.result_0=this.local$closure$feature.responseHandler_0(this.local$closure$sideCall.response,this),this.result_0===y)return y;continue;case 1:this.exceptionState_0=6,this.state_0=3;continue;case 2:this.exceptionState_0=6;var t=this.exception_0;if(!e.isType(t,R))throw t;this.state_0=3;continue;case 3:var n=this.local$closure$sideCall.response.content;if(n.isClosedForRead){this.state_0=5;continue}if(this.state_0=4,this.result_0=be(n,this),this.result_0===y)return y;continue;case 4:case 5:return h;case 6:throw this.exception_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Do.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Do.prototype=Object.create(m.prototype),Do.prototype.constructor=Do,Do.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=ge(this.local$response.content,this.local$response),i=n.component1(),r=n.component2(),o=Oo(this.local$$receiver.context,r),a=Oo(o,i);if(ue(this.local$closure$scope,void 0,void 0,Lo(this.local$closure$feature,a)),this.local$$receiver.context.response=o.response,this.local$$receiver.context.request=o.request,(e.isType(t=this.local$response.coroutineContext.get_j3r2sn$(f.Key),st)?t:v()).complete(),this.state_0=2,this.result_0=this.local$$receiver.proceedWith_trkh7z$(this.local$$receiver.context.response,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Io.prototype.install_wojrb5$=function(t,e){var n,i;e.receivePipeline.intercept_h71y74$(Ia().After,(n=e,i=t,function(t,e,r,o){var a=new Do(n,i,t,e,this,r);return o?a:a.doResume(null)}))},Io.$metadata$={kind:A,simpleName:"Feature",interfaces:[wr]};var qo=null;function Fo(){return null===qo&&new Io,qo}function Uo(){}function Bo(t,e){this.call_e1jkgq$_0=t,this.$delegate_wwo9g4$_0=e}function Ho(){Vo=this}To.$metadata$={kind:x,simpleName:"ResponseObserver",interfaces:[]},Ho.prototype.toString=function(){return"WebSocketCapability"},Ho.$metadata$={kind:A,simpleName:"WebSocketCapability",interfaces:[ji]};var Vo=null;function Ko(){return null===Vo&&new Ho,Vo}function Wo(t){O(t,this),this.name="WebSocketException"}function Yo(){pe.call(this),this.content_1mwwgv$_xt2h6t$_0=ct(Jo)}function Go(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$output=e}function Jo(){return Ce()}function Zo(t,e){this.call_bo7spw$_0=t,this.method_c5x7eh$_0=e.method,this.url_9j6cnp$_0=e.url,this.content_jw4yw1$_0=e.body,this.headers_atwsac$_0=e.headers,this.attributes_el41s3$_0=e.attributes}function Qo(){}function Xo(){ia(),this.url=new me,this.method=Xt.Companion.Get,this.headers_nor9ye$_0=new _e,this.body=Qa();var t=je();S(t),this.executionContext_h6ms6p$_0=t,this.attributes=w(!0)}function ta(){return rs()}function ea(){na=this}Wo.$metadata$={kind:x,simpleName:"WebSocketException",interfaces:[q]},Object.defineProperty(Yo.prototype,"content_1mwwgv$_0",{configurable:!0,get:function(){return this.content_1mwwgv$_xt2h6t$_0.value}}),Object.defineProperty(Yo.prototype,"output",{configurable:!0,get:function(){return this.content_1mwwgv$_0}}),Go.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Go.prototype=Object.create(m.prototype),Go.prototype.constructor=Go,Go.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Ee(this.$this.content_1mwwgv$_0,this.local$output,void 0,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Yo.prototype.pipeTo_h3x4ir$=function(t,e,n){var i=new Go(this,t,e);return n?i:i.doResume(null)},Yo.$metadata$={kind:x,simpleName:"ClientUpgradeContent",interfaces:[pe]},Object.defineProperty(Zo.prototype,"call",{get:function(){return this.call_bo7spw$_0}}),Object.defineProperty(Zo.prototype,"coroutineContext",{configurable:!0,get:function(){return this.call.coroutineContext}}),Object.defineProperty(Zo.prototype,"method",{configurable:!0,get:function(){return this.method_c5x7eh$_0}}),Object.defineProperty(Zo.prototype,"url",{configurable:!0,get:function(){return this.url_9j6cnp$_0}}),Object.defineProperty(Zo.prototype,"content",{configurable:!0,get:function(){return this.content_jw4yw1$_0}}),Object.defineProperty(Zo.prototype,"headers",{configurable:!0,get:function(){return this.headers_atwsac$_0}}),Object.defineProperty(Zo.prototype,"attributes",{configurable:!0,get:function(){return this.attributes_el41s3$_0}}),Zo.$metadata$={kind:x,simpleName:"DefaultHttpRequest",interfaces:[Qo]},Object.defineProperty(Qo.prototype,"coroutineContext",{configurable:!0,get:function(){return this.call.coroutineContext}}),Object.defineProperty(Qo.prototype,"executionContext",{configurable:!0,get:function(){return d(this.coroutineContext.get_j3r2sn$(f.Key))}}),Qo.$metadata$={kind:it,simpleName:"HttpRequest",interfaces:[E,Oe]},Object.defineProperty(Xo.prototype,"headers",{configurable:!0,get:function(){return this.headers_nor9ye$_0}}),Object.defineProperty(Xo.prototype,"executionContext",{configurable:!0,get:function(){return this.executionContext_h6ms6p$_0},set:function(t){S(t),this.executionContext_h6ms6p$_0=t}}),Xo.prototype.url_6yzzjr$=function(t){t(this.url,this.url)},Xo.prototype.build=function(){var t,n,i,r,o;if(t=this.url.build(),n=this.method,i=this.headers.build(),null==(o=e.isType(r=this.body,ae)?r:null))throw O(("No request transformation found: "+this.body.toString()).toString());return new ra(t,n,i,o,this.executionContext,this.attributes)},Xo.prototype.setAttributes_yhh5ns$=function(t){t(this.attributes)},Xo.prototype.takeFromWithExecutionContext_s9rlw$=function(t){return this.executionContext=t.executionContext,this.takeFrom_s9rlw$(t)},Xo.prototype.takeFrom_s9rlw$=function(t){var n;for(this.method=t.method,this.body=t.body,Ne(this.url,t.url),this.url.encodedPath=de(this.url.encodedPath)?"/":this.url.encodedPath,ze(this.headers,t.headers),n=t.attributes.allKeys.iterator();n.hasNext();){var i,r=n.next();this.attributes.put_uuntuo$(e.isType(i=r,$)?i:v(),t.attributes.get_yzaw86$(r))}return this},Xo.prototype.setCapability_wfl2px$=function(t,e){this.attributes.computeIfAbsent_u4q9l2$(Jn,ta).put_xwzc9p$(t,e)},Xo.prototype.getCapabilityOrNull_i25mbv$=function(t){var n,i;return null==(i=null!=(n=this.attributes.getOrNull_yzaw86$(Jn))?n.get_11rb$(t):null)||e.isType(i,N)?i:v()},ea.$metadata$={kind:A,simpleName:"Companion",interfaces:[]};var na=null;function ia(){return null===na&&new ea,na}function ra(t,e,n,i,r,o){var a,s;this.url=t,this.method=e,this.headers=n,this.body=i,this.executionContext=r,this.attributes=o,this.requiredCapabilities_8be2vx$=null!=(s=null!=(a=this.attributes.getOrNull_yzaw86$(Jn))?a.keys:null)?s:et()}function oa(t,e,n,i,r,o){this.statusCode=t,this.requestTime=e,this.headers=n,this.version=i,this.body=r,this.callContext=o,this.responseTime=fe()}function aa(t){return h}function sa(t){return e.isType(t.body,Yo)}function la(t){pa(),void 0===t&&(t=!1),Re.call(this,[pa().Before,pa().State,pa().Transform,pa().Render,pa().Send]),this.developmentMode_dglch5$_0=t}function ca(){ua=this,this.Before=new Rt("Before"),this.State=new Rt("State"),this.Transform=new Rt("Transform"),this.Render=new Rt("Render"),this.Send=new Rt("Send")}Xo.$metadata$={kind:x,simpleName:"HttpRequestBuilder",interfaces:[Te]},ra.prototype.getCapabilityOrNull_1sr7de$=function(t){var n,i;return null==(i=null!=(n=this.attributes.getOrNull_yzaw86$(Jn))?n.get_11rb$(t):null)||e.isType(i,N)?i:v()},ra.prototype.toString=function(){return"HttpRequestData(url="+this.url+", method="+this.method+")"},ra.$metadata$={kind:x,simpleName:"HttpRequestData",interfaces:[]},oa.prototype.toString=function(){return"HttpResponseData=(statusCode="+this.statusCode+")"},oa.$metadata$={kind:x,simpleName:"HttpResponseData",interfaces:[]},Object.defineProperty(la.prototype,"developmentMode",{get:function(){return this.developmentMode_dglch5$_0}}),ca.$metadata$={kind:A,simpleName:"Phases",interfaces:[]};var ua=null;function pa(){return null===ua&&new ca,ua}function ha(t){ya(),void 0===t&&(t=!1),Re.call(this,[ya().Before,ya().State,ya().Monitoring,ya().Engine,ya().Receive]),this.developmentMode_7517lc$_0=t}function fa(){_a=this,this.Before=new Rt("Before"),this.State=new Rt("State"),this.Monitoring=new Rt("Monitoring"),this.Engine=new Rt("Engine"),this.Receive=new Rt("Receive")}la.$metadata$={kind:x,simpleName:"HttpRequestPipeline",interfaces:[Re]},Object.defineProperty(ha.prototype,"developmentMode",{get:function(){return this.developmentMode_7517lc$_0}}),fa.$metadata$={kind:A,simpleName:"Phases",interfaces:[]};var da,_a=null;function ya(){return null===_a&&new fa,_a}function ma(t){mt.call(this),this.formData=t;var n=Ae(this.formData);this.content_0=Ge(Mt.Charsets.UTF_8.newEncoder(),n,0,n.length),this.contentLength_f2tvnf$_0=e.Long.fromInt(this.content_0.length),this.contentType_gyve29$_0=Ft(_t.Application.FormUrlEncoded,Mt.Charsets.UTF_8)}function va(t){Le.call(this),this.boundary_0=function(){for(var t=Gt(),e=0;e<32;e++)t.append_pdl1vj$(Ke(Ve.Default.nextInt(),16));return We(t.toString(),70)}();var n="--"+this.boundary_0+"\r\n";this.BOUNDARY_BYTES_0=Ge(Mt.Charsets.UTF_8.newEncoder(),n,0,n.length);var i="--"+this.boundary_0+"--\r\n";this.LAST_BOUNDARY_BYTES_0=Ge(Mt.Charsets.UTF_8.newEncoder(),i,0,i.length),this.BODY_OVERHEAD_SIZE_0=this.LAST_BOUNDARY_BYTES_0.length,this.PART_OVERHEAD_SIZE_0=(2*da.length|0)+this.BOUNDARY_BYTES_0.length|0;var r,o,a=ve(Je(t,10));for(r=t.iterator();r.hasNext();){var s,l,c,u,p,h=r.next(),f=a.add_11rb$,d=De();for(l=h.headers.entries().iterator();l.hasNext();){var _=l.next(),y=_.key,m=_.value;qe(d,y+": "+B(m,"; ")),Fe(d,da)}var v=null!=(c=h.headers.get_61zpoe$(rt.HttpHeaders.ContentLength))?$t(c):null;if(e.isType(h,Ue)){var $=Z(d.build()),g=null!=(u=null!=v?v.add(e.Long.fromInt(this.PART_OVERHEAD_SIZE_0)):null)?u.add(e.Long.fromInt($.length)):null;s=new ba($,h.provider,g)}else if(e.isType(h,Be)){var b=Z(d.build()),w=null!=(p=null!=v?v.add(e.Long.fromInt(this.PART_OVERHEAD_SIZE_0)):null)?p.add(e.Long.fromInt(b.length)):null;s=new ba(b,h.provider,w)}else if(e.isType(h,He)){var k,S=De(0);try{qe(S,h.value),k=S.build()}catch(t){throw e.isType(t,R)?(S.release(),t):t}var x=Z(k),E=ga(x);null==v&&(qe(d,rt.HttpHeaders.ContentLength+": "+x.length),Fe(d,da));var C=Z(d.build()),O=x.length+this.PART_OVERHEAD_SIZE_0+C.length|0;s=new ba(C,E,e.Long.fromInt(O))}else s=e.noWhenBranchMatched();f.call(a,s)}this.rawParts_0=a,this.contentLength_egukxp$_0=null,this.contentType_azd2en$_0=_t.MultiPart.FormData.withParameter_puj7f4$("boundary",this.boundary_0);var N=le;for(o=this.rawParts_0.iterator();o.hasNext();){var z=o.next().size;if(null==z){N=null;break}N=null!=N?N.add(z):null}null!=N&&(N=N.add(e.Long.fromInt(this.BODY_OVERHEAD_SIZE_0))),this.contentLength_egukxp$_0=N}function $a(t,e,n){m.call(this,n),this.exceptionState_0=15,this.$this=t,this.local$tmp$=void 0,this.local$part=void 0,this.local$$receiver=void 0,this.local$channel=e}function ga(t){return function(){var n,i=De(0);try{Fe(i,t),n=i.build()}catch(t){throw e.isType(t,R)?(i.release(),t):t}return n}}function ba(t,e,n){this.headers=t,this.provider=e,this.size=n}function wa(t,e,n){m.call(this,n),this.exceptionState_0=8,this.local$buffer=void 0,this.local$bytesWritten=void 0,this.local$$receiver=t,this.local$channel=e}function ka(t,n){var i,r;Sa.call(this),this.call_9p3cfk$_0=t,this.coroutineContext_5l7f2v$_0=n.callContext,this.status_gsg6kc$_0=n.statusCode,this.version_vctfwy$_0=n.version,this.requestTime_34y64q$_0=n.requestTime,this.responseTime_u9wao0$_0=n.responseTime,this.content_7wqjir$_0=null!=(r=e.isType(i=n.body,j)?i:null)?r:j.Companion.Empty,this.headers_gyyq4g$_0=n.headers}function Sa(){}function xa(t){return t.call.request}function Ea(t){var n;(e.isType(n=d(t.coroutineContext.get_j3r2sn$(f.Key)),st)?n:v()).complete()}function Ca(t){za(),void 0===t&&(t=!1),Re.call(this,[za().Receive,za().Parse,za().Transform,za().State,za().After]),this.developmentMode_368lah$_0=t}function Oa(){Na=this,this.Receive=new Rt("Receive"),this.Parse=new Rt("Parse"),this.Transform=new Rt("Transform"),this.State=new Rt("State"),this.After=new Rt("After")}ha.$metadata$={kind:x,simpleName:"HttpSendPipeline",interfaces:[Re]},M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.request_ixrg4t$",L((function(){var n=t.io.ktor.client.request.HttpRequestBuilder,i=t.io.ktor.client.statement.HttpStatement,r=e.getReifiedTypeParameterKType,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){void 0===d&&(d=new n);var y,m,v,$=new i(d,f);if(y=o(t),s(y,o(i)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,r(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.request_g0tv8i$",L((function(){var n=t.io.ktor.client.request.HttpRequestBuilder,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){var y=new n;d(y);var m,v,$,g=new r(y,f);if(m=o(t),s(m,o(r)))e.setCoroutineResult(h(v=g)?v:a(),e.coroutineReceiver());else if(s(m,o(l)))e.suspendCall(g.execute(e.coroutineReceiver())),e.setCoroutineResult(h($=e.coroutineResult(e.coroutineReceiver()))?$:a(),e.coroutineReceiver());else{e.suspendCall(g.executeUnsafe(e.coroutineReceiver()));var b=e.coroutineResult(e.coroutineReceiver());try{var w,k,S=b.call;t:do{try{k=new p(o(t),u.JsType,i(t))}catch(e){k=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(S.receive_jo9acv$(k,e.coroutineReceiver())),e.setCoroutineResult(h(w=e.coroutineResult(e.coroutineReceiver()))?w:a(),e.coroutineReceiver())}finally{c(b)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.request_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.io.ktor.client.request.HttpRequestBuilder,r=t.io.ktor.client.request.url_g8iu3v$,o=e.getReifiedTypeParameterKType,a=t.io.ktor.client.statement.HttpStatement,s=e.getKClass,l=e.throwCCE,c=e.equals,u=t.io.ktor.client.statement.HttpResponse,p=t.io.ktor.client.statement.complete_abn2de$,h=t.io.ktor.client.call,f=t.io.ktor.client.call.TypeInfo;function d(t){return n}return function(t,n,_,y,m,v){void 0===m&&(m=d);var $=new i;r($,y),m($);var g,b,w,k=new a($,_);if(g=s(t),c(g,s(a)))e.setCoroutineResult(n(b=k)?b:l(),e.coroutineReceiver());else if(c(g,s(u)))e.suspendCall(k.execute(e.coroutineReceiver())),e.setCoroutineResult(n(w=e.coroutineResult(e.coroutineReceiver()))?w:l(),e.coroutineReceiver());else{e.suspendCall(k.executeUnsafe(e.coroutineReceiver()));var S=e.coroutineResult(e.coroutineReceiver());try{var x,E,C=S.call;t:do{try{E=new f(s(t),h.JsType,o(t))}catch(e){E=new f(s(t),h.JsType);break t}}while(0);e.suspendCall(C.receive_jo9acv$(E,e.coroutineReceiver())),e.setCoroutineResult(n(x=e.coroutineResult(e.coroutineReceiver()))?x:l(),e.coroutineReceiver())}finally{p(S)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.request_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.io.ktor.client.request.HttpRequestBuilder,r=t.io.ktor.client.request.url_qpqkqe$,o=e.getReifiedTypeParameterKType,a=t.io.ktor.client.statement.HttpStatement,s=e.getKClass,l=e.throwCCE,c=e.equals,u=t.io.ktor.client.statement.HttpResponse,p=t.io.ktor.client.statement.complete_abn2de$,h=t.io.ktor.client.call,f=t.io.ktor.client.call.TypeInfo;function d(t){return n}return function(t,n,_,y,m,v){void 0===m&&(m=d);var $=new i;r($,y),m($);var g,b,w,k=new a($,_);if(g=s(t),c(g,s(a)))e.setCoroutineResult(n(b=k)?b:l(),e.coroutineReceiver());else if(c(g,s(u)))e.suspendCall(k.execute(e.coroutineReceiver())),e.setCoroutineResult(n(w=e.coroutineResult(e.coroutineReceiver()))?w:l(),e.coroutineReceiver());else{e.suspendCall(k.executeUnsafe(e.coroutineReceiver()));var S=e.coroutineResult(e.coroutineReceiver());try{var x,E,C=S.call;t:do{try{E=new f(s(t),h.JsType,o(t))}catch(e){E=new f(s(t),h.JsType);break t}}while(0);e.suspendCall(C.receive_jo9acv$(E,e.coroutineReceiver())),e.setCoroutineResult(n(x=e.coroutineResult(e.coroutineReceiver()))?x:l(),e.coroutineReceiver())}finally{p(S)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.get_ixrg4t$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){d.method=n.Companion.Get;var y,m,v,$=new r(d,f);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,i(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.post_ixrg4t$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){d.method=n.Companion.Post;var y,m,v,$=new r(d,f);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,i(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.put_ixrg4t$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){d.method=n.Companion.Put;var y,m,v,$=new r(d,f);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,i(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.delete_ixrg4t$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){d.method=n.Companion.Delete;var y,m,v,$=new r(d,f);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,i(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.options_ixrg4t$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){d.method=n.Companion.Options;var y,m,v,$=new r(d,f);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,i(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.patch_ixrg4t$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){d.method=n.Companion.Patch;var y,m,v,$=new r(d,f);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,i(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.head_ixrg4t$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){d.method=n.Companion.Head;var y,m,v,$=new r(d,f);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,i(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.get_xwttm9$",L((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b,w,k,S){void 0===v&&(v="http"),void 0===$&&($="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===k&&(k=y);var x=new s;r(x,v,$,g,b),x.method=o.Companion.Get,x.body=w,k(x);var E,C,O,N=new l(x,m);if(E=c(t),p(E,c(l)))e.setCoroutineResult(i(C=N)?C:u(),e.coroutineReceiver());else if(p(E,c(h)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var z=e.coroutineResult(e.coroutineReceiver());try{var j,T,P=z.call;t:do{try{T=new _(c(t),d.JsType,a(t))}catch(e){T=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(T,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:u(),e.coroutineReceiver())}finally{f(z)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.post_xwttm9$",L((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b,w,k,S){void 0===v&&(v="http"),void 0===$&&($="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===k&&(k=y);var x=new s;r(x,v,$,g,b),x.method=o.Companion.Post,x.body=w,k(x);var E,C,O,N=new l(x,m);if(E=c(t),p(E,c(l)))e.setCoroutineResult(i(C=N)?C:u(),e.coroutineReceiver());else if(p(E,c(h)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var z=e.coroutineResult(e.coroutineReceiver());try{var j,T,P=z.call;t:do{try{T=new _(c(t),d.JsType,a(t))}catch(e){T=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(T,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:u(),e.coroutineReceiver())}finally{f(z)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.put_xwttm9$",L((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b,w,k,S){void 0===v&&(v="http"),void 0===$&&($="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===k&&(k=y);var x=new s;r(x,v,$,g,b),x.method=o.Companion.Put,x.body=w,k(x);var E,C,O,N=new l(x,m);if(E=c(t),p(E,c(l)))e.setCoroutineResult(i(C=N)?C:u(),e.coroutineReceiver());else if(p(E,c(h)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var z=e.coroutineResult(e.coroutineReceiver());try{var j,T,P=z.call;t:do{try{T=new _(c(t),d.JsType,a(t))}catch(e){T=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(T,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:u(),e.coroutineReceiver())}finally{f(z)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.delete_xwttm9$",L((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b,w,k,S){void 0===v&&(v="http"),void 0===$&&($="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===k&&(k=y);var x=new s;r(x,v,$,g,b),x.method=o.Companion.Delete,x.body=w,k(x);var E,C,O,N=new l(x,m);if(E=c(t),p(E,c(l)))e.setCoroutineResult(i(C=N)?C:u(),e.coroutineReceiver());else if(p(E,c(h)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var z=e.coroutineResult(e.coroutineReceiver());try{var j,T,P=z.call;t:do{try{T=new _(c(t),d.JsType,a(t))}catch(e){T=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(T,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:u(),e.coroutineReceiver())}finally{f(z)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.patch_xwttm9$",L((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b,w,k,S){void 0===v&&(v="http"),void 0===$&&($="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===k&&(k=y);var x=new s;r(x,v,$,g,b),x.method=o.Companion.Patch,x.body=w,k(x);var E,C,O,N=new l(x,m);if(E=c(t),p(E,c(l)))e.setCoroutineResult(i(C=N)?C:u(),e.coroutineReceiver());else if(p(E,c(h)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var z=e.coroutineResult(e.coroutineReceiver());try{var j,T,P=z.call;t:do{try{T=new _(c(t),d.JsType,a(t))}catch(e){T=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(T,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:u(),e.coroutineReceiver())}finally{f(z)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.head_xwttm9$",L((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b,w,k,S){void 0===v&&(v="http"),void 0===$&&($="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===k&&(k=y);var x=new s;r(x,v,$,g,b),x.method=o.Companion.Head,x.body=w,k(x);var E,C,O,N=new l(x,m);if(E=c(t),p(E,c(l)))e.setCoroutineResult(i(C=N)?C:u(),e.coroutineReceiver());else if(p(E,c(h)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var z=e.coroutineResult(e.coroutineReceiver());try{var j,T,P=z.call;t:do{try{T=new _(c(t),d.JsType,a(t))}catch(e){T=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(T,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:u(),e.coroutineReceiver())}finally{f(z)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.options_xwttm9$",L((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b,w,k,S){void 0===v&&(v="http"),void 0===$&&($="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===k&&(k=y);var x=new s;r(x,v,$,g,b),x.method=o.Companion.Options,x.body=w,k(x);var E,C,O,N=new l(x,m);if(E=c(t),p(E,c(l)))e.setCoroutineResult(i(C=N)?C:u(),e.coroutineReceiver());else if(p(E,c(h)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var z=e.coroutineResult(e.coroutineReceiver());try{var j,T,P=z.call;t:do{try{T=new _(c(t),d.JsType,a(t))}catch(e){T=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(T,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:u(),e.coroutineReceiver())}finally{f(z)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.get_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Get,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.post_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Post,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.put_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Put,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.delete_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Delete,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.options_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Options,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.patch_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Patch,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.head_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Head,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.get_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Get,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.post_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Post,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.put_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Put,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.patch_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Patch,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.options_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Options,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.head_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Head,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.delete_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Delete,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),Object.defineProperty(ma.prototype,"contentLength",{configurable:!0,get:function(){return this.contentLength_f2tvnf$_0}}),Object.defineProperty(ma.prototype,"contentType",{configurable:!0,get:function(){return this.contentType_gyve29$_0}}),ma.prototype.bytes=function(){return this.content_0},ma.$metadata$={kind:x,simpleName:"FormDataContent",interfaces:[mt]},Object.defineProperty(va.prototype,"contentLength",{configurable:!0,get:function(){return this.contentLength_egukxp$_0}}),Object.defineProperty(va.prototype,"contentType",{configurable:!0,get:function(){return this.contentType_azd2en$_0}}),$a.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},$a.prototype=Object.create(m.prototype),$a.prototype.constructor=$a,$a.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.exceptionState_0=12,this.local$tmp$=this.$this.rawParts_0.iterator(),this.state_0=1;continue;case 1:if(!this.local$tmp$.hasNext()){this.state_0=10;continue}if(this.local$part=this.local$tmp$.next(),this.state_0=2,this.result_0=Ie(this.local$channel,this.$this.BOUNDARY_BYTES_0,this),this.result_0===y)return y;continue;case 2:if(this.state_0=3,this.result_0=Ie(this.local$channel,this.local$part.headers,this),this.result_0===y)return y;continue;case 3:if(this.state_0=4,this.result_0=Ie(this.local$channel,da,this),this.result_0===y)return y;continue;case 4:if(this.local$$receiver=this.local$part.provider(),this.exceptionState_0=8,this.state_0=5,this.result_0=(n=this.local$$receiver,i=this.local$channel,r=void 0,o=void 0,o=new wa(n,i,this),r?o:o.doResume(null)),this.result_0===y)return y;continue;case 5:this.exceptionState_0=12,this.finallyPath_0=[6],this.state_0=9;continue;case 6:if(this.state_0=7,this.result_0=Ie(this.local$channel,da,this),this.result_0===y)return y;continue;case 7:this.state_0=1;continue;case 8:this.finallyPath_0=[12],this.state_0=9;continue;case 9:this.exceptionState_0=12,this.local$$receiver.close(),this.state_0=this.finallyPath_0.shift();continue;case 10:if(this.state_0=11,this.result_0=Ie(this.local$channel,this.$this.LAST_BOUNDARY_BYTES_0,this),this.result_0===y)return y;continue;case 11:this.exceptionState_0=15,this.finallyPath_0=[14],this.state_0=13;continue;case 12:this.finallyPath_0=[15],this.exceptionState_0=13;var t=this.exception_0;if(!e.isType(t,R))throw t;this.local$channel.close_dbl4no$(t),this.finallyPath_0=[14],this.state_0=13;continue;case 13:this.exceptionState_0=15,Me(this.local$channel),this.state_0=this.finallyPath_0.shift();continue;case 14:return;case 15:throw this.exception_0;default:throw this.state_0=15,new Error("State Machine Unreachable execution")}}catch(t){if(15===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var n,i,r,o},va.prototype.writeTo_h3x4ir$=function(t,e,n){var i=new $a(this,t,e);return n?i:i.doResume(null)},va.$metadata$={kind:x,simpleName:"MultiPartFormDataContent",interfaces:[Le]},ba.$metadata$={kind:x,simpleName:"PreparedPart",interfaces:[]},wa.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},wa.prototype=Object.create(m.prototype),wa.prototype.constructor=wa,wa.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(e.isType(this.local$$receiver,xt)){if(this.state_0=1,this.result_0=this.local$channel.writePacket_3uq2w4$(this.local$$receiver,this),this.result_0===y)return y;continue}this.state_0=2;continue;case 1:return;case 2:this.state_0=3;continue;case 3:if(this.local$$receiver.endOfInput){this.state_0=10;continue}var t;if(this.state_0=4,this.result_0=Ze(this.local$channel,1,this),this.result_0===y)return y;continue;case 4:this.local$buffer=null!=(t=this.result_0)?t:Qe.Companion.Empty,this.local$bytesWritten=0,this.exceptionState_0=5;var n=this.local$buffer.memory,i=e.Long.fromInt(this.local$buffer.writePosition);this.local$bytesWritten=Ye(this.local$$receiver,n,i,e.Long.fromInt(this.local$buffer.limit).subtract(i)).toInt(),this.local$buffer.commitWritten_za3lpa$(this.local$bytesWritten),this.result_0=this.local$bytesWritten,this.exceptionState_0=8,this.finallyPath_0=[9],this.state_0=6;continue;case 5:this.finallyPath_0=[8],this.state_0=6;continue;case 6:if(this.exceptionState_0=8,this.state_0=7,this.result_0=Xe(this.local$channel,this.local$buffer,this.local$bytesWritten,this),this.result_0===y)return y;continue;case 7:this.state_0=this.finallyPath_0.shift();continue;case 8:throw this.exception_0;case 9:this.state_0=3;continue;case 10:return;default:throw this.state_0=8,new Error("State Machine Unreachable execution")}}catch(t){if(8===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.forms.submitForm_k24olv$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.Parameters,i=e.kotlin.Unit,r=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,o=t.io.ktor.client.request.forms.FormDataContent,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b){void 0===v&&(v=n.Companion.Empty),void 0===$&&($=!1),void 0===g&&(g=y);var w=new s;$?(w.method=r.Companion.Get,w.url.parameters.appendAll_hb0ubp$(v)):(w.method=r.Companion.Post,w.body=new o(v)),g(w);var k,S,x,E=new l(w,m);if(k=c(t),p(k,c(l)))e.setCoroutineResult(i(S=E)?S:u(),e.coroutineReceiver());else if(p(k,c(h)))e.suspendCall(E.execute(e.coroutineReceiver())),e.setCoroutineResult(i(x=e.coroutineResult(e.coroutineReceiver()))?x:u(),e.coroutineReceiver());else{e.suspendCall(E.executeUnsafe(e.coroutineReceiver()));var C=e.coroutineResult(e.coroutineReceiver());try{var O,N,z=C.call;t:do{try{N=new _(c(t),d.JsType,a(t))}catch(e){N=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(z.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver())}finally{f(C)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.forms.submitForm_32veqj$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.Parameters,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_g8iu3v$,o=e.getReifiedTypeParameterKType,a=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,s=t.io.ktor.client.request.forms.FormDataContent,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return i}return function(t,i,v,$,g,b,w,k){void 0===g&&(g=n.Companion.Empty),void 0===b&&(b=!1),void 0===w&&(w=m);var S=new l;b?(S.method=a.Companion.Get,S.url.parameters.appendAll_hb0ubp$(g)):(S.method=a.Companion.Post,S.body=new s(g)),r(S,$),w(S);var x,E,C,O=new c(S,v);if(x=u(t),h(x,u(c)))e.setCoroutineResult(i(E=O)?E:p(),e.coroutineReceiver());else if(h(x,u(f)))e.suspendCall(O.execute(e.coroutineReceiver())),e.setCoroutineResult(i(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(O.executeUnsafe(e.coroutineReceiver()));var N=e.coroutineResult(e.coroutineReceiver());try{var z,j,T=N.call;t:do{try{j=new y(u(t),_.JsType,o(t))}catch(e){j=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(T.receive_jo9acv$(j,e.coroutineReceiver())),e.setCoroutineResult(i(z=e.coroutineResult(e.coroutineReceiver()))?z:p(),e.coroutineReceiver())}finally{d(N)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.forms.submitFormWithBinaryData_k1tmp5$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,r=t.io.ktor.client.request.forms.MultiPartFormDataContent,o=e.getReifiedTypeParameterKType,a=t.io.ktor.client.request.HttpRequestBuilder,s=t.io.ktor.client.statement.HttpStatement,l=e.getKClass,c=e.throwCCE,u=e.equals,p=t.io.ktor.client.statement.HttpResponse,h=t.io.ktor.client.statement.complete_abn2de$,f=t.io.ktor.client.call,d=t.io.ktor.client.call.TypeInfo;function _(t){return n}return function(t,n,y,m,v,$){void 0===v&&(v=_);var g=new a;g.method=i.Companion.Post,g.body=new r(m),v(g);var b,w,k,S=new s(g,y);if(b=l(t),u(b,l(s)))e.setCoroutineResult(n(w=S)?w:c(),e.coroutineReceiver());else if(u(b,l(p)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(k=e.coroutineResult(e.coroutineReceiver()))?k:c(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var x=e.coroutineResult(e.coroutineReceiver());try{var E,C,O=x.call;t:do{try{C=new d(l(t),f.JsType,o(t))}catch(e){C=new d(l(t),f.JsType);break t}}while(0);e.suspendCall(O.receive_jo9acv$(C,e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:c(),e.coroutineReceiver())}finally{h(x)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.forms.submitFormWithBinaryData_i2k1l1$",L((function(){var n=e.kotlin.Unit,i=t.io.ktor.client.request.url_g8iu3v$,r=e.getReifiedTypeParameterKType,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=t.io.ktor.client.request.forms.MultiPartFormDataContent,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,m,v,$,g,b){void 0===g&&(g=y);var w=new s;w.method=o.Companion.Post,w.body=new a($),i(w,v),g(w);var k,S,x,E=new l(w,m);if(k=c(t),p(k,c(l)))e.setCoroutineResult(n(S=E)?S:u(),e.coroutineReceiver());else if(p(k,c(h)))e.suspendCall(E.execute(e.coroutineReceiver())),e.setCoroutineResult(n(x=e.coroutineResult(e.coroutineReceiver()))?x:u(),e.coroutineReceiver());else{e.suspendCall(E.executeUnsafe(e.coroutineReceiver()));var C=e.coroutineResult(e.coroutineReceiver());try{var O,N,z=C.call;t:do{try{N=new _(c(t),d.JsType,r(t))}catch(e){N=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(z.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver())}finally{f(C)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.forms.submitForm_ejo4ot$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.Parameters,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=e.getReifiedTypeParameterKType,a=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,s=t.io.ktor.client.request.forms.FormDataContent,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return i}return function(t,i,v,$,g,b,w,k,S,x,E){void 0===$&&($="http"),void 0===g&&(g="localhost"),void 0===b&&(b=80),void 0===w&&(w="/"),void 0===k&&(k=n.Companion.Empty),void 0===S&&(S=!1),void 0===x&&(x=m);var C=new l;S?(C.method=a.Companion.Get,C.url.parameters.appendAll_hb0ubp$(k)):(C.method=a.Companion.Post,C.body=new s(k)),r(C,$,g,b,w),x(C);var O,N,z,j=new c(C,v);if(O=u(t),h(O,u(c)))e.setCoroutineResult(i(N=j)?N:p(),e.coroutineReceiver());else if(h(O,u(f)))e.suspendCall(j.execute(e.coroutineReceiver())),e.setCoroutineResult(i(z=e.coroutineResult(e.coroutineReceiver()))?z:p(),e.coroutineReceiver());else{e.suspendCall(j.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var P,R,A=T.call;t:do{try{R=new y(u(t),_.JsType,o(t))}catch(e){R=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(A.receive_jo9acv$(R,e.coroutineReceiver())),e.setCoroutineResult(i(P=e.coroutineResult(e.coroutineReceiver()))?P:p(),e.coroutineReceiver())}finally{d(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.forms.submitFormWithBinaryData_vcnbbn$",L((function(){var n=e.kotlin.collections.emptyList_287e2$,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=e.getReifiedTypeParameterKType,a=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,s=t.io.ktor.client.request.forms.MultiPartFormDataContent,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return i}return function(t,i,v,$,g,b,w,k,S,x){void 0===$&&($="http"),void 0===g&&(g="localhost"),void 0===b&&(b=80),void 0===w&&(w="/"),void 0===k&&(k=n()),void 0===S&&(S=m);var E=new l;E.method=a.Companion.Post,E.body=new s(k),r(E,$,g,b,w),S(E);var C,O,N,z=new c(E,v);if(C=u(t),h(C,u(c)))e.setCoroutineResult(i(O=z)?O:p(),e.coroutineReceiver());else if(h(C,u(f)))e.suspendCall(z.execute(e.coroutineReceiver())),e.setCoroutineResult(i(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver());else{e.suspendCall(z.executeUnsafe(e.coroutineReceiver()));var j=e.coroutineResult(e.coroutineReceiver());try{var T,P,R=j.call;t:do{try{P=new y(u(t),_.JsType,o(t))}catch(e){P=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(R.receive_jo9acv$(P,e.coroutineReceiver())),e.setCoroutineResult(i(T=e.coroutineResult(e.coroutineReceiver()))?T:p(),e.coroutineReceiver())}finally{d(j)}}return e.coroutineResult(e.coroutineReceiver())}}))),Object.defineProperty(ka.prototype,"call",{get:function(){return this.call_9p3cfk$_0}}),Object.defineProperty(ka.prototype,"coroutineContext",{configurable:!0,get:function(){return this.coroutineContext_5l7f2v$_0}}),Object.defineProperty(ka.prototype,"status",{configurable:!0,get:function(){return this.status_gsg6kc$_0}}),Object.defineProperty(ka.prototype,"version",{configurable:!0,get:function(){return this.version_vctfwy$_0}}),Object.defineProperty(ka.prototype,"requestTime",{configurable:!0,get:function(){return this.requestTime_34y64q$_0}}),Object.defineProperty(ka.prototype,"responseTime",{configurable:!0,get:function(){return this.responseTime_u9wao0$_0}}),Object.defineProperty(ka.prototype,"content",{configurable:!0,get:function(){return this.content_7wqjir$_0}}),Object.defineProperty(ka.prototype,"headers",{configurable:!0,get:function(){return this.headers_gyyq4g$_0}}),ka.$metadata$={kind:x,simpleName:"DefaultHttpResponse",interfaces:[Sa]},Sa.prototype.toString=function(){return"HttpResponse["+xa(this).url+", "+this.status+"]"},Sa.$metadata$={kind:x,simpleName:"HttpResponse",interfaces:[E,Oe]},Object.defineProperty(Ca.prototype,"developmentMode",{get:function(){return this.developmentMode_368lah$_0}}),Oa.$metadata$={kind:A,simpleName:"Phases",interfaces:[]};var Na=null;function za(){return null===Na&&new Oa,Na}function ja(t){Ia(),void 0===t&&(t=!1),Re.call(this,[Ia().Before,Ia().State,Ia().After]),this.developmentMode_wr860l$_0=t}function Ta(){Aa=this,this.Before=new Rt("Before"),this.State=new Rt("State"),this.After=new Rt("After")}Ca.$metadata$={kind:x,simpleName:"HttpResponsePipeline",interfaces:[Re]},Object.defineProperty(ja.prototype,"developmentMode",{get:function(){return this.developmentMode_wr860l$_0}}),Ta.$metadata$={kind:A,simpleName:"Phases",interfaces:[]};var Pa,Ra,Aa=null;function Ia(){return null===Aa&&new Ta,Aa}function Ma(t,e){this.expectedType=t,this.response=e}function La(t,e){this.builder_0=t,this.client_0=e,this.checkCapabilities_0()}function Da(t,e,n){m.call(this,n),this.exceptionState_0=8,this.$this=t,this.local$response=void 0,this.local$block=e}function qa(t,e){m.call(this,e),this.exceptionState_0=1,this.local$it=t}function Fa(t,e,n){var i=new qa(t,e);return n?i:i.doResume(null)}function Ua(t,e,n,i){m.call(this,i),this.exceptionState_0=7,this.$this=t,this.local$response=void 0,this.local$T_0=e,this.local$isT=n}function Ba(t,e,n,i,r){m.call(this,r),this.exceptionState_0=9,this.$this=t,this.local$response=void 0,this.local$T_0=e,this.local$isT=n,this.local$block=i}function Ha(t,e){m.call(this,e),this.exceptionState_0=1,this.$this=t}function Va(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$$receiver=e}function Ka(t,e,n){m.call(this,n),this.exceptionState_0=1,this.local$decoder=void 0,this.local$$receiver=t,this.local$fallbackCharset=e}function Wa(t,e,n,i){var r=new Ka(t,e,n);return i?r:r.doResume(null)}function Ya(){Ga=this,this.MAX_AGE="max-age",this.MIN_FRESH="min-fresh",this.ONLY_IF_CACHED="only-if-cached",this.MAX_STALE="max-stale",this.NO_CACHE="no-cache",this.NO_STORE="no-store",this.NO_TRANSFORM="no-transform",this.MUST_REVALIDATE="must-revalidate",this.PUBLIC="public",this.PRIVATE="private",this.PROXY_REVALIDATE="proxy-revalidate",this.S_MAX_AGE="s-maxage"}ja.$metadata$={kind:x,simpleName:"HttpReceivePipeline",interfaces:[Re]},Ma.$metadata$={kind:x,simpleName:"HttpResponseContainer",interfaces:[]},Ma.prototype.component1=function(){return this.expectedType},Ma.prototype.component2=function(){return this.response},Ma.prototype.copy_ju9ok$=function(t,e){return new Ma(void 0===t?this.expectedType:t,void 0===e?this.response:e)},Ma.prototype.toString=function(){return"HttpResponseContainer(expectedType="+e.toString(this.expectedType)+", response="+e.toString(this.response)+")"},Ma.prototype.hashCode=function(){var t=0;return t=31*(t=31*t+e.hashCode(this.expectedType)|0)+e.hashCode(this.response)|0},Ma.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.expectedType,t.expectedType)&&e.equals(this.response,t.response)},Da.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Da.prototype=Object.create(m.prototype),Da.prototype.constructor=Da,Da.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=1,this.result_0=this.$this.executeUnsafe(this),this.result_0===y)return y;continue;case 1:if(this.local$response=this.result_0,this.exceptionState_0=5,this.state_0=2,this.result_0=this.local$block(this.local$response,this),this.result_0===y)return y;continue;case 2:this.exceptionState_0=8,this.finallyPath_0=[3],this.state_0=6,this.$returnValue=this.result_0;continue;case 3:return this.$returnValue;case 4:return;case 5:this.finallyPath_0=[8],this.state_0=6;continue;case 6:if(this.exceptionState_0=8,this.state_0=7,this.result_0=this.$this.cleanup_abn2de$(this.local$response,this),this.result_0===y)return y;continue;case 7:this.state_0=this.finallyPath_0.shift();continue;case 8:throw this.exception_0;default:throw this.state_0=8,new Error("State Machine Unreachable execution")}}catch(t){if(8===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},La.prototype.execute_2rh6on$=function(t,e,n){var i=new Da(this,t,e);return n?i:i.doResume(null)},qa.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},qa.prototype=Object.create(m.prototype),qa.prototype.constructor=qa,qa.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=hi(this.local$it.call,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0.response;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},La.prototype.execute=function(t){return this.execute_2rh6on$(Fa,t)},Ua.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Ua.prototype=Object.create(m.prototype),Ua.prototype.constructor=Ua,Ua.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e,n;if(t=W(this.local$T_0),pt(t,W(La)))return this.local$isT(e=this.$this)?e:v();if(pt(t,W(Sa))){if(this.state_0=8,this.result_0=this.$this.execute(this),this.result_0===y)return y;continue}if(this.state_0=1,this.result_0=this.$this.executeUnsafe(this),this.result_0===y)return y;continue;case 1:var i;this.local$response=this.result_0,this.exceptionState_0=5;var r,o=this.local$response.call;t:do{try{r=new fi(W(this.local$T_0),ll.JsType,K(this.local$T_0))}catch(t){r=new fi(W(this.local$T_0),ll.JsType);break t}}while(0);if(this.state_0=2,this.result_0=o.receive_jo9acv$(r,this),this.result_0===y)return y;continue;case 2:this.result_0=this.local$isT(i=this.result_0)?i:v(),this.exceptionState_0=7,this.finallyPath_0=[3],this.state_0=6,this.$returnValue=this.result_0;continue;case 3:return this.$returnValue;case 4:this.state_0=9;continue;case 5:this.finallyPath_0=[7],this.state_0=6;continue;case 6:this.exceptionState_0=7,Ea(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 7:throw this.exception_0;case 8:return this.local$isT(n=this.result_0)?n:v();case 9:this.state_0=10;continue;case 10:return;default:throw this.state_0=7,new Error("State Machine Unreachable execution")}}catch(t){if(7===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},La.prototype.receive_287e2$=function(t,e,n,i){var r=new Ua(this,t,e,n);return i?r:r.doResume(null)},M("ktor-ktor-client-core-jsLegacy.io.ktor.client.statement.HttpStatement.receive_287e2$",L((function(){var n=e.getKClass,i=e.throwCCE,r=t.io.ktor.client.statement.HttpStatement,o=e.equals,a=t.io.ktor.client.statement.HttpResponse,s=e.getReifiedTypeParameterKType,l=t.io.ktor.client.statement.complete_abn2de$,c=t.io.ktor.client.call,u=t.io.ktor.client.call.TypeInfo;return function(t,p,h){var f,d;if(f=n(t),o(f,n(r)))return p(this)?this:i();if(o(f,n(a)))return e.suspendCall(this.execute(e.coroutineReceiver())),p(d=e.coroutineResult(e.coroutineReceiver()))?d:i();e.suspendCall(this.executeUnsafe(e.coroutineReceiver()));var _=e.coroutineResult(e.coroutineReceiver());try{var y,m,v=_.call;t:do{try{m=new u(n(t),c.JsType,s(t))}catch(e){m=new u(n(t),c.JsType);break t}}while(0);return e.suspendCall(v.receive_jo9acv$(m,e.coroutineReceiver())),e.setCoroutineResult(p(y=e.coroutineResult(e.coroutineReceiver()))?y:i(),e.coroutineReceiver()),e.coroutineResult(e.coroutineReceiver())}finally{l(_)}}}))),Ba.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Ba.prototype=Object.create(m.prototype),Ba.prototype.constructor=Ba,Ba.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=1,this.result_0=this.$this.executeUnsafe(this),this.result_0===y)return y;continue;case 1:var t;this.local$response=this.result_0,this.exceptionState_0=6;var e,n=this.local$response.call;t:do{try{e=new fi(W(this.local$T_0),ll.JsType,K(this.local$T_0))}catch(t){e=new fi(W(this.local$T_0),ll.JsType);break t}}while(0);if(this.state_0=2,this.result_0=n.receive_jo9acv$(e,this),this.result_0===y)return y;continue;case 2:this.result_0=this.local$isT(t=this.result_0)?t:v();var i=this.result_0;if(this.state_0=3,this.result_0=this.local$block(i,this),this.result_0===y)return y;continue;case 3:this.exceptionState_0=9,this.finallyPath_0=[4],this.state_0=7,this.$returnValue=this.result_0;continue;case 4:return this.$returnValue;case 5:return;case 6:this.finallyPath_0=[9],this.state_0=7;continue;case 7:if(this.exceptionState_0=9,this.state_0=8,this.result_0=this.$this.cleanup_abn2de$(this.local$response,this),this.result_0===y)return y;continue;case 8:this.state_0=this.finallyPath_0.shift();continue;case 9:throw this.exception_0;default:throw this.state_0=9,new Error("State Machine Unreachable execution")}}catch(t){if(9===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},La.prototype.receive_yswr0a$=function(t,e,n,i,r){var o=new Ba(this,t,e,n,i);return r?o:o.doResume(null)},M("ktor-ktor-client-core-jsLegacy.io.ktor.client.statement.HttpStatement.receive_yswr0a$",L((function(){var n=e.getReifiedTypeParameterKType,i=e.throwCCE,r=e.getKClass,o=t.io.ktor.client.call,a=t.io.ktor.client.call.TypeInfo;return function(t,s,l,c){e.suspendCall(this.executeUnsafe(e.coroutineReceiver()));var u=e.coroutineResult(e.coroutineReceiver());try{var p,h,f=u.call;t:do{try{h=new a(r(t),o.JsType,n(t))}catch(e){h=new a(r(t),o.JsType);break t}}while(0);e.suspendCall(f.receive_jo9acv$(h,e.coroutineReceiver())),e.setCoroutineResult(s(p=e.coroutineResult(e.coroutineReceiver()))?p:i(),e.coroutineReceiver());var d=e.coroutineResult(e.coroutineReceiver());return e.suspendCall(l(d,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}finally{e.suspendCall(this.cleanup_abn2de$(u,e.coroutineReceiver()))}}}))),Ha.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Ha.prototype=Object.create(m.prototype),Ha.prototype.constructor=Ha,Ha.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=(new Xo).takeFromWithExecutionContext_s9rlw$(this.$this.builder_0);if(this.state_0=2,this.result_0=this.$this.client_0.execute_s9rlw$(t,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0.response;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},La.prototype.executeUnsafe=function(t,e){var n=new Ha(this,t);return e?n:n.doResume(null)},Va.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Va.prototype=Object.create(m.prototype),Va.prototype.constructor=Va,Va.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=e.isType(t=d(this.local$$receiver.coroutineContext.get_j3r2sn$(f.Key)),st)?t:v();n.complete();try{bt(this.local$$receiver.content)}catch(t){if(!e.isType(t,R))throw t}if(this.state_0=2,this.result_0=n.join(this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},La.prototype.cleanup_abn2de$=function(t,e,n){var i=new Va(this,t,e);return n?i:i.doResume(null)},La.prototype.checkCapabilities_0=function(){var t,n,i,r,o;if(null!=(n=null!=(t=this.builder_0.attributes.getOrNull_yzaw86$(Jn))?t.keys:null)){var a,s=at();for(a=n.iterator();a.hasNext();){var l=a.next();e.isType(l,wr)&&s.add_11rb$(l)}r=s}else r=null;if(null!=(i=r))for(o=i.iterator();o.hasNext();){var c=o.next();if(null==Sr(this.client_0,c))throw Q(("Consider installing "+c+" feature because the request requires it to be installed").toString())}},La.prototype.toString=function(){return"HttpStatement["+this.builder_0.url.buildString()+"]"},La.$metadata$={kind:x,simpleName:"HttpStatement",interfaces:[]},Ka.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Ka.prototype=Object.create(m.prototype),Ka.prototype.constructor=Ka,Ka.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n;void 0===this.local$fallbackCharset&&(this.local$fallbackCharset=null);var i,r=null!=(n=null!=(t=Ut(this.local$$receiver))?t:this.local$fallbackCharset)?n:Mt.Charsets.UTF_8;this.local$decoder=r.newDecoder();var o,a=this.local$$receiver.call;t:do{try{o=new fi(W(Et),ll.JsType,xe(W(Et),[],!1))}catch(t){o=new fi(W(Et),ll.JsType);break t}}while(0);if(this.state_0=2,this.result_0=a.receive_jo9acv$(o,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:this.result_0=e.isType(i=this.result_0,Et)?i:v();var s=this.result_0;return en(this.local$decoder,s);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ya.prototype.getMAX_AGE=function(){return this.MAX_AGE},Ya.prototype.getMIN_FRESH=function(){return this.MIN_FRESH},Ya.prototype.getONLY_IF_CACHED=function(){return this.ONLY_IF_CACHED},Ya.prototype.getMAX_STALE=function(){return this.MAX_STALE},Ya.prototype.getNO_CACHE=function(){return this.NO_CACHE},Ya.prototype.getNO_STORE=function(){return this.NO_STORE},Ya.prototype.getNO_TRANSFORM=function(){return this.NO_TRANSFORM},Ya.prototype.getMUST_REVALIDATE=function(){return this.MUST_REVALIDATE},Ya.prototype.getPUBLIC=function(){return this.PUBLIC},Ya.prototype.getPRIVATE=function(){return this.PRIVATE},Ya.prototype.getPROXY_REVALIDATE=function(){return this.PROXY_REVALIDATE},Ya.prototype.getS_MAX_AGE=function(){return this.S_MAX_AGE},Ya.$metadata$={kind:A,simpleName:"CacheControl",interfaces:[]};var Ga=null;function Ja(){Za=this,pe.call(this),this.contentLength_89rfwp$_0=le}Object.defineProperty(Ja.prototype,"contentLength",{configurable:!0,get:function(){return this.contentLength_89rfwp$_0}}),Ja.prototype.toString=function(){return"EmptyContent"},Ja.$metadata$={kind:A,simpleName:"EmptyContent",interfaces:[pe]};var Za=null;function Qa(){return null===Za&&new Ja,Za}function Xa(t,e){this.this$wrapHeaders=t,pe.call(this),this.headers_byaa2p$_0=e(t.headers)}function ts(t,e){this.this$wrapHeaders=t,vt.call(this),this.headers_byaa2p$_0=e(t.headers)}function es(t,e){this.this$wrapHeaders=t,Le.call(this),this.headers_byaa2p$_0=e(t.headers)}function ns(t,e){this.this$wrapHeaders=t,mt.call(this),this.headers_byaa2p$_0=e(t.headers)}function is(t,e){this.this$wrapHeaders=t,nn.call(this),this.headers_byaa2p$_0=e(t.headers)}function rs(){return z.PlatformUtils.IS_NATIVE?new ye:Qt()}function os(){return z.PlatformUtils.IS_NATIVE?new rn:at()}function as(t){return h}function ss(t){void 0===t&&(t=as);var e=new _e;return t(e),e.build()}function ls(t){return h}function cs(){}function us(){ps=this}Object.defineProperty(Xa.prototype,"contentLength",{configurable:!0,get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(Xa.prototype,"contentType",{configurable:!0,get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(Xa.prototype,"status",{configurable:!0,get:function(){return this.this$wrapHeaders.status}}),Object.defineProperty(Xa.prototype,"headers",{configurable:!0,get:function(){return this.headers_byaa2p$_0}}),Xa.$metadata$={kind:x,interfaces:[pe]},Object.defineProperty(ts.prototype,"contentLength",{configurable:!0,get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(ts.prototype,"contentType",{configurable:!0,get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(ts.prototype,"status",{configurable:!0,get:function(){return this.this$wrapHeaders.status}}),Object.defineProperty(ts.prototype,"headers",{configurable:!0,get:function(){return this.headers_byaa2p$_0}}),ts.prototype.readFrom=function(){return this.this$wrapHeaders.readFrom()},ts.prototype.readFrom_6z6t3e$=function(t){return this.this$wrapHeaders.readFrom_6z6t3e$(t)},ts.$metadata$={kind:x,interfaces:[vt]},Object.defineProperty(es.prototype,"contentLength",{configurable:!0,get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(es.prototype,"contentType",{configurable:!0,get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(es.prototype,"status",{configurable:!0,get:function(){return this.this$wrapHeaders.status}}),Object.defineProperty(es.prototype,"headers",{configurable:!0,get:function(){return this.headers_byaa2p$_0}}),es.prototype.writeTo_h3x4ir$=function(t,e){return this.this$wrapHeaders.writeTo_h3x4ir$(t,e)},es.$metadata$={kind:x,interfaces:[Le]},Object.defineProperty(ns.prototype,"contentLength",{configurable:!0,get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(ns.prototype,"contentType",{configurable:!0,get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(ns.prototype,"status",{configurable:!0,get:function(){return this.this$wrapHeaders.status}}),Object.defineProperty(ns.prototype,"headers",{configurable:!0,get:function(){return this.headers_byaa2p$_0}}),ns.prototype.bytes=function(){return this.this$wrapHeaders.bytes()},ns.$metadata$={kind:x,interfaces:[mt]},Object.defineProperty(is.prototype,"contentLength",{configurable:!0,get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(is.prototype,"contentType",{configurable:!0,get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(is.prototype,"headers",{configurable:!0,get:function(){return this.headers_byaa2p$_0}}),is.prototype.upgrade_h1mv0l$=function(t,e,n,i,r){return this.this$wrapHeaders.upgrade_h1mv0l$(t,e,n,i,r)},is.$metadata$={kind:x,interfaces:[nn]},cs.$metadata$={kind:it,simpleName:"Type",interfaces:[]},us.$metadata$={kind:A,simpleName:"JsType",interfaces:[cs]};var ps=null;function hs(t,e){return e.isInstance_s8jyv4$(t)}function fs(t){return function(e){if(null!=e)return t.cancel_m4sck1$(dt(e.message)),h}}function ds(t){return function(e){return t.dispose(),h}}function _s(t,e,n){var i=b(e),r=t.coroutineContext.plus_1fupul$(i).plus_1fupul$(Gn);t:do{var o;if(null==(o=n.context.get_j3r2sn$(f.Key)))break t;var a=o.invokeOnCompletion_ct2b2z$(!0,void 0,fs(i));i.invokeOnCompletion_f05bi3$(ds(a))}while(0);return r}function ys(){ms=this}ys.prototype.create_dxyxif$$default=function(t){var e=new Ti;return t(e),new bs(e)},ys.$metadata$={kind:A,simpleName:"Js",interfaces:[xi]};var ms=null;function vs(){return null===ms&&new ys,ms}function $s(){return vs()}function gs(t){return function(e){var n=new pn(un(e),1);return n.initCancellability(),t(n),n.getResult()}}function bs(t){if(Oi.call(this,"ktor-js"),this.config_2md4la$_0=t,this.dispatcher_j9yf5v$_0=$e.Dispatchers.Default,this.supportedCapabilities_380cpg$_0=te([Eo(),Ko()]),null!=this.config.proxy)throw O("Proxy unsupported in Js engine.".toString())}function ws(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$callContext=void 0,this.local$requestTime=void 0,this.local$data=e}function ks(t,e,n,i){m.call(this,i),this.exceptionState_0=4,this.$this=t,this.local$requestTime=void 0,this.local$urlString=void 0,this.local$socket=void 0,this.local$request=e,this.local$callContext=n}function Ss(t){return function(e){if(!e.isCancelled){var n=function(t,e){return function(n){switch(n.type){case"open":var i=e;t.resumeWith_tl1gpc$(new ln(i));break;case"error":var r=t,o=new Wo(JSON.stringify(n));r.resumeWith_tl1gpc$(new ln(cn(o)))}return h}}(e,t);return t.addEventListener("open",n),t.addEventListener("error",n),e.invokeOnCancellation_f05bi3$(function(t,e){return function(n){return e.removeEventListener("open",t),e.removeEventListener("error",t),null!=n&&e.close(),h}}(n,t)),h}}}function xs(t,e){m.call(this,e),this.exceptionState_0=1,this.local$$receiver=t}function Es(t){return function(e){var n;return t.forEach((n=e,function(t,e){return n.append_puj7f4$(e,t),h})),h}}function Cs(t){R.call(this),this.message_9vnttw$_0="Error from javascript["+t.toString()+"].",this.cause_kdow7y$_0=null,this.origin=t,e.captureStack(R,this),this.name="JsError"}function Os(t){return function(e,n){return t.set(e,n),h}}function Ns(t,e,n,i){m.call(this,i),this.$controller=n,this.exceptionState_0=1,this.local$closure$content=t,this.local$$receiver=e}function zs(t){return function(e,n,i){var r=new Ns(t,e,this,n);return i?r:r.doResume(null)}}function js(t,e,n){m.call(this,n),this.exceptionState_0=1,this.local$tmp$_0=void 0,this.local$jsHeaders=void 0,this.local$$receiver=t,this.local$callContext=e}function Ts(t,e,n,i){var r=new js(t,e,n);return i?r:r.doResume(null)}function Ps(t){return function(e){var n=new pn(un(e),1);return n.initCancellability(),t(n),n.getResult()}}function Rs(t){return function(e){var n;return t.read().then((n=e,function(t){var e=t.value,i=t.done||null==e?null:e;return n.resumeWith_tl1gpc$(new ln(i)),h})).catch(function(t){return function(e){return t.resumeWith_tl1gpc$(new ln(cn(e))),h}}(e)),h}}function As(t,e){m.call(this,e),this.exceptionState_0=1,this.local$$receiver=t}function Is(t,e,n){var i=new As(t,e);return n?i:i.doResume(null)}function Ms(t){return new Int8Array(t.buffer,t.byteOffset,t.length)}function Ls(t,n){var i,r;if(null==(r=e.isType(i=n.body,Object)?i:null))throw O(("Fail to obtain native stream: "+n.toString()).toString());return qs(t,r)}function Ds(t,e,n,i){m.call(this,i),this.$controller=n,this.exceptionState_0=8,this.local$closure$stream=t,this.local$tmp$=void 0,this.local$reader=void 0,this.local$$receiver=e}function qs(t,e){return jt(t,void 0,void 0,(n=e,function(t,e,i){var r=new Ds(n,t,this,e);return i?r:r.doResume(null)})).channel;var n}function Fs(t,e){t.signal=e}function Us(t){return function(e){var n=new pn(un(e),1);return n.initCancellability(),t(n),n.getResult()}}function Bs(t,e){return function(n){var i,r,o=z.PlatformUtils.IS_BROWSER?new AbortController:new c;return Fs(t,o.signal),n.invokeOnCancellation_f05bi3$((i=o,function(t){return i.abort(),h})),(z.PlatformUtils.IS_BROWSER?window.fetch(e,t):u(e,t)).then((r=n,function(t){return r.resumeWith_tl1gpc$(new ln(t)),h}),function(t){return function(e){var n=t,i=new dn("Fail to fetch",e);return n.resumeWith_tl1gpc$(new ln(cn(i))),h}}(n)),h}}function Hs(t,e,n){m.call(this,n),this.exceptionState_0=1,this.local$input=t,this.local$init=e}function Vs(t,e,n,i){var r=new Hs(t,e,n);return i?r:r.doResume(null)}function Ks(t,e){return z.PlatformUtils.IS_BROWSER?Ls(t,e):Zs(t,e)}function Ws(t,e){return function(n){return t.offer_11rb$(Ms(new Uint8Array(n))),e.pause()}}function Ys(t,e){return function(n){var i=new Cs(n);return t.close_dbl4no$(i),e.channel.close_dbl4no$(i)}}function Gs(t){return function(){return t.close_dbl4no$()}}function Js(t,e,n,i){m.call(this,i),this.$controller=n,this.exceptionState_0=8,this.local$closure$response=t,this.local$tmp$_0=void 0,this.local$body=void 0,this.local$$receiver=e}function Zs(t,e){return jt(t,void 0,void 0,(n=e,function(t,e,i){var r=new Js(n,t,this,e);return i?r:r.doResume(null)})).channel;var n}function Qs(t){}function Xs(t,e){var n,i,r;this.coroutineContext_x6mio4$_0=t,this.websocket_0=e,this._closeReason_0=mn(),this._incoming_0=_n(2147483647),this._outgoing_0=_n(2147483647),this.incoming_115vn1$_0=this._incoming_0,this.outgoing_ex3pqx$_0=this._outgoing_0,this.closeReason_n5pjc5$_0=this._closeReason_0,this.websocket_0.binaryType="arraybuffer",this.websocket_0.addEventListener("message",(i=this,function(t){var e,n;return ue(i,void 0,void 0,(e=t,n=i,function(t,i,r){var o=new tl(e,n,t,this,i);return r?o:o.doResume(null)})),h})),this.websocket_0.addEventListener("error",function(t){return function(e){var n=new Wo(e.toString());return t._closeReason_0.completeExceptionally_tcv7n7$(n),t._incoming_0.close_dbl4no$(n),t._outgoing_0.cancel_m4sck1$(),h}}(this)),this.websocket_0.addEventListener("close",function(t){return function(e){var n,i;return ue(t,void 0,void 0,(n=e,i=t,function(t,e,r){var o=new el(n,i,t,this,e);return r?o:o.doResume(null)})),h}}(this)),ue(this,void 0,void 0,(r=this,function(t,e,n){var i=new nl(r,t,this,e);return n?i:i.doResume(null)})),null!=(n=this.coroutineContext.get_j3r2sn$(f.Key))&&n.invokeOnCompletion_f05bi3$(function(t){return function(e){return null==e?t.websocket_0.close():t.websocket_0.close(yn.INTERNAL_ERROR.code,"Client failed"),h}}(this))}function tl(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$event=t,this.local$this$JsWebSocketSession=e}function el(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$event=t,this.local$this$JsWebSocketSession=e}function nl(t,e,n,i){m.call(this,i),this.$controller=n,this.exceptionState_0=8,this.local$this$JsWebSocketSession=t,this.local$$receiver=void 0,this.local$cause=void 0,this.local$tmp$=void 0}function il(){}function rl(t){return t}Object.defineProperty(bs.prototype,"config",{get:function(){return this.config_2md4la$_0}}),Object.defineProperty(bs.prototype,"dispatcher",{configurable:!0,get:function(){return this.dispatcher_j9yf5v$_0}}),Object.defineProperty(bs.prototype,"supportedCapabilities",{configurable:!0,get:function(){return this.supportedCapabilities_380cpg$_0}}),ws.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},ws.prototype=Object.create(m.prototype),ws.prototype.constructor=ws,ws.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Ri(this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:if(this.local$callContext=this.result_0,sa(this.local$data)){if(this.state_0=3,this.result_0=this.$this.executeWebSocketRequest_0(this.local$data,this.local$callContext,this),this.result_0===y)return y;continue}this.state_0=4;continue;case 3:return this.result_0;case 4:if(this.local$requestTime=fe(),this.state_0=5,this.result_0=Ts(this.local$data,this.local$callContext,this),this.result_0===y)return y;continue;case 5:var t=this.result_0;if(this.state_0=6,this.result_0=Vs(this.local$data.url.toString(),t,this),this.result_0===y)return y;continue;case 6:var e=this.result_0,n=new Tt(e.status,e.statusText),i=ss(Es(e.headers)),r=on.Companion.HTTP_1_1,o=Ks(an(this.local$callContext),e);return new oa(n,this.local$requestTime,i,r,o,this.local$callContext);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bs.prototype.execute_dkgphz$=function(t,e,n){var i=new ws(this,t,e);return n?i:i.doResume(null)},ks.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},ks.prototype=Object.create(m.prototype),ks.prototype.constructor=ks,ks.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.local$requestTime=fe(),this.local$urlString=this.local$request.url.toString(),t=z.PlatformUtils.IS_NODE?new s(this.local$urlString):new WebSocket(this.local$urlString),this.local$socket=t,this.exceptionState_0=2,this.state_0=1,this.result_0=(r=this.local$socket,o=void 0,a=void 0,a=new xs(r,this),o?a:a.doResume(null)),this.result_0===y)return y;continue;case 1:this.exceptionState_0=4,this.state_0=3;continue;case 2:this.exceptionState_0=4;var n=this.exception_0;throw e.isType(n,R)?(sn(this.local$callContext,new zt("Failed to connect to "+this.local$urlString,n)),n):n;case 3:var i=new Xs(this.local$callContext,this.local$socket);return new oa(Tt.Companion.OK,this.local$requestTime,tn.Companion.Empty,on.Companion.HTTP_1_1,i,this.local$callContext);case 4:throw this.exception_0;default:throw this.state_0=4,new Error("State Machine Unreachable execution")}}catch(t){if(4===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var r,o,a},bs.prototype.executeWebSocketRequest_0=function(t,e,n,i){var r=new ks(this,t,e,n);return i?r:r.doResume(null)},bs.$metadata$={kind:x,simpleName:"JsClientEngine",interfaces:[Oi]},xs.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},xs.prototype=Object.create(m.prototype),xs.prototype.constructor=xs,xs.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=gs(Ss(this.local$$receiver))(this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0,this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(Cs.prototype,"message",{get:function(){return this.message_9vnttw$_0}}),Object.defineProperty(Cs.prototype,"cause",{get:function(){return this.cause_kdow7y$_0}}),Cs.$metadata$={kind:x,simpleName:"JsError",interfaces:[R]},Ns.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Ns.prototype=Object.create(m.prototype),Ns.prototype.constructor=Ns,Ns.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$content.writeTo_h3x4ir$(this.local$$receiver.channel,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},js.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},js.prototype=Object.create(m.prototype),js.prototype.constructor=js,js.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;t=z.PlatformUtils.IS_BROWSER?new Headers:new hn,this.local$jsHeaders=t,Pi(this.local$$receiver.headers,this.local$$receiver.body,Os(this.local$jsHeaders));var n=this.local$$receiver.body;if(e.isType(n,mt)){this.local$tmp$_0=n.bytes(),this.state_0=6;continue}if(e.isType(n,vt)){if(this.state_0=4,this.result_0=J(n.readFrom(),this),this.result_0===y)return y;continue}if(e.isType(n,Le)){if(this.state_0=2,this.result_0=J(jt($e.GlobalScope,this.local$callContext,void 0,zs(n)).channel,this),this.result_0===y)return y;continue}this.local$tmp$_0=null,this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.local$tmp$_0=Z(this.result_0),this.state_0=3;continue;case 3:this.state_0=5;continue;case 4:this.local$tmp$_0=Z(this.result_0),this.state_0=5;continue;case 5:this.state_0=6;continue;case 6:var i=null!=this.local$tmp$_0?new Uint8Array(fn(this.local$tmp$_0)):null,r=this.local$$receiver.method.value,o={};return o.method=r,o.headers=this.local$jsHeaders,o.body=i,o.referrer=void 0,o.referrerPolicy=void 0,o.mode=void 0,o.credentials=void 0,o.cache=void 0,o.redirect="follow",o.integrity=void 0,o.keepalive=void 0,o.window=void 0,o;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},As.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},As.prototype=Object.create(m.prototype),As.prototype.constructor=As,As.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Ps(Rs(this.local$$receiver))(this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0,this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ds.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Ds.prototype=Object.create(m.prototype),Ds.prototype.constructor=Ds,Ds.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$reader=this.local$closure$stream.getReader(),this.state_0=1;continue;case 1:if(this.exceptionState_0=6,this.state_0=2,this.result_0=Is(this.local$reader,this),this.result_0===y)return y;continue;case 2:if(this.local$tmp$=this.result_0,null==this.local$tmp$){this.exceptionState_0=6,this.state_0=5;continue}this.state_0=3;continue;case 3:var t=this.local$tmp$;if(this.state_0=4,this.result_0=Ie(this.local$$receiver.channel,Ms(t),this),this.result_0===y)return y;continue;case 4:this.exceptionState_0=8,this.state_0=7;continue;case 5:return h;case 6:this.exceptionState_0=8;var n=this.exception_0;throw e.isType(n,R)?(this.local$reader.cancel(n),n):n;case 7:this.state_0=1;continue;case 8:throw this.exception_0;default:throw this.state_0=8,new Error("State Machine Unreachable execution")}}catch(t){if(8===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Hs.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Hs.prototype=Object.create(m.prototype),Hs.prototype.constructor=Hs,Hs.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Us(Bs(this.local$init,this.local$input))(this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0,this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Js.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Js.prototype=Object.create(m.prototype),Js.prototype.constructor=Js,Js.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n;if(null==(t=this.local$closure$response.body))throw O("Fail to get body".toString());n=t,this.local$body=n;var i=_n(1);this.local$body.on("data",Ws(i,this.local$body)),this.local$body.on("error",Ys(i,this.local$$receiver)),this.local$body.on("end",Gs(i)),this.exceptionState_0=6,this.local$tmp$_0=i.iterator(),this.state_0=1;continue;case 1:if(this.state_0=2,this.result_0=this.local$tmp$_0.hasNext(this),this.result_0===y)return y;continue;case 2:if(this.result_0){this.state_0=3;continue}this.state_0=5;continue;case 3:var r=this.local$tmp$_0.next();if(this.state_0=4,this.result_0=Ie(this.local$$receiver.channel,r,this),this.result_0===y)return y;continue;case 4:this.local$body.resume(),this.state_0=1;continue;case 5:this.exceptionState_0=8,this.state_0=7;continue;case 6:this.exceptionState_0=8;var o=this.exception_0;throw e.isType(o,R)?(this.local$body.destroy(o),o):o;case 7:return h;case 8:throw this.exception_0;default:throw this.state_0=8,new Error("State Machine Unreachable execution")}}catch(t){if(8===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(Xs.prototype,"coroutineContext",{get:function(){return this.coroutineContext_x6mio4$_0}}),Object.defineProperty(Xs.prototype,"incoming",{configurable:!0,get:function(){return this.incoming_115vn1$_0}}),Object.defineProperty(Xs.prototype,"outgoing",{configurable:!0,get:function(){return this.outgoing_ex3pqx$_0}}),Object.defineProperty(Xs.prototype,"extensions",{configurable:!0,get:function(){return he()}}),Object.defineProperty(Xs.prototype,"closeReason",{configurable:!0,get:function(){return this.closeReason_n5pjc5$_0}}),Object.defineProperty(Xs.prototype,"maxFrameSize",{configurable:!0,get:function(){return gt},set:function(t){}}),Xs.prototype.start_wohq5n$$default=function(t){if(!t.isEmpty())throw Q("Extensions are not supported.".toString())},Xs.prototype.flush=function(t){},Xs.prototype.terminate=function(){this._incoming_0.cancel_m4sck1$(),this._outgoing_0.cancel_m4sck1$(),oe(this._closeReason_0,"WebSocket terminated"),this.websocket_0.close()},Xs.prototype.isReservedStatusCode_0=function(t){var e=yn.Companion.byCode_mq22fl$(t);return null==e||pt(e,yn.CLOSED_ABNORMALLY)},tl.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},tl.prototype=Object.create(m.prototype),tl.prototype.constructor=tl,tl.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.local$closure$event.data;if(e.isType(n,ArrayBuffer))t=vn(!1,new Int8Array(n));else{if("string"!=typeof n){var i=O("Unknown frame type: "+this.local$closure$event.type);throw this.local$this$JsWebSocketSession._closeReason_0.completeExceptionally_tcv7n7$(i),i}t=$n(n)}var r=t;return this.local$this$JsWebSocketSession._incoming_0.offer_11rb$(r);case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},el.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},el.prototype=Object.create(m.prototype),el.prototype.constructor=el,el.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e,n=new gn("number"==typeof(t=this.local$closure$event.code)?t:v(),"string"==typeof(e=this.local$closure$event.reason)?e:v());if(this.local$this$JsWebSocketSession._closeReason_0.complete_11rb$(n),this.state_0=2,this.result_0=this.local$this$JsWebSocketSession._incoming_0.send_11rb$(bn(n),this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.local$this$JsWebSocketSession._incoming_0.close_dbl4no$(),this.local$this$JsWebSocketSession._outgoing_0.cancel_m4sck1$(),h;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},nl.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},nl.prototype=Object.create(m.prototype),nl.prototype.constructor=nl,nl.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$$receiver=this.local$this$JsWebSocketSession._outgoing_0,this.local$cause=null,this.exceptionState_0=5,this.local$tmp$=this.local$$receiver.iterator(),this.state_0=1;continue;case 1:if(this.state_0=2,this.result_0=this.local$tmp$.hasNext(this),this.result_0===y)return y;continue;case 2:if(this.result_0){this.state_0=3;continue}this.state_0=4;continue;case 3:var t,n=this.local$tmp$.next(),i=this.local$this$JsWebSocketSession;switch(n.frameType.name){case"TEXT":var r=n.data;i.websocket_0.send(wn(r));break;case"BINARY":var o=e.isType(t=n.data,Int8Array)?t:v(),a=o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength|0);i.websocket_0.send(a);break;case"CLOSE":var s,l=De(0);try{Fe(l,n.data),s=l.build()}catch(t){throw e.isType(t,R)?(l.release(),t):t}var c=s,u=kn(c),p=c.readText_vux9f0$();i._closeReason_0.complete_11rb$(new gn(u,p)),i.isReservedStatusCode_0(u)?i.websocket_0.close():i.websocket_0.close(u,p)}this.state_0=1;continue;case 4:this.exceptionState_0=8,this.finallyPath_0=[7],this.state_0=6;continue;case 5:this.finallyPath_0=[8],this.exceptionState_0=6;var f=this.exception_0;throw e.isType(f,R)?(this.local$cause=f,f):f;case 6:this.exceptionState_0=8,Sn(this.local$$receiver,this.local$cause),this.state_0=this.finallyPath_0.shift();continue;case 7:return this.result_0=h,this.result_0;case 8:throw this.exception_0;default:throw this.state_0=8,new Error("State Machine Unreachable execution")}}catch(t){if(8===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Xs.$metadata$={kind:x,simpleName:"JsWebSocketSession",interfaces:[ke]};var ol=t.io||(t.io={}),al=ol.ktor||(ol.ktor={}),sl=al.client||(al.client={});sl.HttpClient_744i18$=Cn,p["ktor-ktor-io-jsLegacy"]=r,sl.HttpClient_init_qii15z$=Pn,sl.HttpClient=On,sl.HttpClientConfig=An;var ll=sl.call||(sl.call={});ll.HttpClientCall_iofdyz$=Hn,Object.defineProperty(Vn,"Companion",{get:Xn}),ll.HttpClientCall=Vn,ll.HttpEngineCall=ti,ll.call_htnejk$=function(t,e,n){throw void 0===e&&(e=ni),O("Unbound [HttpClientCall] is deprecated. Consider using [request(block)] in instead.".toString())},ll.DoubleReceiveException=ii,ll.ReceivePipelineException=ri,ll.NoTransformationFoundException=oi,ll.SavedHttpCall=si,ll.SavedHttpRequest=ci,ll.SavedHttpResponse=ui,ll.save_iicrl5$=hi,ll.TypeInfo=fi,ll.UnsupportedContentTypeException=di,ll.UnsupportedUpgradeProtocolException=_i,ll.call_30bfl5$=function(t,e,n){throw O("Unbound [HttpClientCall] is deprecated. Consider using [request(builder)] instead.".toString())},ll.call_1t1q32$=function(t,e,n,i){throw void 0===n&&(n=mi),O("Unbound [HttpClientCall] is deprecated. Consider using [request(urlString, block)] instead.".toString())},ll.call_p7i9r1$=function(t,e,n,i){throw void 0===n&&(n=$i),O("Unbound [HttpClientCall] is deprecated. Consider using [request(url, block)] instead.".toString())};var cl=sl.engine||(sl.engine={});cl.HttpClientEngine=gi,cl.HttpClientEngineFactory=xi,cl.HttpClientEngineBase=Oi,cl.ClientEngineClosedException=zi,cl.HttpClientEngineCapability=ji,cl.HttpClientEngineConfig=Ti,cl.mergeHeaders_kqv6tz$=Pi,cl.callContext=Ri,Object.defineProperty(Ai,"Companion",{get:Li}),cl.KtorCallContextElement=Ai,p["kotlinx-coroutines-core"]=n,Object.defineProperty(Di,"Feature",{get:Hi});var ul=sl.features||(sl.features={});ul.DefaultRequest=Di,ul.defaultRequest_fxc3ki$=function(t,e){var n;t.install_xlxg29$(Hi(),(n=e,function(t){return n(t),h}))},ul.addDefaultResponseValidation_bbdm9p$=Wi,ul.ResponseException=Yi,ul.RedirectResponseException=Ji,ul.ServerResponseException=Zi,ul.ClientRequestException=Qi,ul.defaultTransformers_ejcypf$=sr,lr.Config=pr,Object.defineProperty(lr,"Companion",{get:gr}),ul.HttpCallValidator=lr,ul.HttpResponseValidator_jqt3w2$=br,ul.HttpClientFeature=wr,ul.feature_ccg70z$=Sr,ul.get_ccg70z$=xr,Or.Config=Nr,Object.defineProperty(Or,"Feature",{get:Ar}),ul.HttpPlainText=Or,Object.defineProperty(Lr,"Feature",{get:Br}),ul.HttpRedirect=Lr,Object.defineProperty(Vr,"Feature",{get:Gr}),ul.HttpRequestLifecycle=Vr,ul.Sender=Qr,Object.defineProperty(Xr,"Feature",{get:oo}),ul.HttpSend=Xr,ul.SendCountExceedException=lo,Object.defineProperty(po,"Companion",{get:vo}),uo.HttpTimeoutCapabilityConfiguration_init_oq4a4q$=$o,uo.HttpTimeoutCapabilityConfiguration=po,Object.defineProperty(uo,"Feature",{get:Eo}),ul.HttpTimeout=uo,ul.HttpRequestTimeoutException=Co,p["ktor-ktor-http-jsLegacy"]=o;var pl=ul.observer||(ul.observer={});pl.wrapWithContent_e4hb7v$=Oo,pl.DelegatedCall=No,pl.DelegatedRequest=zo,pl.DelegatedResponse=jo,To.Config=Po,Object.defineProperty(To,"Feature",{get:Fo}),pl.ResponseObserver=To;var hl=ul.websocket||(ul.websocket={});hl.ClientWebSocketSession=Uo,hl.DefaultClientWebSocketSession=Bo,Object.defineProperty(hl,"WebSocketCapability",{get:Ko}),hl.WebSocketException=Wo;var fl=sl.request||(sl.request={});fl.ClientUpgradeContent=Yo,fl.DefaultHttpRequest=Zo,fl.HttpRequest=Qo,Object.defineProperty(Xo,"Companion",{get:ia}),fl.HttpRequestBuilder=Xo,fl.HttpRequestData=ra,fl.HttpResponseData=oa,fl.headers_nc42ot$=function(t,e){var n=t.headers;return e(n),n},fl.url_3rzbk2$=function(t,e,n,i,r,o){void 0===e&&(e="http"),void 0===n&&(n="localhost"),void 0===i&&(i=0),void 0===r&&(r="/"),void 0===o&&(o=aa);var a=t.url;a.protocol=Se.Companion.createOrDefault_61zpoe$(e),a.host=n,a.port=i,a.encodedPath=r,o(t.url)},fl.url_g8iu3v$=function(t,e){ne(t.url,e)},fl.isUpgradeRequest_5kadeu$=sa,Object.defineProperty(la,"Phases",{get:pa}),fl.HttpRequestPipeline=la,Object.defineProperty(ha,"Phases",{get:ya}),fl.HttpSendPipeline=ha,fl.url_qpqkqe$=function(t,e){Pe(t.url,e)};var dl=sl.utils||(sl.utils={}),_l=fl.forms||(fl.forms={});_l.FormDataContent=ma,_l.MultiPartFormDataContent=va,fl.header_xadl6p$=function(t,e,n){null!=n&&t.headers.append_puj7f4$(e,n.toString())},fl.accept_fohfhi$=function(t,e){t.headers.append_puj7f4$(rt.HttpHeaders.Accept,e.toString())};var yl=sl.statement||(sl.statement={});yl.DefaultHttpResponse=ka,yl.HttpResponse=Sa,yl.get_request_abn2de$=xa,yl.complete_abn2de$=Ea,Object.defineProperty(Ca,"Phases",{get:za}),yl.HttpResponsePipeline=Ca,Object.defineProperty(ja,"Phases",{get:Ia}),yl.HttpReceivePipeline=ja,yl.HttpResponseContainer=Ma,yl.HttpStatement=La,yl.readText_rjorc7$=Wa,Object.defineProperty(dl,"DEFAULT_HTTP_POOL_SIZE",{get:function(){return Pa}}),Object.defineProperty(dl,"DEFAULT_HTTP_BUFFER_SIZE",{get:function(){return Ra}}),Object.defineProperty(dl,"CacheControl",{get:function(){return null===Ga&&new Ya,Ga}}),Object.defineProperty(dl,"EmptyContent",{get:Qa}),dl.wrapHeaders_j1n6iz$=function(t,n){return e.isType(t,pe)?new Xa(t,n):e.isType(t,vt)?new ts(t,n):e.isType(t,Le)?new es(t,n):e.isType(t,mt)?new ns(t,n):e.isType(t,nn)?new is(t,n):e.noWhenBranchMatched()},dl.sharedMap_aejgjo$=rs,dl.sharedList_tnbmyv$=os,dl.buildHeaders_g6xk4w$=ss,sl.HttpClient_f0veat$=function(t){return void 0===t&&(t=ls),Cn($s(),t)},ll.Type=cs,Object.defineProperty(ll,"JsType",{get:function(){return null===ps&&new us,ps}}),ll.instanceOf_ofcvxk$=hs,cl.createCallContext_antxd1$=_s;var ml=cl.js||(cl.js={});Object.defineProperty(ml,"Js",{get:vs}),ml.JsClient=$s,ml.JsClientEngine=bs,ml.JsError=Cs,ml.toRaw_lu1yd6$=Ts,ml.readChunk_pggmy1$=Is,ml.asByteArray_es0py6$=Ms;var vl=ml.browser||(ml.browser={});vl.readBodyBrowser_qitd22$=Ls,vl.channelFromStream_xaoqny$=qs;var $l=ml.compatibility||(ml.compatibility={});return $l.set_signal_g8fgly$=Fs,$l.commonFetch_70q1td$=Vs,$l.readBody_qitd22$=Ks,(ml.node||(ml.node={})).readBodyNode_qitd22$=Zs,ul.platformDefaultTransformers_h1fxjk$=Qs,hl.JsWebSocketSession=Xs,dl.clientDispatcher_b7msz$=function(t,e,n){return void 0===n&&(n="ktor-client-dispatcher"),t.Unconfined},dl.checkCoroutinesVersion_8be2vx$=il,dl.unwrapCancellationException_dbl4o4$=rl,xi.prototype.create_dxyxif$,Object.defineProperty(Oi.prototype,"supportedCapabilities",Object.getOwnPropertyDescriptor(gi.prototype,"supportedCapabilities")),Oi.prototype.install_k5i6f8$=gi.prototype.install_k5i6f8$,Oi.prototype.executeWithinCallContext_2kaaho$_0=gi.prototype.executeWithinCallContext_2kaaho$_0,Oi.prototype.checkExtensions_1320zn$_0=gi.prototype.checkExtensions_1320zn$_0,Ai.prototype.fold_3cc69b$=ft.prototype.fold_3cc69b$,Ai.prototype.get_j3r2sn$=ft.prototype.get_j3r2sn$,Ai.prototype.minusKey_yeqjby$=ft.prototype.minusKey_yeqjby$,Ai.prototype.plus_1fupul$=ft.prototype.plus_1fupul$,qi.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,wr.prototype.prepare_oh3mgy$,hr.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,zr.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,Dr.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,Kr.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,no.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,go.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,wr.prototype.prepare_oh3mgy$,wr.prototype.prepare_oh3mgy$,wr.prototype.prepare_oh3mgy$,Io.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,Uo.prototype.send_x9o3m3$=we.prototype.send_x9o3m3$,Bo.prototype.start_wohq5n$=ke.prototype.start_wohq5n$,wr.prototype.prepare_oh3mgy$,Object.defineProperty(Zo.prototype,"executionContext",Object.getOwnPropertyDescriptor(Qo.prototype,"executionContext")),ys.prototype.create_dxyxif$=xi.prototype.create_dxyxif$,bs.prototype.executeWithinCallContext_2kaaho$_0=gi.prototype.executeWithinCallContext_2kaaho$_0,bs.prototype.checkExtensions_1320zn$_0=gi.prototype.checkExtensions_1320zn$_0,Xs.prototype.send_x9o3m3$=ke.prototype.send_x9o3m3$,Xs.prototype.start_wohq5n$=ke.prototype.start_wohq5n$,Gn=new tt("call-context"),Jn=new $("EngineCapabilities"),ut(Eo()),Zn="Ktor client",Ui=new $("ValidateMark"),mr=new $("ExpectSuccessAttribyteKey"),vr=new $("ApplicationFeatureRegistry"),Pr=te([Xt.Companion.Get,Xt.Companion.Head]),new $("Websocket extensions"),da=Ge(Mt.Charsets.UTF_8.newEncoder(),"\r\n",0,"\r\n".length),Pa=1e3,Ra=4096,t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){"use strict";(function(e){void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,n,i,r){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,n)}));case 3:return e.nextTick((function(){t.call(null,n,i)}));case 4:return e.nextTick((function(){t.call(null,n,i,r)}));default:for(o=new Array(s-1),a=0;a>>24]^u[d>>>16&255]^p[_>>>8&255]^h[255&y]^e[m++],a=c[d>>>24]^u[_>>>16&255]^p[y>>>8&255]^h[255&f]^e[m++],s=c[_>>>24]^u[y>>>16&255]^p[f>>>8&255]^h[255&d]^e[m++],l=c[y>>>24]^u[f>>>16&255]^p[d>>>8&255]^h[255&_]^e[m++],f=o,d=a,_=s,y=l;return o=(i[f>>>24]<<24|i[d>>>16&255]<<16|i[_>>>8&255]<<8|i[255&y])^e[m++],a=(i[d>>>24]<<24|i[_>>>16&255]<<16|i[y>>>8&255]<<8|i[255&f])^e[m++],s=(i[_>>>24]<<24|i[y>>>16&255]<<16|i[f>>>8&255]<<8|i[255&d])^e[m++],l=(i[y>>>24]<<24|i[f>>>16&255]<<16|i[d>>>8&255]<<8|i[255&_])^e[m++],[o>>>=0,a>>>=0,s>>>=0,l>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],l=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var n=[],i=[],r=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,l=0;l<256;++l){var c=s^s<<1^s<<2^s<<3^s<<4;c=c>>>8^255&c^99,n[a]=c,i[c]=a;var u=t[a],p=t[u],h=t[p],f=257*t[c]^16843008*c;r[0][a]=f<<24|f>>>8,r[1][a]=f<<16|f>>>16,r[2][a]=f<<8|f>>>24,r[3][a]=f,f=16843009*h^65537*p^257*u^16843008*a,o[0][c]=f<<24|f>>>8,o[1][c]=f<<16|f>>>16,o[2][c]=f<<8|f>>>24,o[3][c]=f,0===a?a=s=1:(a=u^t[t[t[h^u]]],s^=t[t[s]])}return{SBOX:n,INV_SBOX:i,SUB_MIX:r,INV_SUB_MIX:o}}();function c(t){this._key=r(t),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var t=this._key,e=t.length,n=e+6,i=4*(n+1),r=[],o=0;o>>24,a=l.SBOX[a>>>24]<<24|l.SBOX[a>>>16&255]<<16|l.SBOX[a>>>8&255]<<8|l.SBOX[255&a],a^=s[o/e|0]<<24):e>6&&o%e==4&&(a=l.SBOX[a>>>24]<<24|l.SBOX[a>>>16&255]<<16|l.SBOX[a>>>8&255]<<8|l.SBOX[255&a]),r[o]=r[o-e]^a}for(var c=[],u=0;u>>24]]^l.INV_SUB_MIX[1][l.SBOX[h>>>16&255]]^l.INV_SUB_MIX[2][l.SBOX[h>>>8&255]]^l.INV_SUB_MIX[3][l.SBOX[255&h]]}this._nRounds=n,this._keySchedule=r,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(t){return a(t=r(t),this._keySchedule,l.SUB_MIX,l.SBOX,this._nRounds)},c.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),n=i.allocUnsafe(16);return n.writeUInt32BE(e[0],0),n.writeUInt32BE(e[1],4),n.writeUInt32BE(e[2],8),n.writeUInt32BE(e[3],12),n},c.prototype.decryptBlock=function(t){var e=(t=r(t))[1];t[1]=t[3],t[3]=e;var n=a(t,this._invKeySchedule,l.INV_SUB_MIX,l.INV_SBOX,this._nRounds),o=i.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=c},function(t,e,n){var i=n(2).Buffer,r=n(45);t.exports=function(t,e,n,o){if(i.isBuffer(t)||(t=i.from(t,"binary")),e&&(i.isBuffer(e)||(e=i.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=n/8,s=i.alloc(a),l=i.alloc(o||0),c=i.alloc(0);a>0||o>0;){var u=new r;u.update(c),u.update(t),e&&u.update(e),c=u.digest();var p=0;if(a>0){var h=s.length-a;p=Math.min(a,c.length),c.copy(s,h,0,p),a-=p}if(p0){var f=l.length-o,d=Math.min(o,c.length-p);c.copy(l,f,p,p+d),o-=d}}return c.fill(0),{key:s,iv:l}}},function(t,e,n){"use strict";var i=n(5),r=n(10),o=r.getNAF,a=r.getJSF,s=r.assert;function l(t,e){this.type=t,this.p=new i(e.p,16),this.red=e.prime?i.red(e.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=e.n&&new i(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=l,l.prototype.point=function(){throw new Error("Not implemented")},l.prototype.validate=function(){throw new Error("Not implemented")},l.prototype._fixedNafMul=function(t,e){s(t.precomputed);var n=t._getDoubles(),i=o(e,1,this._bitLength),r=(1<=a;u--)l=(l<<1)+i[u];c.push(l)}for(var p=this.jpoint(null,null,null),h=this.jpoint(null,null,null),f=r;f>0;f--){for(a=0;a=0;c--){for(var u=0;c>=0&&0===a[c];c--)u++;if(c>=0&&u++,l=l.dblp(u),c<0)break;var p=a[c];s(0!==p),l="affine"===t.type?p>0?l.mixedAdd(r[p-1>>1]):l.mixedAdd(r[-p-1>>1].neg()):p>0?l.add(r[p-1>>1]):l.add(r[-p-1>>1].neg())}return"affine"===t.type?l.toP():l},l.prototype._wnafMulAdd=function(t,e,n,i,r){var s,l,c,u=this._wnafT1,p=this._wnafT2,h=this._wnafT3,f=0;for(s=0;s=1;s-=2){var _=s-1,y=s;if(1===u[_]&&1===u[y]){var m=[e[_],null,null,e[y]];0===e[_].y.cmp(e[y].y)?(m[1]=e[_].add(e[y]),m[2]=e[_].toJ().mixedAdd(e[y].neg())):0===e[_].y.cmp(e[y].y.redNeg())?(m[1]=e[_].toJ().mixedAdd(e[y]),m[2]=e[_].add(e[y].neg())):(m[1]=e[_].toJ().mixedAdd(e[y]),m[2]=e[_].toJ().mixedAdd(e[y].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],$=a(n[_],n[y]);for(f=Math.max($[0].length,f),h[_]=new Array(f),h[y]=new Array(f),l=0;l=0;s--){for(var S=0;s>=0;){var x=!0;for(l=0;l=0&&S++,w=w.dblp(S),s<0)break;for(l=0;l0?c=p[l][E-1>>1]:E<0&&(c=p[l][-E-1>>1].neg()),w="affine"===c.type?w.mixedAdd(c):w.add(c))}}for(s=0;s=Math.ceil((t.bitLength()+1)/e.step)},c.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,r=0;r=0){this.childList.removeAt_za3lpa$(n);var i={};M(i,e);var r=m(t,i);this.childList.add_wxm5ur$(n,r)}},N.prototype.withKey_pspxar$=function(t,e){this.withKey_s5hl0b$(t,e.toString())},N.$metadata$={kind:s,simpleName:"RBuilder",interfaces:[]},Object.defineProperty(P.prototype,"attrs",{get:function(){return this.attrs_iyt8sk$_0}}),P.prototype.attrs_slhiwc$=function(t){t(this.attrs)},Object.defineProperty(P.prototype,"key",{configurable:!0,get:function(){throw S("".toString())},set:function(t){M(this.attrs,t)}}),Object.defineProperty(P.prototype,"ref",{configurable:!0,get:function(){throw S("".toString())},set:function(t){L(this.attrs,t)}}),P.prototype.ref_5ij4lk$=function(t){D(this.attrs,t)},P.$metadata$={kind:s,simpleName:"RElementBuilder",interfaces:[N]},q.prototype.init_bc6fkx$=function(t){},q.prototype.init_65a95q$=function(t,e){},q.prototype.children_ss14n$=function(t){t.children_yllgzm$(this.props)},q.prototype.children_tgvp6h$=function(t,e){t.children_48djri$(this.props,e)},q.prototype.render=function(){return T((t=this,function(e){return t.render_ss14n$(e),a}));var t},q.$metadata$={kind:s,simpleName:"RComponent",interfaces:[]},F.prototype.component1=function(){return this.state_0},F.prototype.component2=function(){return this.setState_0},F.prototype.getValue_lrcp0p$=function(t,e){return this.state_0},F.prototype.setValue_9rddgb$=function(t,e,n){this.setState_0(n)},F.$metadata$={kind:s,simpleName:"RStateDelegate",interfaces:[C]};var U=t.react||(t.react={});return o["kotlin-wrappers-kotlin-extensions-jsLegacy"]=i,U.RBuilder=N,U.buildElements_zepujl$=T,U.RElementBuilder=P,U.functionalComponent_7g4vsr$=function(t,e){void 0===t&&(t=null);var n,i=(n=e,function(t){return T(function(t,e){return function(n){return t(n,e),a}}(n,t))});return null!=t&&(i.displayName=t),i},U.child_9r8yuv$=function(t,e,n,i){return void 0===n&&(n={}),void 0===i&&(i=R),t.child_4dvv5y$(e,n,i)},o.react=n,U.get_rClass_inwa2g$=A,U.get_children_yllgzm$=I,U.set_key_38rnt0$=M,U.set_ref_jjyqia$=L,U.ref_dpkau5$=D,U.setState_kpl3tw$=function(t,e){var n;t.setState((n=e,function(t){var e=n,i=u(t);return e(i),i}))},U.RComponent_init_8bz2yq$=function(t,e){e=e||Object.create(q.prototype),E.call(e,t),q.call(e);var n={};return e.init_65a95q$(n,t),e.state=n,e},U.RComponent=q,U.RStateDelegate=F,U.useEffect_wrbdb4$=function(t,e){void 0===t&&(t=null);var n,i=(n=e,function(){n()});null!=t?O(i,g(t)):O(i)},t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){var i,r,o;r=[e,n(1)],void 0===(o="function"==typeof(i=function(t,e){"use strict";var n=e.Kind.INTERFACE,i=e.kotlin.Unit,r=e.Kind.CLASS;function o(){}function a(){}function s(){return i}function l(t){return i}function c(t,e){this.onComplete_0=t,this.onNext_0=e}o.$metadata$={kind:n,simpleName:"Disposable",interfaces:[]},a.$metadata$={kind:n,simpleName:"Observer",interfaces:[]},c.prototype.onNext=function(t){this.onNext_0(t)},c.prototype.onComplete=function(){this.onComplete_0()},c.$metadata$={kind:r,simpleName:"ObserverImpl",interfaces:[a]};var u=t.com||(t.com={}),p=u.arkivanov||(u.arkivanov={}),h=p.mvikotlin||(p.mvikotlin={}),f=h.rx||(h.rx={});return f.Disposable=o,f.Observer=a,f.observer_8xtgbe$=function(t,e){return void 0===t&&(t=s),void 0===e&&(e=l),new c(t,e)},t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){var i,r,o;r=[e,n(1),n(75),n(36),n(67),n(129),n(131),n(248),n(132),n(249),n(18),n(34),n(8),n(251),n(253),n(254),n(255),n(13),n(256),n(25),n(257)],void 0===(o="function"==typeof(i=function(t,e,n,i,r,o,a,s,l,c,u,p,h,f,d,_,y,m,v,$,g){"use strict";var b,w,k=t.$$importsForInline$$||(t.$$importsForInline$$={}),S=e.kotlin.Unit,x=n.org.koin.core.context.startKoin_eciske$,E=i.io.ktor.client.HttpClient,C=e.getKClass,O=r.co.touchlab.kermit.Kermit,N=o.com.shabinder.common.database.createDatabase,z=o.com.shabinder.common.database.getLogger,j=r.co.touchlab.kermit.Kermit_init_bigt7k$,T=n.org.koin.dsl.module_7dh9ex$,P=a.kotlinx.serialization.json.Json_x26noe$,R=s.io.ktor.client.features.json.serializer.KotlinxSerializer,A=l.io.ktor.client.features.json.JsonFeature,I=c.io.ktor.client.features.logging.Logging,M=c.io.ktor.client.features.logging.Logger,L=c.io.ktor.client.features.logging.get_DEFAULT_3z44iy$,D=c.io.ktor.client.features.logging.LogLevel,q=i.io.ktor.client.HttpClient_f0veat$,F=n.org.koin.core.module.addDefinition_iz18dn$,U=e.kotlin.collections.emptyList_287e2$,B=n.org.koin.core.definition.Kind,H=n.org.koin.core.definition.BeanDefinition,V=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,K=e.kotlin.coroutines.CoroutineImpl,W=i.io.ktor.client.statement.HttpStatement,Y=e.createKType,G=u.io.ktor.http.contentLength_v1wgmc$,J=e.ensureNotNull,Z=p.com.shabinder.common.models.DownloadResult.Progress,Q=u.io.ktor.http.isSuccess_b3he4c$,X=p.com.shabinder.common.models.DownloadResult.Success,tt=p.com.shabinder.common.models.DownloadResult.Error,et=h.kotlinx.coroutines.flow.flow_sxz0o1$,nt=(e.kotlin.text.lastIndexOf_8eortd$,e.kotlin.text.replace_r2fvfm$),it=i.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,rt=i.io.ktor.client.utils,ot=i.io.ktor.client.request.url_3rzbk2$,at=i.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,st=i.io.ktor.client.request.HttpRequestBuilder,lt=e.throwCCE,ct=e.equals,ut=i.io.ktor.client.statement.HttpResponse,pt=i.io.ktor.client.statement.complete_abn2de$,ht=i.io.ktor.client.call,ft=i.io.ktor.client.call.TypeInfo,dt=e.kotlin.math.roundToInt_yrwdxr$,_t=e.kotlin.text.contains_li3zpu$,yt=h.kotlinx.coroutines,mt=h.kotlinx.coroutines.withContext_i5cbzn$,vt=e.Kind.CLASS,$t=f.kotlinx.datetime.Clock,gt=p.com.shabinder.common.models.spotify.TokenData,bt=e.toString,wt=e.Long.ZERO,kt=h.kotlinx.coroutines.launch_s496o7$,St=e.kotlin.text.isBlank_gw00vp$,xt=p.com.shabinder.common.models.AllPlatforms,Et=p.com.shabinder.common.models,Ct=p.com.shabinder.common.models.gaana.GaanaPlaylist,Ot=p.com.shabinder.common.models.gaana.GaanaAlbum,Nt=p.com.shabinder.common.models.gaana.GaanaSong,zt=p.com.shabinder.common.models.gaana.GaanaArtistDetails,jt=p.com.shabinder.common.models.gaana.GaanaArtistTracks,Tt=e.Kind.INTERFACE,Pt=e.kotlin.text.substringAfter_j4ogox$,Rt=e.kotlin.text.substringAfterLast_8cymmc$,At=e.kotlin.text.substringBeforeLast_8cymmc$,It=p.com.shabinder.common.models.spotify.Source,Mt=p.com.shabinder.common.models.PlatformQueryResult,Lt=e.kotlin.collections.firstOrNull_2p1efm$,Dt=e.kotlin.collections.listOf_mh5how$,qt=p.com.shabinder.common.models.DownloadStatus,Ft=p.com.shabinder.common.models.TrackDetails,Ut=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,Bt=e.kotlin.collections.ArrayList_init_ww73n8$,Ht=i.io.ktor.client.request.header_xadl6p$,Vt=i.io.ktor.client.features.defaultRequest_fxc3ki$,Kt=e.throwUPAE,Wt=e.kotlin.text.substringAfterLast_j4ogox$,Yt=e.kotlin.text.substringBefore_j4ogox$,Gt=e.kotlin.text.substringBefore_8cymmc$,Jt=p.com.shabinder.common.models.spotify.Image,Zt=p.com.shabinder.common.models.spotify.Album,Qt=e.kotlin.collections.joinToString_fmv235$,Xt=e.kotlin.text.trim_gw00vp$,te=e.kotlin.collections.getOrNull_yzln2o$,ee=e.kotlin.collections.ArrayList_init_287e2$,ne=e.kotlin.text.Regex_init_61zpoe$,ie=e.kotlin.collections.firstOrNull_7wnvza$,re=a.kotlinx.serialization.json.Json,oe=a.kotlinx.serialization.json.get_jsonObject_u3sd3g$,ae=a.kotlinx.serialization.json.get_jsonArray_u3sd3g$,se=a.kotlinx.serialization.json.get_jsonPrimitive_u3sd3g$,le=a.kotlinx.serialization.json.get_contentOrNull_59esu7$,ce=e.kotlin.collections.listOf_i5x0yv$,ue=e.kotlin.text.split_o64adg$,pe=e.kotlin.collections.last_2p1efm$,he=p.com.shabinder.common.models.YoutubeTrack,fe=e.kotlin.text.replace_680rmw$,de=e.kotlin.text.split_ip8yn$,_e=d.com.willowtreeapps.fuzzywuzzy.diffutils,ye=e.kotlin.text.toInt_pdl1vz$,me=e.numberToInt,ve=e.kotlin.collections.toList_abgq59$,$e=e.kotlin.collections.toMap_6hr0sd$,ge=u.io.ktor.http.ContentType,be=u.io.ktor.http.contentType_41kwpe$,we=i.io.ktor.client.request.headers_nc42ot$,ke=a.kotlinx.serialization.json.put_kdidqz$,Se=a.kotlinx.serialization.json.putJsonObject_qdwamy$,xe=e.kotlin.reflect.js.internal.PrimitiveClasses.stringClass,Ee=a.kotlinx.serialization.json.JsonArrayBuilder,Ce=e.kotlin.collections.LinkedHashMap_init_q3lmfv$,Oe=e.kotlin.math.abs_za3lpa$,Ne=e.kotlin.collections.sortedWith_eknfly$,ze=e.wrapFunction,je=e.kotlin.Comparator,Te=a.kotlinx.serialization.json.JsonObjectBuilder,Pe=i.io.ktor.client.request.forms.FormDataContent,Re=_.io.ktor.client.features.auth.Auth,Ae=_.io.ktor.client.features.auth.providers.basic_c7fts0$,Ie=e.kotlin.lazy_klfg04$,Me=u.io.ktor.http.ParametersBuilder,Le=p.com.shabinder.common.models.spotify.Playlist,De=p.com.shabinder.common.models.spotify.PagingObjectPlaylistTrack,qe=p.com.shabinder.common.models.spotify.Track,Fe=(h.kotlinx.coroutines.CancellationException_init_pdl1vj$,h.kotlinx.coroutines.cancel_x105z1$,h.kotlinx.coroutines.CoroutineScope_1fupul$,Error,h.kotlinx.coroutines.CompletableDeferred_xptg6w$,h.kotlinx.coroutines.Job_5dx9e$,h.kotlinx.coroutines.channels.Channel_lsve6m$,m.io.ktor.utils.io.core.Closeable,h.kotlinx.coroutines.selects.SelectBuilderImpl,e.kotlin.IllegalArgumentException_init_pdl1vj$,e.unboxChar),Ue=a.kotlinx.serialization.json.JsonObject,Be=e.kotlin.io.println_s8jyv4$,He=e.kotlin.Exception,Ve=h.kotlinx.coroutines.flow.MutableSharedFlow_ympafm$,Ke=p.com.shabinder.common.models.DownloadStatus.Downloading,We=h.kotlinx.coroutines.flow.FlowCollector,Ye=e.kotlin.collections.HashMap_init_q3lmfv$,Ge=g.saveAs,Je=e.kotlin.collections.copyToArray;function Ze(t){return S}function Qe(t,e){return new Ki(t.get_7a9my5$(C(O),null,null),N())}function Xe(t,e){return j(z())}function tn(t,e){return new gn(t.get_7a9my5$(C(Ki),null,null),t.get_7a9my5$(C(O),null,null))}function en(t,e){return new ri(t.get_7a9my5$(C(O),null,null),t.get_7a9my5$(C(E),null,null))}function nn(t,e){return new Ln(t.get_7a9my5$(C(gn),null,null),t.get_7a9my5$(C(O),null,null),t.get_7a9my5$(C(Ki),null,null))}function rn(t,e){return new An(t.get_7a9my5$(C(E),null,null),t.get_7a9my5$(C(O),null,null),t.get_7a9my5$(C(Ki),null,null))}function on(t,e){return new nr(t.get_7a9my5$(C(E),null,null),t.get_7a9my5$(C(O),null,null),t.get_7a9my5$(C(Ki),null,null))}function an(t,e){return new Gn(t.get_7a9my5$(C(E),null,null),t.get_7a9my5$(C(O),null,null),t.get_7a9my5$(C(Ki),null,null))}function sn(t,e){return new yn(t.get_7a9my5$(C(An),null,null),t.get_7a9my5$(C(Ln),null,null),t.get_7a9my5$(C(nr),null,null),t.get_7a9my5$(C(ri),null,null),t.get_7a9my5$(C(Gn),null,null),t.get_7a9my5$(C(Ki),null,null))}function ln(t){return function(e){var n,i=function(t){return function(e,n){return hn(t)}}(t),r=e.makeOptions_dqye30$(!1,!1),o=e.rootScope;n=U();var a=new H(o,C(E),null,i,B.Single,n,r);F(e.definitions,a);var s,l=e.makeOptions_dqye30$(!1,!1),c=e.rootScope;s=U();var u=new H(c,C(Ki),null,Qe,B.Single,s,l);F(e.definitions,u);var p,h=e.makeOptions_dqye30$(!1,!1),f=e.rootScope;p=U();var d=new H(f,C(O),null,Xe,B.Single,p,h);F(e.definitions,d);var _,y=e.makeOptions_dqye30$(!1,!1),m=e.rootScope;_=U();var v=new H(m,C(gn),null,tn,B.Single,_,y);F(e.definitions,v);var $,g=e.makeOptions_dqye30$(!1,!1),b=e.rootScope;$=U();var w=new H(b,C(ri),null,en,B.Single,$,g);F(e.definitions,w);var k,x=e.makeOptions_dqye30$(!1,!1),N=e.rootScope;k=U();var z=new H(N,C(Ln),null,nn,B.Single,k,x);F(e.definitions,z);var j,T=e.makeOptions_dqye30$(!1,!1),P=e.rootScope;j=U();var R=new H(P,C(An),null,rn,B.Single,j,T);F(e.definitions,R);var A,I=e.makeOptions_dqye30$(!1,!1),M=e.rootScope;A=U();var L=new H(M,C(nr),null,on,B.Single,A,I);F(e.definitions,L);var D,q=e.makeOptions_dqye30$(!1,!1),V=e.rootScope;D=U();var K=new H(V,C(Gn),null,an,B.Single,D,q);F(e.definitions,K);var W,Y=e.makeOptions_dqye30$(!1,!1),G=e.rootScope;W=U();var J=new H(G,C(yn),null,sn,B.Single,W,Y);return F(e.definitions,J),S}}function cn(t){return T(void 0,void 0,ln(t))}function un(t){return t.logger=L(M.Companion),t.level=D.INFO,S}function pn(t,e){return function(n){return n.install_xlxg29$(A.Feature,function(t){return function(e){return e.serializer=t,S}}(t)),e&&n.install_xlxg29$(I.Companion,un),S}}function hn(t,e){return void 0===t&&(t=!1),void 0===e&&(e=b),q(pn(e,t))}function fn(t,e,n,i){K.call(this,i),this.$controller=n,this.exceptionState_0=6,this.local$closure$url=t,this.local$client=void 0,this.local$response=void 0,this.local$response_0=void 0,this.local$data=void 0,this.local$offset=void 0,this.local$currentRead=void 0,this.local$$receiver=e}function dn(t,e){return et((n=t,function(t,e,i){var r=new fn(n,t,this,e);return i?r:r.doResume(null)}));var n}function _n(t,e,n,i,r,o){return void 0===o&&(o=".mp3"),r+Ni(n)+t.fileSeparator()+(0===i.length?"":Ni(i)+t.fileSeparator())+Ni(e)+o}function yn(t,e,n,i,r,o){this.gaanaProvider_0=t,this.spotifyProvider_0=e,this.youtubeProvider=n,this.youtubeMusic=i,this.youtubeMp3=r,this.dir_0=o}function mn(t,e,n,i,r,o){K.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$this$FetchPlatformQueryResult=t,this.local$this$=e,this.local$closure$link=n}function vn(t,e,n){return function(i,r,o){var a=new mn(t,e,n,i,this,r);return o?a:a.doResume(null)}}function $n(t,e,n){K.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$result=void 0,this.local$link=e}function gn(t,e){this.dir_0=t,this.logger_0=e}function bn(t){return function(){var e;return"System Time:"+$t.System.now().epochSeconds.toString()+" , Token Expiry:"+bt(null!=(e=t.v)?e.expiry:null)}}function wn(){return"Requesting New Token"}function kn(t,e,n,i,r){K.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$token=t,this.local$this$TokenStore=e}function Sn(t,e){return function(n,i,r){var o=new kn(t,e,n,this,i);return r?o:o.doResume(null)}}function xn(t,e){K.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$token=void 0}function En(t){return S}function Cn(){return e.isType(Xn,Object.getPrototypeOf(xt.Js).constructor)?Et.corsProxy.url:""}function On(){return Cn()+"https://api.gaana.com"}function Nn(){}function zn(t,e,n,i,r,o,a){K.call(this,a),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$type=e,this.local$subtype=n,this.local$seokey=i,this.local$format=r,this.local$limit=o}function jn(t,e,n,i,r,o,a){K.call(this,a),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$type=e,this.local$subtype=n,this.local$seokey=i,this.local$format=r,this.local$limit=o}function Tn(t,e,n,i,r,o){K.call(this,o),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$type=e,this.local$subtype=n,this.local$seokey=i,this.local$format=r}function Pn(t,e,n,i,r,o){K.call(this,o),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$type=e,this.local$subtype=n,this.local$seokey=i,this.local$format=r}function Rn(t,e,n,i,r,o,a){K.call(this,a),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$type=e,this.local$subtype=n,this.local$seokey=i,this.local$format=r,this.local$limit=o}function An(t,e,n){this.httpClient_olzm31$_0=t,this.logger_0=e,this.dir_0=n,this.gaanaPlaceholderImageUrl_0="https://a10.gaanacdn.com/images/social/gaana_social.jpg"}function In(t,e){return function(){return"GAANA SEARCH: "+t+" - "+e}}function Mn(t,e,n,i){K.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$result=void 0,this.local$type=e,this.local$link=n}function Ln(t,e,n){var i;this.tokenStore_0=t,this.logger_0=e,this.dir_0=n,this.logger_0.d_h4ejuu$(Wn),kt(yt.GlobalScope,yt.Dispatchers.Default,void 0,(i=this,function(t,e,n){var r=new Yn(i,t,this,e);return n?r:r.doResume(null)})),this.httpClient_y295mb$_0=this.httpClient_y295mb$_0}function Dn(){return"Please Check your Network Connection"}function qn(t){return function(){return"Spotify Provider Created with "+bt(t)}}function Fn(t){return t.serializer=b,S}function Un(t){return function(e){return Vt(e,function(t){return function(e){return Ht(e,"Authorization","Bearer "+bt(t.access_token)),S}}(t)),e.install_xlxg29$(A.Feature,Fn),S}}function Bn(t,e,n){K.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$override=e}function Hn(t,e,n){K.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$spotifyLink=void 0,this.local$link=void 0,this.local$type=void 0,this.local$fullLink=e}function Vn(t,e,n,i){K.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$result=void 0,this.local$playlistObject=void 0,this.local$tempTrackList=void 0,this.local$moreTracksAvailable=void 0,this.local$type=e,this.local$link=n}function Kn(t,e,n){K.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$url=e}function Wn(){return"Creating Spotify Provider"}function Yn(t,e,n,i){K.call(this,i),this.$controller=n,this.exceptionState_0=1,this.local$this$SpotifyProvider=t}function Gn(t,e,n){this.httpClient_zhlaeb$_0=t,this.logger_0=e,this.dir_0=n}function Jn(t,e,n){K.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$videoID=e}fn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},fn.prototype=Object.create(K.prototype),fn.prototype.constructor=fn,fn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$client=hn();var t,n=this.local$closure$url;t=rt.EmptyContent;var i=new st;ot(i,"http","localhost",0,"/"),i.method=at.Companion.Get,i.body=t,it(i.url,n);var r,o,a,s=new W(i,this.local$client);if(r=C(W),ct(r,C(W))){this.result_0=e.isType(o=s,W)?o:lt(),this.state_0=9;continue}if(ct(r,C(ut))){if(this.state_0=7,this.result_0=s.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=s.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var l;this.local$response=this.result_0,this.exceptionState_0=4;var c,u=this.local$response.call;t:do{try{c=new ft(C(W),ht.JsType,Y(C(W),[],!1))}catch(t){c=new ft(C(W),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=u.receive_jo9acv$(c,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(l=this.result_0,W)?l:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(a=this.result_0,W)?a:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:if(this.result_0,this.state_0=10,this.result_0=this.result_0.execute(this),this.result_0===V)return V;continue;case 10:this.local$response_0=this.result_0,this.local$data=new Int8Array(J(G(this.local$response_0)).toInt()),this.local$offset=0,this.state_0=11;continue;case 11:if(this.state_0=12,this.result_0=this.local$response_0.content.readAvailable_mj6st8$(this.local$data,this.local$offset,this.local$data.length,this),this.result_0===V)return V;continue;case 12:this.local$currentRead=this.result_0,this.local$offset=this.local$offset+this.local$currentRead|0;var p=dt(100*this.local$offset/this.local$data.length);if(this.state_0=13,this.result_0=this.local$$receiver.emit_11rb$(new Z(p),this),this.result_0===V)return V;continue;case 13:if(this.local$currentRead<=0){this.state_0=14;continue}this.state_0=11;continue;case 14:if(Q(this.local$response_0.status)){if(this.state_0=16,this.result_0=this.local$$receiver.emit_11rb$(new X(this.local$data),this),this.result_0===V)return V;continue}if(this.state_0=15,this.result_0=this.local$$receiver.emit_11rb$(new tt("File not downloaded"),this),this.result_0===V)return V;continue;case 15:case 16:this.state_0=17;continue;case 17:return this.local$client.close(),S;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(yn.prototype,"db_0",{configurable:!0,get:function(){var t;return null!=(t=this.dir_0.db)?t.downloadRecordDatabaseQueries:null}}),mn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},mn.prototype=Object.create(K.prototype),mn.prototype.constructor=mn,mn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;return null!=(t=this.local$this$FetchPlatformQueryResult.db_0)?(t.add_9slmj3$(this.local$this$.folderType,this.local$this$.title,this.local$closure$link,this.local$this$.coverUrl,e.Long.fromInt(this.local$this$.trackList.size)),S):null;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},$n.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},$n.prototype=Object.create(K.prototype),$n.prototype.constructor=$n,$n.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(_t(this.local$link,"spotify",!0)){if(this.state_0=6,this.result_0=this.$this.spotifyProvider_0.query_61zpoe$(this.local$link,this),this.result_0===V)return V;continue}if(_t(this.local$link,"youtube.com",!0)||_t(this.local$link,"youtu.be",!0)){if(this.state_0=4,this.result_0=this.$this.youtubeProvider.query_61zpoe$(this.local$link,this),this.result_0===V)return V;continue}if(_t(this.local$link,"gaana",!0)){if(this.state_0=2,this.result_0=this.$this.gaanaProvider_0.query_61zpoe$(this.local$link,this),this.result_0===V)return V;continue}this.local$tmp$=null,this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:this.state_0=5;continue;case 4:this.local$tmp$=this.result_0,this.state_0=5;continue;case 5:this.state_0=7;continue;case 6:this.local$tmp$=this.result_0,this.state_0=7;continue;case 7:if(this.local$result=this.local$tmp$,null!=this.local$result){if(this.state_0=8,this.result_0=mt(yt.Dispatchers.Default,vn(this.$this,this.local$result,this.local$link),this),this.result_0===V)return V;continue}this.state_0=9;continue;case 8:this.state_0=9;continue;case 9:return this.local$result;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},yn.prototype.query_61zpoe$=function(t,e,n){var i=new $n(this,t,e);return n?i:i.doResume(null)},yn.$metadata$={kind:vt,simpleName:"FetchPlatformQueryResult",interfaces:[]},Object.defineProperty(gn.prototype,"db_0",{configurable:!0,get:function(){var t;return null!=(t=this.dir_0.db)?t.tokenDBQueries:null}}),gn.prototype.save_0=function(t){var e,n=t.access_token;null==n||St(n)||null==t.expiry||null!=(e=this.db_0)&&e.add_4wgjuj$(J(t.access_token),J(t.expiry).add($t.System.now().epochSeconds))},kn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},kn.prototype=Object.create(K.prototype),kn.prototype.constructor=kn,kn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e;if(null!=(null!=(t=this.local$closure$token.v)?t.access_token:null)){var n=this.local$closure$token;this.local$this$TokenStore.save_0(n.v),e=S}else e=null;return e;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},xn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},xn.prototype=Object.create(K.prototype),xn.prototype.constructor=xn,xn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e,n,i,r,o,a=n;if(o=new gt(a.accessToken,null,a.expiry),this.local$token={v:null!=(n=null!=(e=null!=(t=this.$this.db_0)?t.select():null)?e.executeAsOneOrNull():null)?o:null},this.$this.logger_0.d_h4ejuu$(bn(this.local$token)),$t.System.now().epochSeconds.compareTo_11rb$(null!=(r=null!=(i=this.local$token.v)?i.expiry:null)?r:wt)>0||null==this.local$token.v){if(this.$this.logger_0.d_h4ejuu$(wn),this.state_0=2,this.result_0=_i(this),this.result_0===V)return V;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.local$token.v=this.result_0,kt(yt.GlobalScope,void 0,void 0,Sn(this.local$token,this.$this)),this.state_0=3;continue;case 3:return this.local$token.v;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},gn.prototype.getToken=function(t,e){var n=new xn(this,t);return e?n:n.doResume(null)},gn.$metadata$={kind:vt,simpleName:"TokenStore",interfaces:[]},zn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},zn.prototype=Object.create(K.prototype),zn.prototype.constructor=zn,zn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=On()+"/?type="+this.local$type+"&subtype="+this.local$subtype+"&seokey="+this.local$seokey+"&token="+w+"&format="+this.local$format+"&limit="+this.local$limit;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),En();var o,a,s,l=new W(r,n);if(o=C(Ct),ct(o,C(W))){this.result_0=e.isType(a=l,Ct)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(Ct),ht.JsType,Y(C(Ct),[],!1))}catch(t){u=new ft(C(Ct),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,Ct)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,Ct)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Nn.prototype.getGaanaPlaylist_tgym8q$$default=function(t,e,n,i,r,o,a){var s=new zn(this,t,e,n,i,r,o);return a?s:s.doResume(null)},Nn.prototype.getGaanaPlaylist_tgym8q$=function(t,e,n,i,r,o,a){return void 0===t&&(t="playlist"),void 0===e&&(e="playlist_detail"),void 0===i&&(i="JSON"),void 0===r&&(r=2e3),a?a(t,e,n,i,r,o):this.getGaanaPlaylist_tgym8q$$default(t,e,n,i,r,o)},jn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},jn.prototype=Object.create(K.prototype),jn.prototype.constructor=jn,jn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=On()+"/?type="+this.local$type+"&subtype="+this.local$subtype+"&seokey="+this.local$seokey+"&token="+w+"&format="+this.local$format+"&limit="+this.local$limit;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),En();var o,a,s,l=new W(r,n);if(o=C(Ot),ct(o,C(W))){this.result_0=e.isType(a=l,Ot)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(Ot),ht.JsType,Y(C(Ot),[],!1))}catch(t){u=new ft(C(Ot),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,Ot)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,Ot)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Nn.prototype.getGaanaAlbum_tgym8q$$default=function(t,e,n,i,r,o,a){var s=new jn(this,t,e,n,i,r,o);return a?s:s.doResume(null)},Nn.prototype.getGaanaAlbum_tgym8q$=function(t,e,n,i,r,o,a){return void 0===t&&(t="album"),void 0===e&&(e="album_detail"),void 0===i&&(i="JSON"),void 0===r&&(r=2e3),a?a(t,e,n,i,r,o):this.getGaanaAlbum_tgym8q$$default(t,e,n,i,r,o)},Tn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Tn.prototype=Object.create(K.prototype),Tn.prototype.constructor=Tn,Tn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=On()+"/?type="+this.local$type+"&subtype="+this.local$subtype+"&seokey="+this.local$seokey+"&token="+w+"&format="+this.local$format;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),En();var o,a,s,l=new W(r,n);if(o=C(Nt),ct(o,C(W))){this.result_0=e.isType(a=l,Nt)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(Nt),ht.JsType,Y(C(Nt),[],!1))}catch(t){u=new ft(C(Nt),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,Nt)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,Nt)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Nn.prototype.getGaanaSong_w74nik$$default=function(t,e,n,i,r,o){var a=new Tn(this,t,e,n,i,r);return o?a:a.doResume(null)},Nn.prototype.getGaanaSong_w74nik$=function(t,e,n,i,r,o){return void 0===t&&(t="song"),void 0===e&&(e="song_detail"),void 0===i&&(i="JSON"),o?o(t,e,n,i,r):this.getGaanaSong_w74nik$$default(t,e,n,i,r)},Pn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Pn.prototype=Object.create(K.prototype),Pn.prototype.constructor=Pn,Pn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=On()+"/?type="+this.local$type+"&subtype="+this.local$subtype+"&seokey="+this.local$seokey+"&token="+w+"&format="+this.local$format;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),En();var o,a,s,l=new W(r,n);if(o=C(zt),ct(o,C(W))){this.result_0=e.isType(a=l,zt)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(zt),ht.JsType,Y(C(zt),[],!1))}catch(t){u=new ft(C(zt),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,zt)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,zt)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Nn.prototype.getGaanaArtistDetails_w74nik$$default=function(t,e,n,i,r,o){var a=new Pn(this,t,e,n,i,r);return o?a:a.doResume(null)},Nn.prototype.getGaanaArtistDetails_w74nik$=function(t,e,n,i,r,o){return void 0===t&&(t="artist"),void 0===e&&(e="artist_details_info"),void 0===i&&(i="JSON"),o?o(t,e,n,i,r):this.getGaanaArtistDetails_w74nik$$default(t,e,n,i,r)},Rn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Rn.prototype=Object.create(K.prototype),Rn.prototype.constructor=Rn,Rn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=On()+"/?type="+this.local$type+"&subtype="+this.local$subtype+"&seokey="+this.local$seokey+"&token="+w+"&format="+this.local$format+"&limit="+this.local$limit;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),En();var o,a,s,l=new W(r,n);if(o=C(jt),ct(o,C(W))){this.result_0=e.isType(a=l,jt)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(jt),ht.JsType,Y(C(jt),[],!1))}catch(t){u=new ft(C(jt),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,jt)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,jt)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Nn.prototype.getGaanaArtistTracks_tgym8q$$default=function(t,e,n,i,r,o,a){var s=new Rn(this,t,e,n,i,r,o);return a?s:s.doResume(null)},Nn.prototype.getGaanaArtistTracks_tgym8q$=function(t,e,n,i,r,o,a){return void 0===t&&(t="artist"),void 0===e&&(e="artist_track_listing"),void 0===i&&(i="JSON"),void 0===r&&(r=50),a?a(t,e,n,i,r,o):this.getGaanaArtistTracks_tgym8q$$default(t,e,n,i,r,o)},Nn.$metadata$={kind:Tt,simpleName:"GaanaRequests",interfaces:[]},Object.defineProperty(An.prototype,"httpClient",{get:function(){return this.httpClient_olzm31$_0}}),An.prototype.query_61zpoe$=function(t,e){var n=Pt(t,"gaana.com/"),i=Rt(n,47,"error"),r=Rt(At(n,47,"error"),47);return ct(r,"Error")||ct(i,"Error")?null:this.gaanaSearch_0(r,i,e)},Mn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Mn.prototype=Object.create(K.prototype),Mn.prototype.constructor=Mn,Mn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e;switch(this.local$result=new Mt("",this.local$link,this.local$link,this.$this.gaanaPlaceholderImageUrl_0,U(),It.Gaana),this.$this.logger_0.i_h4ejuu$(In(this.local$type,this.local$link)),this.local$type){case"song":if(this.state_0=6,this.result_0=this.$this.getGaanaSong_w74nik$(void 0,void 0,this.local$link,void 0,this),this.result_0===V)return V;continue;case"album":if(this.state_0=5,this.result_0=this.$this.getGaanaAlbum_tgym8q$(void 0,void 0,this.local$link,void 0,void 0,this),this.result_0===V)return V;continue;case"playlist":if(this.state_0=4,this.result_0=this.$this.getGaanaPlaylist_tgym8q$(void 0,void 0,this.local$link,void 0,void 0,this),this.result_0===V)return V;continue;case"artist":if(this.local$result.folderType="Artist",this.local$result.subFolder=this.local$link,this.local$result.coverUrl=this.$this.gaanaPlaceholderImageUrl_0,this.state_0=2,this.result_0=this.$this.getGaanaArtistDetails_w74nik$(void 0,void 0,this.local$link,void 0,this),this.result_0===V)return V;continue;default:this.state_0=7;continue}case 1:throw this.exception_0;case 2:var n;if(null!=(e=Lt(this.result_0.artist))&&(this.local$result.title=e.name,this.local$result.coverUrl=null!=(n=e.artworkLink)?n:this.$this.gaanaPlaceholderImageUrl_0),this.state_0=3,this.result_0=this.$this.getGaanaArtistTracks_tgym8q$(void 0,void 0,this.local$link,void 0,void 0,this),this.result_0===V)return V;continue;case 3:var i,r,o,a,s=this.result_0;if(null!=(i=s.tracks))for(a=i.iterator();a.hasNext();){var l=a.next();this.$this.updateStatusIfPresent_0(l,this.local$result.folderType,this.local$result.subFolder)}this.local$result.trackList=null!=(o=null!=(r=s.tracks)?this.$this.toTrackDetailsList_0(r,this.local$result.folderType,this.local$result.subFolder):null)?o:U(),this.state_0=7;continue;case 4:var c,u=this.result_0;for(this.local$result.folderType="Playlists",this.local$result.subFolder=this.local$link,c=u.tracks.iterator();c.hasNext();){var p=c.next();this.$this.updateStatusIfPresent_0(p,this.local$result.folderType,this.local$result.subFolder)}this.local$result.trackList=this.$this.toTrackDetailsList_0(u.tracks,this.local$result.folderType,this.local$result.subFolder),this.local$result.title=this.local$link,this.local$result.coverUrl=this.$this.gaanaPlaceholderImageUrl_0,this.state_0=7;continue;case 5:var h,f=this.result_0;for(this.local$result.folderType="Albums",this.local$result.subFolder=this.local$link,h=f.tracks.iterator();h.hasNext();){var d=h.next();this.$this.updateStatusIfPresent_0(d,this.local$result.folderType,this.local$result.subFolder)}this.local$result.trackList=this.$this.toTrackDetailsList_0(f.tracks,this.local$result.folderType,this.local$result.subFolder),this.local$result.title=this.local$link,this.local$result.coverUrl=f.custom_artworks.size_480p,this.state_0=7;continue;case 6:null!=(t=Lt(this.result_0.tracks))&&(this.local$result.folderType="Tracks",this.local$result.subFolder="",this.$this.updateStatusIfPresent_0(t,this.local$result.folderType,this.local$result.subFolder),this.local$result.trackList=this.$this.toTrackDetailsList_0(Dt(t),this.local$result.folderType,this.local$result.subFolder),this.local$result.title=t.track_title,this.local$result.coverUrl=t.artworkLink),this.state_0=7;continue;case 7:return this.local$result;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},An.prototype.gaanaSearch_0=function(t,e,n,i){var r=new Mn(this,t,e,n);return i?r:r.doResume(null)},An.prototype.toTrackDetailsList_0=function(t,e,n){var i,r=Bt(Ut(t,10));for(i=t.iterator();i.hasNext();){var o,a,s,l,c,u,p,h,f,d,_,y=i.next(),m=r.add_11rb$;o=y.track_title;var v,$,g,b=y.artist,w=Bt(Ut(b,10));for(v=b.iterator();v.hasNext();){var k=v.next();w.add_11rb$(bt(null!=k?k.name:null))}if(a=y.duration,s=this.dir_0.imageCacheDir()+Rt(At(y.artworkLink,47),47)+".jpeg",l=y.album_title,c=y.release_date,null!=(u=y.genre)){var S,x=Bt(Ut(u,10));for(S=u.iterator();S.hasNext();){var E=S.next();x.add_11rb$(null!=E?E.name:null)}$=x}else $=null;if(null!=(p=$)){var C;t:do{var O=p.iterator();if(!O.hasNext()){C=null;break t}for(var N=O.next();O.hasNext();)N+=bt(O.next());C=N}while(0);g=C}else g=null;h="Genres:"+bt(g),f=y.lyrics_url,_=null!=(d=y.downloaded)?d:qt.NotDownloaded,m.call(r,new Ft(o,w,a,l,c,h,void 0,f,s,y.artworkLink,It.Gaana,void 0,_,_n(this.dir_0,y.track_title,e,n,this.dir_0.defaultDir())))}return r},An.prototype.updateStatusIfPresent_0=function(t,e,n){this.dir_0.isPresent_61zpoe$(_n(this.dir_0,t.track_title,e,n,this.dir_0.defaultDir()))&&(t.downloaded=qt.Downloaded)},An.$metadata$={kind:vt,simpleName:"GaanaProvider",interfaces:[Nn]},Bn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Bn.prototype=Object.create(K.prototype),Bn.prototype.constructor=Bn,Bn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.local$override){if(this.state_0=3,this.result_0=_i(this),this.result_0===V)return V;continue}if(this.state_0=2,this.result_0=this.$this.tokenStore_0.getToken(this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:case 3:this.local$tmp$=this.result_0,this.state_0=4;continue;case 4:var e=this.local$tmp$;return null==e?(this.$this.logger_0.d_h4ejuu$(Dn),t=null):(this.$this.logger_0.d_h4ejuu$(qn(e)),this.$this.httpClient=q(Un(e)),t=this.$this.httpClient),t;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ln.prototype.authenticateSpotifyClient_6taknv$$default=function(t,e,n){var i=new Bn(this,t,e);return n?i:i.doResume(null)},Object.defineProperty(Ln.prototype,"httpClient",{configurable:!0,get:function(){return null==this.httpClient_y295mb$_0?Kt("httpClient"):this.httpClient_y295mb$_0},set:function(t){this.httpClient_y295mb$_0=t}}),Hn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Hn.prototype=Object.create(K.prototype),Hn.prototype.constructor=Hn,Hn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(null==this.$this.httpClient_y295mb$_0){if(this.state_0=2,this.result_0=this.$this.authenticateSpotifyClient_6taknv$(void 0,this),this.result_0===V)return V;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.state_0=3;continue;case 3:var t,n=Yt(Wt(this.local$fullLink,"https://")," ");if(this.local$spotifyLink="https://"+Xt(e.isCharSequence(t=n)?t:lt()).toString(),_t(this.local$spotifyLink,"open.spotify")){this.state_0=5;continue}if(this.state_0=4,this.result_0=this.$this.resolveLink_0(this.local$spotifyLink,this),this.result_0===V)return V;continue;case 4:this.local$spotifyLink=this.result_0,this.state_0=5;continue;case 5:if(this.local$link=Gt(Rt(this.local$spotifyLink,47,"Error"),63),this.local$type=Rt(At(this.local$spotifyLink,47,"Error"),47),ct(this.local$type,"Error")||ct(this.local$link,"Error"))return null;this.state_0=6;continue;case 6:if(ct(this.local$type,"episode")||ct(this.local$type,"show"))return null;this.state_0=7;continue;case 7:if(this.state_0=8,this.result_0=this.$this.spotifySearch_0(this.local$type,this.local$link,this),this.result_0===V)return V;continue;case 8:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ln.prototype.query_61zpoe$=function(t,e,n){var i=new Hn(this,t,e);return n?i:i.doResume(null)},Vn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Vn.prototype=Object.create(K.prototype),Vn.prototype.constructor=Vn,Vn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$result=new Mt("","","","",U(),It.Spotify),this.state_0=2;continue;case 1:throw this.exception_0;case 2:var t,e,n,i,r,o,a,s,l,c,u,p,h;switch(this.local$type){case"track":if(this.state_0=8,this.result_0=this.$this.getTrack_pdl1vj$(this.local$link,this),this.result_0===V)return V;continue;case"album":if(this.state_0=7,this.result_0=this.$this.getAlbum_61zpoe$(this.local$link,this),this.result_0===V)return V;continue;case"playlist":if(this.state_0=3,this.result_0=this.$this.getPlaylist_61zpoe$(this.local$link,this),this.result_0===V)return V;continue;case"episode":case"show":default:this.state_0=9;continue}case 3:var f;if(this.local$playlistObject=this.result_0,this.local$result.folderType="Playlists",this.local$result.subFolder=bt(this.local$playlistObject.name),this.local$tempTrackList=ee(),null!=(o=null!=(r=this.local$playlistObject.tracks)?r.items:null))for(f=o.iterator();f.hasNext();){var d;null!=(d=f.next().track)&&(this.$this.updateStatusIfPresent_0(d,this.local$result.folderType,this.local$result.subFolder),this.local$tempTrackList.add_11rb$(d))}var _=null!=(a=this.local$playlistObject.tracks)?a.next:null;this.local$moreTracksAvailable=!(null==_||St(_)),this.state_0=4;continue;case 4:if(!this.local$moreTracksAvailable){this.state_0=6;continue}if(this.state_0=5,this.result_0=this.$this.getPlaylistTracks_hs9j5r$(this.local$link,this.local$tempTrackList.size,void 0,this),this.result_0===V)return V;continue;case 5:var y,m=this.result_0;if(null!=(s=m.items))for(y=s.iterator();y.hasNext();){var v;null!=(v=y.next().track)&&this.local$tempTrackList.add_11rb$(v)}var $=m.next;this.local$moreTracksAvailable=!(null==$||St($)),this.state_0=4;continue;case 6:this.local$result.trackList=this.$this.toTrackDetailsList_0(this.local$tempTrackList,this.local$result.folderType,this.local$result.subFolder),this.local$result.title=bt(this.local$playlistObject.name),this.local$result.coverUrl=null!=(h=null!=(c=null!=(l=this.local$playlistObject.images)?te(l,1):null)?c.url:null)?h:bt(null!=(p=null!=(u=this.local$playlistObject.images)?Lt(u):null)?p.url:null),this.state_0=9;continue;case 7:var g,b=this.result_0;if(this.local$result.folderType="Albums",this.local$result.subFolder=bt(b.name),null!=(e=null!=(t=b.tracks)?t.items:null))for(g=e.iterator();g.hasNext();){var w,k,S,x,E,C=g.next();this.$this.updateStatusIfPresent_0(C,this.local$result.folderType,this.local$result.subFolder),C.album=new Zt(void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,Dt(new Jt(void 0,void 0,null!=(E=null!=(k=null!=(w=b.images)?te(w,1):null)?k.url:null)?E:null!=(x=null!=(S=b.images)?te(S,0):null)?x.url:null)))}var O,N,z,j,T,P=null!=(i=null!=(n=b.tracks)?n.items:null)?this.$this.toTrackDetailsList_0(i,this.local$result.folderType,this.local$result.subFolder):null;null==P||P.isEmpty()||(this.local$result.trackList=P,this.local$result.title=bt(b.name),this.local$result.coverUrl=bt(null!=(T=null!=(N=null!=(O=b.images)?te(O,1):null)?N.url:null)?T:null!=(j=null!=(z=b.images)?te(z,0):null)?j.url:null)),this.state_0=9;continue;case 8:var R,A,I,M,L,D,q,F=this.result_0;this.local$result.folderType="Tracks",this.local$result.subFolder="",this.$this.updateStatusIfPresent_0(F,this.local$result.folderType,this.local$result.subFolder),this.local$result.trackList=this.$this.toTrackDetailsList_0(Dt(F),this.local$result.folderType,this.local$result.subFolder),this.local$result.title=bt(F.name),this.local$result.coverUrl=bt(null!=(q=null!=(I=null!=(A=null!=(R=F.album)?R.images:null)?te(A,1):null)?I.url:null)?q:null!=(D=null!=(L=null!=(M=F.album)?M.images:null)?te(L,0):null)?D.url:null),this.state_0=9;continue;case 9:return this.local$result;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ln.prototype.spotifySearch_0=function(t,e,n,i){var r=new Vn(this,t,e,n);return i?r:r.doResume(null)},Kn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Kn.prototype=Object.create(K.prototype),Kn.prototype.constructor=Kn,Kn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.getResponse_61zpoe$(this.local$url,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:var e=this.result_0,n=ne("https://open\\.spotify\\.com.+\\w");return bt(null!=(t=n.find_905azu$(e))?t.value:null);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ln.prototype.resolveLink_0=function(t,e,n){var i=new Kn(this,t,e);return n?i:i.doResume(null)},Ln.prototype.toTrackDetailsList_0=function(t,n,i){var r,o=Bt(Ut(t,10));for(r=t.iterator();r.hasNext();){var a,s,l,c,u,p,h,f,d,_,y,m,v,$,g,b,w,k,S,x,E,C,O,N,z,j,T,P,R,A,I,M,L=r.next(),D=o.add_11rb$;if(a=bt(L.name),null!=(s=L.artists)){var q,F=Bt(Ut(s,10));for(q=s.iterator();q.hasNext();){var B=q.next();F.add_11rb$(bt(null!=B?B.name:null))}M=F}else M=null;c=null!=(l=M)?l:U(),u=L.duration_ms.div(e.Long.fromInt(1e3)).toInt(),$=this.dir_0.imageCacheDir(),v=Rt(null!=(m=null!=(f=null!=(h=null!=(p=L.album)?p.images:null)?te(h,1):null)?f.url:null)?m:bt(null!=(y=null!=(_=null!=(d=L.album)?d.images:null)?Lt(_):null)?y.url:null),47),b=null!=(g=L.album)?g.name:null,k=null!=(w=L.album)?w.release_date:null,E="Genres:"+bt(null!=(x=null!=(S=L.album)?S.genres:null)?Qt(x):null),C=L.href,O=L.downloaded,N=It.Spotify,D.call(o,new Ft(a,c,u,b,k,E,void 0,C,$+v+".jpeg",null!=(I=null!=(T=null!=(j=null!=(z=L.album)?z.images:null)?te(j,1):null)?T.url:null)?I:bt(null!=(A=null!=(R=null!=(P=L.album)?P.images:null)?Lt(R):null)?A.url:null),N,void 0,O,_n(this.dir_0,bt(L.name),n,i,this.dir_0.defaultDir())))}return o},Ln.prototype.updateStatusIfPresent_0=function(t,e,n){this.dir_0.isPresent_61zpoe$(_n(this.dir_0,bt(t.name),e,n,this.dir_0.defaultDir()))&&(t.downloaded=qt.Downloaded)},Yn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Yn.prototype=Object.create(K.prototype),Yn.prototype.constructor=Yn,Yn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(e.isType(Xn,Object.getPrototypeOf(xt.Js).constructor)){if(this.state_0=3,this.result_0=this.local$this$SpotifyProvider.authenticateSpotifyClient_6taknv$(!0,this),this.result_0===V)return V;continue}if(this.state_0=2,this.result_0=this.local$this$SpotifyProvider.authenticateSpotifyClient_6taknv$(void 0,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:case 3:return this.result_0;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ln.$metadata$={kind:vt,simpleName:"SpotifyProvider",interfaces:[bi]},Object.defineProperty(Gn.prototype,"httpClient",{get:function(){return this.httpClient_zhlaeb$_0}}),Jn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Jn.prototype=Object.create(K.prototype),Jn.prototype.constructor=Jn,Jn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.getLinkFromYt1sMp3_61zpoe$(this.local$videoID,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:return null!=(t=this.result_0)?e.isType(Xn,Object.getPrototypeOf(xt.Js).constructor)?"https://spotiflyer.azurewebsites.net/"+t:t:null;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Gn.prototype.getMp3DownloadLink_61zpoe$=function(t,e,n){var i=new Jn(this,t,e);return n?i:i.doResume(null)},Gn.$metadata$={kind:vt,simpleName:"YoutubeMp3",interfaces:[zi]};var Zn,Qn,Xn,ti,ei,ni,ii=ze((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(i),r(n))}}}));function ri(t,e){this.logger_0=t,this.httpClient_0=e,this.tag_0="YT Music"}function oi(t,e,n,i){K.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$query=e,this.local$trackDetails=n}function ai(t,e,n){K.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$youtubeTracks=void 0,this.local$query=e}function si(t){return t.second}function li(t){return t.append_puj7f4$("referer","https://music.youtube.com/search"),S}function ci(t){return ke(t,"clientName","WEB_REMIX"),ke(t,"clientVersion","0.1"),S}function ui(t){return Se(t,"client",ci),S}function pi(t){return function(e){be(e,ge.Application.Json),we(e,li);var n=new Te,i=t;return Se(n,"context",ui),ke(n,"query",i),e.body=n.build(),S}}function hi(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$query=e}function fi(t){var e=new Me;return e.append_puj7f4$("grant_type","client_credentials"),t.body=new Pe(e.build()),S}function di(t){K.call(this,t),this.exceptionState_0=6,this.local$tmp$=void 0,this.local$response=void 0}function _i(t,e){var n=new di(t);return e?n:n.doResume(null)}function yi(t,e){return function(n){return Ae(n,function(t,e){return function(n){return n.sendWithoutRequest=!0,n.username=t,n.password=e,S}}(t,e)),S}}function mi(t){return t.serializer=b,S}function vi(t){return t.install_xlxg29$(Re.Feature,yi("694d8bf4f6ec420fa66ea7fb4c68f89d","02ca2d4021a7452dae2328b47a6e8fe8")),t.install_xlxg29$(A.Feature,mi),S}function $i(t){return S}function gi(){return Cn()+"https://api.spotify.com/v1"}function bi(){}function wi(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$playlistID=e}function ki(t,e,n,i,r){K.call(this,r),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$playlistID=e,this.local$offset=n,this.local$limit=i}function Si(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$id=e}function xi(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$id=e}function Ei(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$id=e}function Ci(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$id=e}function Oi(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$url=e}function Ni(t){var n,i=e.charArrayOf(47,10,13,9,0,12,96,63,42,92,60,62,124,34,46,45,39),r=t;for(n=0;n!==i.length;++n){var o=Fe(i[n]);r=nt(t,o,95)}var a=r,s=r=ne("\\s").replace_x2uqeu$(a,"_"),l=r=ne("\\)").replace_x2uqeu$(s,""),c=r=ne("\\(").replace_x2uqeu$(l,""),u=r=ne("\\[").replace_x2uqeu$(c,""),p=r=ne("]").replace_x2uqeu$(u,""),h=r=ne("\\.").replace_x2uqeu$(p,""),f=r=ne('"').replace_x2uqeu$(h,""),d=r=ne("'").replace_x2uqeu$(f,""),_=r=ne(":").replace_x2uqeu$(d,"");return r=ne("\\|").replace_x2uqeu$(_,"")}function zi(){}function ji(t,e,n){K.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$videoID=e}function Ti(t){return function(e){var n=new Me;return n.append_puj7f4$("q","https://www.youtube.com/watch?v="+t),n.append_puj7f4$("vt","mp3"),e.body=new Pe(n.build()),S}}function Pi(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$videoID=e}function Ri(t,e){return function(n){var i=new Me,r=t,o=e;return i.append_puj7f4$("vid",r),i.append_puj7f4$("k",o),n.body=new Pe(i.build()),S}}function Ai(t,e,n,i){K.call(this,i),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$videoID=e,this.local$key=n}function Ii(t){this.closure$action=t}function Mi(){return!0}function Li(t,e,n,i,r,o){K.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$it=t,this.local$closure$fetcher=e,this.local$closure$dir=n}function Di(t,e,n){return function(i,r,o){var a=new Li(t,e,n,i,this,r);return o?a:a.doResume(null)}}function qi(t,e,n,i){K.call(this,i),this.exceptionState_0=1,this.local$tmp$=void 0,this.local$list=t,this.local$fetcher=e,this.local$dir=n}function Fi(t,e,n,i){K.call(this,i),this.exceptionState_0=1,this.local$closure$dir=t,this.local$closure$track=e,this.local$it=n}function Ui(t,e){return function(n,i,r){var o=new Fi(t,e,n,i);return r?o:o.doResume(null)}}function Bi(t,e,n,i,r){K.call(this,r),this.exceptionState_0=1,this.local$videoID=t,this.local$track=e,this.local$fetcher=n,this.local$dir=i}function Hi(t,e,n,i,r,o){var a=new Bi(t,e,n,i,r);return o?a:a.doResume(null)}function Vi(t){this.closure$action=t}function Ki(t,e){void 0===e&&(e=N()),this.logger_0=t,this.database_0=e}function Wi(){return"Album Art Downloaded Success"}function Yi(){return"Album Art Downloading Error"}function Gi(t){return function(){return"Album Art Downloading: "+t.progress}}function Ji(t,e,n,i,r){K.call(this,r),this.exceptionState_0=1,this.local$this$Dir=t,this.local$closure$writer=e,this.local$closure$trackDetails=n,this.local$it=i}function Zi(t,e,n){return function(i,r,o){var a=new Ji(t,e,n,i,r);return o?a:a.doResume(null)}}function Qi(t,e,n,i){K.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$writer=void 0,this.local$mp3ByteArray=e,this.local$trackDetails=n}function Xi(t,e,n,i,r){K.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$writer=e,this.local$albumArt=n,this.local$trackDetails=i}function tr(t){return t.buffer}function er(t){this.imageUrl=t}function nr(t,e,n){}oi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},oi.prototype=Object.create(K.prototype),oi.prototype.constructor=oi,oi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.getYTTracks_0(this.local$query,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:return ie(this.$this.sortByBestMatch_0(this.result_0,this.local$trackDetails.title,this.local$trackDetails.artists,this.local$trackDetails.durationSec).keys);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ri.prototype.getYTIDBestMatch_8c1lij$=function(t,e,n,i){var r=new oi(this,t,e,n);return i?r:r.doResume(null)},ai.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},ai.prototype=Object.create(K.prototype),ai.prototype.constructor=ai,ai.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n,i,r,o,a,s,l,c,u,p,h,f,d,_,y,m,v,$,g,b,w,k,S,x,E,C,O,N,z,j,T,P,R,A,I,M,L,D,q,F,B,H,K;if(this.local$youtubeTracks=ee(),this.local$tmp$=re.Default,this.state_0=2,this.result_0=this.$this.getYoutubeMusicResponse_0(this.local$query,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:var W=this.local$tmp$.parseToJsonElement_61zpoe$(this.result_0),Y=null!=(o=null!=(r=null!=(i=null!=(n=null!=(t=oe(W).get_11rb$("contents"))?oe(t):null)?n.get_11rb$("sectionListRenderer"):null)?oe(i):null)?r.get_11rb$("contents"):null)?ae(o):null,G=ee();if(null!=Y){for(a=Y.iterator();a.hasNext();){var J=a.next();if(!oe(J).containsKey_11rb$("itemSectionRenderer"))for(p=(null!=(u=null!=(c=null!=(l=null!=(s=oe(J).get_11rb$("musicShelfRenderer"))?oe(s):null)?l.get_11rb$("contents"):null)?ae(c):null)?u:U()).iterator();p.hasNext();){var Z=p.next(),Q=null!=(d=null!=(f=null!=(h=oe(Z).get_11rb$("musicResponsiveListItemRenderer"))?oe(h):null)?f.get_11rb$("flexColumns"):null)?ae(d):null,X=null!=(S=null!=(k=null!=(w=null!=(b=null!=(g=null!=($=null!=(v=null!=(m=null!=(y=null!=(_=oe(Z).get_11rb$("musicResponsiveListItemRenderer"))?oe(_):null)?y.get_11rb$("overlay"):null)?oe(m):null)?v.get_11rb$("musicItemThumbnailOverlayRenderer"):null)?oe($):null)?g.get_11rb$("content"):null)?oe(b):null)?w.get_11rb$("musicPlayButtonRenderer"):null)?oe(k):null)?S.get_11rb$("playNavigationEndpoint"):null,tt=new Ee;null!=Q&&tt.add_qiw0cd$(Q),null!=X&&tt.add_qiw0cd$(X);var et=tt.build();G.add_11rb$(et)}}for(x=G.iterator();x.hasNext();){var nt=x.next(),it=ee();for(E=nt.subList_vux9f0$(0,nt.size-1|0).iterator();E.hasNext();){var rt=E.next();for(C=ae(rt).iterator();C.hasNext();){var ot=C.next();if(!((null!=(z=null!=(N=null!=(O=oe(ot).get_11rb$("musicResponsiveListItemFlexColumnRenderer"))?oe(O):null)?N.size:null)?z:0)<2))for(M=(null!=(I=null!=(A=null!=(R=null!=(P=null!=(T=null!=(j=oe(ot).get_11rb$("musicResponsiveListItemFlexColumnRenderer"))?oe(j):null)?T.get_11rb$("text"):null)?oe(P):null)?R.get_11rb$("runs"):null)?ae(A):null)?I:U()).iterator();M.hasNext();){var at=M.next();null!=(q=null!=(D=null!=(L=oe(at).get_11rb$("text"))?se(L):null)?le(D):null)&&(ct(q," • ")||it.add_11rb$(q))}}}if(5===it.size&&ce(["Song","Video"]).contains_11rb$(it.get_za3lpa$(1))){if(2!==ue(it.get_za3lpa$(4),e.charArrayOf(58)).size)continue;var st=null!=(K=null!=(H=null!=(B=null!=(F=oe(pe(nt)).get_11rb$("watchEndpoint"))?oe(F):null)?B.get_11rb$("videoId"):null)?se(H):null)?K.content:null,lt=new he(it.get_za3lpa$(0),it.get_za3lpa$(1),it.get_za3lpa$(2),it.get_za3lpa$(4),st);this.local$youtubeTracks.add_11rb$(lt)}}}return this.local$youtubeTracks;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ri.prototype.getYTTracks_0=function(t,e,n){var i=new ai(this,t,e);return n?i:i.doResume(null)},ri.prototype.sortByBestMatch_0=function(t,n,i,r){var o,a,s,l,c,u,p,h,f,d,_,y,m,v,$,g,b,w,k,S,x,E,C,O,N,z=Ce();for(o=t.iterator();o.hasNext();){var j=o.next(),T=!1,P=null!=(c=null!=(l=null!=(s=null!=(a=j.name)?a.toLowerCase():null)?fe(s,"-"," "):null)?fe(l,"/"," "):null)?c:"";for(u=de(n.toLowerCase(),[" "]).iterator();u.hasNext();){var R=u.next();!St(R)&&_e.FuzzySearch.partialRatio_puj7f4$(R,P)>85&&(T=!0)}if(T){var A=0;if(ct(j.type,"Song"))for(p=i.iterator();p.hasNext();){var I=p.next();_e.FuzzySearch.ratio_puj7f4$(I.toLowerCase(),null!=(f=null!=(h=j.artist)?h.toLowerCase():null)?f:"")>85&&(A=A+1|0)}else for(d=i.iterator();d.hasNext();){var M=d.next();_e.FuzzySearch.partialRatio_puj7f4$(M.toLowerCase(),null!=(y=null!=(_=j.name)?_.toLowerCase():null)?y:"")>85&&(A=A+1|0)}if(0!==A){var L=100*(A/i.size|0)|0;E=null!=(g=null!=($=null!=(v=null!=(m=j.duration)?de(m,[":"]):null)?v.get_za3lpa$(0):null)?ye($):null)?60*g|0:null,x=null!=(S=null!=(k=null!=(w=null!=(b=j.duration)?de(b,[":"]):null)?w.get_za3lpa$(1):null)?ye(k):null)?S:0;var D=null!=(N=null!=(O=null!=(C=null!=E?E+x|0:null)?C-r|0:null)?Oe(O):null)?N:0,q=(L+(100-e.imul(D,D)/r*100))/2,F=bt(j.videoId),U=me(q);z.put_xwzc9p$(F,U)}}}var B,H,V=$e(Ne(ve(z),new je(ii(si))));return this.logger_0.d_swpfbs$(this.tag_0,(B=n,H=V,function(){return"Match Found for "+B+" - "+!(null==H||H.isEmpty())})),V},hi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},hi.prototype=Object.create(K.prototype),hi.prototype.constructor=hi,hi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e=this.$this.httpClient_0,n=Cn()+"https://music.youtube.com/youtubei/v1/search?alt=json&key="+Zn;t=rt.EmptyContent;var i=new st;ot(i,"http","localhost",0,"/"),i.method=at.Companion.Post,i.body=t,it(i.url,n),pi(this.local$query)(i);var r,o,a,s=new W(i,e);if(ct(r=xe,C(W))){this.result_0="string"==typeof(o=s)?o:lt(),this.state_0=9;continue}if(ct(r,C(ut))){if(this.state_0=7,this.result_0=s.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=s.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var l;this.local$response=this.result_0,this.exceptionState_0=4;var c,u=this.local$response.call;t:do{try{c=new ft(xe,ht.JsType,Y(xe,[],!1))}catch(t){c=new ft(xe,ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=u.receive_jo9acv$(c,this),this.result_0===V)return V;continue;case 2:this.result_0="string"==typeof(l=this.result_0)?l:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0="string"==typeof(a=this.result_0)?a:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ri.prototype.getYoutubeMusicResponse_0=function(t,e,n){var i=new hi(this,t,e);return n?i:i.doResume(null)},ri.$metadata$={kind:vt,simpleName:"YoutubeMusic",interfaces:[]},di.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},di.prototype=Object.create(K.prototype),di.prototype.constructor=di,di.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=Qn.value;t=rt.EmptyContent;var i=new st;ot(i,"http","localhost",0,"/"),i.method=at.Companion.Post,i.body=t,it(i.url,"https://accounts.spotify.com/api/token"),fi(i);var r,o,a,s=new W(i,n);if(r=C(gt),ct(r,C(W))){this.result_0=null==(o=s)||e.isType(o,gt)?o:lt(),this.state_0=9;continue}if(ct(r,C(ut))){if(this.state_0=7,this.result_0=s.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=s.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var l;this.local$response=this.result_0,this.exceptionState_0=4;var c,u=this.local$response.call;t:do{try{c=new ft(C(gt),ht.JsType,Y(C(gt),[],!0))}catch(t){c=new ft(C(gt),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=u.receive_jo9acv$(c,this),this.result_0===V)return V;continue;case 2:this.result_0=null==(l=this.result_0)||e.isType(l,gt)?l:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=null==(a=this.result_0)||e.isType(a,gt)?a:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:this.result_0,this.local$tmp$=this.result_0,this.state_0=10;continue;case 10:return this.local$tmp$;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.authenticateSpotifyClient_6taknv$=function(t,e,n){return void 0===t&&(t=!1),n?n(t,e):this.authenticateSpotifyClient_6taknv$$default(t,e)},wi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},wi.prototype=Object.create(K.prototype),wi.prototype.constructor=wi,wi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=gi()+"/playlists/"+this.local$playlistID;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),$i();var o,a,s,l=new W(r,n);if(o=C(Le),ct(o,C(W))){this.result_0=e.isType(a=l,Le)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(Le),ht.JsType,Y(C(Le),[],!1))}catch(t){u=new ft(C(Le),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,Le)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,Le)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.getPlaylist_61zpoe$=function(t,e,n){var i=new wi(this,t,e);return n?i:i.doResume(null)},ki.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},ki.prototype=Object.create(K.prototype),ki.prototype.constructor=ki,ki.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=gi()+"/playlists/"+bt(this.local$playlistID)+"/tracks?offset="+this.local$offset+"&limit="+this.local$limit;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),$i();var o,a,s,l=new W(r,n);if(o=C(De),ct(o,C(W))){this.result_0=e.isType(a=l,De)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(De),ht.JsType,Y(C(De),[],!1))}catch(t){u=new ft(C(De),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,De)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,De)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.getPlaylistTracks_hs9j5r$$default=function(t,e,n,i,r){var o=new ki(this,t,e,n,i);return r?o:o.doResume(null)},bi.prototype.getPlaylistTracks_hs9j5r$=function(t,e,n,i,r){return void 0===e&&(e=0),void 0===n&&(n=100),r?r(t,e,n,i):this.getPlaylistTracks_hs9j5r$$default(t,e,n,i)},Si.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Si.prototype=Object.create(K.prototype),Si.prototype.constructor=Si,Si.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=gi()+"/tracks/"+bt(this.local$id);t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),$i();var o,a,s,l=new W(r,n);if(o=C(qe),ct(o,C(W))){this.result_0=e.isType(a=l,qe)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(qe),ht.JsType,Y(C(qe),[],!1))}catch(t){u=new ft(C(qe),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,qe)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,qe)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.getTrack_pdl1vj$=function(t,e,n){var i=new Si(this,t,e);return n?i:i.doResume(null)},xi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},xi.prototype=Object.create(K.prototype),xi.prototype.constructor=xi,xi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=gi()+"/episodes/"+bt(this.local$id);t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),$i();var o,a,s,l=new W(r,n);if(o=C(qe),ct(o,C(W))){this.result_0=e.isType(a=l,qe)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(qe),ht.JsType,Y(C(qe),[],!1))}catch(t){u=new ft(C(qe),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,qe)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,qe)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.getEpisode_pdl1vj$=function(t,e,n){var i=new xi(this,t,e);return n?i:i.doResume(null)},Ei.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Ei.prototype=Object.create(K.prototype),Ei.prototype.constructor=Ei,Ei.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=gi()+"/shows/"+bt(this.local$id);t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),$i();var o,a,s,l=new W(r,n);if(o=C(qe),ct(o,C(W))){this.result_0=e.isType(a=l,qe)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(qe),ht.JsType,Y(C(qe),[],!1))}catch(t){u=new ft(C(qe),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,qe)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,qe)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.getShow_pdl1vj$=function(t,e,n){var i=new Ei(this,t,e);return n?i:i.doResume(null)},Ci.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Ci.prototype=Object.create(K.prototype),Ci.prototype.constructor=Ci,Ci.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=gi()+"/albums/"+this.local$id;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),$i();var o,a,s,l=new W(r,n);if(o=C(Zt),ct(o,C(W))){this.result_0=e.isType(a=l,Zt)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(Zt),ht.JsType,Y(C(Zt),[],!1))}catch(t){u=new ft(C(Zt),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,Zt)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,Zt)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.getAlbum_61zpoe$=function(t,e,n){var i=new Ci(this,t,e);return n?i:i.doResume(null)},Oi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Oi.prototype=Object.create(K.prototype),Oi.prototype.constructor=Oi,Oi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e=this.$this.httpClient;t=rt.EmptyContent;var n=new st;ot(n,"http","localhost",0,"/"),n.method=at.Companion.Get,n.body=t,it(n.url,this.local$url),$i();var i,r,o,a=new W(n,e);if(ct(i=xe,C(W))){this.result_0="string"==typeof(r=a)?r:lt(),this.state_0=9;continue}if(ct(i,C(ut))){if(this.state_0=7,this.result_0=a.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=a.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var s;this.local$response=this.result_0,this.exceptionState_0=4;var l,c=this.local$response.call;t:do{try{l=new ft(xe,ht.JsType,Y(xe,[],!1))}catch(t){l=new ft(xe,ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=c.receive_jo9acv$(l,this),this.result_0===V)return V;continue;case 2:this.result_0="string"==typeof(s=this.result_0)?s:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0="string"==typeof(o=this.result_0)?o:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.getResponse_61zpoe$=function(t,e,n){var i=new Oi(this,t,e);return n?i:i.doResume(null)},bi.$metadata$={kind:Tt,simpleName:"SpotifyRequests",interfaces:[]},ji.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},ji.prototype=Object.create(K.prototype),ji.prototype.constructor=ji,ji.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e,n,i;if(this.state_0=2,this.result_0=this.$this.getKey_z1wm5e$_0(this.local$videoID,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.getConvertedMp3Link_e5s44t$_0(this.local$videoID,this.result_0,this),this.result_0===V)return V;continue;case 3:return null!=(i=null!=(n=null!=(e=null!=(t=this.result_0)?t.get_11rb$("dlink"):null)?se(e):null)?n.toString():null)?fe(i,'"',""):null;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},zi.prototype.getLinkFromYt1sMp3_61zpoe$=function(t,e,n){var i=new ji(this,t,e);return n?i:i.doResume(null)},Pi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Pi.prototype=Object.create(K.prototype),Pi.prototype.constructor=Pi,Pi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n,i=this.$this.httpClient,r=Cn()+"https://yt1s.com/api/ajaxSearch/index";n=rt.EmptyContent;var o=new st;ot(o,"http","localhost",0,"/"),o.method=at.Companion.Post,o.body=n,it(o.url,r),Ti(this.local$videoID)(o);var a,s,l,c=new W(o,i);if(a=C(Ue),ct(a,C(W))){this.result_0=null==(s=c)||e.isType(s,Ue)?s:lt(),this.state_0=9;continue}if(ct(a,C(ut))){if(this.state_0=7,this.result_0=c.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=c.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var u;this.local$response=this.result_0,this.exceptionState_0=4;var p,h=this.local$response.call;t:do{try{p=new ft(C(Ue),ht.JsType,Y(C(Ue),[],!0))}catch(t){p=new ft(C(Ue),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=h.receive_jo9acv$(p,this),this.result_0===V)return V;continue;case 2:this.result_0=null==(u=this.result_0)||e.isType(u,Ue)?u:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=null==(l=this.result_0)||e.isType(l,Ue)?l:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:this.result_0;var f=this.result_0;return bt(null!=(t=null!=f?f.get_11rb$("kc"):null)?se(t):null);default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},zi.prototype.getKey_z1wm5e$_0=function(t,e,n){var i=new Pi(this,t,e);return n?i:i.doResume(null)},Ai.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Ai.prototype=Object.create(K.prototype),Ai.prototype.constructor=Ai,Ai.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=Cn()+"https://yt1s.com/api/ajaxConvert/convert";t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Post,r.body=t,it(r.url,i),Ri(this.local$videoID,this.local$key)(r);var o,a,s,l=new W(r,n);if(o=C(Ue),ct(o,C(W))){this.result_0=null==(a=l)||e.isType(a,Ue)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(Ue),ht.JsType,Y(C(Ue),[],!0))}catch(t){u=new ft(C(Ue),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=null==(c=this.result_0)||e.isType(c,Ue)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=null==(s=this.result_0)||e.isType(s,Ue)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},zi.prototype.getConvertedMp3Link_e5s44t$_0=function(t,e,n,i){var r=new Ai(this,t,e,n);return i?r:r.doResume(null)},zi.$metadata$={kind:Tt,simpleName:"Yt1sMp3",interfaces:[]},Ii.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},Ii.$metadata$={kind:vt,interfaces:[We]},Li.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Li.prototype=Object.create(K.prototype),Li.prototype.constructor=Li,Li.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=ni,e=this.local$closure$it.title,n=qt.Queued;t.put_xwzc9p$(e,n);var i=this.local$closure$it.videoID;if(null==i||St(i)){var r=this.local$closure$it.title+" - "+Qt(this.local$closure$it.artists,",");if(this.state_0=2,this.result_0=this.local$closure$fetcher.youtubeMusic.getYTIDBestMatch_8c1lij$(r,this.local$closure$it,this),this.result_0===V)return V;continue}if(this.state_0=6,this.result_0=Hi(J(this.local$closure$it.videoID),this.local$closure$it,this.local$closure$fetcher,this.local$closure$dir,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:var o=this.result_0;if(Be(o+" : "+this.local$closure$it.title),null==o||St(o)){var a=ni,s=this.local$closure$it.title,l=qt.Failed;if(a.put_xwzc9p$(s,l),this.state_0=4,this.result_0=ei.emit_11rb$(ni,this),this.result_0===V)return V;continue}if(this.state_0=3,this.result_0=Hi(o,this.local$closure$it,this.local$closure$fetcher,this.local$closure$dir,this),this.result_0===V)return V;continue;case 3:case 4:this.state_0=5;continue;case 5:case 6:this.state_0=7;continue;case 7:if(this.state_0=8,this.result_0=ei.emit_11rb$(ni,this),this.result_0===V)return V;continue;case 8:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},qi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},qi.prototype=Object.create(K.prototype),qi.prototype.constructor=qi,qi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$tmp$=this.local$list.iterator(),this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(!this.local$tmp$.hasNext()){this.state_0=4;continue}var t=this.local$tmp$.next();if(this.state_0=3,this.result_0=mt(ti,Di(t,this.local$fetcher,this.local$dir),this),this.result_0===V)return V;continue;case 3:this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Fi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Fi.prototype=Object.create(K.prototype),Fi.prototype.constructor=Fi,Fi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(e.isType(this.local$it,X)){if(Be("Download Completed"),this.state_0=2,this.result_0=this.local$closure$dir.saveFileWithMetadata_vmnm85$(this.local$it.byteArray,this.local$closure$track,this),this.result_0===V)return V;continue}if(e.isType(this.local$it,tt)){var t=ni,n=this.local$closure$track.title,i=qt.Failed;t.put_xwzc9p$(n,i),Be("Download Error: "+this.local$closure$track.title)}else if(e.isType(this.local$it,Z)){var r=ni,o=this.local$closure$track.title,a=new Ke(this.local$it.progress);r.put_xwzc9p$(o,a),Be("Download Progress: "+this.local$it.progress+" : "+this.local$closure$track.title)}this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.state_0=3;continue;case 3:if(this.state_0=4,this.result_0=ei.emit_11rb$(ni,this),this.result_0===V)return V;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Bi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Bi.prototype=Object.create(K.prototype),Bi.prototype.constructor=Bi,Bi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$fetcher.youtubeMp3.getMp3DownloadLink_61zpoe$(this.local$videoID,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;if(null==t){var e=ni,n=this.local$track.title,i=qt.Failed;if(e.put_xwzc9p$(n,i),this.state_0=5,this.result_0=ei.emit_11rb$(ni,this),this.result_0===V)return V;continue}if(this.state_0=3,this.result_0=dn(t),this.result_0===V)return V;continue;case 3:if(this.state_0=4,this.result_0=this.result_0.collect_42ocv1$(new Ii(Ui(this.local$dir,this.local$track)),this),this.result_0===V)return V;continue;case 4:this.result_0,this.state_0=6;continue;case 5:Be("No URL to Download"),this.state_0=6;continue;case 6:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Vi.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},Vi.$metadata$={kind:vt,interfaces:[We]},Ki.prototype.fileSeparator=function(){return"/"},Ki.prototype.imageCacheDir=function(){return"TODO"+this.fileSeparator()+"SpotiFlyer/.images"+this.fileSeparator()},Ki.prototype.defaultDir=function(){return"TODO"+this.fileSeparator()+"SpotiFlyer"+this.fileSeparator()},Ki.prototype.isPresent_61zpoe$=function(t){return!1},Ki.prototype.createDirectory_61zpoe$=function(t){},Ki.prototype.clearCache=function(t){},Ki.prototype.cacheImage_hwpqgh$=function(t,e,n){},Ji.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Ji.prototype=Object.create(K.prototype),Ji.prototype.constructor=Ji,Ji.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n;if(e.isType(this.local$it,X)){this.local$this$Dir.logger_0.d_h4ejuu$(Wi);var i={type:3};i.data=tr(this.local$it.byteArray),i.description="Cover Art";var r=i;if(n=e.isType(t=r,Object)?t:lt(),this.state_0=5,this.result_0=this.local$this$Dir.writeTagsAndSave_0(this.local$closure$writer,n,this.local$closure$trackDetails,this),this.result_0===V)return V;continue}if(e.isType(this.local$it,tt)){if(this.local$this$Dir.logger_0.d_h4ejuu$(Yi),this.state_0=3,this.result_0=this.local$this$Dir.writeTagsAndSave_0(this.local$closure$writer,null,this.local$closure$trackDetails,this),this.result_0===V)return V;continue}if(e.isType(this.local$it,Z))return this.local$this$Dir.logger_0.d_h4ejuu$(Gi(this.local$it)),S;this.state_0=2;continue;case 1:throw this.exception_0;case 2:this.state_0=4;continue;case 3:return S;case 4:this.state_0=6;continue;case 5:case 6:return S;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Qi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Qi.prototype=Object.create(K.prototype),Qi.prototype.constructor=Qi,Qi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$writer=new v(tr(this.local$mp3ByteArray)),this.state_0=2,this.result_0=dn(Cn()+this.local$trackDetails.albumArtURL),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;if(this.state_0=3,this.result_0=t.collect_42ocv1$(new Vi(Zi(this.$this,this.local$writer,this.local$trackDetails)),this),this.result_0===V)return V;continue;case 3:return void this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ki.prototype.saveFileWithMetadata_vmnm85$=function(t,e,n,i){var r=new Qi(this,t,e,n);return i?r:r.doResume(null)},Xi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Xi.prototype=Object.create(K.prototype),Xi.prototype.constructor=Xi,Xi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n,i,r;this.local$writer.setFrame("TIT2",this.local$trackDetails.title),this.local$writer.setFrame("TPE1",Je(this.local$trackDetails.artists)),this.local$writer.setFrame("TALB",null!=(t=this.local$trackDetails.albumName)?t:"");try{null!=(r=null!=(i=null!=(n=this.local$trackDetails.year)?n.substring(0,4):null)?ye(i):null)&&this.local$writer.setFrame("TYER",r)}catch(t){if(!e.isType(t,He))throw t}this.local$writer.setFrame("TPE2",Qt(this.local$trackDetails.artists,",")),this.local$writer.setFrame("WOAS",this.local$trackDetails.source.toString()),this.local$writer.setFrame("TLEN",this.local$trackDetails.durationSec),null!=this.local$albumArt&&this.local$writer.setFrame("APIC",this.local$albumArt),this.local$writer.addTag();var o=ni,a=this.local$trackDetails.title,s=qt.Downloaded;if(o.put_xwzc9p$(a,s),this.state_0=2,this.result_0=ei.emit_11rb$(ni,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:return void Ge(this.local$writer.getBlob(),Ni(this.local$trackDetails.title)+".mp3");default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ki.prototype.writeTagsAndSave_0=function(t,e,n,i,r){var o=new Xi(this,t,e,n,i);return r?o:o.doResume(null)},Ki.prototype.addToLibrary_61zpoe$=function(t){},Ki.prototype.loadImage_61zpoe$=function(t,e){return new er(t)},Ki.prototype.loadCachedImage_0=function(t){return null},Ki.prototype.freshImage_0=function(t,e){return null},Object.defineProperty(Ki.prototype,"db",{configurable:!0,get:function(){return this.database_0}}),Ki.$metadata$={kind:vt,simpleName:"Dir",interfaces:[]},er.$metadata$={kind:vt,simpleName:"Picture",interfaces:[]},er.prototype.component1=function(){return this.imageUrl},er.prototype.copy_61zpoe$=function(t){return new er(void 0===t?this.imageUrl:t)},er.prototype.toString=function(){return"Picture(imageUrl="+e.toString(this.imageUrl)+")"},er.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.imageUrl)|0},er.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.imageUrl,t.imageUrl)},nr.prototype.query_61zpoe$=function(t,e){return null},nr.$metadata$={kind:vt,simpleName:"YoutubeProvider",interfaces:[]};var ir=t.com||(t.com={}),rr=ir.shabinder||(ir.shabinder={}),or=rr.common||(rr.common={}),ar=or.di||(or.di={});ar.initKoin_8xlgbz$=function(t,e){return void 0===t&&(t=!1),void 0===e&&(e=Ze),x((n=e,i=t,function(t){return n(t),t.modules_7zxgee$(cn(i)),S}));var n,i},k["core-koin-core"]=n,ar.commonModule_6taknv$=cn,ar.createHttpClient_i0srga$=hn,k["ktor-ktor-client-core-jsLegacy"]=i,ar.downloadFile_61zpoe$=dn,ar.finalOutputDir_gpfont$=_n,ar.FetchPlatformQueryResult=yn,ar.TokenStore=gn;var sr=ar.gaana||(ar.gaana={});Object.defineProperty(sr,"corsApi",{get:Cn}),sr.GaanaRequests=Nn;var lr=ar.providers||(ar.providers={});lr.GaanaProvider=An,lr.SpotifyProvider=Ln,lr.YoutubeMp3=Gn,k["kotlinx-serialization-kotlinx-serialization-json-jsLegacy"]=a,lr.YoutubeMusic=ri,k["ktor-ktor-http-jsLegacy"]=u;var cr=ar.spotify||(ar.spotify={});return cr.authenticateSpotify=_i,cr.SpotifyRequests=bi,k["kotlinx-coroutines-core"]=h,(ar.utils||(ar.utils={})).removeIllegalChars_61zpoe$=Ni,(ar.youtubeMp3||(ar.youtubeMp3={})).Yt1sMp3=zi,ar.openPlatform_puj7f4$=function(t,e){},ar.shareApp=function(){},ar.giveDonation=function(){},ar.queryActiveTracks=function(){},Object.defineProperty(ar,"isInternetAvailable",{get:Mi}),Object.defineProperty(ar,"DownloadProgressFlow",{get:function(){return ei}}),ar.downloadTracks_fe9u7d$=function(t,e,n,i,r){var o=new qi(t,e,n,i);return r?o:o.doResume(null)},ar.downloadTrack_oyk27a$=Hi,k["kotlin-wrappers-kotlin-extensions-jsLegacy"]=$,ar.Dir=Ki,ar.toArrayBuffer_964n91$=tr,ar.Picture=er,ar.YoutubeProvider=nr,An.prototype.getGaanaPlaylist_tgym8q$$default=Nn.prototype.getGaanaPlaylist_tgym8q$$default,An.prototype.getGaanaAlbum_tgym8q$$default=Nn.prototype.getGaanaAlbum_tgym8q$$default,An.prototype.getGaanaSong_w74nik$$default=Nn.prototype.getGaanaSong_w74nik$$default,An.prototype.getGaanaArtistDetails_w74nik$$default=Nn.prototype.getGaanaArtistDetails_w74nik$$default,An.prototype.getGaanaArtistTracks_tgym8q$$default=Nn.prototype.getGaanaArtistTracks_tgym8q$$default,An.prototype.getGaanaPlaylist_tgym8q$=Nn.prototype.getGaanaPlaylist_tgym8q$,An.prototype.getGaanaAlbum_tgym8q$=Nn.prototype.getGaanaAlbum_tgym8q$,An.prototype.getGaanaSong_w74nik$=Nn.prototype.getGaanaSong_w74nik$,An.prototype.getGaanaArtistDetails_w74nik$=Nn.prototype.getGaanaArtistDetails_w74nik$,An.prototype.getGaanaArtistTracks_tgym8q$=Nn.prototype.getGaanaArtistTracks_tgym8q$,Ln.prototype.getPlaylist_61zpoe$=bi.prototype.getPlaylist_61zpoe$,Ln.prototype.getPlaylistTracks_hs9j5r$$default=bi.prototype.getPlaylistTracks_hs9j5r$$default,Ln.prototype.getTrack_pdl1vj$=bi.prototype.getTrack_pdl1vj$,Ln.prototype.getEpisode_pdl1vj$=bi.prototype.getEpisode_pdl1vj$,Ln.prototype.getShow_pdl1vj$=bi.prototype.getShow_pdl1vj$,Ln.prototype.getAlbum_61zpoe$=bi.prototype.getAlbum_61zpoe$,Ln.prototype.getResponse_61zpoe$=bi.prototype.getResponse_61zpoe$,Ln.prototype.authenticateSpotifyClient_6taknv$=bi.prototype.authenticateSpotifyClient_6taknv$,Ln.prototype.getPlaylistTracks_hs9j5r$=bi.prototype.getPlaylistTracks_hs9j5r$,Gn.prototype.getLinkFromYt1sMp3_61zpoe$=zi.prototype.getLinkFromYt1sMp3_61zpoe$,Gn.prototype.getKey_z1wm5e$_0=zi.prototype.getKey_z1wm5e$_0,Gn.prototype.getConvertedMp3Link_e5s44t$_0=zi.prototype.getConvertedMp3Link_e5s44t$_0,b=new R(P(void 0,(function(t){return t.isLenient=!0,t.ignoreUnknownKeys=!0,S}))),q((function(t){return S})),w="b2e6d7fbc136547a940516e9b77e5990",Zn="AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30",Qn=Ie((function(){return q(vi)})),Xn=xt.Js,ti=yt.Dispatchers.Default,ei=Ve(1),ni=Ye(),t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){"use strict";var i=n(0),r=n(77),o=n(2).Buffer,a=new Array(16);function s(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function l(t,e){return t<>>32-e}function c(t,e,n,i,r,o,a){return l(t+(e&n|~e&i)+r+o|0,a)+e|0}function u(t,e,n,i,r,o,a){return l(t+(e&i|n&~i)+r+o|0,a)+e|0}function p(t,e,n,i,r,o,a){return l(t+(e^n^i)+r+o|0,a)+e|0}function h(t,e,n,i,r,o,a){return l(t+(n^(e|~i))+r+o|0,a)+e|0}i(s,r),s.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var n=this._a,i=this._b,r=this._c,o=this._d;n=c(n,i,r,o,t[0],3614090360,7),o=c(o,n,i,r,t[1],3905402710,12),r=c(r,o,n,i,t[2],606105819,17),i=c(i,r,o,n,t[3],3250441966,22),n=c(n,i,r,o,t[4],4118548399,7),o=c(o,n,i,r,t[5],1200080426,12),r=c(r,o,n,i,t[6],2821735955,17),i=c(i,r,o,n,t[7],4249261313,22),n=c(n,i,r,o,t[8],1770035416,7),o=c(o,n,i,r,t[9],2336552879,12),r=c(r,o,n,i,t[10],4294925233,17),i=c(i,r,o,n,t[11],2304563134,22),n=c(n,i,r,o,t[12],1804603682,7),o=c(o,n,i,r,t[13],4254626195,12),r=c(r,o,n,i,t[14],2792965006,17),n=u(n,i=c(i,r,o,n,t[15],1236535329,22),r,o,t[1],4129170786,5),o=u(o,n,i,r,t[6],3225465664,9),r=u(r,o,n,i,t[11],643717713,14),i=u(i,r,o,n,t[0],3921069994,20),n=u(n,i,r,o,t[5],3593408605,5),o=u(o,n,i,r,t[10],38016083,9),r=u(r,o,n,i,t[15],3634488961,14),i=u(i,r,o,n,t[4],3889429448,20),n=u(n,i,r,o,t[9],568446438,5),o=u(o,n,i,r,t[14],3275163606,9),r=u(r,o,n,i,t[3],4107603335,14),i=u(i,r,o,n,t[8],1163531501,20),n=u(n,i,r,o,t[13],2850285829,5),o=u(o,n,i,r,t[2],4243563512,9),r=u(r,o,n,i,t[7],1735328473,14),n=p(n,i=u(i,r,o,n,t[12],2368359562,20),r,o,t[5],4294588738,4),o=p(o,n,i,r,t[8],2272392833,11),r=p(r,o,n,i,t[11],1839030562,16),i=p(i,r,o,n,t[14],4259657740,23),n=p(n,i,r,o,t[1],2763975236,4),o=p(o,n,i,r,t[4],1272893353,11),r=p(r,o,n,i,t[7],4139469664,16),i=p(i,r,o,n,t[10],3200236656,23),n=p(n,i,r,o,t[13],681279174,4),o=p(o,n,i,r,t[0],3936430074,11),r=p(r,o,n,i,t[3],3572445317,16),i=p(i,r,o,n,t[6],76029189,23),n=p(n,i,r,o,t[9],3654602809,4),o=p(o,n,i,r,t[12],3873151461,11),r=p(r,o,n,i,t[15],530742520,16),n=h(n,i=p(i,r,o,n,t[2],3299628645,23),r,o,t[0],4096336452,6),o=h(o,n,i,r,t[7],1126891415,10),r=h(r,o,n,i,t[14],2878612391,15),i=h(i,r,o,n,t[5],4237533241,21),n=h(n,i,r,o,t[12],1700485571,6),o=h(o,n,i,r,t[3],2399980690,10),r=h(r,o,n,i,t[10],4293915773,15),i=h(i,r,o,n,t[1],2240044497,21),n=h(n,i,r,o,t[8],1873313359,6),o=h(o,n,i,r,t[15],4264355552,10),r=h(r,o,n,i,t[6],2734768916,15),i=h(i,r,o,n,t[13],1309151649,21),n=h(n,i,r,o,t[4],4149444226,6),o=h(o,n,i,r,t[11],3174756917,10),r=h(r,o,n,i,t[2],718787259,15),i=h(i,r,o,n,t[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+i|0,this._c=this._c+r|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=s},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var i=!1;return function(){if(!i){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),i=!0}return t.apply(this,arguments)}}}).call(this,n(7))},function(t,e,n){"use strict";var i=n(20).codes.ERR_STREAM_PREMATURE_CLOSE;function r(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,i=new Array(n),r=0;r>>32-e}function _(t,e,n,i,r,o,a,s){return d(t+(e^n^i)+o+a|0,s)+r|0}function y(t,e,n,i,r,o,a,s){return d(t+(e&n|~e&i)+o+a|0,s)+r|0}function m(t,e,n,i,r,o,a,s){return d(t+((e|~n)^i)+o+a|0,s)+r|0}function v(t,e,n,i,r,o,a,s){return d(t+(e&i|n&~i)+o+a|0,s)+r|0}function $(t,e,n,i,r,o,a,s){return d(t+(e^(n|~i))+o+a|0,s)+r|0}r(f,o),f.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var n=0|this._a,i=0|this._b,r=0|this._c,o=0|this._d,f=0|this._e,g=0|this._a,b=0|this._b,w=0|this._c,k=0|this._d,S=0|this._e,x=0;x<80;x+=1){var E,C;x<16?(E=_(n,i,r,o,f,t[s[x]],p[0],c[x]),C=$(g,b,w,k,S,t[l[x]],h[0],u[x])):x<32?(E=y(n,i,r,o,f,t[s[x]],p[1],c[x]),C=v(g,b,w,k,S,t[l[x]],h[1],u[x])):x<48?(E=m(n,i,r,o,f,t[s[x]],p[2],c[x]),C=m(g,b,w,k,S,t[l[x]],h[2],u[x])):x<64?(E=v(n,i,r,o,f,t[s[x]],p[3],c[x]),C=y(g,b,w,k,S,t[l[x]],h[3],u[x])):(E=$(n,i,r,o,f,t[s[x]],p[4],c[x]),C=_(g,b,w,k,S,t[l[x]],h[4],u[x])),n=f,f=o,o=d(r,10),r=i,i=E,g=S,S=k,k=d(w,10),w=b,b=C}var O=this._b+r+k|0;this._b=this._c+o+S|0,this._c=this._d+f+g|0,this._d=this._e+n+b|0,this._e=this._a+i+w|0,this._a=O},f.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=i.alloc?i.alloc(20):new i(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=f},function(t,e,n){(e=t.exports=function(t){t=t.toLowerCase();var n=e[t];if(!n)throw new Error(t+" is not supported (we accept pull requests)");return new n}).sha=n(161),e.sha1=n(162),e.sha224=n(163),e.sha256=n(84),e.sha384=n(164),e.sha512=n(85)},function(t,e,n){(e=t.exports=n(86)).Stream=e,e.Readable=e,e.Writable=n(52),e.Duplex=n(17),e.Transform=n(89),e.PassThrough=n(171)},function(t,e,n){var i=n(6),r=i.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function a(t,e,n){return r(t,e,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=i:(o(i,e),e.Buffer=a),o(r,a),a.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return r(t,e,n)},a.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=r(t);return void 0!==e?"string"==typeof n?i.fill(e,n):i.fill(e):i.fill(0),i},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e,n){"use strict";(function(e,i,r){var o=n(37);function a(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var i=t.entry;t.entry=null;for(;i;){var r=i.callback;e.pendingcb--,r(n),i=i.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=v;var s,l=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?i:o.nextTick;v.WritableState=m;var c=Object.create(n(30));c.inherits=n(0);var u={deprecate:n(46)},p=n(87),h=n(51).Buffer,f=r.Uint8Array||function(){};var d,_=n(88);function y(){}function m(t,e){s=s||n(17),t=t||{};var i=e instanceof s;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var r=t.highWaterMark,c=t.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i&&(c||0===c)?c:u,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var p=!1===t.decodeStrings;this.decodeStrings=!p,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,r=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,r){--e.pendingcb,n?(o.nextTick(r,i),o.nextTick(S,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(r(i),t._writableState.errorEmitted=!0,t.emit("error",i),S(t,e))}(t,n,i,e,r);else{var a=w(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||b(t,n),i?l(g,t,n,a,r):g(t,n,a,r)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function v(t){if(s=s||n(17),!(d.call(v,this)||this instanceof s))return new v(t);this._writableState=new m(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),p.call(this)}function $(t,e,n,i,r,o,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,n?t._writev(r,e.onwrite):t._write(r,o,e.onwrite),e.sync=!1}function g(t,e,n,i){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),S(t,e)}function b(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var i=e.bufferedRequestCount,r=new Array(i),o=e.corkedRequestsFree;o.entry=n;for(var s=0,l=!0;n;)r[s]=n,n.isBuf||(l=!1),n=n.next,s+=1;r.allBuffers=l,$(t,e,!0,e.length,r,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new a(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,u=n.encoding,p=n.callback;if($(t,e,!1,e.objectMode?1:c.length,c,u,p),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function w(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function k(t,e){t._final((function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),S(t,e)}))}function S(t,e){var n=w(e);return n&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(k,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}c.inherits(v,p),m.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(m.prototype,"buffer",{get:u.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(v,Symbol.hasInstance,{value:function(t){return!!d.call(this,t)||this===v&&(t&&t._writableState instanceof m)}})):d=function(t){return t instanceof this},v.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},v.prototype.write=function(t,e,n){var i,r=this._writableState,a=!1,s=!r.objectMode&&(i=t,h.isBuffer(i)||i instanceof f);return s&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof n&&(n=y),r.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),o.nextTick(e,n)}(this,n):(s||function(t,e,n,i){var r=!0,a=!1;return null===n?a=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),o.nextTick(i,a),r=!1),r}(this,r,t,n))&&(r.pendingcb++,a=function(t,e,n,i,r,o){if(!n){var a=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,n));return e}(e,i,r);i!==a&&(n=!0,r="buffer",i=a)}var s=e.objectMode?1:i.length;e.length+=s;var l=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),v.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},v.prototype._writev=null,v.prototype.end=function(t,e,n){var i=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(t,e,n){e.ending=!0,S(t,e),n&&(e.finished?o.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n)},Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),v.prototype.destroy=_.destroy,v.prototype._undestroy=_.undestroy,v.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,n(4),n(169).setImmediate,n(7))},function(t,e,n){"use strict";var i=n(9);function r(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}t.exports=r,r.prototype._init=function(){},r.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},r.prototype._buffer=function(t,e){for(var n=Math.min(this.buffer.length-this.bufferOff,t.length-e),i=0;i0;i--)e+=this._buffer(t,e),n+=this._flushBuffer(r,n);return e+=this._buffer(t,e),r},r.prototype.final=function(t){var e,n;return t&&(e=this.update(t)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(n):n},r.prototype._pad=function(t,e){if(0===e)return!1;for(;e=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function a(t,n){var r=function(t){var e=o(t);return{blinder:e.toRed(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(n),a=n.modulus.byteLength(),s=new i(t).mul(r.blinder).umod(n.modulus),l=s.toRed(i.mont(n.prime1)),c=s.toRed(i.mont(n.prime2)),u=n.coefficient,p=n.prime1,h=n.prime2,f=l.redPow(n.exponent1).fromRed(),d=c.redPow(n.exponent2).fromRed(),_=f.isub(d).imul(u).umod(p).imul(h);return d.iadd(_).imul(r.unblinder).umod(n.modulus).toArrayLike(e,"be",a)}a.getr=o,t.exports=a}).call(this,n(6).Buffer)},function(t,e,n){"use strict";var i=e;i.version=n(211).version,i.utils=n(10),i.rand=n(57),i.curve=n(114),i.curves=n(61),i.ec=n(222),i.eddsa=n(226)},function(t,e,n){"use strict";var i,r=e,o=n(62),a=n(114),s=n(10).assert;function l(t){"short"===t.type?this.curve=new a.short(t):"edwards"===t.type?this.curve=new a.edwards(t):this.curve=new a.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var n=new l(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=l,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=n(221)}catch(t){i=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},function(t,e,n){var i=e;i.utils=n(11),i.common=n(32),i.sha=n(215),i.ripemd=n(219),i.hmac=n(220),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},function(t,e,n){"use strict";(function(e){var i,r=n(6),o=r.Buffer,a={};for(i in r)r.hasOwnProperty(i)&&"SlowBuffer"!==i&&"Buffer"!==i&&(a[i]=r[i]);var s=a.Buffer={};for(i in o)o.hasOwnProperty(i)&&"allocUnsafe"!==i&&"allocUnsafeSlow"!==i&&(s[i]=o[i]);if(a.Buffer.prototype=o.prototype,s.from&&s.from!==Uint8Array.from||(s.from=function(t,e,n){if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&void 0===t.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return o(t,e,n)}),s.alloc||(s.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var i=o(t);return e&&0!==e.length?"string"==typeof n?i.fill(e,n):i.fill(e):i.fill(0),i}),!a.kStringMaxLength)try{a.kStringMaxLength=e.binding("buffer").kStringMaxLength}catch(t){}a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),t.exports=a}).call(this,n(4))},function(t,e,n){"use strict";const i=n(65).Reporter,r=n(33).EncoderBuffer,o=n(33).DecoderBuffer,a=n(9),s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],l=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function c(t,e,n){const i={};this._baseState=i,i.name=n,i.enc=t,i.parent=e||null,i.children=null,i.tag=null,i.args=null,i.reverseArgs=null,i.choice=null,i.optional=!1,i.any=!1,i.obj=!1,i.use=null,i.useDecoder=null,i.key=null,i.default=null,i.explicit=null,i.implicit=null,i.contains=null,i.parent||(i.children=[],this._wrap())}t.exports=c;const u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function(){const t=this._baseState,e={};u.forEach((function(n){e[n]=t[n]}));const n=new this.constructor(e.parent);return n._baseState=e,n},c.prototype._wrap=function(){const t=this._baseState;l.forEach((function(e){this[e]=function(){const n=new this.constructor(this);return t.children.push(n),n[e].apply(n,arguments)}}),this)},c.prototype._init=function(t){const e=this._baseState;a(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),a.equal(e.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function(t){const e=this._baseState,n=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==n.length&&(a(null===e.children),e.children=n,n.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(a(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach((function(n){n==(0|n)&&(n|=0);const i=t[n];e[i]=n})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){c.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),s.forEach((function(t){c.prototype[t]=function(){const e=this._baseState,n=Array.prototype.slice.call(arguments);return a(null===e.tag),e.tag=t,this._useArgs(n),this}})),c.prototype.use=function(t){a(t);const e=this._baseState;return a(null===e.use),e.use=t,this},c.prototype.optional=function(){return this._baseState.optional=!0,this},c.prototype.def=function(t){const e=this._baseState;return a(null===e.default),e.default=t,e.optional=!0,this},c.prototype.explicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.explicit=t,this},c.prototype.implicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.implicit=t,this},c.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},c.prototype.key=function(t){const e=this._baseState;return a(null===e.key),e.key=t,this},c.prototype.any=function(){return this._baseState.any=!0,this},c.prototype.choice=function(t){const e=this._baseState;return a(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},c.prototype.contains=function(t){const e=this._baseState;return a(null===e.use),e.contains=t,this},c.prototype._decode=function(t,e){const n=this._baseState;if(null===n.parent)return t.wrapResult(n.children[0]._decode(t,e));let i,r=n.default,a=!0,s=null;if(null!==n.key&&(s=t.enterKey(n.key)),n.optional){let i=null;if(null!==n.explicit?i=n.explicit:null!==n.implicit?i=n.implicit:null!==n.tag&&(i=n.tag),null!==i||n.any){if(a=this._peekTag(t,i,n.any),t.isError(a))return a}else{const i=t.save();try{null===n.choice?this._decodeGeneric(n.tag,t,e):this._decodeChoice(t,e),a=!0}catch(t){a=!1}t.restore(i)}}if(n.obj&&a&&(i=t.enterObject()),a){if(null!==n.explicit){const e=this._decodeTag(t,n.explicit);if(t.isError(e))return e;t=e}const i=t.offset;if(null===n.use&&null===n.choice){let e;n.any&&(e=t.save());const i=this._decodeTag(t,null!==n.implicit?n.implicit:n.tag,n.any);if(t.isError(i))return i;n.any?r=t.raw(e):t=i}if(e&&e.track&&null!==n.tag&&e.track(t.path(),i,t.length,"tagged"),e&&e.track&&null!==n.tag&&e.track(t.path(),t.offset,t.length,"content"),n.any||(r=null===n.choice?this._decodeGeneric(n.tag,t,e):this._decodeChoice(t,e)),t.isError(r))return r;if(n.any||null!==n.choice||null===n.children||n.children.forEach((function(n){n._decode(t,e)})),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const i=new o(r);r=this._getUse(n.contains,t._reporterState.obj)._decode(i,e)}}return n.obj&&a&&(r=t.leaveObject(i)),null===n.key||null===r&&!0!==a?null!==s&&t.exitKey(s):t.leaveKey(s,n.key,r),r},c.prototype._decodeGeneric=function(t,e,n){const i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,i.args[0],n):/str$/.test(t)?this._decodeStr(e,t,n):"objid"===t&&i.args?this._decodeObjid(e,i.args[0],i.args[1],n):"objid"===t?this._decodeObjid(e,null,null,n):"gentime"===t||"utctime"===t?this._decodeTime(e,t,n):"null_"===t?this._decodeNull(e,n):"bool"===t?this._decodeBool(e,n):"objDesc"===t?this._decodeStr(e,t,n):"int"===t||"enum"===t?this._decodeInt(e,i.args&&i.args[0],n):null!==i.use?this._getUse(i.use,e._reporterState.obj)._decode(e,n):e.error("unknown tag: "+t)},c.prototype._getUse=function(t,e){const n=this._baseState;return n.useDecoder=this._use(t,e),a(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},c.prototype._decodeChoice=function(t,e){const n=this._baseState;let i=null,r=!1;return Object.keys(n.choice).some((function(o){const a=t.save(),s=n.choice[o];try{const n=s._decode(t,e);if(t.isError(n))return!1;i={type:o,value:n},r=!0}catch(e){return t.restore(a),!1}return!0}),this),r?i:t.error("Choice not matched")},c.prototype._createEncoderBuffer=function(t){return new r(t,this.reporter)},c.prototype._encode=function(t,e,n){const i=this._baseState;if(null!==i.default&&i.default===t)return;const r=this._encodeValue(t,e,n);return void 0===r||this._skipDefault(r,e,n)?void 0:r},c.prototype._encodeValue=function(t,e,n){const r=this._baseState;if(null===r.parent)return r.children[0]._encode(t,e||new i);let o=null;if(this.reporter=e,r.optional&&void 0===t){if(null===r.default)return;t=r.default}let a=null,s=!1;if(r.any)o=this._createEncoderBuffer(t);else if(r.choice)o=this._encodeChoice(t,e);else if(r.contains)a=this._getUse(r.contains,n)._encode(t,e),s=!0;else if(r.children)a=r.children.map((function(n){if("null_"===n._baseState.tag)return n._encode(null,e,t);if(null===n._baseState.key)return e.error("Child should have a key");const i=e.enterKey(n._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const r=n._encode(t[n._baseState.key],e,t);return e.leaveKey(i),r}),this).filter((function(t){return t})),a=this._createEncoderBuffer(a);else if("seqof"===r.tag||"setof"===r.tag){if(!r.args||1!==r.args.length)return e.error("Too many args for : "+r.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const n=this.clone();n._baseState.implicit=null,a=this._createEncoderBuffer(t.map((function(n){const i=this._baseState;return this._getUse(i.args[0],t)._encode(n,e)}),n))}else null!==r.use?o=this._getUse(r.use,n)._encode(t,e):(a=this._encodePrimitive(r.tag,t),s=!0);if(!r.any&&null===r.choice){const t=null!==r.implicit?r.implicit:r.tag,n=null===r.implicit?"universal":"context";null===t?null===r.use&&e.error("Tag could be omitted only for .use()"):null===r.use&&(o=this._encodeComposite(t,s,n,a))}return null!==r.explicit&&(o=this._encodeComposite(r.explicit,!1,"context",o)),o},c.prototype._encodeChoice=function(t,e){const n=this._baseState,i=n.choice[t.type];return i||a(!1,t.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(t.value,e)},c.prototype._encodePrimitive=function(t,e){const n=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&n.args)return this._encodeObjid(e,n.reverseArgs[0],n.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,n.args&&n.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},c.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},c.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(t,e,n){"use strict";const i=n(0);function r(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.Reporter=r,r.prototype.isError=function(t){return t instanceof o},r.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},r.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},r.prototype.enterKey=function(t){return this._reporterState.path.push(t)},r.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},r.prototype.leaveKey=function(t,e,n){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[e]=n)},r.prototype.path=function(){return this._reporterState.path.join("/")},r.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},r.prototype.leaveObject=function(t){const e=this._reporterState,n=e.obj;return e.obj=t,n},r.prototype.error=function(t){let e;const n=this._reporterState,i=t instanceof o;if(e=i?t:new o(n.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!n.options.partial)throw e;return i||n.errors.push(e),e},r.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},i(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},function(t,e,n){"use strict";function i(t){const e={};return Object.keys(t).forEach((function(n){(0|n)==n&&(n|=0);const i=t[n];e[i]=n})),e}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=i(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=i(e.tag)},function(t,e,n){var i,r,o;r=[e,n(1)],void 0===(o="function"==typeof(i=function(t,e){"use strict";var n,i,r,o,a,s,l=e.kotlin.io.println_s8jyv4$,c=e.Kind.CLASS,u=e.kotlin.lazy_klfg04$,p=e.wrapFunction,h=e.kotlin.collections.listOf_mh5how$,f=(e.kotlin.collections.asList_us0mfu$,e.kotlin.Enum),d=e.throwISE,_=(e.kotlin.Unit,e.Kind.INTERFACE),y=e.kotlin.text.StringBuilder_init;function m(t){void 0===t&&(t=new z),g.call(this),this.throwableStringProvider_0=t}function v(t){return function(){return t()}}function $(t,e){void 0===t&&(t=h(new m)),void 0===e&&(e="Kermit"),this.loggerList_0=t,this.defaultTag_0=e}function g(){}function b(t,e){f.call(this),this.name$=t,this.ordinal$=e}function w(){w=function(){},n=new b("Verbose",0),i=new b("Debug",1),r=new b("Info",2),o=new b("Warn",3),a=new b("Error",4),s=new b("Assert",5)}function k(){return w(),n}function S(){return w(),i}function x(){return w(),r}function E(){return w(),o}function C(){return w(),a}function O(){return w(),s}function N(){}function z(){}m.prototype=Object.create(g.prototype),m.prototype.constructor=m,b.prototype=Object.create(f.prototype),b.prototype.constructor=b,m.prototype.log_hbb6rz$$default=function(t,e,n,i){l(t.toString()+": ("+n+") "+e),null!=i&&l(this.throwableStringProvider_0.getThrowableString_tcv7n7$(i))},m.$metadata$={kind:c,simpleName:"CommonLogger",interfaces:[g]},$.prototype.withTag_61zpoe$=function(t){return new $(this.loggerList_0,t)},$.prototype.v_ttfnl4$=function(t,e,n){void 0===t&&(t=this.defaultTag_0),void 0===e&&(e=null);var i,r=k(),o=u(v(n));for(i=this.loggerList_0.iterator();i.hasNext();){var a=i.next();a.isLoggable_7vw6fh$(r)&&a.v_gqh5ww$(o.value,t,e)}},$.prototype.v_h4ejuu$=function(t){this.v_ttfnl4$(void 0,void 0,t)},$.prototype.v_l35kib$=function(t,e){this.v_ttfnl4$(void 0,t,e)},$.prototype.v_swpfbs$=function(t,e){this.v_ttfnl4$(t,void 0,e)},$.prototype.d_ttfnl4$=function(t,e,n){void 0===t&&(t=this.defaultTag_0),void 0===e&&(e=null);var i,r=S(),o=u(v(n));for(i=this.loggerList_0.iterator();i.hasNext();){var a=i.next();a.isLoggable_7vw6fh$(r)&&a.d_gqh5ww$(o.value,t,e)}},$.prototype.d_h4ejuu$=function(t){this.d_ttfnl4$(void 0,void 0,t)},$.prototype.d_sd3n2e$=function(t,e){this.d_ttfnl4$(void 0,t,e)},$.prototype.d_swpfbs$=function(t,e){this.d_ttfnl4$(t,void 0,e)},$.prototype.i_ttfnl4$=function(t,e,n){void 0===t&&(t=this.defaultTag_0),void 0===e&&(e=null);var i,r=x(),o=u(v(n));for(i=this.loggerList_0.iterator();i.hasNext();){var a=i.next();a.isLoggable_7vw6fh$(r)&&a.i_gqh5ww$(o.value,t,e)}},$.prototype.i_h4ejuu$=function(t){this.i_ttfnl4$(void 0,void 0,t)},$.prototype.i_sd3n2e$=function(t,e){this.i_ttfnl4$(void 0,t,e)},$.prototype.i_swpfbs$=function(t,e){this.i_ttfnl4$(t,void 0,e)},$.prototype.w_ttfnl4$=function(t,e,n){void 0===t&&(t=this.defaultTag_0),void 0===e&&(e=null);var i,r=E(),o=u(v(n));for(i=this.loggerList_0.iterator();i.hasNext();){var a=i.next();a.isLoggable_7vw6fh$(r)&&a.w_gqh5ww$(o.value,t,e)}},$.prototype.w_h4ejuu$=function(t){this.w_ttfnl4$(void 0,void 0,t)},$.prototype.w_sd3n2e$=function(t,e){this.w_ttfnl4$(void 0,t,e)},$.prototype.w_swpfbs$=function(t,e){this.w_ttfnl4$(t,void 0,e)},$.prototype.e_ttfnl4$=function(t,e,n){void 0===t&&(t=this.defaultTag_0),void 0===e&&(e=null);var i,r=C(),o=u(v(n));for(i=this.loggerList_0.iterator();i.hasNext();){var a=i.next();a.isLoggable_7vw6fh$(r)&&a.e_gqh5ww$(o.value,t,e)}},$.prototype.e_h4ejuu$=function(t){this.e_ttfnl4$(void 0,void 0,t)},$.prototype.e_sd3n2e$=function(t,e){this.e_ttfnl4$(void 0,t,e)},$.prototype.e_swpfbs$=function(t,e){this.e_ttfnl4$(t,void 0,e)},$.prototype.wtf_ttfnl4$=function(t,e,n){void 0===t&&(t=this.defaultTag_0),void 0===e&&(e=null);var i,r=O(),o=u(v(n));for(i=this.loggerList_0.iterator();i.hasNext();){var a=i.next();a.isLoggable_7vw6fh$(r)&&a.wtf_gqh5ww$(o.value,t,e)}},$.prototype.wtf_h4ejuu$=function(t){this.wtf_ttfnl4$(void 0,void 0,t)},$.prototype.wtf_sd3n2e$=function(t,e){this.wtf_ttfnl4$(void 0,t,e)},$.prototype.wtf_swpfbs$=function(t,e){this.wtf_ttfnl4$(t,void 0,e)},$.prototype.log_lb0tcp$=function(t,e,n,i){void 0===e&&(e=this.defaultTag_0);var r,o=u(v(i));for(r=this.loggerList_0.iterator();r.hasNext();){var a=r.next();a.isLoggable_7vw6fh$(t)&&a.log_hbb6rz$(t,o.value,e,n)}},$.prototype.processLog_0=p((function(){return function(t,e,n,i,r){var o,a,s=u((o=i,function(){return o()}));for(a=this.loggerList_0.iterator();a.hasNext();){var l=a.next();l.isLoggable_7vw6fh$(t)&&r(l,s.value,e,n)}}})),$.$metadata$={kind:c,simpleName:"Kermit",interfaces:[]},g.prototype.isLoggable_7vw6fh$=function(t){return!0},g.prototype.log_hbb6rz$=function(t,e,n,i,r){void 0===i&&(i=null),r?r(t,e,n,i):this.log_hbb6rz$$default(t,e,n,i)},g.prototype.v_gqh5ww$$default=function(t,e,n){this.log_hbb6rz$(k(),t,e,n)},g.prototype.v_gqh5ww$=function(t,e,n,i){void 0===n&&(n=null),i?i(t,e,n):this.v_gqh5ww$$default(t,e,n)},g.prototype.d_gqh5ww$$default=function(t,e,n){this.log_hbb6rz$(S(),t,e,n)},g.prototype.d_gqh5ww$=function(t,e,n,i){void 0===n&&(n=null),i?i(t,e,n):this.d_gqh5ww$$default(t,e,n)},g.prototype.i_gqh5ww$$default=function(t,e,n){this.log_hbb6rz$(x(),t,e,n)},g.prototype.i_gqh5ww$=function(t,e,n,i){void 0===n&&(n=null),i?i(t,e,n):this.i_gqh5ww$$default(t,e,n)},g.prototype.w_gqh5ww$$default=function(t,e,n){this.log_hbb6rz$(E(),t,e,n)},g.prototype.w_gqh5ww$=function(t,e,n,i){void 0===n&&(n=null),i?i(t,e,n):this.w_gqh5ww$$default(t,e,n)},g.prototype.e_gqh5ww$$default=function(t,e,n){this.log_hbb6rz$(C(),t,e,n)},g.prototype.e_gqh5ww$=function(t,e,n,i){void 0===n&&(n=null),i?i(t,e,n):this.e_gqh5ww$$default(t,e,n)},g.prototype.wtf_gqh5ww$$default=function(t,e,n){this.log_hbb6rz$(O(),t,e,n)},g.prototype.wtf_gqh5ww$=function(t,e,n,i){void 0===n&&(n=null),i?i(t,e,n):this.wtf_gqh5ww$$default(t,e,n)},g.$metadata$={kind:c,simpleName:"Logger",interfaces:[]},b.$metadata$={kind:c,simpleName:"Severity",interfaces:[f]},b.values=function(){return[k(),S(),x(),E(),C(),O()]},b.valueOf_61zpoe$=function(t){switch(t){case"Verbose":return k();case"Debug":return S();case"Info":return x();case"Warn":return E();case"Error":return C();case"Assert":return O();default:d("No enum constant co.touchlab.kermit.Severity."+t)}},N.prototype.getThrowableString_tcv7n7$=function(t){var e,n,i=y(),r=(n=i,function t(e,i){var r;void 0===i&&(i=0),n.append_pdl1vj$("Caused by: "+e.toString()+"\n"),null!=(r=e.cause)&&r!==e&&i<2&&t(r,i+1|0)});return i.append_pdl1vj$(t.toString()+"\n"),null!=(e=t.cause)&&r(e),i.toString()},N.$metadata$={kind:_,simpleName:"ThrowableStringProvider",interfaces:[]},z.$metadata$={kind:c,simpleName:"PlatformThrowableStringProvider",interfaces:[N]};var j=t.co||(t.co={}),T=j.touchlab||(j.touchlab={}),P=T.kermit||(T.kermit={});return P.CommonLogger=m,P.Kermit_init_bigt7k$=function(t,e){return e=e||Object.create($.prototype),$.call(e,h(t)),e},P.Kermit=$,P.Logger=g,Object.defineProperty(b,"Verbose",{get:k}),Object.defineProperty(b,"Debug",{get:S}),Object.defineProperty(b,"Info",{get:x}),Object.defineProperty(b,"Warn",{get:E}),Object.defineProperty(b,"Error",{get:C}),Object.defineProperty(b,"Assert",{get:O}),P.Severity=b,P.ThrowableStringProvider=N,P.PlatformThrowableStringProvider=z,z.prototype.getThrowableString_tcv7n7$=N.prototype.getThrowableString_tcv7n7$,t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){var i,r,o;r=[e,n(1)],void 0===(o="function"==typeof(i=function(t,e){"use strict";var n=e.getKClass,i=e.Kind.CLASS,r=e.kotlin.Annotation,o=e.Kind.INTERFACE,a=(e.kotlin.js.internal.StringCompanionObject,e.toString),s=e.kotlin.Unit,l=e.kotlin.IllegalArgumentException_init_pdl1vj$,c=e.kotlin.collections.zip_r9t3v7$,u=e.kotlin.collections.toMap_6hr0sd$,p=e.kotlin.collections.Grouping,h=e.kotlin.collections.LinkedHashMap_init_q3lmfv$,f=e.kotlin.IllegalStateException_init_pdl1vj$,d=e.kotlin.collections.mapCapacity_za3lpa$,_=e.kotlin.collections.LinkedHashMap_init_bwtc7$,y=e.kotlin.collections.Map,m=e.throwCCE,v=(e.defineInlineFunction,e.wrapFunction,e.kotlin.IllegalArgumentException),$=(e.kotlin.IllegalArgumentException_init,e.kotlin.IllegalArgumentException_init_dbl4no$,e.getCallableRef),g=e.kotlin.collections.Collection,b=e.equals,w=e.kotlin.collections.List,k=e.kotlin.collections.MutableList,S=e.kotlin.collections.ArrayList,x=e.kotlin.collections.HashSet,E=e.kotlin.collections.Set,C=e.kotlin.collections.MutableSet,O=e.kotlin.collections.LinkedHashSet,N=e.kotlin.collections.HashMap,z=e.kotlin.collections.MutableMap,j=e.kotlin.collections.LinkedHashMap,T=e.kotlin.collections.Map.Entry,P=e.kotlin.Pair,R=e.kotlin.Triple,A=e.kotlin.reflect.KClass,I=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,M=e.kotlin.collections.ArrayList_init_ww73n8$,L=e.kotlin.collections.copyToArray,D=(e.kotlin.text.toLong_pdl1vz$,e.Kind.OBJECT),q=e.kotlin.collections.emptyList_287e2$,F=e.hashCode,U=e.kotlin.collections.Iterator,B=e.kotlin.collections.Iterable,H=e.kotlin.collections.toList_us0mfu$,V=e.kotlin.collections.ArrayList_init_287e2$,K=e.kotlin.collections.HashSet_init_287e2$,W=e.arrayEquals,Y=e.kotlin.ranges.until_dqglrj$,G=e.kotlin.collections.joinToString_fmv235$,J=e.kotlin.collections.toHashSet_7wnvza$,Z=e.kotlin.collections.toBooleanArray_xmyvgf$,Q=e.kotlin.collections.withIndex_us0mfu$,X=e.kotlin.to_ujzrz7$,tt=e.kotlin.lazy_klfg04$,et=e.kotlin.text.isBlank_gw00vp$,nt=e.ensureNotNull,it=e.toBoxedChar,rt=Object,ot=Error,at=e.kotlin.text.toIntOrNull_pdl1vz$,st=e.kotlin.collections.getValue_t9ocha$,lt=e.kotlin.collections.asList_us0mfu$,ct=e.kotlin.collections.ArrayList_init_mqih57$,ut=e.kotlin.collections.LinkedHashSet_init_mqih57$,pt=e.kotlin.collections.HashSet_init_mqih57$,ht=e.kotlin.collections.LinkedHashMap_init_73mtqc$,ft=e.kotlin.collections.HashMap_init_q3lmfv$,dt=e.kotlin.collections.HashMap_init_73mtqc$,_t=e.kotlin.collections.LinkedHashSet_init_287e2$,yt=e.kotlin.collections.indexOf_mjy6jw$,mt=e.arrayToString,vt=e.kotlin.collections.get_indices_m7z4lg$,$t=Array,gt=(e.kotlin.js.internal.IntCompanionObject,e.kotlin.js.internal.LongCompanionObject,e.kotlin.js.internal.ByteCompanionObject,e.kotlin.js.internal.ShortCompanionObject,e.kotlin.UInt),bt=e.kotlin.ULong,wt=e.kotlin.UByte,kt=e.kotlin.UShort,St=(e.toByte,e.kotlin.ranges.CharRange,e.kotlin.text.StringBuilder_init_za3lpa$,e.kotlin.text.trimStart_wqw3xr$,e.kotlin.collections.HashSet_init_ww73n8$),xt=e.arrayHashCode,Et=e.kotlin.ranges.coerceAtLeast_dqglrj$,Ct=e.kotlin.collections.copyOf_mrm5p$,Ot=e.kotlin.collections.copyOf_m2jy6x$,Nt=e.kotlin.collections.copyOf_c03ot6$,zt=e.kotlin.collections.copyOf_3aefkx$,jt=(e.kotlin.js.internal.FloatCompanionObject,e.kotlin.collections.copyOf_rblqex$),Tt=(e.kotlin.js.internal.DoubleCompanionObject,e.kotlin.collections.copyOf_xgrzbe$),Pt=e.unboxChar,Rt=(e.kotlin.js.internal.CharCompanionObject,e.kotlin.collections.copyOf_gtcw5h$),At=(e.kotlin.js.internal.BooleanCompanionObject,e.kotlin.collections.copyOf_1qu12l$),It=e.kotlin.reflect.js.internal.PrimitiveClasses.stringClass,Mt=e.BoxedChar,Lt=e.kotlin.reflect.js.internal.PrimitiveClasses.charArrayClass,Dt=e.kotlin.reflect.js.internal.PrimitiveClasses.doubleClass,qt=e.kotlin.reflect.js.internal.PrimitiveClasses.doubleArrayClass,Ft=e.kotlin.reflect.js.internal.PrimitiveClasses.floatClass,Ut=e.kotlin.reflect.js.internal.PrimitiveClasses.floatArrayClass,Bt=e.Long,Ht=e.kotlin.reflect.js.internal.PrimitiveClasses.longArrayClass,Vt=e.kotlin.reflect.js.internal.PrimitiveClasses.intClass,Kt=e.kotlin.reflect.js.internal.PrimitiveClasses.intArrayClass,Wt=e.kotlin.reflect.js.internal.PrimitiveClasses.shortClass,Yt=e.kotlin.reflect.js.internal.PrimitiveClasses.shortArrayClass,Gt=e.kotlin.reflect.js.internal.PrimitiveClasses.byteClass,Jt=e.kotlin.reflect.js.internal.PrimitiveClasses.byteArrayClass,Zt=e.kotlin.reflect.js.internal.PrimitiveClasses.booleanClass,Qt=e.kotlin.reflect.js.internal.PrimitiveClasses.booleanArrayClass,Xt=e.kotlin,te=e.kotlin.collections.mapOf_qfcya0$,ee=e.kotlin.text.capitalize_pdl1vz$,ne=e.kotlin.text.equals_igcy3c$,ie=e.kotlin.text.trimIndent_pdl1vz$,re=e.kotlin.collections.last_2p1efm$,oe=e.kotlin.collections.lastOrNull_2p1efm$,ae=e.kotlin.collections.get_lastIndex_55thoc$,se=e.kotlin.collections.emptyMap_q3lmfv$,le=e.kotlin.IndexOutOfBoundsException,ce=e.kotlin.collections.get_indices_l1lu5t$,ue=e.kotlin.js.get_js_1yb8b7$,pe=e.kotlin.reflect.js.internal.PrimitiveClasses.arrayClass,he=e.findAssociatedObject_yjf3nl$;function fe(){}function de(){}function _e(){}function ye(t,e,n){var i;return null!=(i=t.findPolymorphicSerializerOrNull_ca6uye$(e,n))?i:Oi(n,t.baseClass)}function me(t,n,i){var r;return null!=(r=t.findPolymorphicSerializerOrNull_kjsxpj$(n,i))?r:Ni(e.getKClassFromExpression(i),t.baseClass)}function ve(t,e){this.this$groupingBy=t,this.closure$keySelector=e}function $e(t,e,n,i){var r,o;if(Ci.call(this),this.baseClass_a0a98o$_0=e,this.descriptor_gganzq$_0=cn(t,ci(),[],(r=this,o=i,function(t){t.element_vxrguq$("type",Xe().descriptor);var e=cn("kotlinx.serialization.Sealed<"+a(r.baseClass.simpleName)+">",vn(),[],function(t){return function(e){var n,i=t;for(n=0;n!==i.length;++n){var r=i[n].descriptor;e.element_vxrguq$(r.serialName,r)}return s}}(o));return t.element_vxrguq$("value",e),s})),this.class2Serializer_0=null,this.serialName2Serializer_0=null,n.length!==i.length)throw l("All subclasses of sealed class "+a(this.baseClass.simpleName)+" should be marked @Serializable");this.class2Serializer_0=u(c(n,i));var p,y=new ve(this.class2Serializer_0.entries,ge),m=h();for(p=y.sourceIterator();p.hasNext();){var v=p.next(),$=y.keyOf_11rb$(v),g=m.get_11rb$($),b=m.put_xwzc9p$;if(null==g&&m.containsKey_11rb$($),null!=g)throw f(("Multiple sealed subclasses of '"+this.baseClass+"' have the same serial name '"+$+"': '"+g.key+"', '"+v.key+"'").toString());b.call(m,$,v)}var w,k=_(d(m.size));for(w=m.entries.iterator();w.hasNext();){var S=w.next();k.put_xwzc9p$(S.key,S.value.value)}this.serialName2Serializer_0=k}function ge(t){return t.value.descriptor.serialName}function be(){}function we(){}function ke(){this.name="SerializationException"}function Se(t,e){return e=e||Object.create(ke.prototype),l(t,e),ke.call(e),e}function xe(t,e,n){return n=n||Object.create(ke.prototype),v.call(n,t,e),ke.call(n),n}function Ee(t,e){xe(t,e,this),this.name="MissingFieldException"}function Ce(t){Se(t,this),this.name="UnknownFieldException"}function Oe(t,e){var n;return null!=(n=ze(t,e,!0))?n:la(Sr(e))}function Ne(t,e){return ze(t,e,!1)}function ze(t,i,r){var o,a,s,c=Sr(i),u=i.isMarkedNullable,p=i.arguments,h=M(I(p,10));for(s=p.iterator();s.hasNext();){var f,d=s.next(),_=h.add_11rb$,v=d.type;if(null==v)throw l(("Star projections in type arguments are not allowed, but had "+i).toString());f=v,_.call(h,f)}var D,q,F=h;return null!=(D=null!=(a=F.isEmpty()?null!=(o=je(c))?o:t.getContextual_lmshww$(c):function(t,i,r,o){var a,s,l;if(o){var c,u=$("serializer",function(t,e){return Oe(t,e)}.bind(null,t)),p=M(I(i,10));for(c=i.iterator();c.hasNext();){var h=c.next();p.add_11rb$(u(h))}a=p}else{var f,d=M(I(i,10));for(f=i.iterator();f.hasNext();){var _,v=f.next(),D=d.add_11rb$;if(null==(_=Ne(t,v)))return null;D.call(d,_)}a=d}var q=a;if(b(r,n(g))||b(r,n(w))||b(r,n(k))||b(r,n(S)))l=new Ki(q.get_za3lpa$(0));else if(b(r,n(x)))l=new Yi(q.get_za3lpa$(0));else if(b(r,n(E))||b(r,n(C))||b(r,n(O)))l=new Wi(q.get_za3lpa$(0));else if(b(r,n(N)))l=new Ji(q.get_za3lpa$(0),q.get_za3lpa$(1));else if(b(r,n(y))||b(r,n(z))||b(r,n(j)))l=new Gi(q.get_za3lpa$(0),q.get_za3lpa$(1));else if(b(r,n(T)))l=Re(q.get_za3lpa$(0),q.get_za3lpa$(1));else if(b(r,n(P)))l=Pe(q.get_za3lpa$(0),q.get_za3lpa$(1));else if(b(r,n(R)))l=Ae(q.get_za3lpa$(0),q.get_za3lpa$(1),q.get_za3lpa$(2));else{var F;if(ua(r))return e.isType(F=tn(e.isType(s=i.get_za3lpa$(0).classifier,A)?s:m(),q.get_za3lpa$(0)),fe)?F:m();l=ca(r,L(q).slice())}return l}(t,F,c,r))?e.isType(q=a,fe)?q:m():null)?function(t,n){var i;return n?Te(t):e.isType(i=t,fe)?i:m()}(D,u):null}function je(t){var e;return null!=(e=oa(t))?e:uo(t)}function Te(t){var n;return t.descriptor.isNullable?e.isType(n=t,fe)?n:m():new vr(t)}function Pe(t,e){return new Zo(t,e)}function Re(t,e){return new Go(t,e)}function Ae(t,e,n){return new Qo(t,e,n)}function Ie(t){return Lo()}function Me(){return eo()}function Le(t){return go()}function De(){return jr()}function qe(t){return ko()}function Fe(){return Ar()}function Ue(t){return Eo()}function Be(){return Dr()}function He(t){return No()}function Ve(){return Br()}function Ke(t){return To()}function We(){return Wr()}function Ye(t){return Ao()}function Ge(){return Zr()}function Je(t){return mo()}function Ze(){return ao()}function Qe(t){return fo()}function Xe(t){return Bo()}function tn(t,e){return new Vi(t,e)}function en(t){this.closure$iterator=t}function nn(){}function rn(t){this.this$elementDescriptors=t,this.elementsLeft_0=t.elementsCount}function on(t){return new en((e=t,function(){return new rn(e)}));var e}function an(t){return s}function sn(t,e,n){if(void 0===n&&(n=an),et(t))throw l("Blank serial names are prohibited".toString());var i=new un(t);return n(i),new pn(t,Jn(),i.elementNames_8be2vx$.size,H(e),i)}function ln(t){return s}function cn(t,e,n,i){if(void 0===i&&(i=ln),et(t))throw l("Blank serial names are prohibited".toString());if(b(e,Jn()))throw l("For StructureKind.CLASS please use 'buildClassSerialDescriptor' instead".toString());var r=new un(t);return i(r),new pn(t,e,r.elementNames_8be2vx$.size,H(n),r)}function un(t){this.serialName=t,this.isNullable=!1,this.annotations=q(),this.elementNames_8be2vx$=V(),this.uniqueNames_0=K(),this.elementDescriptors_8be2vx$=V(),this.elementAnnotations_8be2vx$=V(),this.elementOptionality_8be2vx$=V()}function pn(t,e,n,i,r){this.serialName_btmdyn$_0=t,this.kind_589tly$_0=e,this.elementsCount_wewqc2$_0=n,this.annotations_efqcf6$_0=r.annotations,this.serialNames_bcpscy$_0=J(r.elementNames_8be2vx$),this.elementNames_0=L(r.elementNames_8be2vx$),this.elementDescriptors_0=wr(r.elementDescriptors_8be2vx$),this.elementAnnotations_0=L(r.elementAnnotations_8be2vx$),this.elementOptionality_0=Z(r.elementOptionality_8be2vx$);var o,a,s=Q(this.elementNames_0),l=M(I(s,10));for(o=s.iterator();o.hasNext();){var c=o.next();l.add_11rb$(X(c.value,c.index))}this.name2Index_0=u(l),this.typeParametersDescriptors_0=wr(i),this._hashCode_6e2cwc$_0=tt((a=this,function(){return Er(a,a.typeParametersDescriptors_0)}))}function hn(){}function fn(){dn=this,hn.call(this)}$e.prototype=Object.create(Ci.prototype),$e.prototype.constructor=$e,ke.prototype=Object.create(v.prototype),ke.prototype.constructor=ke,Ee.prototype=Object.create(ke.prototype),Ee.prototype.constructor=Ee,Ce.prototype=Object.create(ke.prototype),Ce.prototype.constructor=Ce,fn.prototype=Object.create(hn.prototype),fn.prototype.constructor=fn,yn.prototype=Object.create(hn.prototype),yn.prototype.constructor=yn,$n.prototype=Object.create(hn.prototype),$n.prototype.constructor=$n,gn.prototype=Object.create($n.prototype),gn.prototype.constructor=gn,kn.prototype=Object.create($n.prototype),kn.prototype.constructor=kn,En.prototype=Object.create($n.prototype),En.prototype.constructor=En,Nn.prototype=Object.create($n.prototype),Nn.prototype.constructor=Nn,Tn.prototype=Object.create($n.prototype),Tn.prototype.constructor=Tn,An.prototype=Object.create($n.prototype),An.prototype.constructor=An,Ln.prototype=Object.create($n.prototype),Ln.prototype.constructor=Ln,Fn.prototype=Object.create($n.prototype),Fn.prototype.constructor=Fn,Hn.prototype=Object.create($n.prototype),Hn.prototype.constructor=Hn,Wn.prototype=Object.create(hn.prototype),Wn.prototype.constructor=Wn,Yn.prototype=Object.create(Wn.prototype),Yn.prototype.constructor=Yn,Zn.prototype=Object.create(Wn.prototype),Zn.prototype.constructor=Zn,ti.prototype=Object.create(Wn.prototype),ti.prototype.constructor=ti,ii.prototype=Object.create(Wn.prototype),ii.prototype.constructor=ii,ai.prototype=Object.create(hn.prototype),ai.prototype.constructor=ai,si.prototype=Object.create(ai.prototype),si.prototype.constructor=si,ui.prototype=Object.create(ai.prototype),ui.prototype.constructor=ui,Pi.prototype=Object.create(ji.prototype),Pi.prototype.constructor=Pi,Ri.prototype=Object.create(ji.prototype),Ri.prototype.constructor=Ri,Ai.prototype=Object.create(ji.prototype),Ai.prototype.constructor=Ai,Ii.prototype=Object.create(ji.prototype),Ii.prototype.constructor=Ii,Mi.prototype=Object.create(ji.prototype),Mi.prototype.constructor=Mi,Li.prototype=Object.create(Ti.prototype),Li.prototype.constructor=Li,Di.prototype=Object.create(Ti.prototype),Di.prototype.constructor=Di,Fi.prototype=Object.create(qi.prototype),Fi.prototype.constructor=Fi,Ui.prototype=Object.create(qi.prototype),Ui.prototype.constructor=Ui,Hi.prototype=Object.create(Fi.prototype),Hi.prototype.constructor=Hi,Vi.prototype=Object.create(Fi.prototype),Vi.prototype.constructor=Vi,Ki.prototype=Object.create(Fi.prototype),Ki.prototype.constructor=Ki,Wi.prototype=Object.create(Fi.prototype),Wi.prototype.constructor=Wi,Yi.prototype=Object.create(Fi.prototype),Yi.prototype.constructor=Yi,Gi.prototype=Object.create(Ui.prototype),Gi.prototype.constructor=Gi,Ji.prototype=Object.create(Ui.prototype),Ji.prototype.constructor=Ji,Qi.prototype=Object.create(xr.prototype),Qi.prototype.constructor=Qi,fr.prototype=Object.create(fi.prototype),fr.prototype.constructor=fr,Nr.prototype=Object.create(Hi.prototype),Nr.prototype.constructor=Nr,Tr.prototype=Object.create(Bi.prototype),Tr.prototype.constructor=Tr,Pr.prototype=Object.create(Hi.prototype),Pr.prototype.constructor=Pr,Ir.prototype=Object.create(Bi.prototype),Ir.prototype.constructor=Ir,Mr.prototype=Object.create(Hi.prototype),Mr.prototype.constructor=Mr,qr.prototype=Object.create(Bi.prototype),qr.prototype.constructor=qr,Fr.prototype=Object.create(Hi.prototype),Fr.prototype.constructor=Fr,Hr.prototype=Object.create(Bi.prototype),Hr.prototype.constructor=Hr,Vr.prototype=Object.create(Hi.prototype),Vr.prototype.constructor=Vr,Yr.prototype=Object.create(Bi.prototype),Yr.prototype.constructor=Yr,Gr.prototype=Object.create(Hi.prototype),Gr.prototype.constructor=Gr,Qr.prototype=Object.create(Bi.prototype),Qr.prototype.constructor=Qr,Xr.prototype=Object.create(Hi.prototype),Xr.prototype.constructor=Xr,no.prototype=Object.create(Bi.prototype),no.prototype.constructor=no,io.prototype=Object.create(Hi.prototype),io.prototype.constructor=io,so.prototype=Object.create(Bi.prototype),so.prototype.constructor=so,Vo.prototype=Object.create(Ho.prototype),Vo.prototype.constructor=Vo,Wo.prototype=Object.create(Ko.prototype),Wo.prototype.constructor=Wo,Go.prototype=Object.create(Yo.prototype),Go.prototype.constructor=Go,Zo.prototype=Object.create(Yo.prototype),Zo.prototype.constructor=Zo,ta.prototype=Object.create(Xo.prototype),ta.prototype.constructor=ta,fe.$metadata$={kind:o,simpleName:"KSerializer",interfaces:[_e,de]},de.$metadata$={kind:o,simpleName:"SerializationStrategy",interfaces:[]},_e.$metadata$={kind:o,simpleName:"DeserializationStrategy",interfaces:[]},ve.prototype.sourceIterator=function(){return this.this$groupingBy.iterator()},ve.prototype.keyOf_11rb$=function(t){return this.closure$keySelector(t)},ve.$metadata$={kind:i,interfaces:[p]},Object.defineProperty($e.prototype,"baseClass",{get:function(){return this.baseClass_a0a98o$_0}}),Object.defineProperty($e.prototype,"descriptor",{configurable:!0,get:function(){return this.descriptor_gganzq$_0}}),$e.prototype.findPolymorphicSerializerOrNull_ca6uye$=function(t,n){var i,r,o=this.serialName2Serializer_0;return null!=(i=(e.isType(r=o,y)?r:m()).get_11rb$(n))?i:Ci.prototype.findPolymorphicSerializerOrNull_ca6uye$.call(this,t,n)},$e.prototype.findPolymorphicSerializerOrNull_kjsxpj$=function(t,n){var i,r,o;return null!=(r=null!=(i=this.class2Serializer_0.get_11rb$(e.getKClassFromExpression(n)))?i:Ci.prototype.findPolymorphicSerializerOrNull_kjsxpj$.call(this,t,n))?e.isType(o=r,de)?o:m():null},$e.$metadata$={kind:i,simpleName:"SealedClassSerializer",interfaces:[Ci]},be.$metadata$={kind:o,simpleName:"SerialFormat",interfaces:[]},we.$metadata$={kind:o,simpleName:"StringFormat",interfaces:[be]},ke.$metadata$={kind:i,simpleName:"SerializationException",interfaces:[v]},Ee.$metadata$={kind:i,simpleName:"MissingFieldException",interfaces:[ke]},Ce.$metadata$={kind:i,simpleName:"UnknownFieldException",interfaces:[ke]},en.prototype.iterator=function(){return this.closure$iterator()},en.$metadata$={kind:i,interfaces:[B]},Object.defineProperty(nn.prototype,"isNullable",{configurable:!0,get:function(){return!1}}),Object.defineProperty(nn.prototype,"isInline",{configurable:!0,get:function(){return!1}}),Object.defineProperty(nn.prototype,"annotations",{configurable:!0,get:function(){return q()}}),nn.$metadata$={kind:o,simpleName:"SerialDescriptor",interfaces:[]},rn.prototype.hasNext=function(){return this.elementsLeft_0>0},rn.prototype.next=function(){var t,e,n;return n=this.this$elementDescriptors.elementsCount,t=this.elementsLeft_0,this.elementsLeft_0=t-1|0,e=t,this.this$elementDescriptors.getElementDescriptor_za3lpa$(n-e|0)},rn.$metadata$={kind:i,interfaces:[U]},un.prototype.element_vxrguq$=function(t,e,n,i){if(void 0===n&&(n=q()),void 0===i&&(i=!1),!this.uniqueNames_0.add_11rb$(t))throw l(("Element with name '"+t+"' is already registered").toString());this.elementNames_8be2vx$.add_11rb$(t),this.elementDescriptors_8be2vx$.add_11rb$(e),this.elementAnnotations_8be2vx$.add_11rb$(n),this.elementOptionality_8be2vx$.add_11rb$(i)},un.$metadata$={kind:i,simpleName:"ClassSerialDescriptorBuilder",interfaces:[]},Object.defineProperty(pn.prototype,"serialName",{get:function(){return this.serialName_btmdyn$_0}}),Object.defineProperty(pn.prototype,"kind",{get:function(){return this.kind_589tly$_0}}),Object.defineProperty(pn.prototype,"elementsCount",{get:function(){return this.elementsCount_wewqc2$_0}}),Object.defineProperty(pn.prototype,"annotations",{configurable:!0,get:function(){return this.annotations_efqcf6$_0}}),Object.defineProperty(pn.prototype,"serialNames",{configurable:!0,get:function(){return this.serialNames_bcpscy$_0}}),Object.defineProperty(pn.prototype,"_hashCode_0",{configurable:!0,get:function(){return this._hashCode_6e2cwc$_0.value}}),pn.prototype.getElementName_za3lpa$=function(t){return ia(this.elementNames_0,t)},pn.prototype.getElementIndex_61zpoe$=function(t){var e;return null!=(e=this.name2Index_0.get_11rb$(t))?e:-3},pn.prototype.getElementAnnotations_za3lpa$=function(t){return ia(this.elementAnnotations_0,t)},pn.prototype.getElementDescriptor_za3lpa$=function(t){return ia(this.elementDescriptors_0,t)},pn.prototype.isElementOptional_za3lpa$=function(t){return ra(this.elementOptionality_0,t)},pn.prototype.equals=function(t){var n;t:do{var i;if(this===t){n=!0;break t}if(!e.isType(t,pn)){n=!1;break t}if(!b(this.serialName,t.serialName)){n=!1;break t}if(!W(this.typeParametersDescriptors_0,t.typeParametersDescriptors_0)){n=!1;break t}if(this.elementsCount!==t.elementsCount){n=!1;break t}i=this.elementsCount;for(var r=0;r=0)){var e="Illegal index "+t+", "+this.serialName+" expects only non-negative indices";throw l(e.toString())}return!1},ji.prototype.getElementAnnotations_za3lpa$=function(t){if(!(t>=0)){var e="Illegal index "+t+", "+this.serialName+" expects only non-negative indices";throw l(e.toString())}return q()},ji.prototype.getElementDescriptor_za3lpa$=function(t){if(!(t>=0)){var e="Illegal index "+t+", "+this.serialName+" expects only non-negative indices";throw l(e.toString())}return this.elementDescriptor},ji.prototype.equals=function(t){return this===t||!!e.isType(t,ji)&&!(!b(this.elementDescriptor,t.elementDescriptor)||!b(this.serialName,t.serialName))},ji.prototype.hashCode=function(){return(31*F(this.elementDescriptor)|0)+F(this.serialName)|0},ji.prototype.toString=function(){return this.serialName+"("+this.elementDescriptor+")"},ji.$metadata$={kind:i,simpleName:"ListLikeDescriptor",interfaces:[nn]},Object.defineProperty(Ti.prototype,"serialName",{get:function(){return this.serialName_ra35nx$_0}}),Object.defineProperty(Ti.prototype,"kind",{configurable:!0,get:function(){return ni()}}),Object.defineProperty(Ti.prototype,"elementsCount",{configurable:!0,get:function(){return this.elementsCount_qp2ocq$_0}}),Ti.prototype.getElementName_za3lpa$=function(t){return t.toString()},Ti.prototype.getElementIndex_61zpoe$=function(t){var e;if(null==(e=at(t)))throw l(t+" is not a valid map index");return e},Ti.prototype.isElementOptional_za3lpa$=function(t){if(!(t>=0)){var e="Illegal index "+t+", "+this.serialName+" expects only non-negative indices";throw l(e.toString())}return!1},Ti.prototype.getElementAnnotations_za3lpa$=function(t){if(!(t>=0)){var e="Illegal index "+t+", "+this.serialName+" expects only non-negative indices";throw l(e.toString())}return q()},Ti.prototype.getElementDescriptor_za3lpa$=function(t){var e;if(!(t>=0)){var n="Illegal index "+t+", "+this.serialName+" expects only non-negative indices";throw l(n.toString())}switch(t%2){case 0:e=this.keyDescriptor;break;case 1:e=this.valueDescriptor;break;default:throw f("Unreached".toString())}return e},Ti.prototype.equals=function(t){return this===t||!!e.isType(t,Ti)&&!!b(this.serialName,t.serialName)&&!!b(this.keyDescriptor,t.keyDescriptor)&&!!b(this.valueDescriptor,t.valueDescriptor)},Ti.prototype.hashCode=function(){var t=F(this.serialName);return t=(31*(t=(31*t|0)+F(this.keyDescriptor)|0)|0)+F(this.valueDescriptor)|0},Ti.prototype.toString=function(){return this.serialName+"("+this.keyDescriptor+", "+this.valueDescriptor+")"},Ti.$metadata$={kind:i,simpleName:"MapLikeDescriptor",interfaces:[nn]},Object.defineProperty(Pi.prototype,"serialName",{configurable:!0,get:function(){return this.serialName_reprdi$_0}}),Pi.$metadata$={kind:i,simpleName:"PrimitiveArrayDescriptor",interfaces:[ji]},Object.defineProperty(Ri.prototype,"serialName",{configurable:!0,get:function(){return mi}}),Ri.$metadata$={kind:i,simpleName:"ArrayClassDesc",interfaces:[ji]},Object.defineProperty(Ai.prototype,"serialName",{configurable:!0,get:function(){return vi}}),Ai.$metadata$={kind:i,simpleName:"ArrayListClassDesc",interfaces:[ji]},Object.defineProperty(Ii.prototype,"serialName",{configurable:!0,get:function(){return $i}}),Ii.$metadata$={kind:i,simpleName:"LinkedHashSetClassDesc",interfaces:[ji]},Object.defineProperty(Mi.prototype,"serialName",{configurable:!0,get:function(){return gi}}),Mi.$metadata$={kind:i,simpleName:"HashSetClassDesc",interfaces:[ji]},Li.$metadata$={kind:i,simpleName:"LinkedHashMapClassDesc",interfaces:[Ti]},Di.$metadata$={kind:i,simpleName:"HashMapClassDesc",interfaces:[Ti]},qi.prototype.merge_h7kg3q$=function(t,e){var n,i=null!=(n=null!=e?this.toBuilder_wikn$(e):null)?n:this.builder(),r=this.builderSize_wili$(i),o=t.beginStructure_24f42q$(this.descriptor);if(o.decodeSequentially())this.readAll_8oyp34$(o,i,r,this.readSize_bl0yv7$_0(o,i));else for(;;){var a=o.decodeElementIndex_24f42q$(this.descriptor);if(-1===a)break;this.readElement_8pvye7$(o,r+a|0,i)}return o.endStructure_24f42q$(this.descriptor),this.toResult_wili$(i)},qi.prototype.deserialize_bq71mq$=function(t){return this.merge_h7kg3q$(t,null)},qi.prototype.readSize_bl0yv7$_0=function(t,e){var n=t.decodeCollectionSize_24f42q$(this.descriptor);return this.checkCapacity_rk7bw8$(e,n),n},qi.prototype.readElement_8pvye7$=function(t,e,n,i,r){void 0===i&&(i=!0),r?r(t,e,n,i):this.readElement_8pvye7$$default(t,e,n,i)},qi.$metadata$={kind:i,simpleName:"AbstractCollectionSerializer",interfaces:[fe]},Fi.prototype.serialize_55azsf$=function(t,e){for(var n=this.collectionSize_wikn$(e),i=t.beginCollection_szpzho$(this.descriptor,n),r=this.collectionIterator_wikn$(e),o=0;o=0))throw l("Size must be known in advance when using READ_ALL".toString());for(var r=0;r=0))throw l("Size must be known in advance when using READ_ALL".toString());r=2*i|0;for(var o=0;o"},Zi.$metadata$={kind:i,simpleName:"EnumSerializer",interfaces:[fe]},Object.defineProperty(Qi.prototype,"isInline",{configurable:!0,get:function(){return this.isInline_4xqniz$_0}}),Qi.prototype.hashCode=function(){return 31*xr.prototype.hashCode.call(this)|0},Qi.prototype.equals=function(t){var n;t:do{var i;if(this===t){n=!0;break t}if(!e.isType(t,Qi)){n=!1;break t}if(!b(this.serialName,t.serialName)){n=!1;break t}if(!t.isInline||!W(this.typeParameterDescriptors_8be2vx$,t.typeParameterDescriptors_8be2vx$)){n=!1;break t}if(this.elementsCount!==t.elementsCount){n=!1;break t}i=this.elementsCount;for(var r=0;r])/g,v=/([[}=:>])\s+/g,$=/(\{[^{]+?);(?=\})/g,g=/\s{2,}/g,b=/([^\(])(:+) */g,w=/[svh]\w+-[tblr]{2}/,k=/\(\s*(.*)\s*\)/g,S=/([\s\S]*?);/g,x=/-self|flex-/g,E=/[^]*?(:[rp][el]a[\w-]+)[^]*/,C=/stretch|:\s*\w+\-(?:conte|avail)/,O=/([^-])(image-set\()/,N="-webkit-",z="-moz-",j="-ms-",T=59,P=125,R=123,A=40,I=41,M=10,L=13,D=32,q=45,F=42,U=44,B=58,H=47,V=1,K=1,W=0,Y=1,G=1,J=1,Z=0,Q=0,X=0,tt=[],et=[],nt=0,it=null,rt=0,ot=1,at="",st="",lt="";function ct(t,e,r,o,a){for(var s,l,u=0,p=0,h=0,f=0,m=0,v=0,$=0,g=0,w=0,S=0,x=0,E=0,C=0,O=0,z=0,j=0,Z=0,et=0,it=0,pt=r.length,mt=pt-1,vt="",$t="",gt="",bt="",wt="",kt="";z0&&($t=$t.replace(i,"")),$t.trim().length>0)){switch($){case D:case 9:case T:case L:case M:break;default:$t+=r.charAt(z)}$=T}if(1===Z)switch($){case R:case P:case T:case 34:case 39:case A:case I:case U:Z=0;case 9:case L:case M:case D:break;default:for(Z=0,it=z,m=$,z--,$=T;it0&&(++z,$=m);case R:it=pt}}switch($){case R:for(m=($t=$t.trim()).charCodeAt(0),x=1,it=++z;z0&&($t=$t.replace(i,"")),v=$t.charCodeAt(1)){case 100:case 109:case 115:case q:s=e;break;default:s=tt}if(it=(gt=ct(e,s,gt,v,a+1)).length,X>0&&0===it&&(it=$t.length),nt>0&&(l=_t(3,gt,s=ut(tt,$t,et),e,K,V,it,v,a,o),$t=s.join(""),void 0!==l&&0===(it=(gt=l.trim()).length)&&(v=0,gt="")),it>0)switch(v){case 115:$t=$t.replace(k,dt);case 100:case 109:case q:gt=$t+"{"+gt+"}";break;case 107:gt=($t=$t.replace(d,"$1 $2"+(ot>0?at:"")))+"{"+gt+"}",gt=1===G||2===G&&ft("@"+gt,3)?"@"+N+gt+"@"+gt:"@"+gt;break;default:gt=$t+gt,112===o&&(bt+=gt,gt="")}else gt="";break;default:gt=ct(e,ut(e,$t,et),gt,o,a+1)}wt+=gt,E=0,Z=0,O=0,j=0,et=0,C=0,$t="",gt="",$=r.charCodeAt(++z);break;case P:case T:if((it=($t=(j>0?$t.replace(i,""):$t).trim()).length)>1)switch(0===O&&((m=$t.charCodeAt(0))===q||m>96&&m<123)&&(it=($t=$t.replace(" ",":")).length),nt>0&&void 0!==(l=_t(1,$t,e,t,K,V,bt.length,o,a,o))&&0===(it=($t=l.trim()).length)&&($t="\0\0"),m=$t.charCodeAt(0),v=$t.charCodeAt(1),m){case 0:break;case 64:if(105===v||99===v){kt+=$t+r.charAt(z);break}default:if($t.charCodeAt(it-1)===B)break;bt+=ht($t,m,v,$t.charCodeAt(2))}E=0,Z=0,O=0,j=0,et=0,$t="",$=r.charCodeAt(++z)}}switch($){case L:case M:if(p+f+h+u+Q===0)switch(S){case I:case 39:case 34:case 64:case 126:case 62:case F:case 43:case H:case q:case B:case U:case T:case R:case P:break;default:O>0&&(Z=1)}p===H?p=0:Y+E===0&&107!==o&&$t.length>0&&(j=1,$t+="\0"),nt*rt>0&&_t(0,$t,e,t,K,V,bt.length,o,a,o),V=1,K++;break;case T:case P:if(p+f+h+u===0){V++;break}default:switch(V++,vt=r.charAt(z),$){case 9:case D:if(f+u+p===0)switch(g){case U:case B:case 9:case D:vt="";break;default:$!==D&&(vt=" ")}break;case 0:vt="\\0";break;case 12:vt="\\f";break;case 11:vt="\\v";break;case 38:f+p+u===0&&Y>0&&(et=1,j=1,vt="\f"+vt);break;case 108:if(f+p+u+W===0&&O>0)switch(z-O){case 2:112===g&&r.charCodeAt(z-3)===B&&(W=g);case 8:111===w&&(W=w)}break;case B:f+p+u===0&&(O=z);break;case U:p+h+f+u===0&&(j=1,vt+="\r");break;case 34:case 39:0===p&&(f=f===$?0:0===f?$:f);break;case 91:f+p+h===0&&u++;break;case 93:f+p+h===0&&u--;break;case I:f+p+u===0&&h--;break;case A:if(f+p+u===0){if(0===E)switch(2*g+3*w){case 533:break;default:x=0,E=1}h++}break;case 64:p+h+f+u+O+C===0&&(C=1);break;case F:case H:if(f+u+h>0)break;switch(p){case 0:switch(2*$+3*r.charCodeAt(z+1)){case 235:p=H;break;case 220:it=z,p=F}break;case F:$===H&&g===F&&it+2!==z&&(33===r.charCodeAt(it+2)&&(bt+=r.substring(it,z+1)),vt="",p=0)}}if(0===p){if(Y+f+u+C===0&&107!==o&&$!==T)switch($){case U:case 126:case 62:case 43:case I:case A:if(0===E){switch(g){case 9:case D:case M:case L:vt+="\0";break;default:vt="\0"+vt+($===U?"":"\0")}j=1}else switch($){case A:O+7===z&&108===g&&(O=0),E=++x;break;case I:0==(E=--x)&&(j=1,vt+="\0")}break;case 9:case D:switch(g){case 0:case R:case P:case T:case U:case 12:case 9:case D:case M:case L:break;default:0===E&&(j=1,vt+="\0")}}$t+=vt,$!==D&&9!==$&&(S=$)}}w=g,g=$,z++}if(it=bt.length,X>0&&0===it&&0===wt.length&&0===e[0].length==0&&(109!==o||1===e.length&&(Y>0?st:lt)===e[0])&&(it=e.join(",").length+2),it>0){if(s=0===Y&&107!==o?function(t){for(var e,n,r=0,o=t.length,a=Array(o);r1)){if(h=l.charCodeAt(l.length-1),f=n.charCodeAt(0),e="",0!==u)switch(h){case F:case 126:case 62:case 43:case D:case A:break;default:e=" "}switch(f){case 38:n=e+st;case 126:case 62:case 43:case D:case I:case A:break;case 91:n=e+n+st;break;case B:switch(2*n.charCodeAt(1)+3*n.charCodeAt(2)){case 530:if(J>0){n=e+n.substring(8,p-1);break}default:(u<1||s[u-1].length<1)&&(n=e+st+n)}break;case U:e="";default:n=p>1&&n.indexOf(":")>0?e+n.replace(b,"$1"+st+"$2"):e+n+st}l+=n}a[r]=l.replace(i,"").trim()}return a}(e):e,nt>0&&void 0!==(l=_t(2,bt,s,t,K,V,it,o,a,o))&&0===(bt=l).length)return kt+bt+wt;if(bt=s.join(",")+"{"+bt+"}",G*W!=0){switch(2!==G||ft(bt,2)||(W=0),W){case 111:bt=bt.replace(y,":-moz-$1")+bt;break;case 112:bt=bt.replace(_,"::"+N+"input-$1")+bt.replace(_,"::-moz-$1")+bt.replace(_,":-ms-input-$1")+bt}W=0}}return kt+bt+wt}function ut(t,e,n){var i=e.trim().split(u),r=i,o=i.length,a=t.length;switch(a){case 0:case 1:for(var s=0,l=0===a?"":t[0]+" ";s0&&Y>0)return r.replace(h,"$1").replace(p,"$1"+lt);break;default:return t.trim()+r.replace(p,"$1"+t.trim())}default:if(n*Y>0&&r.indexOf("\f")>0)return r.replace(p,(t.charCodeAt(0)===B?"":"$1")+t.trim())}return t+r}function ht(t,e,n,i){var c,u=0,p=t+";",h=2*e+3*n+4*i;if(944===h)return function(t){var e=t.length,n=t.indexOf(":",9)+1,i=t.substring(0,n).trim(),r=t.substring(n,e-1).trim();switch(t.charCodeAt(9)*ot){case 0:break;case q:if(110!==t.charCodeAt(10))break;default:var o=r.split((r="",s)),a=0;for(n=0,e=o.length;a64&&p<90||p>96&&p<123||95===p||p===q&&c.charCodeAt(1)!==q))switch(isNaN(parseFloat(c))+(-1!==c.indexOf("("))){case 1:switch(c){case"infinite":case"alternate":case"backwards":case"running":case"normal":case"forwards":case"both":case"none":case"linear":case"ease":case"ease-in":case"ease-out":case"ease-in-out":case"paused":case"reverse":case"alternate-reverse":case"inherit":case"initial":case"unset":case"step-start":case"step-end":break;default:c+=at}}u[n++]=c}r+=(0===a?"":",")+u.join(" ")}}return r=i+r+";",1===G||2===G&&ft(r,1)?N+r+r:r}(p);if(0===G||2===G&&!ft(p,1))return p;switch(h){case 1015:return 97===p.charCodeAt(10)?N+p+p:p;case 951:return 116===p.charCodeAt(3)?N+p+p:p;case 963:return 110===p.charCodeAt(5)?N+p+p:p;case 1009:if(100!==p.charCodeAt(4))break;case 969:case 942:return N+p+p;case 978:return N+p+z+p+p;case 1019:case 983:return N+p+z+p+j+p+p;case 883:return p.charCodeAt(8)===q?N+p+p:p.indexOf("image-set(",11)>0?p.replace(O,"$1"+N+"$2")+p:p;case 932:if(p.charCodeAt(4)===q)switch(p.charCodeAt(5)){case 103:return N+"box-"+p.replace("-grow","")+N+p+j+p.replace("grow","positive")+p;case 115:return N+p+j+p.replace("shrink","negative")+p;case 98:return N+p+j+p.replace("basis","preferred-size")+p}return N+p+j+p+p;case 964:return N+p+j+"flex-"+p+p;case 1023:if(99!==p.charCodeAt(8))break;return c=p.substring(p.indexOf(":",15)).replace("flex-","").replace("space-between","justify"),N+"box-pack"+c+N+p+j+"flex-pack"+c+p;case 1005:return o.test(p)?p.replace(r,":"+N)+p.replace(r,":"+z)+p:p;case 1e3:switch(u=(c=p.substring(13).trim()).indexOf("-")+1,c.charCodeAt(0)+c.charCodeAt(u)){case 226:c=p.replace(w,"tb");break;case 232:c=p.replace(w,"tb-rl");break;case 220:c=p.replace(w,"lr");break;default:return p}return N+p+j+c+p;case 1017:if(-1===p.indexOf("sticky",9))return p;case 975:switch(u=(p=t).length-10,h=(c=(33===p.charCodeAt(u)?p.substring(0,u):p).substring(t.indexOf(":",7)+1).trim()).charCodeAt(0)+(0|c.charCodeAt(7))){case 203:if(c.charCodeAt(8)<111)break;case 115:p=p.replace(c,N+c)+";"+p;break;case 207:case 102:p=p.replace(c,N+(h>102?"inline-":"")+"box")+";"+p.replace(c,N+c)+";"+p.replace(c,j+c+"box")+";"+p}return p+";";case 938:if(p.charCodeAt(5)===q)switch(p.charCodeAt(6)){case 105:return c=p.replace("-items",""),N+p+N+"box-"+c+j+"flex-"+c+p;case 115:return N+p+j+"flex-item-"+p.replace(x,"")+p;default:return N+p+j+"flex-line-pack"+p.replace("align-content","").replace(x,"")+p}break;case 973:case 989:if(p.charCodeAt(3)!==q||122===p.charCodeAt(4))break;case 931:case 953:if(!0===C.test(t))return 115===(c=t.substring(t.indexOf(":")+1)).charCodeAt(0)?ht(t.replace("stretch","fill-available"),e,n,i).replace(":fill-available",":stretch"):p.replace(c,N+c)+p.replace(c,z+c.replace("fill-",""))+p;break;case 962:if(p=N+p+(102===p.charCodeAt(5)?j+p:"")+p,n+i===211&&105===p.charCodeAt(13)&&p.indexOf("transform",10)>0)return p.substring(0,p.indexOf(";",27)+1).replace(a,"$1"+N+"$2")+p}return p}function ft(t,e){var n=t.indexOf(1===e?":":"{"),i=t.substring(0,3!==e?n:10),r=t.substring(n+1,t.length-1);return it(2!==e?i:i.replace(E,"$1"),r,e)}function dt(t,e){var n=ht(e,e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2));return n!==e+";"?n.replace(S," or ($1)").substring(4):"("+e+")"}function _t(t,e,n,i,r,o,a,s,l,c){for(var u,p=0,h=e;p0&&(at=r.replace(f,91===o?"":"-")),o=1,1===Y?lt=r:st=r;var a,s=[lt];nt>0&&void 0!==(a=_t(-1,n,s,s,K,V,0,0,0,0))&&"string"==typeof a&&(n=a);var l=ct(tt,s,n,0,0);return nt>0&&void 0!==(a=_t(-2,l,s,s,K,V,l.length,0,0,0))&&"string"!=typeof(l=a)&&(o=0),at="",lt="",st="",W=0,K=1,V=1,Z*o==0?l:l.replace(i,"").replace(m,"").replace(v,"$1").replace($,"$1").replace(g," ")}return vt.use=function t(e){switch(e){case void 0:case null:nt=et.length=0;break;default:if("function"==typeof e)et[nt++]=e;else if("object"==typeof e)for(var n=0,i=e.length;n=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function d(t,e){if(l.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return q(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(t).length;default:if(i)return q(t).length;e=(""+e).toLowerCase(),i=!0}}function _(t,e,n){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return N(this,e,n);case"utf8":case"utf-8":return E(this,e,n);case"ascii":return C(this,e,n);case"latin1":case"binary":return O(this,e,n);case"base64":return x(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function y(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function m(t,e,n,i,r){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(r)return-1;n=t.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof e&&(e=l.from(e,i)),l.isBuffer(e))return 0===e.length?-1:v(t,e,n,i,r);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,i,r);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,i,r){var o,a=1,s=t.length,l=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;a=2,s/=2,l/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(r){var u=-1;for(o=n;os&&(n=s-l),o=n;o>=0;o--){for(var p=!0,h=0;hr&&(i=r):i=r;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var a=0;a>8,r=n%256,o.push(r),o.push(i);return o}(e,t.length-n),t,n,i)}function x(t,e,n){return 0===e&&n===t.length?i.fromByteArray(t):i.fromByteArray(t.slice(e,n))}function E(t,e,n){n=Math.min(t.length,n);for(var i=[],r=e;r239?4:c>223?3:c>191?2:1;if(r+p<=n)switch(p){case 1:c<128&&(u=c);break;case 2:128==(192&(o=t[r+1]))&&(l=(31&c)<<6|63&o)>127&&(u=l);break;case 3:o=t[r+1],a=t[r+2],128==(192&o)&&128==(192&a)&&(l=(15&c)<<12|(63&o)<<6|63&a)>2047&&(l<55296||l>57343)&&(u=l);break;case 4:o=t[r+1],a=t[r+2],s=t[r+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(l=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(u=l)}null===u?(u=65533,p=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u),r+=p}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var n="",i=0;for(;i0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},l.prototype.compare=function(t,e,n,i,r){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===r&&(r=this.length),e<0||n>t.length||i<0||r>this.length)throw new RangeError("out of range index");if(i>=r&&e>=n)return 0;if(i>=r)return-1;if(e>=n)return 1;if(this===t)return 0;for(var o=(r>>>=0)-(i>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(o,a),c=this.slice(i,r),u=t.slice(e,n),p=0;pr)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return $(this,t,e,n);case"utf8":case"utf-8":return g(this,t,e,n);case"ascii":return b(this,t,e,n);case"latin1":case"binary":return w(this,t,e,n);case"base64":return k(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function C(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;ri)&&(n=i);for(var r="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function T(t,e,n,i,r,o){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>r||et.length)throw new RangeError("Index out of range")}function P(t,e,n,i){e<0&&(e=65535+e+1);for(var r=0,o=Math.min(t.length-n,2);r>>8*(i?r:1-r)}function R(t,e,n,i){e<0&&(e=4294967295+e+1);for(var r=0,o=Math.min(t.length-n,4);r>>8*(i?r:3-r)&255}function A(t,e,n,i,r,o){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function I(t,e,n,i,o){return o||A(t,0,n,4),r.write(t,e,n,i,23,4),n+4}function M(t,e,n,i,o){return o||A(t,0,n,8),r.write(t,e,n,i,52,8),n+8}l.prototype.slice=function(t,e){var n,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e0&&(r*=256);)i+=this[t+--e]*r;return i},l.prototype.readUInt8=function(t,e){return e||j(t,1,this.length),this[t]},l.prototype.readUInt16LE=function(t,e){return e||j(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function(t,e){return e||j(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function(t,e){return e||j(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function(t,e){return e||j(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||j(t,e,this.length);for(var i=this[t],r=1,o=0;++o=(r*=128)&&(i-=Math.pow(2,8*e)),i},l.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||j(t,e,this.length);for(var i=e,r=1,o=this[t+--i];i>0&&(r*=256);)o+=this[t+--i]*r;return o>=(r*=128)&&(o-=Math.pow(2,8*e)),o},l.prototype.readInt8=function(t,e){return e||j(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){e||j(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(t,e){e||j(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(t,e){return e||j(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return e||j(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return e||j(t,4,this.length),r.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return e||j(t,4,this.length),r.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return e||j(t,8,this.length),r.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return e||j(t,8,this.length),r.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function(t,e,n,i){(t=+t,e|=0,n|=0,i)||T(this,t,e,n,Math.pow(2,8*n)-1,0);var r=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+r]=t/o&255;return e+n},l.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},l.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):R(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):R(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);T(this,t,e,n,r-1,-r)}var o=0,a=1,s=0;for(this[e]=255&t;++o>0)-s&255;return e+n},l.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);T(this,t,e,n,r-1,-r)}var o=n-1,a=1,s=0;for(this[e+o]=255&t;--o>=0&&(a*=256);)t<0&&0===s&&0!==this[e+o+1]&&(s=1),this[e+o]=(t/a>>0)-s&255;return e+n},l.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):P(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):P(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):R(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||T(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):R(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,n){return I(this,t,e,!0,n)},l.prototype.writeFloatBE=function(t,e,n){return I(this,t,e,!1,n)},l.prototype.writeDoubleLE=function(t,e,n){return M(this,t,e,!0,n)},l.prototype.writeDoubleBE=function(t,e,n){return M(this,t,e,!1,n)},l.prototype.copy=function(t,e,n,i){if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e=0;--r)t[r+e]=this[r+n];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(r=0;r>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(a+1===i){(e-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(t){return i.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(L,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function U(t,e,n,i){for(var r=0;r=e.length||r>=t.length);++r)e[r+n]=t[r];return r}}).call(this,n(7))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(i){var r,o,a;o=[e,n(1)],void 0===(a="function"==typeof(r=function(t,e){"use strict";var n,r=Object,o=e.throwCCE,a=e.Kind.CLASS,s=e.kotlin.coroutines.Continuation,l=(e.kotlin.Annotation,e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED),c=e.kotlin.coroutines.CoroutineImpl,u=e.kotlin.collections.emptyList_287e2$,p=e.kotlin.Unit,h=e.throwUPAE,f=e.kotlin.collections.copyToArray,d=Array,_=e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,y=e.kotlin.collections.ArrayList_init_ww73n8$,m=e.kotlin.Result,v=e.kotlin.coroutines,$=e.kotlin.coroutines.intrinsics.createCoroutineUnintercepted_3a617i$,g=e.kotlin.coroutines.ContinuationInterceptor,b=e.equals,w=e.defineInlineFunction,k=e.wrapFunction,S=e.kotlin.IllegalStateException_init_pdl1vj$,x=e.Kind.INTERFACE,E=Error,C=e.toString,O=e.Kind.OBJECT,N=e.kotlin.createFailure_tcv7n7$,z=e.kotlin.coroutines.AbstractCoroutineContextKey,j=e.kotlin.coroutines.AbstractCoroutineContextElement,T=e.kotlin.RuntimeException,P=e.kotlin.coroutines.CoroutineContext.Key,R=e.kotlin.coroutines.CoroutineContext.Element,A=e.kotlin.coroutines.startCoroutine_x18nsh$,I=e.kotlin.coroutines.startCoroutine_3a617i$,M=e.kotlin.Enum,L=e.throwISE,D=e.Long.MAX_VALUE,q=(e.kotlin.time.Duration,e.Long.ONE),F=e.Long.ZERO,U=new e.Long(0,1),B=(e.Long.fromInt(1e6),new e.Long(2077252342,2147),new e.Long(-1,1073741823),e.ensureNotNull),H=(e.kotlin.Comparable,e.kotlin.IllegalArgumentException_init_pdl1vj$),V=e.kotlin.Error,K=e.kotlin.IllegalStateException,W=e.kotlin.sequences.sequence_o0x0bg$,Y=e.kotlin.collections.ArrayList,G=e.kotlin.text.StringBuilder_init,J=e.kotlin.UnsupportedOperationException,Z=e.kotlin.UnsupportedOperationException_init_pdl1vj$,Q=(e.kotlin.sequences.emptySequence_287e2$,e.kotlin.addSuppressed_oh0dqn$),X=Function,tt=e.kotlin.ranges.coerceAtMost_2p08ub$,et=e.kotlin.collections.fill_jfbbbd$,nt=Math,it=e.kotlin.NoSuchElementException,rt=e.hashCode,ot=(e.kotlin.collections.IndexedValue,e.kotlin.IndexOutOfBoundsException),at=(e.kotlin.collections.LinkedHashMap_init_q3lmfv$,e.kotlin.collections.ArrayList_init_287e2$),st=(e.kotlin.collections.HashSet_init_287e2$,e.kotlin.collections.LinkedHashSet_init_287e2$),lt=(e.kotlin.Pair,e.kotlin.to_ujzrz7$,e.kotlin.collections.indexOf_mjy6jw$),ct=e.kotlin.collections.arrayCopy,ut=e.kotlin.text.trimIndent_pdl1vz$,pt=e.Long.NEG_ONE,ht=e.kotlin.ranges.until_2p08ub$,ft=e.kotlin.collections.copyOf_8ujjk8$,dt=e.kotlin.collections.joinToString_fmv235$,_t=e.kotlin.collections.listOf_mh5how$,yt=(e.toByte,e.kotlin.ranges.coerceAtLeast_dqglrj$,e.kotlin.ArithmeticException,new e.Long(0,805306368),e.Long.fromInt(1073741823),new e.Long(-1073741824,268435455),new e.Long(0,268435456),new e.Long(0,536870912),e.kotlin.text.toLongOrNull_pdl1vz$,e.kotlin.coroutines.intrinsics.createCoroutineUnintercepted_x18nsh$),mt=e.kotlin.collections.shuffle_vvxzk3$,vt=e.Long.fromInt(2147483647),$t=e.kotlin.ranges.coerceIn_ekzx8g$,gt=e.kotlin.collections.HashSet_init_ww73n8$,bt=e.kotlin.collections.get_lastIndex_55thoc$,wt=e.kotlin.NoSuchElementException_init,kt=e.kotlin.collections.MutableIterator,St=e.kotlin.collections.AbstractMutableList,xt=e.kotlin.UnsupportedOperationException_init;function Et(t,e){void 0===e&&(e=!0),$n.call(this,e),this.parentContext=t,this.context_p8rm81$_0=this.parentContext.plus_1fupul$(this)}function Ct(t,e){c.call(this,e),this.exceptionState_0=1,this.local$$receiver=t}function Ot(t){this.deferreds_0=t,this.notCompletedCount_0=this.deferreds_0.length}function Nt(t,e){this.$outer=t,Gt.call(this),this.nodes_0=e}function zt(t,e){this.$outer=t,jn.call(this),this.continuation_0=e,this.handle_45x73s$_0=this.handle_45x73s$_0,this._disposer_0=null}function jt(t,e,n,i){void 0===e&&(e=v.EmptyCoroutineContext),void 0===n&&(n=Ae());var r=As(t,e),o=n.isLazy?new It(r,i):new At(r,!0);return o.start_b5ul0p$(n,o,i),o}function Tt(t,e){Et.call(this,t,e)}function Pt(t,e){c.call(this,e),this.exceptionState_0=1,this.$this=t}function Rt(t,e){Tt.call(this,t,!1),this.continuation_0=$(e,this,this)}function At(t,e){Et.call(this,t,e)}function It(t,e){At.call(this,t,!1),this.continuation_0=$(e,this,this)}function Mt(t,e){Va.call(this,t,e),this._decision_0=0}function Lt(){}function Dt(t){var n,i;return e.isType(t,Pa)?null==(i=null!=(n=t.claimReusableCancellableContinuation())&&n.resetStateReusable_8be2vx$()?n:null)?new Ht(t,2):i:new Ht(t,2)}function qt(t,e){t.invokeOnCancellation_f05bi3$(new Ut(e))}function Ft(t,e){t.invokeOnCancellation_f05bi3$(new Bt(e))}function Ut(t){Jt.call(this),this.node_0=t}function Bt(t){Gt.call(this),this.handle_0=t}function Ht(t,e){Ma.call(this,e),this.delegate_dhbmku$_0=t,this.context_xycjfy$_0=this.delegate.context,this._decision_0=0,this._state_0=Yt(),this._parentHandle_0=null}function Vt(){}function Kt(){Wt=this}Et.prototype=Object.create($n.prototype),Et.prototype.constructor=Et,Gt.prototype=Object.create(js.prototype),Gt.prototype.constructor=Gt,Nt.prototype=Object.create(Gt.prototype),Nt.prototype.constructor=Nt,zs.prototype=Object.create(Ol.prototype),zs.prototype.constructor=zs,jn.prototype=Object.create(zs.prototype),jn.prototype.constructor=jn,zt.prototype=Object.create(jn.prototype),zt.prototype.constructor=zt,Tt.prototype=Object.create(Et.prototype),Tt.prototype.constructor=Tt,Rt.prototype=Object.create(Tt.prototype),Rt.prototype.constructor=Rt,At.prototype=Object.create(Et.prototype),At.prototype.constructor=At,It.prototype=Object.create(At.prototype),It.prototype.constructor=It,Va.prototype=Object.create(Et.prototype),Va.prototype.constructor=Va,Mt.prototype=Object.create(Va.prototype),Mt.prototype.constructor=Mt,Jt.prototype=Object.create(Gt.prototype),Jt.prototype.constructor=Jt,Ut.prototype=Object.create(Jt.prototype),Ut.prototype.constructor=Ut,Bt.prototype=Object.create(Gt.prototype),Bt.prototype.constructor=Bt,Ma.prototype=Object.create(_l.prototype),Ma.prototype.constructor=Ma,Ht.prototype=Object.create(Ma.prototype),Ht.prototype.constructor=Ht,Zt.prototype=Object.create(Gt.prototype),Zt.prototype.constructor=Zt,te.prototype=Object.create($n.prototype),te.prototype.constructor=te,le.prototype=Object.create(se.prototype),le.prototype.constructor=le,ue.prototype=Object.create(z.prototype),ue.prototype.constructor=ue,ce.prototype=Object.create(j.prototype),ce.prototype.constructor=ce,ge.prototype=Object.create(j.prototype),ge.prototype.constructor=ge,Pe.prototype=Object.create(M.prototype),Pe.prototype.constructor=Pe,He.prototype=Object.create(ce.prototype),He.prototype.constructor=He,Gs.prototype=Object.create(He.prototype),Gs.prototype.constructor=Gs,Ye.prototype=Object.create(Gs.prototype),Ge.prototype=Object.create(T.prototype),Ge.prototype.constructor=Ge,Je.prototype=Object.create(V.prototype),Je.prototype.constructor=Je,kn.prototype=Object.create(jn.prototype),kn.prototype.constructor=kn,Sn.prototype=Object.create(Ht.prototype),Sn.prototype.constructor=Sn,Nn.prototype=Object.create($n.prototype),Nn.prototype.constructor=Nn,Pl.prototype=Object.create(Ol.prototype),Pl.prototype.constructor=Pl,Tn.prototype=Object.create(Pl.prototype),Tn.prototype.constructor=Tn,Rn.prototype=Object.create(jn.prototype),Rn.prototype.constructor=Rn,An.prototype=Object.create(jn.prototype),An.prototype.constructor=An,In.prototype=Object.create(jn.prototype),In.prototype.constructor=In,Mn.prototype=Object.create(jn.prototype),Mn.prototype.constructor=Mn,Ln.prototype=Object.create(jn.prototype),Ln.prototype.constructor=Ln,Dn.prototype=Object.create(jn.prototype),Dn.prototype.constructor=Dn,qn.prototype=Object.create(Dn.prototype),qn.prototype.constructor=qn,Fn.prototype=Object.create(Dn.prototype),Fn.prototype.constructor=Fn,Un.prototype=Object.create(Dn.prototype),Un.prototype.constructor=Un,Bn.prototype=Object.create(ce.prototype),Bn.prototype.constructor=Bn,Hn.prototype=Object.create(j.prototype),Vn.prototype=Object.create(Nn.prototype),Vn.prototype.constructor=Vn,Zs.prototype=Object.create(K.prototype),Zs.prototype.constructor=Zs,Kn.prototype=Object.create(Zs.prototype),Kn.prototype.constructor=Kn,Wn.prototype=Object.create(ce.prototype),Wn.prototype.constructor=Wn,jl.prototype=Object.create(Ta.prototype),jl.prototype.constructor=jl,Nl.prototype=Object.create(jl.prototype),Nl.prototype.constructor=Nl,hi.prototype=Object.create(Nl.prototype),hi.prototype.constructor=hi,zl.prototype=Object.create(jl.prototype),zl.prototype.constructor=zl,di.prototype=Object.create(zl.prototype),di.prototype.constructor=di,zi.prototype=Object.create(Ol.prototype),zi.prototype.constructor=zi,yi.prototype=Object.create(zi.prototype),yi.prototype.constructor=yi,mi.prototype=Object.create(zi.prototype),mi.prototype.constructor=mi,gi.prototype=Object.create(zl.prototype),gi.prototype.constructor=gi,Si.prototype=Object.create(Jt.prototype),Si.prototype.constructor=Si,Ai.prototype=Object.create(Ol.prototype),Ai.prototype.constructor=Ai,Ei.prototype=Object.create(Ai.prototype),Ei.prototype.constructor=Ei,Ci.prototype=Object.create(Ei.prototype),Ci.prototype.constructor=Ci,Oi.prototype=Object.create(Ai.prototype),Oi.prototype.constructor=Oi,Ni.prototype=Object.create(Ai.prototype),Ni.prototype.constructor=Ni,vi.prototype=Object.create(pi.prototype),vi.prototype.constructor=vi,Ti.prototype=Object.create(zi.prototype),Ti.prototype.constructor=Ti,Pi.prototype=Object.create(Ti.prototype),Pi.prototype.constructor=Pi,Ri.prototype=Object.create(zi.prototype),Ri.prototype.constructor=Ri,Mi.prototype=Object.create(vi.prototype),Mi.prototype.constructor=Mi,Ii.prototype=Object.create(pi.prototype),Ii.prototype.constructor=Ii,Li.prototype=Object.create(vi.prototype),Li.prototype.constructor=Li,qi.prototype=Object.create(Et.prototype),qi.prototype.constructor=qi,Fi.prototype=Object.create(qi.prototype),Fi.prototype.constructor=Fi,Hi.prototype=Object.create(M.prototype),Hi.prototype.constructor=Hi,ur.prototype=Object.create(K.prototype),ur.prototype.constructor=ur,pr.prototype=Object.create(it.prototype),pr.prototype.constructor=pr,hr.prototype=Object.create(Et.prototype),hr.prototype.constructor=hr,Er.prototype=Object.create(vi.prototype),Er.prototype.constructor=Er,xr.prototype=Object.create(Er.prototype),xr.prototype.constructor=xr,Cr.prototype=Object.create(vi.prototype),Cr.prototype.constructor=Cr,Rr.prototype=Object.create(hr.prototype),Rr.prototype.constructor=Rr,Ar.prototype=Object.create(vi.prototype),Ar.prototype.constructor=Ar,Ir.prototype=Object.create(Hr.prototype),Ir.prototype.constructor=Ir,Lr.prototype=Object.create(yo.prototype),Lr.prototype.constructor=Lr,Dr.prototype=Object.create(Lr.prototype),Dr.prototype.constructor=Dr,Jr.prototype=Object.create(ho.prototype),Jr.prototype.constructor=Jr,Zr.prototype=Object.create(fo.prototype),Zr.prototype.constructor=Zr,so.prototype=Object.create(ho.prototype),so.prototype.constructor=so,lo.prototype=Object.create(fo.prototype),lo.prototype.constructor=lo,$o.prototype=Object.create(yo.prototype),$o.prototype.constructor=$o,wo.prototype=Object.create($o.prototype),wo.prototype.constructor=wo,Oo.prototype=Object.create(Va.prototype),Oo.prototype.constructor=Oo,zo.prototype=Object.create($o.prototype),zo.prototype.constructor=zo,ja.prototype=Object.create(za.prototype),ja.prototype.constructor=ja,Pa.prototype=Object.create(Ma.prototype),Pa.prototype.constructor=Pa,Ha.prototype=Object.create(T.prototype),Ha.prototype.constructor=Ha,hs.prototype=Object.create(Dn.prototype),hs.prototype.constructor=hs,fs.prototype=Object.create(za.prototype),fs.prototype.constructor=fs,ds.prototype=Object.create(ja.prototype),ds.prototype.constructor=ds,_s.prototype=Object.create(Ol.prototype),_s.prototype.constructor=_s,ps.prototype=Object.create(Pl.prototype),ps.prototype.constructor=ps,Ss.prototype=Object.create(za.prototype),Ss.prototype.constructor=Ss,ks.prototype=Object.create(Ta.prototype),ks.prototype.constructor=ks,xs.prototype=Object.create(Pl.prototype),xs.prototype.constructor=xs,Es.prototype=Object.create(Ol.prototype),Es.prototype.constructor=Es,Cs.prototype=Object.create(Es.prototype),Cs.prototype.constructor=Cs,Os.prototype=Object.create(Es.prototype),Os.prototype.constructor=Os,Ns.prototype=Object.create(ja.prototype),Ns.prototype.constructor=Ns,Ls.prototype=Object.create(Va.prototype),Ls.prototype.constructor=Ls,Ks.prototype=Object.create(Bn.prototype),Ks.prototype.constructor=Ks,Ys.prototype=Object.create(He.prototype),Ys.prototype.constructor=Ys,Xs.prototype=Object.create(Zs.prototype),Xs.prototype.constructor=Xs,fl.prototype=Object.create(Na.prototype),fl.prototype.constructor=fl,nl.prototype=Object.create(fl.prototype),nl.prototype.constructor=nl,el.prototype=Object.create(ce.prototype),el.prototype.constructor=el,il.prototype=Object.create(el.prototype),il.prototype.constructor=il,al.prototype=Object.create(el.prototype),al.prototype.constructor=al,cl.prototype=Object.create(Gt.prototype),cl.prototype.constructor=cl,ul.prototype=Object.create(ce.prototype),ul.prototype.constructor=ul,hl.prototype=Object.create(fl.prototype),hl.prototype.constructor=hl,vl.prototype=Object.create(Zs.prototype),vl.prototype.constructor=vl,$l.prototype=Object.create(Zs.prototype),$l.prototype.constructor=$l,El.prototype=Object.create(St.prototype),El.prototype.constructor=El,Tl.prototype=Object.create(za.prototype),Tl.prototype.constructor=Tl,Object.defineProperty(Et.prototype,"context",{configurable:!0,get:function(){return this.context_p8rm81$_0}}),Object.defineProperty(Et.prototype,"coroutineContext",{configurable:!0,get:function(){return this.context}}),Object.defineProperty(Et.prototype,"isActive",{configurable:!0,get:function(){return e.callGetter(this,$n.prototype,"isActive")}}),Et.prototype.initParentJob_8be2vx$=function(){this.initParentJobInternal_8vd9i7$(this.parentContext.get_j3r2sn$(tn()))},Et.prototype.onStart=function(){},Et.prototype.onStartInternal=function(){this.onStart()},Et.prototype.onCompleted_11rb$=function(t){},Et.prototype.onCancelled_z1nxw$=function(t,e){},Et.prototype.cancellationExceptionMessage=function(){return Fs(this)+" was cancelled"},Et.prototype.onCompletionInternal_s8jyv4$=function(t){var n;e.isType(t,se)?this.onCancelled_z1nxw$(t.cause,t.handled):this.onCompleted_11rb$(null==(n=t)||e.isType(n,r)?n:o())},Et.prototype.resumeWith_tl1gpc$=function(t){var e=this.makeCompletingOnce_8ea4ql$(ie(t));e!==pn&&this.afterResume_s8jyv4$(e)},Et.prototype.afterResume_s8jyv4$=function(t){this.afterCompletion_s8jyv4$(t)},Et.prototype.handleOnCompletionException_tcv7n7$=function(t){de(this.context,t)},Et.prototype.nameString=function(){var t;return this.context,null==(t=null)?$n.prototype.nameString.call(this):'"'+t+'":'+$n.prototype.nameString.call(this)},Et.prototype.start_cfq2d3$=function(t,e){this.initParentJob_8be2vx$(),t.invoke_810yno$(e,this)},Et.prototype.start_b5ul0p$=function(t,e,n){this.initParentJob_8be2vx$(),t.invoke_3o0yor$(n,e,this)},Et.$metadata$={kind:a,simpleName:"AbstractCoroutine",interfaces:[Se,s,$n,Ze]},Ct.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Ct.prototype=Object.create(c.prototype),Ct.prototype.constructor=Ct,Ct.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$$receiver.isEmpty())return u();if(this.state_0=2,this.result_0=new Ot(f(this.local$$receiver)).await(this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.result_0;case 3:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ot.prototype.await=function(t){return(n=this,e=function(t){var e,i=n.deferreds_0.length,r=d(i);e=r.length-1|0;for(var o=0;o<=e;o++){var a=n,s=a.deferreds_0[o];s.start();var l=new zt(a,t);l.handle=s.invokeOnCompletion_f05bi3$(l),r[o]=l}var c,u=r,h=new Nt(n,u);for(c=0;c!==u.length;++c)u[c].disposer=h;return t.isCompleted?h.disposeAll():t.invokeOnCancellation_f05bi3$(h),p},function(t){var n=new Ht(_(t),1);return n.initCancellability(),e(n),n.getResult()})(t);var e,n},Nt.prototype.disposeAll=function(){var t,e=this.nodes_0;for(t=0;t!==e.length;++t)e[t].handle.dispose()},Nt.prototype.invoke=function(t){this.disposeAll()},Nt.prototype.toString=function(){return"DisposeHandlersOnCancel["+this.nodes_0+"]"},Nt.$metadata$={kind:a,simpleName:"DisposeHandlersOnCancel",interfaces:[Gt]},Object.defineProperty(zt.prototype,"handle",{configurable:!0,get:function(){return null==this.handle_45x73s$_0?h("handle"):this.handle_45x73s$_0},set:function(t){this.handle_45x73s$_0=t}}),Object.defineProperty(zt.prototype,"disposer",{configurable:!0,get:function(){return this._disposer_0},set:function(t){this._disposer_0=t}}),zt.prototype.invoke=function(t){var e;if(null!=t){var n=this.continuation_0.tryResumeWithException_tcv7n7$(t);null!=n&&(this.continuation_0.completeResume_za3rmp$(n),null!=(e=this.disposer)&&e.disposeAll())}else if(0==--this.$outer.notCompletedCount_0){var i,r=this.continuation_0,o=this.$outer.deferreds_0,a=y(o.length);for(i=0;i!==o.length;++i){var s=o[i];a.add_11rb$(s.getCompleted())}r.resumeWith_tl1gpc$(new m(a))}},zt.$metadata$={kind:a,simpleName:"AwaitAllNode",interfaces:[jn]},Ot.$metadata$={kind:a,simpleName:"AwaitAll",interfaces:[]},Tt.prototype.getCompleted=function(){var t;return null==(t=this.getCompletedInternal_8be2vx$())||e.isType(t,r)?t:o()},Pt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Pt.prototype=Object.create(c.prototype),Pt.prototype.constructor=Pt,Pt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.awaitInternal_8be2vx$(this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return null==(t=this.result_0)||e.isType(t,r)?t:o();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Tt.prototype.await=function(t,e){var n=new Pt(this,t);return e?n:n.doResume(null)},Object.defineProperty(Tt.prototype,"onAwait",{configurable:!0,get:function(){return this}}),Tt.prototype.registerSelectClause1_o3xas4$=function(t,e){this.registerSelectClause1Internal_u6kgbh$(t,e)},Tt.$metadata$={kind:a,simpleName:"DeferredCoroutine",interfaces:[ss,qe,Et]},Rt.prototype.onStart=function(){Qa(this.continuation_0,this)},Rt.$metadata$={kind:a,simpleName:"LazyDeferredCoroutine",interfaces:[Tt]},w("kotlinx-coroutines-core.kotlinx.coroutines.invoke_5xrhu2$",k((function(){var n=t.kotlinx.coroutines.withContext_i5cbzn$;return function(t,i,r){return e.suspendCall(n(t,i,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),At.prototype.handleJobException_tcv7n7$=function(t){return de(this.context,t),!0},At.$metadata$={kind:a,simpleName:"StandaloneCoroutine",interfaces:[Et]},It.prototype.onStart=function(){Qa(this.continuation_0,this)},It.$metadata$={kind:a,simpleName:"LazyStandaloneCoroutine",interfaces:[At]},Mt.prototype.trySuspend_0=function(){var t;for(this._decision_0;;)switch(this._decision_0){case 0:if(0===(t=this)._decision_0&&(t._decision_0=1,1))return!0;break;case 2:return!1;default:throw S("Already suspended".toString())}},Mt.prototype.tryResume_0=function(){var t;for(this._decision_0;;)switch(this._decision_0){case 0:if(0===(t=this)._decision_0&&(t._decision_0=2,1))return!0;break;case 1:return!1;default:throw S("Already resumed".toString())}},Mt.prototype.afterCompletion_s8jyv4$=function(t){this.afterResume_s8jyv4$(t)},Mt.prototype.afterResume_s8jyv4$=function(t){this.tryResume_0()||Ra(_(this.uCont),oe(t,this.uCont))},Mt.prototype.getResult=function(){var t;if(this.trySuspend_0())return l;var n=Cn(this.state_8be2vx$);if(e.isType(n,se))throw n.cause;return null==(t=n)||e.isType(t,r)?t:o()},Mt.$metadata$={kind:a,simpleName:"DispatchedCoroutine",interfaces:[Va]},Lt.prototype.tryResume_19pj23$=function(t,e,n){return void 0===e&&(e=null),n?n(t,e):this.tryResume_19pj23$$default(t,e)},Lt.prototype.cancel_dbl4no$=function(t,e){return void 0===t&&(t=null),e?e(t):this.cancel_dbl4no$$default(t)},Lt.$metadata$={kind:x,simpleName:"CancellableContinuation",interfaces:[s]},w("kotlinx-coroutines-core.kotlinx.coroutines.suspendCancellableCoroutine_o6sdx9$",k((function(){var n=e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,i=t.kotlinx.coroutines.CancellableContinuationImpl;return function(t,r){var o;return e.suspendCall((o=t,function(t){var e=new i(n(t),1);return e.initCancellability(),o(e),e.getResult()})(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.suspendCancellableCoroutineReusable_mkkzkw$",k((function(){var n=e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,i=t.kotlinx.coroutines.getOrCreateCancellableContinuation_3j0xf1$;return function(t,r){var o;return e.suspendCall((o=t,function(t){var e=i(n(t));return o(e),e.getResult()})(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),Ut.prototype.invoke=function(t){this.node_0.remove()},Ut.prototype.toString=function(){return"RemoveOnCancel["+this.node_0+"]"},Ut.$metadata$={kind:a,simpleName:"RemoveOnCancel",interfaces:[Jt]},Bt.prototype.invoke=function(t){this.handle_0.dispose()},Bt.prototype.toString=function(){return"DisposeOnCancel["+this.handle_0+"]"},Bt.$metadata$={kind:a,simpleName:"DisposeOnCancel",interfaces:[Gt]},Object.defineProperty(Ht.prototype,"delegate",{get:function(){return this.delegate_dhbmku$_0}}),Object.defineProperty(Ht.prototype,"context",{configurable:!0,get:function(){return this.context_xycjfy$_0}}),Object.defineProperty(Ht.prototype,"parentHandle_0",{configurable:!0,get:function(){return this._parentHandle_0},set:function(t){this._parentHandle_0=t}}),Object.defineProperty(Ht.prototype,"state_8be2vx$",{configurable:!0,get:function(){return this._state_0}}),Object.defineProperty(Ht.prototype,"isActive",{configurable:!0,get:function(){return e.isType(this.state_8be2vx$,Vt)}}),Object.defineProperty(Ht.prototype,"isCompleted",{configurable:!0,get:function(){return!e.isType(this.state_8be2vx$,Vt)}}),Object.defineProperty(Ht.prototype,"isCancelled",{configurable:!0,get:function(){return e.isType(this.state_8be2vx$,le)}}),Object.defineProperty(Ht.prototype,"stateDebugRepresentation_0",{configurable:!0,get:function(){var t;return t=this.state_8be2vx$,e.isType(t,Vt)?"Active":e.isType(t,le)?"Cancelled":"Completed"}}),Ht.prototype.initCancellability=function(){this.setupCancellation_0()},Ht.prototype.isReusable_0=function(){return e.isType(this.delegate,Pa)&&this.delegate.isReusable_pmw987$(this)},Ht.prototype.resetStateReusable_8be2vx$=function(){var t=this._state_0;return e.isType(t,Qt)&&null!=t.idempotentResume?(this.detachChild_8be2vx$(),!1):(this._decision_0=0,this._state_0=Yt(),!0)},Ht.prototype.setupCancellation_0=function(){var t;if(!this.checkCompleted_0()&&null===this.parentHandle_0&&null!=(t=this.delegate.context.get_j3r2sn$(tn()))){var e=t.invokeOnCompletion_ct2b2z$(!0,void 0,new Un(this));this.parentHandle_0=e,this.isCompleted&&!this.isReusable_0()&&(e.dispose(),this.parentHandle_0=vn())}},Ht.prototype.checkCompleted_0=function(){var t,n,i,r=this.isCompleted;if(!Ia(this.resumeMode))return r;if(null==(n=e.isType(t=this.delegate,Pa)?t:null))return r;if(null==(i=n.checkPostponedCancellation_jp3215$(this)))return r;var o=i;return r||this.cancel_dbl4no$(o),!0},Object.defineProperty(Ht.prototype,"callerFrame",{configurable:!0,get:function(){var t;return e.isType(t=this.delegate,Ml)?t:null}}),Ht.prototype.getStackTraceElement=function(){return null},Ht.prototype.takeState=function(){return this.state_8be2vx$},Ht.prototype.cancelCompletedResult_83a7kv$=function(t,n){var i;for(this._state_0;;){var r=this._state_0;if(e.isType(r,Vt))throw S("Not completed".toString());if(e.isType(r,se))return;if(e.isType(r,Qt)){if(r.cancelled)throw S("Must be called at most once".toString());var o=r.copy_pkdjca$(void 0,void 0,void 0,void 0,n);if((i=this)._state_0===r&&(i._state_0=o,1))return void r.invokeHandlers_gygfbe$(this,n)}else if(function(t){return t._state_0===r&&(t._state_0=new Qt(r,void 0,void 0,void 0,n),!0)}(this))return}},Ht.prototype.cancelLater_0=function(t){var n,i;return!!Ia(this.resumeMode)&&null!=(i=e.isType(n=this.delegate,Pa)?n:null)&&i.postponeCancellation_tcv7n7$(t)},Ht.prototype.cancel_dbl4no$$default=function(t){var n;for(this._state_0;;){var i=this._state_0;t:do{var r,o;if(!e.isType(i,Vt))return!1;var a=new le(this,t,e.isType(i,Gt));if((n=this)._state_0!==i||(n._state_0=a,0))break t;return null!=(o=e.isType(r=i,Gt)?r:null)&&this.callCancelHandler_gluymk$(o,t),this.detachChildIfNonResuable_0(),this.dispatchResume_0(this.resumeMode),!0}while(0)}},Ht.prototype.parentCancelled_8o0b5c$=function(t){this.cancelLater_0(t)||(this.cancel_dbl4no$(t),this.detachChildIfNonResuable_0())},Ht.prototype.callCancelHandlerSafely_0=function(t){try{t()}catch(t){if(!e.isType(t,E))throw t;de(this.context,new Ge("Exception in invokeOnCancellation handler for "+this,t))}},Ht.prototype.callCancelHandler_0=function(t,n){try{Ts(t,n)}catch(t){if(!e.isType(t,E))throw t;de(this.context,new Ge("Exception in invokeOnCancellation handler for "+this,t))}},Ht.prototype.callCancelHandler_gluymk$=function(t,n){try{t.invoke(n)}catch(t){if(!e.isType(t,E))throw t;de(this.context,new Ge("Exception in invokeOnCancellation handler for "+this,t))}},Ht.prototype.callOnCancellation_e590hv$=function(t,n){try{t(n)}catch(t){if(!e.isType(t,E))throw t;de(this.context,new Ge("Exception in resume onCancellation handler for "+this,t))}},Ht.prototype.getContinuationCancellationCause_dqr1mp$=function(t){return t.getCancellationException()},Ht.prototype.trySuspend_0=function(){var t;for(this._decision_0;;)switch(this._decision_0){case 0:if(0===(t=this)._decision_0&&(t._decision_0=1,1))return!0;break;case 2:return!1;default:throw S("Already suspended".toString())}},Ht.prototype.tryResume_0=function(){var t;for(this._decision_0;;)switch(this._decision_0){case 0:if(0===(t=this)._decision_0&&(t._decision_0=2,1))return!0;break;case 1:return!1;default:throw S("Already resumed".toString())}},Ht.prototype.getResult=function(){if(this.setupCancellation_0(),this.trySuspend_0())return l;var t=this.state_8be2vx$;if(e.isType(t,se))throw Rl(t.cause);if(Aa(this.resumeMode)){var n=this.context.get_j3r2sn$(tn());if(null!=n&&!n.isActive){var i=n.getCancellationException();throw this.cancelCompletedResult_83a7kv$(t,i),Rl(i)}}return this.getSuccessfulResult_tpy1pm$(t)},Ht.prototype.resumeWith_tl1gpc$=function(t){this.resumeImpl_0(re(t,this),this.resumeMode)},Ht.prototype.resume_q1ktlu$=function(t,e){this.resumeImpl_0(t,this.resumeMode,e)},Ht.prototype.invokeOnCancellation_f05bi3$=function(t){var n,i=this.makeCancelHandler_0(t);for(this._state_0;;){var r,o,a=this._state_0;if(e.isType(a,Kt)){if((n=this)._state_0===a&&(n._state_0=i,1))return}else if(e.isType(a,Gt))this.multipleHandlersError_0(t,a);else{if(e.isType(a,se))return a.makeHandled()||this.multipleHandlersError_0(t,a),void(e.isType(a,le)&&this.callCancelHandler_0(t,null!=(o=e.isType(r=a,se)?r:null)?o.cause:null));if(e.isType(a,Qt)){if(null!=a.cancelHandler&&this.multipleHandlersError_0(t,a),e.isType(i,Jt))return;if(a.cancelled)return void this.callCancelHandler_0(t,a.cancelCause);var s=a.copy_pkdjca$(void 0,i);if(function(t){return t._state_0===a&&(t._state_0=s,!0)}(this))return}else{if(e.isType(i,Jt))return;var l=new Qt(a,i);if(function(t){return t._state_0===a&&(t._state_0=l,!0)}(this))return}}}},Ht.prototype.multipleHandlersError_0=function(t,e){throw S(("It's prohibited to register multiple handlers, tried to register "+t+", already has "+C(e)).toString())},Ht.prototype.makeCancelHandler_0=function(t){return e.isType(t,Gt)?t:new Zt(t)},Ht.prototype.dispatchResume_0=function(t){this.tryResume_0()||La(this,t)},Ht.prototype.resumedState_0=function(t,n,i,r,o){var a;return e.isType(n,se)||!Aa(i)&&null==o||null==r&&(!e.isType(t,Gt)||e.isType(t,Jt))&&null==o?n:new Qt(n,e.isType(a=t,Gt)?a:null,r,o)},Ht.prototype.resumeImpl_0=function(t,n,i){var r;for(void 0===i&&(i=null),this._state_0;;){var o=this._state_0;t:do{if(e.isType(o,Vt)){var a=this.resumedState_0(o,t,n,i,null);if((r=this)._state_0!==o||(r._state_0=a,0))break t;return this.detachChildIfNonResuable_0(),void this.dispatchResume_0(n)}if(e.isType(o,le)&&o.makeResumed())return void(null!=i&&this.callOnCancellation_e590hv$(i,o.cause));this.alreadyResumedError_0(t)}while(0)}},Ht.prototype.tryResumeImpl_0=function(t,i,r){var o;for(this._state_0;;){var a=this._state_0;t:do{if(e.isType(a,Vt)){var s=this.resumedState_0(a,t,this.resumeMode,r,i);if((o=this)._state_0!==a||(o._state_0=s,0))break t;return this.detachChildIfNonResuable_0(),n}return e.isType(a,Qt)&&null!=i&&a.idempotentResume===i?n:null}while(0)}},Ht.prototype.alreadyResumedError_0=function(t){throw S(("Already resumed, but proposed with update "+C(t)).toString())},Ht.prototype.detachChildIfNonResuable_0=function(){this.isReusable_0()||this.detachChild_8be2vx$()},Ht.prototype.detachChild_8be2vx$=function(){var t=this.parentHandle_0;null!=t&&t.dispose(),this.parentHandle_0=vn()},Ht.prototype.tryResume_19pj23$$default=function(t,e){return this.tryResumeImpl_0(t,e,null)},Ht.prototype.tryResume_i8qury$=function(t,e,n){return this.tryResumeImpl_0(t,e,n)},Ht.prototype.tryResumeWithException_tcv7n7$=function(t){return this.tryResumeImpl_0(new se(t),null,null)},Ht.prototype.completeResume_za3rmp$=function(t){this.dispatchResume_0(this.resumeMode)},Ht.prototype.resumeUndispatched_hyuxa3$=function(t,n){var i,r=e.isType(i=this.delegate,Pa)?i:null;this.resumeImpl_0(n,(null!=r?r.dispatcher:null)===t?4:this.resumeMode)},Ht.prototype.resumeUndispatchedWithException_gd0rtt$=function(t,n){var i,r=e.isType(i=this.delegate,Pa)?i:null;this.resumeImpl_0(new se(n),(null!=r?r.dispatcher:null)===t?4:this.resumeMode)},Ht.prototype.getSuccessfulResult_tpy1pm$=function(t){var n,i;return e.isType(t,Qt)?null==(n=t.result)||e.isType(n,r)?n:o():null==(i=t)||e.isType(i,r)?i:o()},Ht.prototype.getExceptionalResult_s8jyv4$=function(t){var e;return null!=(e=Ma.prototype.getExceptionalResult_s8jyv4$.call(this,t))?Rl(e,this.delegate):null},Ht.prototype.toString=function(){return this.nameString()+"("+Is(this.delegate)+"){"+this.stateDebugRepresentation_0+"}@"+qs(this)},Ht.prototype.nameString=function(){return"CancellableContinuation"},Ht.$metadata$={kind:a,simpleName:"CancellableContinuationImpl",interfaces:[Ml,Lt,Ma]},Vt.$metadata$={kind:x,simpleName:"NotCompleted",interfaces:[]},Kt.prototype.toString=function(){return"Active"},Kt.$metadata$={kind:O,simpleName:"Active",interfaces:[Vt]};var Wt=null;function Yt(){return null===Wt&&new Kt,Wt}function Gt(){js.call(this)}function Jt(){Gt.call(this)}function Zt(t){Gt.call(this),this.handler_0=t}function Qt(t,e,n,i,r){void 0===e&&(e=null),void 0===n&&(n=null),void 0===i&&(i=null),void 0===r&&(r=null),this.result=t,this.cancelHandler=e,this.onCancellation=n,this.idempotentResume=i,this.cancelCause=r}function Xt(){}function te(t){$n.call(this,!0),this.initParentJobInternal_8vd9i7$(t)}function ee(t,e){c.call(this,e),this.exceptionState_0=1,this.$this=t}function ne(){}function ie(t,n){var i,a;void 0===n&&(n=null);var s=t.exceptionOrNull();if(null==s){var l=null==(i=t.value)||e.isType(i,r)?i:o();a=null!=n?new ae(l,n):l}else a=new se(s);return a}function re(t,n){var i,a=t.exceptionOrNull();return null==a?null==(i=t.value)||e.isType(i,r)?i:o():new se(Rl(a))}function oe(t,n){var i;return e.isType(t,se)?new m(N(Rl(t.cause))):(m.Companion,new m(null==(i=t)||e.isType(i,r)?i:o()))}function ae(t,e){this.result=t,this.onCancellation=e}function se(t,e){void 0===e&&(e=!1),this.cause=t,this._handled_0=e}function le(t,e,n){se.call(this,null!=e?e:Qs("Continuation "+t+" was cancelled normally"),n),this._resumed_0=!1}function ce(){fe(),j.call(this,g.Key)}function ue(){he=this,z.call(this,g.Key,pe)}function pe(t){var n;return e.isType(n=t,ce)?n:null}Gt.$metadata$={kind:a,simpleName:"CancelHandler",interfaces:[Vt,js]},Jt.$metadata$={kind:a,simpleName:"BeforeResumeCancelHandler",interfaces:[Gt]},Zt.prototype.invoke=function(t){this.handler_0(t)},Zt.prototype.toString=function(){return"InvokeOnCancel["+Fs(this.handler_0)+"@"+qs(this)+"]"},Zt.$metadata$={kind:a,simpleName:"InvokeOnCancel",interfaces:[Gt]},Object.defineProperty(Qt.prototype,"cancelled",{configurable:!0,get:function(){return null!=this.cancelCause}}),Qt.prototype.invokeHandlers_gygfbe$=function(t,e){var n,i;null!=(n=this.cancelHandler)&&t.callCancelHandler_gluymk$(n,e),null!=(i=this.onCancellation)&&t.callOnCancellation_e590hv$(i,e)},Qt.$metadata$={kind:a,simpleName:"CompletedContinuation",interfaces:[]},Qt.prototype.component1=function(){return this.result},Qt.prototype.component2=function(){return this.cancelHandler},Qt.prototype.component3=function(){return this.onCancellation},Qt.prototype.component4=function(){return this.idempotentResume},Qt.prototype.component5=function(){return this.cancelCause},Qt.prototype.copy_pkdjca$=function(t,e,n,i,r){return new Qt(void 0===t?this.result:t,void 0===e?this.cancelHandler:e,void 0===n?this.onCancellation:n,void 0===i?this.idempotentResume:i,void 0===r?this.cancelCause:r)},Qt.prototype.toString=function(){return"CompletedContinuation(result="+e.toString(this.result)+", cancelHandler="+e.toString(this.cancelHandler)+", onCancellation="+e.toString(this.onCancellation)+", idempotentResume="+e.toString(this.idempotentResume)+", cancelCause="+e.toString(this.cancelCause)+")"},Qt.prototype.hashCode=function(){var t=0;return t=31*(t=31*(t=31*(t=31*(t=31*t+e.hashCode(this.result)|0)+e.hashCode(this.cancelHandler)|0)+e.hashCode(this.onCancellation)|0)+e.hashCode(this.idempotentResume)|0)+e.hashCode(this.cancelCause)|0},Qt.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.result,t.result)&&e.equals(this.cancelHandler,t.cancelHandler)&&e.equals(this.onCancellation,t.onCancellation)&&e.equals(this.idempotentResume,t.idempotentResume)&&e.equals(this.cancelCause,t.cancelCause)},Xt.$metadata$={kind:x,simpleName:"CompletableDeferred",interfaces:[qe]},Object.defineProperty(te.prototype,"onCancelComplete",{configurable:!0,get:function(){return!0}}),te.prototype.getCompleted=function(){var t;return null==(t=this.getCompletedInternal_8be2vx$())||e.isType(t,r)?t:o()},ee.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},ee.prototype=Object.create(c.prototype),ee.prototype.constructor=ee,ee.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.awaitInternal_8be2vx$(this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return null==(t=this.result_0)||e.isType(t,r)?t:o();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},te.prototype.await=function(t,e){var n=new ee(this,t);return e?n:n.doResume(null)},Object.defineProperty(te.prototype,"onAwait",{configurable:!0,get:function(){return this}}),te.prototype.registerSelectClause1_o3xas4$=function(t,e){this.registerSelectClause1Internal_u6kgbh$(t,e)},te.prototype.complete_11rb$=function(t){return this.makeCompleting_8ea4ql$(t)},te.prototype.completeExceptionally_tcv7n7$=function(t){return this.makeCompleting_8ea4ql$(new se(t))},te.$metadata$={kind:a,simpleName:"CompletableDeferredImpl",interfaces:[ss,Xt,$n]},ne.$metadata$={kind:x,simpleName:"CompletableJob",interfaces:[Ze]},ae.$metadata$={kind:a,simpleName:"CompletedWithCancellation",interfaces:[]},ae.prototype.component1=function(){return this.result},ae.prototype.component2=function(){return this.onCancellation},ae.prototype.copy_pe4fyg$=function(t,e){return new ae(void 0===t?this.result:t,void 0===e?this.onCancellation:e)},ae.prototype.toString=function(){return"CompletedWithCancellation(result="+e.toString(this.result)+", onCancellation="+e.toString(this.onCancellation)+")"},ae.prototype.hashCode=function(){var t=0;return t=31*(t=31*t+e.hashCode(this.result)|0)+e.hashCode(this.onCancellation)|0},ae.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.result,t.result)&&e.equals(this.onCancellation,t.onCancellation)},Object.defineProperty(se.prototype,"handled",{configurable:!0,get:function(){return this._handled_0}}),se.prototype.makeHandled=function(){return!1===(t=this)._handled_0&&(t._handled_0=!0,!0);var t},se.prototype.toString=function(){return Fs(this)+"["+this.cause+"]"},se.$metadata$={kind:a,simpleName:"CompletedExceptionally",interfaces:[]},le.prototype.makeResumed=function(){return!1===(t=this)._resumed_0&&(t._resumed_0=!0,!0);var t},le.$metadata$={kind:a,simpleName:"CancelledContinuation",interfaces:[se]},ue.$metadata$={kind:O,simpleName:"Key",interfaces:[z]};var he=null;function fe(){return null===he&&new ue,he}function de(t,n){var i;try{if(null!=(i=t.get_j3r2sn$($e())))return void i.handleException_1ur55u$(t,n)}catch(t){if(e.isType(t,E))return void Ds(0,_e(n,t));throw t}Ds(0,n)}function _e(t,e){return t===e?t:new T("Exception while trying to handle coroutine exception",e)}function ye(){$e()}function me(){ve=this}ce.prototype.isDispatchNeeded_1fupul$=function(t){return!0},ce.prototype.dispatchYield_5bn72i$=function(t,e){this.dispatch_5bn72i$(t,e)},ce.prototype.interceptContinuation_wj8d80$=function(t){return new Pa(this,t)},ce.prototype.releaseInterceptedContinuation_k98bjh$=function(t){var n,i;null!=(i=(e.isType(n=t,Pa)?n:o()).reusableCancellableContinuation)&&i.detachChild_8be2vx$()},ce.prototype.plus_9wrrq5$=function(t){return t},ce.prototype.toString=function(){return Fs(this)+"@"+qs(this)},ce.$metadata$={kind:a,simpleName:"CoroutineDispatcher",interfaces:[g,j]},me.$metadata$={kind:O,simpleName:"Key",interfaces:[P]};var ve=null;function $e(){return null===ve&&new me,ve}function ge(t){ke(),j.call(this,ke()),this.name=t}function be(){we=this}ye.$metadata$={kind:x,simpleName:"CoroutineExceptionHandler",interfaces:[R]},be.$metadata$={kind:O,simpleName:"Key",interfaces:[P]};var we=null;function ke(){return null===we&&new be,we}function Se(){}function xe(){ze=this}ge.prototype.toString=function(){return"CoroutineName("+this.name+")"},ge.$metadata$={kind:a,simpleName:"CoroutineName",interfaces:[j]},ge.prototype.component1=function(){return this.name},ge.prototype.copy_61zpoe$=function(t){return new ge(void 0===t?this.name:t)},ge.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.name)|0},ge.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.name,t.name)},Se.$metadata$={kind:x,simpleName:"CoroutineScope",interfaces:[]},Object.defineProperty(xe.prototype,"coroutineContext",{configurable:!0,get:function(){return v.EmptyCoroutineContext}}),xe.$metadata$={kind:O,simpleName:"GlobalScope",interfaces:[Se]};var Ee,Ce,Oe,Ne,ze=null;function je(t,e){return(n=t,function(t){var e=new Va(t.context,t);return is(e,e,n)})(e);var n}function Te(t,e){var n;if(void 0===e&&(e=null),null==(n=t.coroutineContext.get_j3r2sn$(tn())))throw S(("Scope cannot be cancelled because it does not have a job: "+t).toString());n.cancel_m4sck1$(e)}function Pe(t,e){M.call(this),this.name$=t,this.ordinal$=e}function Re(){Re=function(){},Ee=new Pe("DEFAULT",0),Ce=new Pe("LAZY",1),Oe=new Pe("ATOMIC",2),Ne=new Pe("UNDISPATCHED",3)}function Ae(){return Re(),Ee}function Ie(){return Re(),Ce}function Me(){return Re(),Oe}function Le(){return Re(),Ne}function De(){}function qe(){}function Fe(t){return function(e){var n=new Ht(_(e),1);return n.initCancellability(),t(n),n.getResult()}}function Ue(){}function Be(t){var n,i;return null!=(i=e.isType(n=t.get_j3r2sn$(g.Key),Ue)?n:null)?i:Rs()}function He(){ce.call(this),this.useCount_0=F,this.shared_0=!1,this.unconfinedQueue_0=null}function Ve(){Ke=this,this.ref_0=new Fl}w("kotlinx-coroutines-core.kotlinx.coroutines.currentCoroutineContext",(function(t){return e.coroutineReceiver().context})),Pe.prototype.invoke_810yno$=function(t,n){switch(this.name){case"DEFAULT":Ja(t,n);break;case"ATOMIC":A(t,n);break;case"UNDISPATCHED":es(t,n);break;case"LAZY":break;default:e.noWhenBranchMatched()}},Pe.prototype.invoke_3o0yor$=function(t,n,i){switch(this.name){case"DEFAULT":Za(t,n,i);break;case"ATOMIC":I(t,n,i);break;case"UNDISPATCHED":ns(t,n,i);break;case"LAZY":break;default:e.noWhenBranchMatched()}},Object.defineProperty(Pe.prototype,"isLazy",{configurable:!0,get:function(){return this===Ie()}}),Pe.$metadata$={kind:a,simpleName:"CoroutineStart",interfaces:[M]},Pe.values=function(){return[Ae(),Ie(),Me(),Le()]},Pe.valueOf_61zpoe$=function(t){switch(t){case"DEFAULT":return Ae();case"LAZY":return Ie();case"ATOMIC":return Me();case"UNDISPATCHED":return Le();default:L("No enum constant kotlinx.coroutines.CoroutineStart."+t)}},De.$metadata$={kind:x,simpleName:"CopyableThrowable",interfaces:[]},qe.$metadata$={kind:x,simpleName:"Deferred",interfaces:[Ze]},Ue.prototype.delay_s8cxhz$=function(t,e){var n,i;if(!(t.toNumber()<=0))return Fe((n=t,i=this,function(t){return i.scheduleResumeAfterDelay_egqmvs$(n,t),p}))(e)},Ue.prototype.invokeOnTimeout_oczv3n$=function(t,e,n){return Rs().invokeOnTimeout_oczv3n$(t,e,n)},Ue.$metadata$={kind:x,simpleName:"Delay",interfaces:[]},He.prototype.processNextEvent=function(){return this.processUnconfinedEvent()?F:D},Object.defineProperty(He.prototype,"isEmpty",{configurable:!0,get:function(){return this.isUnconfinedQueueEmpty}}),Object.defineProperty(He.prototype,"nextTime",{configurable:!0,get:function(){var t;return null==(t=this.unconfinedQueue_0)||t.isEmpty?D:F}}),He.prototype.processUnconfinedEvent=function(){var t,e;return null!=(t=this.unconfinedQueue_0)&&null!=(e=t.removeFirstOrNull())&&(e.run(),!0)},He.prototype.shouldBeProcessedFromContext=function(){return!1},He.prototype.dispatchUnconfined_4avnfa$=function(t){var e,n;if(null!=(e=this.unconfinedQueue_0))n=e;else{var i=new Na;this.unconfinedQueue_0=i,n=i}n.addLast_trkh7z$(t)},Object.defineProperty(He.prototype,"isActive",{configurable:!0,get:function(){return this.useCount_0.toNumber()>0}}),Object.defineProperty(He.prototype,"isUnconfinedLoopActive",{configurable:!0,get:function(){return this.useCount_0.compareTo_11rb$(this.delta_0(!0))>=0}}),Object.defineProperty(He.prototype,"isUnconfinedQueueEmpty",{configurable:!0,get:function(){var t,e;return null==(e=null!=(t=this.unconfinedQueue_0)?t.isEmpty:null)||e}}),He.prototype.delta_0=function(t){return t?U:q},He.prototype.incrementUseCount_6taknv$=function(t){void 0===t&&(t=!1),this.useCount_0=this.useCount_0.add(this.delta_0(t)),t||(this.shared_0=!0)},He.prototype.decrementUseCount_6taknv$=function(t){void 0===t&&(t=!1),this.useCount_0=this.useCount_0.subtract(this.delta_0(t)),this.useCount_0.toNumber()>0||this.shared_0&&this.shutdown()},He.prototype.shutdown=function(){},He.$metadata$={kind:a,simpleName:"EventLoop",interfaces:[ce]},Object.defineProperty(Ve.prototype,"eventLoop_8be2vx$",{configurable:!0,get:function(){var t,e;if(null!=(t=this.ref_0.get()))e=t;else{var n=Ws();this.ref_0.set_11rb$(n),e=n}return e}}),Ve.prototype.currentOrNull_8be2vx$=function(){return this.ref_0.get()},Ve.prototype.resetEventLoop_8be2vx$=function(){this.ref_0.set_11rb$(null)},Ve.prototype.setEventLoop_13etkv$=function(t){this.ref_0.set_11rb$(t)},Ve.$metadata$={kind:O,simpleName:"ThreadLocalEventLoop",interfaces:[]};var Ke=null;function We(){return null===Ke&&new Ve,Ke}function Ye(){Gs.call(this),this._queue_0=null,this._delayed_0=null,this._isCompleted_0=!1}function Ge(t,e){T.call(this,t,e),this.name="CompletionHandlerException"}function Je(t,e){V.call(this,t,e),this.name="CoroutinesInternalError"}function Ze(){tn()}function Qe(){Xe=this,$e()}Ge.$metadata$={kind:a,simpleName:"CompletionHandlerException",interfaces:[T]},Je.$metadata$={kind:a,simpleName:"CoroutinesInternalError",interfaces:[V]},Qe.$metadata$={kind:O,simpleName:"Key",interfaces:[P]};var Xe=null;function tn(){return null===Xe&&new Qe,Xe}function en(t){return void 0===t&&(t=null),new Nn(t)}function nn(){}function rn(){}function on(){}function an(){}function sn(t){if(!t.isActive)throw t.getCancellationException()}function ln(t){var e;null!=(e=t.get_j3r2sn$(tn()))&&sn(e)}function cn(){mn=this}Ze.prototype.cancel_m4sck1$=function(t,e){void 0===t&&(t=null),e?e(t):this.cancel_m4sck1$$default(t)},Ze.prototype.cancel=function(){this.cancel_m4sck1$(null)},Ze.prototype.cancel_dbl4no$=function(t,e){return void 0===t&&(t=null),e?e(t):this.cancel_dbl4no$$default(t)},Ze.prototype.invokeOnCompletion_ct2b2z$=function(t,e,n,i){return void 0===t&&(t=!1),void 0===e&&(e=!0),i?i(t,e,n):this.invokeOnCompletion_ct2b2z$$default(t,e,n)},Ze.prototype.plus_dqr1mp$=function(t){return t},Ze.$metadata$={kind:x,simpleName:"Job",interfaces:[R]},nn.$metadata$={kind:x,simpleName:"DisposableHandle",interfaces:[]},rn.$metadata$={kind:x,simpleName:"ChildJob",interfaces:[Ze]},on.$metadata$={kind:x,simpleName:"ParentJob",interfaces:[Ze]},an.$metadata$={kind:x,simpleName:"ChildHandle",interfaces:[nn]},cn.prototype.dispose=function(){},cn.prototype.childCancelled_tcv7n7$=function(t){return!1},cn.prototype.toString=function(){return"NonDisposableHandle"},cn.$metadata$={kind:O,simpleName:"NonDisposableHandle",interfaces:[an,nn]};var un,pn,hn,fn,dn,_n,yn,mn=null;function vn(){return null===mn&&new cn,mn}function $n(t){this._state_v70vig$_0=t?yn:_n,this._parentHandle_acgcx5$_0=null}function gn(t,e){return function(){return t.state_8be2vx$===e}}function bn(t,e,n,i){c.call(this,i),this.$controller=n,this.exceptionState_0=1,this.local$this$JobSupport=t,this.local$tmp$=void 0,this.local$tmp$_0=void 0,this.local$cur=void 0,this.local$$receiver=e}function wn(t,e,n){this.list_m9wkmb$_0=t,this._isCompleting_0=e,this._rootCause_0=n,this._exceptionsHolder_0=null}function kn(t,e,n,i){jn.call(this),this.parent_0=t,this.state_0=e,this.child_0=n,this.proposedUpdate_0=i}function Sn(t,e){Ht.call(this,t,1),this.job_0=e}function xn(t){this.state=t}function En(t){return e.isType(t,zn)?new xn(t):t}function Cn(t){var n,i,r;return null!=(r=null!=(i=e.isType(n=t,xn)?n:null)?i.state:null)?r:t}function On(t){this.isActive_hyoax9$_0=t}function Nn(t){$n.call(this,!0),this.initParentJobInternal_8vd9i7$(t),this.handlesException_fejgjb$_0=this.handlesExceptionF()}function zn(){}function jn(){zs.call(this),this.job_ndnibc$_0=this.job_ndnibc$_0}function Tn(){Pl.call(this)}function Pn(t){this.list_afai45$_0=t}function Rn(t){jn.call(this),this.handler_0=t}function An(t){jn.call(this),this.continuation_0=t}function In(t){jn.call(this),this.continuation_0=t}function Mn(t,e){jn.call(this),this.select_0=t,this.block_0=e}function Ln(t,e){jn.call(this),this.select_0=t,this.block_0=e}function Dn(){jn.call(this)}function qn(t){Dn.call(this),this.handler_0=t,this._invoked_0=0}function Fn(t){Dn.call(this),this.childJob=t}function Un(t){Dn.call(this),this.child=t}function Bn(){ce.call(this)}function Hn(){j.call(this,tn())}function Vn(t){Nn.call(this,t)}function Kn(t,e){Qs(t,this),this.coroutine_8be2vx$=e,this.name="TimeoutCancellationException"}function Wn(){Yn=this,ce.call(this)}Object.defineProperty($n.prototype,"key",{configurable:!0,get:function(){return tn()}}),Object.defineProperty($n.prototype,"parentHandle_8be2vx$",{configurable:!0,get:function(){return this._parentHandle_acgcx5$_0},set:function(t){this._parentHandle_acgcx5$_0=t}}),$n.prototype.initParentJobInternal_8vd9i7$=function(t){if(null!=t){t.start();var e=t.attachChild_kx8v25$(this);this.parentHandle_8be2vx$=e,this.isCompleted&&(e.dispose(),this.parentHandle_8be2vx$=vn())}else this.parentHandle_8be2vx$=vn()},Object.defineProperty($n.prototype,"state_8be2vx$",{configurable:!0,get:function(){for(this._state_v70vig$_0;;){var t=this._state_v70vig$_0;if(!e.isType(t,za))return t;t.perform_s8jyv4$(this)}}}),$n.prototype.loopOnState_46ivxf$_0=function(t){for(;;)t(this.state_8be2vx$)},Object.defineProperty($n.prototype,"isActive",{configurable:!0,get:function(){var t=this.state_8be2vx$;return e.isType(t,zn)&&t.isActive}}),Object.defineProperty($n.prototype,"isCompleted",{configurable:!0,get:function(){return!e.isType(this.state_8be2vx$,zn)}}),Object.defineProperty($n.prototype,"isCancelled",{configurable:!0,get:function(){var t=this.state_8be2vx$;return e.isType(t,se)||e.isType(t,wn)&&t.isCancelling}}),$n.prototype.finalizeFinishingState_10mr1z$_0=function(t,n){var i,r,a,s=null!=(r=e.isType(i=n,se)?i:null)?r.cause:null,l={v:!1};l.v=t.isCancelling;var c=t.sealLocked_dbl4no$(s),u=this.getFinalRootCause_3zkch4$_0(t,c);null!=u&&this.addSuppressedExceptions_85dgeo$_0(u,c);var p,h=u,f=null==h||h===s?n:new se(h);return null!=h&&(this.cancelParent_7dutpz$_0(h)||this.handleJobException_tcv7n7$(h))&&(e.isType(a=f,se)?a:o()).makeHandled(),l.v||this.onCancelling_dbl4no$(h),this.onCompletionInternal_s8jyv4$(f),(p=this)._state_v70vig$_0===t&&(p._state_v70vig$_0=En(f)),this.completeStateFinalization_a4ilmi$_0(t,f),f},$n.prototype.getFinalRootCause_3zkch4$_0=function(t,n){if(n.isEmpty())return t.isCancelling?new Xs(this.cancellationExceptionMessage(),null,this):null;var i;t:do{var r;for(r=n.iterator();r.hasNext();){var o=r.next();if(!e.isType(o,Zs)){i=o;break t}}i=null}while(0);if(null!=i)return i;var a=n.get_za3lpa$(0);if(e.isType(a,Kn)){var s;t:do{var l;for(l=n.iterator();l.hasNext();){var c=l.next();if(c!==a&&e.isType(c,Kn)){s=c;break t}}s=null}while(0);if(null!=s)return s}return a},$n.prototype.addSuppressedExceptions_85dgeo$_0=function(t,n){var i;if(!(n.size<=1)){var r=xl(n.size),o=t;for(i=n.iterator();i.hasNext();){var a=i.next();a!==t&&a!==o&&!e.isType(a,Zs)&&r.add_11rb$(a)}}},$n.prototype.tryFinalizeSimpleState_5emg4m$_0=function(t,e){return(n=this)._state_v70vig$_0===t&&(n._state_v70vig$_0=En(e),!0)&&(this.onCancelling_dbl4no$(null),this.onCompletionInternal_s8jyv4$(e),this.completeStateFinalization_a4ilmi$_0(t,e),!0);var n},$n.prototype.completeStateFinalization_a4ilmi$_0=function(t,n){var i,r,o,a;null!=(i=this.parentHandle_8be2vx$)&&(i.dispose(),this.parentHandle_8be2vx$=vn());var s=null!=(o=e.isType(r=n,se)?r:null)?o.cause:null;if(e.isType(t,jn))try{t.invoke(s)}catch(n){if(!e.isType(n,E))throw n;this.handleOnCompletionException_tcv7n7$(new Ge("Exception in completion handler "+t+" for "+this,n))}else null!=(a=t.list)&&this.notifyCompletion_mgxta4$_0(a,s)},$n.prototype.notifyCancelling_xkpzb8$_0=function(t,n){var i;this.onCancelling_dbl4no$(n);for(var r={v:null},o=t._next;!b(o,t);){if(e.isType(o,Dn)){var a,s=o;try{s.invoke(n)}catch(t){if(!e.isType(t,E))throw t;null==(null!=(a=r.v)?a:null)&&(r.v=new Ge("Exception in completion handler "+s+" for "+this,t))}}o=o._next}null!=(i=r.v)&&this.handleOnCompletionException_tcv7n7$(i),this.cancelParent_7dutpz$_0(n)},$n.prototype.cancelParent_7dutpz$_0=function(t){if(this.isScopedCoroutine)return!0;var n=e.isType(t,Zs),i=this.parentHandle_8be2vx$;return null===i||i===vn()?n:i.childCancelled_tcv7n7$(t)||n},$n.prototype.notifyCompletion_mgxta4$_0=function(t,n){for(var i,r={v:null},o=t._next;!b(o,t);){if(e.isType(o,jn)){var a,s=o;try{s.invoke(n)}catch(t){if(!e.isType(t,E))throw t;null==(null!=(a=r.v)?a:null)&&(r.v=new Ge("Exception in completion handler "+s+" for "+this,t))}}o=o._next}null!=(i=r.v)&&this.handleOnCompletionException_tcv7n7$(i)},$n.prototype.notifyHandlers_8g4jwh$_0=k((function(){var t=e.equals;return function(n,i,r,o){for(var a,s={v:null},l=r._next;!t(l,r);){if(i(l)){var c,u=l;try{u.invoke(o)}catch(t){if(!e.isType(t,E))throw t;null==(null!=(c=s.v)?c:null)&&(s.v=new Ge("Exception in completion handler "+u+" for "+this,t))}}l=l._next}null!=(a=s.v)&&this.handleOnCompletionException_tcv7n7$(a)}})),$n.prototype.start=function(){for(;;)switch(this.startInternal_tp1bqd$_0(this.state_8be2vx$)){case 0:return!1;case 1:return!0}},$n.prototype.startInternal_tp1bqd$_0=function(t){return e.isType(t,On)?t.isActive?0:(n=this)._state_v70vig$_0!==t||(n._state_v70vig$_0=yn,0)?-1:(this.onStartInternal(),1):e.isType(t,Pn)?function(e){return e._state_v70vig$_0===t&&(e._state_v70vig$_0=t.list,!0)}(this)?(this.onStartInternal(),1):-1:0;var n},$n.prototype.onStartInternal=function(){},$n.prototype.getCancellationException=function(){var t,n,i=this.state_8be2vx$;if(e.isType(i,wn)){if(null==(n=null!=(t=i.rootCause)?this.toCancellationException_rg9tb7$(t,Fs(this)+" is cancelling"):null))throw S(("Job is still new or active: "+this).toString());return n}if(e.isType(i,zn))throw S(("Job is still new or active: "+this).toString());return e.isType(i,se)?this.toCancellationException_rg9tb7$(i.cause):new Xs(Fs(this)+" has completed normally",null,this)},$n.prototype.toCancellationException_rg9tb7$=function(t,n){var i,r;return void 0===n&&(n=null),null!=(r=e.isType(i=t,Zs)?i:null)?r:new Xs(null!=n?n:this.cancellationExceptionMessage(),t,this)},Object.defineProperty($n.prototype,"completionCause",{configurable:!0,get:function(){var t,n=this.state_8be2vx$;if(e.isType(n,wn)){if(null==(t=n.rootCause))throw S(("Job is still new or active: "+this).toString());return t}if(e.isType(n,zn))throw S(("Job is still new or active: "+this).toString());return e.isType(n,se)?n.cause:null}}),Object.defineProperty($n.prototype,"completionCauseHandled",{configurable:!0,get:function(){var t=this.state_8be2vx$;return e.isType(t,se)&&t.handled}}),$n.prototype.invokeOnCompletion_f05bi3$=function(t){return this.invokeOnCompletion_ct2b2z$(!1,!0,t)},$n.prototype.invokeOnCompletion_ct2b2z$$default=function(t,n,i){for(var r,a=this.makeNode_9qhc1i$_0(i,t);;){var s=this.state_8be2vx$;t:do{var l,c,u;if(e.isType(s,On))if(s.isActive){if((r=this)._state_v70vig$_0===s&&(r._state_v70vig$_0=a,1))return a}else this.promoteEmptyToNodeList_lchanx$_0(s);else{if(!e.isType(s,zn))return n&&Ts(i,null!=(u=e.isType(c=s,se)?c:null)?u.cause:null),vn();var p=s.list;if(null==p)this.promoteSingleToNodeList_l9deey$_0(e.isType(l=s,jn)?l:o());else{var h={v:null},f={v:vn()};if(t&&e.isType(s,wn)){h.v=s.rootCause;var d=null==h.v;if(d||(d=e.isType(i,Fn)&&!s.isCompleting),d){if(!this.addLastAtomic_ct8uo8$_0(s,p,a))break t;if(null==h.v)return a;f.v=a}}if(null!=h.v)return n&&Ts(i,h.v),f.v;if(this.addLastAtomic_ct8uo8$_0(s,p,a))return a}}}while(0)}},$n.prototype.makeNode_9qhc1i$_0=function(t,n){var i,r,o,a,s,l=n?null!=(r=e.isType(i=t,Dn)?i:null)?r:new qn(t):null!=(s=null!=(a=e.isType(o=t,jn)?o:null)?a:null)?s:new Rn(t);return l.job=this,l},$n.prototype.addLastAtomic_ct8uo8$_0=function(t,e,n){var i;t:do{if(!gn(this,t)()){i=!1;break t}e.addLast_l2j9rm$(n),i=!0}while(0);return i},$n.prototype.promoteEmptyToNodeList_lchanx$_0=function(t){var e,n=new Tn,i=t.isActive?n:new Pn(n);(e=this)._state_v70vig$_0===t&&(e._state_v70vig$_0=i)},$n.prototype.promoteSingleToNodeList_l9deey$_0=function(t){t.addOneIfEmpty_l2j9rm$(new Tn);var e,n=t._next;(e=this)._state_v70vig$_0===t&&(e._state_v70vig$_0=n)},$n.prototype.join=function(t){if(this.joinInternal_ta6o25$_0())return this.joinSuspend_kfh5g8$_0(t);ci(t.context)},$n.prototype.joinInternal_ta6o25$_0=function(){for(;;){var t=this.state_8be2vx$;if(!e.isType(t,zn))return!1;if(this.startInternal_tp1bqd$_0(t)>=0)return!0}},$n.prototype.joinSuspend_kfh5g8$_0=function(t){return(n=this,e=function(t){return Ft(t,n.invokeOnCompletion_f05bi3$(new An(t))),p},function(t){var n=new Ht(_(t),1);return n.initCancellability(),e(n),n.getResult()})(t);var e,n},Object.defineProperty($n.prototype,"onJoin",{configurable:!0,get:function(){return this}}),$n.prototype.registerSelectClause0_s9h9qd$=function(t,n){for(;;){var i=this.state_8be2vx$;if(t.isSelected)return;if(!e.isType(i,zn))return void(t.trySelect()&&Xa(n,t.completion));if(0===this.startInternal_tp1bqd$_0(i))return void t.disposeOnSelect_rvfg84$(this.invokeOnCompletion_f05bi3$(new Mn(t,n)))}},$n.prototype.removeNode_jr34ao$=function(t){for(;;){var n=this.state_8be2vx$;if(!e.isType(n,jn))return e.isType(n,zn)?void(null!=n.list&&t.remove()):void 0;if(n!==t)return;if((i=this)._state_v70vig$_0===n&&(i._state_v70vig$_0=yn,1))return}var i},Object.defineProperty($n.prototype,"onCancelComplete",{configurable:!0,get:function(){return!1}}),$n.prototype.cancel_m4sck1$$default=function(t){this.cancelInternal_tcv7n7$(null!=t?t:new Xs(this.cancellationExceptionMessage(),null,this))},$n.prototype.cancellationExceptionMessage=function(){return"Job was cancelled"},$n.prototype.cancel_dbl4no$$default=function(t){var e;return this.cancelInternal_tcv7n7$(null!=(e=null!=t?this.toCancellationException_rg9tb7$(t):null)?e:new Xs(this.cancellationExceptionMessage(),null,this)),!0},$n.prototype.cancelInternal_tcv7n7$=function(t){this.cancelImpl_8ea4ql$(t)},$n.prototype.parentCancelled_pv1t6x$=function(t){this.cancelImpl_8ea4ql$(t)},$n.prototype.childCancelled_tcv7n7$=function(t){return!!e.isType(t,Zs)||this.cancelImpl_8ea4ql$(t)&&this.handlesException},$n.prototype.cancelCoroutine_dbl4no$=function(t){return this.cancelImpl_8ea4ql$(t)},$n.prototype.cancelImpl_8ea4ql$=function(t){var e,n=un;return!(!this.onCancelComplete||(n=this.cancelMakeCompleting_z3ww04$_0(t))!==pn)||(n===un&&(n=this.makeCancelling_xjon1g$_0(t)),n===un||n===pn?e=!0:n===fn?e=!1:(this.afterCompletion_s8jyv4$(n),e=!0),e)},$n.prototype.cancelMakeCompleting_z3ww04$_0=function(t){for(;;){var n=this.state_8be2vx$;if(!e.isType(n,zn)||e.isType(n,wn)&&n.isCompleting)return un;var i=new se(this.createCauseException_kfrsk8$_0(t)),r=this.tryMakeCompleting_w5s53t$_0(n,i);if(r!==hn)return r}},$n.prototype.defaultCancellationException_6umzry$=w("kotlinx-coroutines-core.kotlinx.coroutines.JobSupport.defaultCancellationException_6umzry$",k((function(){var e=t.kotlinx.coroutines.JobCancellationException;return function(t,n){return void 0===t&&(t=null),void 0===n&&(n=null),new e(null!=t?t:this.cancellationExceptionMessage(),n,this)}}))),$n.prototype.getChildJobCancellationCause=function(){var t,n,i,r=this.state_8be2vx$;if(e.isType(r,wn))t=r.rootCause;else if(e.isType(r,se))t=r.cause;else{if(e.isType(r,zn))throw S(("Cannot be cancelling child in this state: "+C(r)).toString());t=null}var o=t;return null!=(i=e.isType(n=o,Zs)?n:null)?i:new Xs("Parent job is "+this.stateString_u2sjqg$_0(r),o,this)},$n.prototype.createCauseException_kfrsk8$_0=function(t){var n;return null==t||e.isType(t,E)?null!=t?t:new Xs(this.cancellationExceptionMessage(),null,this):(e.isType(n=t,on)?n:o()).getChildJobCancellationCause()},$n.prototype.makeCancelling_xjon1g$_0=function(t){for(var n={v:null};;){var i,r,o=this.state_8be2vx$;if(e.isType(o,wn)){var a;if(o.isSealed)return fn;var s=o.isCancelling;if(null!=t||!s){var l;if(null!=(a=n.v))l=a;else{var c=this.createCauseException_kfrsk8$_0(t);n.v=c,l=c}var u=l;o.addExceptionLocked_tcv7n7$(u)}var p=o.rootCause,h=s?null:p;return null!=h&&this.notifyCancelling_xkpzb8$_0(o.list,h),un}if(!e.isType(o,zn))return fn;if(null!=(i=n.v))r=i;else{var f=this.createCauseException_kfrsk8$_0(t);n.v=f,r=f}var d=r;if(o.isActive){if(this.tryMakeCancelling_v0qvyy$_0(o,d))return un}else{var _=this.tryMakeCompleting_w5s53t$_0(o,new se(d));if(_===un)throw S(("Cannot happen in "+C(o)).toString());if(_!==hn)return _}}},$n.prototype.getOrPromoteCancellingList_dmij2j$_0=function(t){var n,i;if(null==(i=t.list)){if(e.isType(t,On))n=new Tn;else{if(!e.isType(t,jn))throw S(("State should have list: "+t).toString());this.promoteSingleToNodeList_l9deey$_0(t),n=null}i=n}return i},$n.prototype.tryMakeCancelling_v0qvyy$_0=function(t,e){var n;if(null==(n=this.getOrPromoteCancellingList_dmij2j$_0(t)))return!1;var i,r=n,o=new wn(r,!1,e);return(i=this)._state_v70vig$_0===t&&(i._state_v70vig$_0=o,!0)&&(this.notifyCancelling_xkpzb8$_0(r,e),!0)},$n.prototype.makeCompleting_8ea4ql$=function(t){for(;;){var e=this.tryMakeCompleting_w5s53t$_0(this.state_8be2vx$,t);if(e===un)return!1;if(e===pn)return!0;if(e!==hn)return this.afterCompletion_s8jyv4$(e),!0}},$n.prototype.makeCompletingOnce_8ea4ql$=function(t){for(;;){var e=this.tryMakeCompleting_w5s53t$_0(this.state_8be2vx$,t);if(e===un)throw new K("Job "+this+" is already complete or completing, but is being completed with "+C(t),this.get_exceptionOrNull_ejijbb$_0(t));if(e!==hn)return e}},$n.prototype.tryMakeCompleting_w5s53t$_0=function(t,n){return e.isType(t,zn)?!e.isType(t,On)&&!e.isType(t,jn)||e.isType(t,Fn)||e.isType(n,se)?this.tryMakeCompletingSlowPath_uh1ctj$_0(t,n):this.tryFinalizeSimpleState_5emg4m$_0(t,n)?n:hn:un},$n.prototype.tryMakeCompletingSlowPath_uh1ctj$_0=function(t,n){var i,r,o,a;if(null==(i=this.getOrPromoteCancellingList_dmij2j$_0(t)))return hn;var s,l,c,u=i,p=null!=(o=e.isType(r=t,wn)?r:null)?o:new wn(u,!1,null),h={v:null};if(p.isCompleting)return un;if(p.isCompleting=!0,p!==t&&((c=this)._state_v70vig$_0!==t||(c._state_v70vig$_0=p,0)))return hn;var f=p.isCancelling;null!=(l=e.isType(s=n,se)?s:null)&&p.addExceptionLocked_tcv7n7$(l.cause);var d=p.rootCause;h.v=f?null:d,null!=(a=h.v)&&this.notifyCancelling_xkpzb8$_0(u,a);var _=this.firstChild_15hr5g$_0(t);return null!=_&&this.tryWaitForChild_dzo3im$_0(p,_,n)?pn:this.finalizeFinishingState_10mr1z$_0(p,n)},$n.prototype.get_exceptionOrNull_ejijbb$_0=function(t){var n,i;return null!=(i=e.isType(n=t,se)?n:null)?i.cause:null},$n.prototype.firstChild_15hr5g$_0=function(t){var n,i,r;return null!=(r=e.isType(n=t,Fn)?n:null)?r:null!=(i=t.list)?this.nextChild_n2no7k$_0(i):null},$n.prototype.tryWaitForChild_dzo3im$_0=function(t,e,n){var i;if(e.childJob.invokeOnCompletion_ct2b2z$(void 0,!1,new kn(this,t,e,n))!==vn())return!0;if(null==(i=this.nextChild_n2no7k$_0(e)))return!1;var r=i;return this.tryWaitForChild_dzo3im$_0(t,r,n)},$n.prototype.continueCompleting_vth2d4$_0=function(t,e,n){var i=this.nextChild_n2no7k$_0(e);if(null==i||!this.tryWaitForChild_dzo3im$_0(t,i,n)){var r=this.finalizeFinishingState_10mr1z$_0(t,n);this.afterCompletion_s8jyv4$(r)}},$n.prototype.nextChild_n2no7k$_0=function(t){for(var n=t;n._removed;)n=n._prev;for(;;)if(!(n=n._next)._removed){if(e.isType(n,Fn))return n;if(e.isType(n,Tn))return null}},bn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},bn.prototype=Object.create(c.prototype),bn.prototype.constructor=bn,bn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=this.local$this$JobSupport.state_8be2vx$;if(e.isType(t,Fn)){if(this.state_0=8,this.result_0=this.local$$receiver.yield_11rb$(t.childJob,this),this.result_0===l)return l;continue}if(e.isType(t,zn)){if(null!=(this.local$tmp$=t.list)){this.local$cur=this.local$tmp$._next,this.state_0=2;continue}this.local$tmp$_0=null,this.state_0=6;continue}this.state_0=7;continue;case 1:throw this.exception_0;case 2:if(b(this.local$cur,this.local$tmp$)){this.state_0=5;continue}if(e.isType(this.local$cur,Fn)){if(this.state_0=3,this.result_0=this.local$$receiver.yield_11rb$(this.local$cur.childJob,this),this.result_0===l)return l;continue}this.state_0=4;continue;case 3:this.state_0=4;continue;case 4:this.local$cur=this.local$cur._next,this.state_0=2;continue;case 5:this.local$tmp$_0=p,this.state_0=6;continue;case 6:return this.local$tmp$_0;case 7:this.state_0=9;continue;case 8:return this.result_0;case 9:return p;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty($n.prototype,"children",{configurable:!0,get:function(){return W((t=this,function(e,n,i){var r=new bn(t,e,this,n);return i?r:r.doResume(null)}));var t}}),$n.prototype.attachChild_kx8v25$=function(t){var n;return e.isType(n=this.invokeOnCompletion_ct2b2z$(!0,void 0,new Fn(t)),an)?n:o()},$n.prototype.handleOnCompletionException_tcv7n7$=function(t){throw t},$n.prototype.onCancelling_dbl4no$=function(t){},Object.defineProperty($n.prototype,"isScopedCoroutine",{configurable:!0,get:function(){return!1}}),Object.defineProperty($n.prototype,"handlesException",{configurable:!0,get:function(){return!0}}),$n.prototype.handleJobException_tcv7n7$=function(t){return!1},$n.prototype.onCompletionInternal_s8jyv4$=function(t){},$n.prototype.afterCompletion_s8jyv4$=function(t){},$n.prototype.toString=function(){return this.toDebugString()+"@"+qs(this)},$n.prototype.toDebugString=function(){return this.nameString()+"{"+this.stateString_u2sjqg$_0(this.state_8be2vx$)+"}"},$n.prototype.nameString=function(){return Fs(this)},$n.prototype.stateString_u2sjqg$_0=function(t){return e.isType(t,wn)?t.isCancelling?"Cancelling":t.isCompleting?"Completing":"Active":e.isType(t,zn)?t.isActive?"Active":"New":e.isType(t,se)?"Cancelled":"Completed"},Object.defineProperty(wn.prototype,"list",{get:function(){return this.list_m9wkmb$_0}}),Object.defineProperty(wn.prototype,"isCompleting",{configurable:!0,get:function(){return this._isCompleting_0},set:function(t){this._isCompleting_0=t}}),Object.defineProperty(wn.prototype,"rootCause",{configurable:!0,get:function(){return this._rootCause_0},set:function(t){this._rootCause_0=t}}),Object.defineProperty(wn.prototype,"exceptionsHolder_0",{configurable:!0,get:function(){return this._exceptionsHolder_0},set:function(t){this._exceptionsHolder_0=t}}),Object.defineProperty(wn.prototype,"isSealed",{configurable:!0,get:function(){return this.exceptionsHolder_0===dn}}),Object.defineProperty(wn.prototype,"isCancelling",{configurable:!0,get:function(){return null!=this.rootCause}}),Object.defineProperty(wn.prototype,"isActive",{configurable:!0,get:function(){return null==this.rootCause}}),wn.prototype.sealLocked_dbl4no$=function(t){var n,i,r=this.exceptionsHolder_0;if(null==r)i=this.allocateList_0();else if(e.isType(r,E)){var a=this.allocateList_0();a.add_11rb$(r),i=a}else{if(!e.isType(r,Y))throw S(("State is "+C(r)).toString());i=e.isType(n=r,Y)?n:o()}var s=i,l=this.rootCause;return null!=l&&s.add_wxm5ur$(0,l),null==t||b(t,l)||s.add_11rb$(t),this.exceptionsHolder_0=dn,s},wn.prototype.addExceptionLocked_tcv7n7$=function(t){var n,i=this.rootCause;if(null!=i){if(t!==i){var r=this.exceptionsHolder_0;if(null==r)this.exceptionsHolder_0=t;else if(e.isType(r,E)){if(t===r)return;var a=this.allocateList_0();a.add_11rb$(r),a.add_11rb$(t),this.exceptionsHolder_0=a}else{if(!e.isType(r,Y))throw S(("State is "+C(r)).toString());(e.isType(n=r,Y)?n:o()).add_11rb$(t)}}}else this.rootCause=t},wn.prototype.allocateList_0=function(){return y(4)},wn.prototype.toString=function(){return"Finishing[cancelling="+this.isCancelling+", completing="+this.isCompleting+", rootCause="+C(this.rootCause)+", exceptions="+C(this.exceptionsHolder_0)+", list="+this.list+"]"},wn.$metadata$={kind:a,simpleName:"Finishing",interfaces:[zn]},$n.prototype.get_isCancelling_dpdoz8$_0=function(t){return e.isType(t,wn)&&t.isCancelling},kn.prototype.invoke=function(t){this.parent_0.continueCompleting_vth2d4$_0(this.state_0,this.child_0,this.proposedUpdate_0)},kn.$metadata$={kind:a,simpleName:"ChildCompletion",interfaces:[jn]},Sn.prototype.getContinuationCancellationCause_dqr1mp$=function(t){var n,i=this.job_0.state_8be2vx$;return e.isType(i,wn)&&null!=(n=i.rootCause)?n:e.isType(i,se)?i.cause:t.getCancellationException()},Sn.prototype.nameString=function(){return"AwaitContinuation"},Sn.$metadata$={kind:a,simpleName:"AwaitContinuation",interfaces:[Ht]},Object.defineProperty($n.prototype,"isCompletedExceptionally",{configurable:!0,get:function(){return e.isType(this.state_8be2vx$,se)}}),$n.prototype.getCompletionExceptionOrNull=function(){var t=this.state_8be2vx$;if(e.isType(t,zn))throw S("This job has not completed yet".toString());return this.get_exceptionOrNull_ejijbb$_0(t)},$n.prototype.getCompletedInternal_8be2vx$=function(){var t=this.state_8be2vx$;if(e.isType(t,zn))throw S("This job has not completed yet".toString());if(e.isType(t,se))throw t.cause;return Cn(t)},$n.prototype.awaitInternal_8be2vx$=function(t){for(;;){var n=this.state_8be2vx$;if(!e.isType(n,zn)){if(e.isType(n,se))throw n.cause;return Cn(n)}if(this.startInternal_tp1bqd$_0(n)>=0)break}return this.awaitSuspend_ixl9xw$_0(t)},$n.prototype.awaitSuspend_ixl9xw$_0=function(t){return(e=this,function(t){var n=new Sn(_(t),e);return Ft(n,e.invokeOnCompletion_f05bi3$(new In(n))),n.getResult()})(t);var e},$n.prototype.registerSelectClause1Internal_u6kgbh$=function(t,n){for(;;){var i,a=this.state_8be2vx$;if(t.isSelected)return;if(!e.isType(a,zn))return void(t.trySelect()&&(e.isType(a,se)?t.resumeSelectWithException_tcv7n7$(a.cause):ts(n,null==(i=Cn(a))||e.isType(i,r)?i:o(),t.completion)));if(0===this.startInternal_tp1bqd$_0(a))return void t.disposeOnSelect_rvfg84$(this.invokeOnCompletion_f05bi3$(new Ln(t,n)))}},$n.prototype.selectAwaitCompletion_u6kgbh$=function(t,n){var i,a=this.state_8be2vx$;e.isType(a,se)?t.resumeSelectWithException_tcv7n7$(a.cause):Za(n,null==(i=Cn(a))||e.isType(i,r)?i:o(),t.completion)},$n.$metadata$={kind:a,simpleName:"JobSupport",interfaces:[as,on,rn,Ze]},xn.$metadata$={kind:a,simpleName:"IncompleteStateBox",interfaces:[]},Object.defineProperty(On.prototype,"isActive",{get:function(){return this.isActive_hyoax9$_0}}),Object.defineProperty(On.prototype,"list",{configurable:!0,get:function(){return null}}),On.prototype.toString=function(){return"Empty{"+(this.isActive?"Active":"New")+"}"},On.$metadata$={kind:a,simpleName:"Empty",interfaces:[zn]},Object.defineProperty(Nn.prototype,"onCancelComplete",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Nn.prototype,"handlesException",{configurable:!0,get:function(){return this.handlesException_fejgjb$_0}}),Nn.prototype.complete=function(){return this.makeCompleting_8ea4ql$(p)},Nn.prototype.completeExceptionally_tcv7n7$=function(t){return this.makeCompleting_8ea4ql$(new se(t))},Nn.prototype.handlesExceptionF=function(){var t,n,i,r,o,a;if(null==(i=null!=(n=e.isType(t=this.parentHandle_8be2vx$,Fn)?t:null)?n.job:null))return!1;for(var s=i;;){if(s.handlesException)return!0;if(null==(a=null!=(o=e.isType(r=s.parentHandle_8be2vx$,Fn)?r:null)?o.job:null))return!1;s=a}},Nn.$metadata$={kind:a,simpleName:"JobImpl",interfaces:[ne,$n]},zn.$metadata$={kind:x,simpleName:"Incomplete",interfaces:[]},Object.defineProperty(jn.prototype,"job",{configurable:!0,get:function(){return null==this.job_ndnibc$_0?h("job"):this.job_ndnibc$_0},set:function(t){this.job_ndnibc$_0=t}}),Object.defineProperty(jn.prototype,"isActive",{configurable:!0,get:function(){return!0}}),Object.defineProperty(jn.prototype,"list",{configurable:!0,get:function(){return null}}),jn.prototype.dispose=function(){this.job.removeNode_jr34ao$(this)},jn.prototype.toString=function(){return Fs(this)+"@"+qs(this)+"[job@"+qs(this.job)+"]"},jn.$metadata$={kind:a,simpleName:"JobNode",interfaces:[zn,nn,zs]},Object.defineProperty(Tn.prototype,"isActive",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Tn.prototype,"list",{configurable:!0,get:function(){return this}}),Tn.prototype.getString_61zpoe$=function(t){var n=G();n.append_pdl1vj$("List{"),n.append_pdl1vj$(t),n.append_pdl1vj$("}[");for(var i={v:!0},r=this._next;!b(r,this);){if(e.isType(r,jn)){var o=r;i.v?i.v=!1:n.append_pdl1vj$(", "),n.append_s8jyv4$(o)}r=r._next}return n.append_pdl1vj$("]"),n.toString()},Tn.prototype.toString=function(){return oa?this.getString_61zpoe$("Active"):Pl.prototype.toString.call(this)},Tn.$metadata$={kind:a,simpleName:"NodeList",interfaces:[zn,Pl]},Object.defineProperty(Pn.prototype,"list",{get:function(){return this.list_afai45$_0}}),Object.defineProperty(Pn.prototype,"isActive",{configurable:!0,get:function(){return!1}}),Pn.prototype.toString=function(){return oa?this.list.getString_61zpoe$("New"):r.prototype.toString.call(this)},Pn.$metadata$={kind:a,simpleName:"InactiveNodeList",interfaces:[zn]},Rn.prototype.invoke=function(t){this.handler_0(t)},Rn.$metadata$={kind:a,simpleName:"InvokeOnCompletion",interfaces:[jn]},An.prototype.invoke=function(t){this.continuation_0.resumeWith_tl1gpc$(new m(p))},An.$metadata$={kind:a,simpleName:"ResumeOnCompletion",interfaces:[jn]},In.prototype.invoke=function(t){var n,i,a=this.job.state_8be2vx$;if(e.isType(a,se)){var s=this.continuation_0,l=a.cause;s.resumeWith_tl1gpc$(new m(N(l)))}else{i=this.continuation_0;var c=null==(n=Cn(a))||e.isType(n,r)?n:o();i.resumeWith_tl1gpc$(new m(c))}},In.$metadata$={kind:a,simpleName:"ResumeAwaitOnCompletion",interfaces:[jn]},Mn.prototype.invoke=function(t){this.select_0.trySelect()&&Ja(this.block_0,this.select_0.completion)},Mn.$metadata$={kind:a,simpleName:"SelectJoinOnCompletion",interfaces:[jn]},Ln.prototype.invoke=function(t){this.select_0.trySelect()&&this.job.selectAwaitCompletion_u6kgbh$(this.select_0,this.block_0)},Ln.$metadata$={kind:a,simpleName:"SelectAwaitOnCompletion",interfaces:[jn]},Dn.$metadata$={kind:a,simpleName:"JobCancellingNode",interfaces:[jn]},qn.prototype.invoke=function(t){var e;0===(e=this)._invoked_0&&(e._invoked_0=1,1)&&this.handler_0(t)},qn.$metadata$={kind:a,simpleName:"InvokeOnCancelling",interfaces:[Dn]},Fn.prototype.invoke=function(t){this.childJob.parentCancelled_pv1t6x$(this.job)},Fn.prototype.childCancelled_tcv7n7$=function(t){return this.job.childCancelled_tcv7n7$(t)},Fn.$metadata$={kind:a,simpleName:"ChildHandleNode",interfaces:[an,Dn]},Un.prototype.invoke=function(t){this.child.parentCancelled_8o0b5c$(this.child.getContinuationCancellationCause_dqr1mp$(this.job))},Un.$metadata$={kind:a,simpleName:"ChildContinuation",interfaces:[Dn]},Bn.prototype.toString=function(){var t;return null!=(t=this.toStringInternalImpl())?t:Fs(this)+"@"+qs(this)},Bn.prototype.toStringInternalImpl=function(){var t,n=Vs().Main;if(this===n)return"Dispatchers.Main";try{t=n.immediate}catch(n){if(!e.isType(n,J))throw n;t=null}return this===t?"Dispatchers.Main.immediate":null},Bn.$metadata$={kind:a,simpleName:"MainCoroutineDispatcher",interfaces:[ce]},Vn.prototype.childCancelled_tcv7n7$=function(t){return!1},Vn.$metadata$={kind:a,simpleName:"SupervisorJobImpl",interfaces:[Nn]},Kn.prototype.createCopy=function(){var t,e=new Kn(null!=(t=this.message)?t:"",this.coroutine_8be2vx$);return e},Kn.$metadata$={kind:a,simpleName:"TimeoutCancellationException",interfaces:[De,Zs]},Wn.prototype.isDispatchNeeded_1fupul$=function(t){return!1},Wn.prototype.dispatch_5bn72i$=function(t,e){var n=t.get_j3r2sn$(li());if(null==n)throw Z("Dispatchers.Unconfined.dispatch function can only be used by the yield function. If you wrap Unconfined dispatcher in your code, make sure you properly delegate isDispatchNeeded and dispatch calls.");n.dispatcherWasUnconfined=!0},Wn.prototype.toString=function(){return"Dispatchers.Unconfined"},Wn.$metadata$={kind:O,simpleName:"Unconfined",interfaces:[ce]};var Yn=null;function Gn(){return null===Yn&&new Wn,Yn}function Jn(){li(),j.call(this,li()),this.dispatcherWasUnconfined=!1}function Zn(){si=this}Zn.$metadata$={kind:O,simpleName:"Key",interfaces:[P]};var Qn,Xn,ti,ei,ni,ii,ri,oi,ai,si=null;function li(){return null===si&&new Zn,si}function ci(t){var e=t.get_j3r2sn$(tn());if(null!=e&&!e.isActive)throw e.getCancellationException()}function ui(t){return function(e){var n=Dt(_(e));return t(n),n.getResult()}}function pi(t){this.onUndeliveredElement_0=t,this.queue_0=new Pl,this.onCloseHandler_0=null}function hi(t,e){Nl.call(this,t,new mi(e))}function fi(t){return function(){return t.isBufferFull}}function di(t,e){zl.call(this,e),this.element=t}function _i(t){this.this$AbstractSendChannel=t}function yi(t,e,n,i){zi.call(this),this.pollResult_m5nr4l$_0=t,this.channel=e,this.select=n,this.block=i}function mi(t){zi.call(this),this.element=t}function vi(t){pi.call(this,t)}function $i(t){return function(){return t.isBufferEmpty}}function gi(t){zl.call(this,t)}function bi(t){this.this$AbstractChannel=t}function wi(t){this.this$AbstractChannel=t}function ki(t){this.this$AbstractChannel=t}function Si(t,e){this.$outer=t,Jt.call(this),this.receive_0=e}function xi(t){this.channel=t,this.result=ei}function Ei(t,e){Ai.call(this),this.cont=t,this.receiveMode=e}function Ci(t,e,n){Ei.call(this,t,e),this.onUndeliveredElement=n}function Oi(t,e){Ai.call(this),this.iterator=t,this.cont=e}function Ni(t,e,n,i){Ai.call(this),this.channel=t,this.select=e,this.block=n,this.receiveMode=i}function zi(){Ol.call(this)}function ji(){}function Ti(t,e){zi.call(this),this.pollResult_vo6xxe$_0=t,this.cont=e}function Pi(t,e,n){Ti.call(this,t,e),this.onUndeliveredElement=n}function Ri(t){zi.call(this),this.closeCause=t}function Ai(){Ol.call(this)}function Ii(t){if(pi.call(this,null),this.capacity=t,!(this.capacity>=1)){var n="ArrayBroadcastChannel capacity must be at least 1, but "+this.capacity+" was specified";throw H(n.toString())}this.bufferLock_0=new kl,this.buffer_0=e.newArray(this.capacity,null),this._head_0=F,this._tail_0=F,this._size_0=0,this.subscribers_0=Sl()}function Mi(t){vi.call(this,null),this.broadcastChannel_0=t,this.subLock_0=new kl,this._subHead_0=F}function Li(t,n,i){if(vi.call(this,i),this.capacity_0=t,this.onBufferOverflow_0=n,!(this.capacity_0>=1)){var r="ArrayChannel capacity must be at least 1, but "+this.capacity_0+" was specified";throw H(r.toString())}this.lock_0=new kl;var o=this.capacity_0,a=e.newArray(nt.min(o,8),null);et(a,Qn),this.buffer_0=a,this.head_0=0,this.size_0=0}function Di(t,e,n,i,r,o){void 0===e&&(e=v.EmptyCoroutineContext),void 0===n&&(n=1),void 0===i&&(i=Ie()),void 0===r&&(r=null);var a=As(t,e),s=Bi(n),l=i.isLazy?new Fi(a,s,o):new qi(a,s,!0);return null!=r&&l.invokeOnCompletion_f05bi3$(r),l.start_b5ul0p$(i,l,o),l}function qi(t,e,n){Et.call(this,t,n),this._channel_0=e}function Fi(t,e,n){qi.call(this,t,e,!1),this.continuation_0=$(n,this,this)}function Ui(){}function Bi(t){switch(t){case 0:throw H("Unsupported 0 capacity for BroadcastChannel");case 2147483647:throw H("Unsupported UNLIMITED capacity for BroadcastChannel");case-1:return new dr;case-2:return new Ii(lr().CHANNEL_DEFAULT_CAPACITY_8be2vx$);default:return new Ii(t)}}function Hi(t,e){M.call(this),this.name$=t,this.ordinal$=e}function Vi(){Vi=function(){},ri=new Hi("SUSPEND",0),oi=new Hi("DROP_OLDEST",1),ai=new Hi("DROP_LATEST",2)}function Ki(){return Vi(),ri}function Wi(){return Vi(),oi}function Yi(){return Vi(),ai}function Gi(){}function Ji(){}function Zi(t){er(),this.holder_0=t}function Qi(t){this.cause=t}function Xi(){tr=this}pi.prototype.offerInternal_11rb$=function(t){for(var e;;){if(null==(e=this.takeFirstReceiveOrPeekClosed()))return ti;var n=e;if(null!=n.tryResumeReceive_j43gjz$(t,null))return n.completeResumeReceive_11rb$(t),n.offerResult}},pi.prototype.offerSelectInternal_ys5ufj$=function(t,e){var n=this.describeTryOffer_0(t),i=e.performAtomicTrySelect_6q0pxr$(n);if(null!=i)return i;var r=n.result;return r.completeResumeReceive_11rb$(t),r.offerResult},Object.defineProperty(pi.prototype,"closedForSend_0",{configurable:!0,get:function(){var t,n,i;return null!=(n=e.isType(t=this.queue_0._prev,Ri)?t:null)?(this.helpClose_0(n),i=n):i=null,i}}),Object.defineProperty(pi.prototype,"closedForReceive_0",{configurable:!0,get:function(){var t,n,i;return null!=(n=e.isType(t=this.queue_0._next,Ri)?t:null)?(this.helpClose_0(n),i=n):i=null,i}}),pi.prototype.takeFirstSendOrPeekClosed_0=function(){var t,n=this.queue_0;t:do{var i=n._next;if(i===n){t=null;break t}if(!e.isType(i,zi)){t=null;break t}if(e.isType(i,Ri)){t=i;break t}if(!i.remove())throw S("Should remove".toString());t=i}while(0);return t},pi.prototype.sendBuffered_0=function(t){var n=this.queue_0,i=new mi(t),r=n._prev;return e.isType(r,ji)?r:(n.addLast_l2j9rm$(i),null)},pi.prototype.describeSendBuffered_0=function(t){return new hi(this.queue_0,t)},hi.prototype.failure_l2j9rm$=function(t){return e.isType(t,Ri)?t:e.isType(t,ji)?ti:null},hi.$metadata$={kind:a,simpleName:"SendBufferedDesc",interfaces:[Nl]},Object.defineProperty(pi.prototype,"isClosedForSend",{configurable:!0,get:function(){return null!=this.closedForSend_0}}),Object.defineProperty(pi.prototype,"isFull",{configurable:!0,get:function(){return this.isFullImpl_0}}),Object.defineProperty(pi.prototype,"isFullImpl_0",{configurable:!0,get:function(){return!e.isType(this.queue_0._next,ji)&&this.isBufferFull}}),pi.prototype.send_11rb$=function(t,e){if(this.offerInternal_11rb$(t)!==Xn)return this.sendSuspend_0(t,e)},pi.prototype.offer_11rb$=function(t){var n,i=this.offerInternal_11rb$(t);if(i!==Xn){if(i===ti){if(null==(n=this.closedForSend_0))return!1;throw this.helpCloseAndGetSendException_0(t,n)}throw e.isType(i,Ri)?this.helpCloseAndGetSendException_0(t,i):S(("offerInternal returned "+i.toString()).toString())}return!0},pi.prototype.helpCloseAndGetSendException_0=function(t,e){var n,i;if(this.helpClose_0(e),null!=(i=null!=(n=this.onUndeliveredElement_0)?Fa(n,t):null))throw Q(i,e.sendException),i;return e.sendException},pi.prototype.sendSuspend_0=function(t,n){return ui((i=this,r=t,function(t){for(;;){if(i.isFullImpl_0){var n=null==i.onUndeliveredElement_0?new Ti(r,t):new Pi(r,t,i.onUndeliveredElement_0),o=i.enqueueSend_vs6846$(n);if(null==o)return void qt(t,n);if(e.isType(o,Ri))return void i.helpCloseAndResumeWithSendException_0(t,r,o);if(o!==ni&&!e.isType(o,Ai))throw S(("enqueueSend returned "+C(o)).toString())}var a=i.offerInternal_11rb$(r);if(a===Xn)return void t.resumeWith_tl1gpc$(new m(p));if(a!==ti){if(e.isType(a,Ri))return void i.helpCloseAndResumeWithSendException_0(t,r,a);throw S(("offerInternal returned "+a.toString()).toString())}}}))(n);var i,r},pi.prototype.helpCloseAndResumeWithSendException_0=function(t,e,n){var i,r;this.helpClose_0(n);var o=n.sendException;if(null!=(r=null!=(i=this.onUndeliveredElement_0)?Fa(i,e):null))return Q(r,o),void t.resumeWith_tl1gpc$(new m(N(r)));t.resumeWith_tl1gpc$(new m(N(o)))},pi.prototype.enqueueSend_vs6846$=function(t){if(this.isBufferAlwaysFull){var n=this.queue_0,i=n._prev;if(e.isType(i,ji))return i;n.addLast_l2j9rm$(t)}else{var r,o=this.queue_0;t:do{var a=o._prev;if(e.isType(a,ji))return a;if(!fi(this)()){r=!1;break t}o.addLast_l2j9rm$(t),r=!0}while(0);if(!r)return ni}return null},pi.prototype.close_dbl4no$$default=function(t){var n,i,r=new Ri(t),a=this.queue_0;t:do{if(e.isType(a._prev,Ri)){i=!1;break t}a.addLast_l2j9rm$(r),i=!0}while(0);var s=i,l=s?r:e.isType(n=this.queue_0._prev,Ri)?n:o();return this.helpClose_0(l),s&&this.invokeOnCloseHandler_0(t),s},pi.prototype.invokeOnCloseHandler_0=function(t){var e,n,i=this.onCloseHandler_0;null!==i&&i!==ii&&(n=this).onCloseHandler_0===i&&(n.onCloseHandler_0=ii,1)&&("function"==typeof(e=i)?e:o())(t)},pi.prototype.invokeOnClose_f05bi3$=function(t){if(null!=(n=this).onCloseHandler_0||(n.onCloseHandler_0=t,0)){var e=this.onCloseHandler_0;if(e===ii)throw S("Another handler was already registered and successfully invoked");throw S("Another handler was already registered: "+C(e))}var n,i=this.closedForSend_0;null!=i&&function(e){return e.onCloseHandler_0===t&&(e.onCloseHandler_0=ii,!0)}(this)&&t(i.closeCause)},pi.prototype.helpClose_0=function(t){for(var n,i,a=new qa;null!=(i=e.isType(n=t._prev,Ai)?n:null);){var s=i;s.remove()?a=a.plus_11rb$(s):s.helpRemove()}var l,c,u,p=a;if(null!=(l=p.holder_0))if(e.isType(l,Y))for(var h=e.isType(u=p.holder_0,Y)?u:o(),f=h.size-1|0;f>=0;f--)h.get_za3lpa$(f).resumeReceiveClosed_1zqbm$(t);else(null==(c=p.holder_0)||e.isType(c,r)?c:o()).resumeReceiveClosed_1zqbm$(t);this.onClosedIdempotent_l2j9rm$(t)},pi.prototype.onClosedIdempotent_l2j9rm$=function(t){},pi.prototype.takeFirstReceiveOrPeekClosed=function(){var t,n=this.queue_0;t:do{var i=n._next;if(i===n){t=null;break t}if(!e.isType(i,ji)){t=null;break t}if(e.isType(i,Ri)){t=i;break t}if(!i.remove())throw S("Should remove".toString());t=i}while(0);return t},pi.prototype.describeTryOffer_0=function(t){return new di(t,this.queue_0)},di.prototype.failure_l2j9rm$=function(t){return e.isType(t,Ri)?t:e.isType(t,ji)?null:ti},di.prototype.onPrepare_xe32vn$=function(t){var n,i;return null==(i=(e.isType(n=t.affected,ji)?n:o()).tryResumeReceive_j43gjz$(this.element,t))?Ho:i===Fo?Fo:null},di.$metadata$={kind:a,simpleName:"TryOfferDesc",interfaces:[zl]},_i.prototype.registerSelectClause2_rol3se$=function(t,e,n){this.this$AbstractSendChannel.registerSelectSend_0(t,e,n)},_i.$metadata$={kind:a,interfaces:[ls]},Object.defineProperty(pi.prototype,"onSend",{configurable:!0,get:function(){return new _i(this)}}),pi.prototype.registerSelectSend_0=function(t,n,i){for(;;){if(t.isSelected)return;if(this.isFullImpl_0){var r=new yi(n,this,t,i),o=this.enqueueSend_vs6846$(r);if(null==o)return void t.disposeOnSelect_rvfg84$(r);if(e.isType(o,Ri))throw this.helpCloseAndGetSendException_0(n,o);if(o!==ni&&!e.isType(o,Ai))throw S(("enqueueSend returned "+C(o)+" ").toString())}var a=this.offerSelectInternal_ys5ufj$(n,t);if(a===Ko)return;if(a!==ti&&a!==Fo){if(a===Xn)return void ts(i,this,t.completion);throw e.isType(a,Ri)?this.helpCloseAndGetSendException_0(n,a):S(("offerSelectInternal returned "+a.toString()).toString())}}},pi.prototype.toString=function(){return Fs(this)+"@"+qs(this)+"{"+this.queueDebugStateString_0+"}"+this.bufferDebugString},Object.defineProperty(pi.prototype,"queueDebugStateString_0",{configurable:!0,get:function(){var t=this.queue_0._next;if(t===this.queue_0)return"EmptyQueue";var n=e.isType(t,Ri)?t.toString():e.isType(t,Ai)?"ReceiveQueued":e.isType(t,zi)?"SendQueued":"UNEXPECTED:"+t,i=this.queue_0._prev;return i!==t&&(n+=",queueSize="+this.countQueueSize_0(),e.isType(i,Ri)&&(n+=",closedForSend="+i)),n}}),pi.prototype.countQueueSize_0=function(){for(var t={v:0},n=this.queue_0,i=n._next;!b(i,n);)e.isType(i,Ol)&&(t.v=t.v+1|0),i=i._next;return t.v},Object.defineProperty(pi.prototype,"bufferDebugString",{configurable:!0,get:function(){return""}}),Object.defineProperty(yi.prototype,"pollResult",{get:function(){return this.pollResult_m5nr4l$_0}}),yi.prototype.tryResumeSend_uc1cc4$=function(t){var n;return null==(n=this.select.trySelectOther_uc1cc4$(t))||e.isType(n,Wa)?n:o()},yi.prototype.completeResumeSend=function(){Za(this.block,this.channel,this.select.completion)},yi.prototype.dispose=function(){this.remove()&&this.undeliveredElement()},yi.prototype.resumeSendClosed_1zqbm$=function(t){this.select.trySelect()&&this.select.resumeSelectWithException_tcv7n7$(t.sendException)},yi.prototype.undeliveredElement=function(){var t;null!=(t=this.channel.onUndeliveredElement_0)&&Ua(t,this.pollResult,this.select.completion.context)},yi.prototype.toString=function(){return"SendSelect@"+qs(this)+"("+this.pollResult+")["+this.channel+", "+this.select+"]"},yi.$metadata$={kind:a,simpleName:"SendSelect",interfaces:[nn,zi]},Object.defineProperty(mi.prototype,"pollResult",{configurable:!0,get:function(){return this.element}}),mi.prototype.tryResumeSend_uc1cc4$=function(t){return null!=t&&t.finishPrepare(),n},mi.prototype.completeResumeSend=function(){},mi.prototype.resumeSendClosed_1zqbm$=function(t){},mi.prototype.toString=function(){return"SendBuffered@"+qs(this)+"("+this.element+")"},mi.$metadata$={kind:a,simpleName:"SendBuffered",interfaces:[zi]},pi.$metadata$={kind:a,simpleName:"AbstractSendChannel",interfaces:[Gi]},vi.prototype.pollInternal=function(){for(var t;;){if(null==(t=this.takeFirstSendOrPeekClosed_0()))return ei;var e=t;if(null!=e.tryResumeSend_uc1cc4$(null))return e.completeResumeSend(),e.pollResult;e.undeliveredElement()}},vi.prototype.pollSelectInternal_y5yyj0$=function(t){var e=this.describeTryPoll_0(),n=t.performAtomicTrySelect_6q0pxr$(e);return null!=n?n:(e.result.completeResumeSend(),e.result.pollResult)},Object.defineProperty(vi.prototype,"hasReceiveOrClosed_0",{configurable:!0,get:function(){return e.isType(this.queue_0._next,ji)}}),Object.defineProperty(vi.prototype,"isClosedForReceive",{configurable:!0,get:function(){return null!=this.closedForReceive_0&&this.isBufferEmpty}}),Object.defineProperty(vi.prototype,"isEmpty",{configurable:!0,get:function(){return this.isEmptyImpl_0}}),Object.defineProperty(vi.prototype,"isEmptyImpl_0",{configurable:!0,get:function(){return!e.isType(this.queue_0._next,zi)&&this.isBufferEmpty}}),vi.prototype.receive=function(t){var n,i=this.pollInternal();return i===ei||e.isType(i,Ri)?this.receiveSuspend_0(0,t):null==(n=i)||e.isType(n,r)?n:o()},vi.prototype.receiveSuspend_0=function(t,n){return ui((i=this,a=t,function(t){var n,s,l,c,u,h,f;null==i.onUndeliveredElement_0?u=new Ei(e.isType(n=t,Lt)?n:o(),a):(l=e.isType(s=t,Lt)?s:o(),c=i.onUndeliveredElement_0,u=new Ci(l,a,c));for(var d=u;;){if(i.enqueueReceive_0(d))return void i.removeReceiveOnCancel_0(t,d);var _=i.pollInternal();if(e.isType(_,Ri))return void d.resumeReceiveClosed_1zqbm$(_);if(_!==ei)return void t.resume_q1ktlu$(d.resumeValue_11rb$(null==(h=_)||e.isType(h,r)?h:o()),d.resumeOnCancellationFun_11rb$(null==(f=_)||e.isType(f,r)?f:o()))}return p}))(n);var i,a},vi.prototype.enqueueReceiveInternal_i292ax$=function(t){var n;if(this.isBufferAlwaysEmpty){var i,r=this.queue_0;t:do{if(e.isType(r._prev,zi)){i=!1;break t}r.addLast_l2j9rm$(t),i=!0}while(0);n=i}else{var o,a=this.queue_0;t:do{if(e.isType(a._prev,zi)){o=!1;break t}if(!$i(this)()){o=!1;break t}a.addLast_l2j9rm$(t),o=!0}while(0);n=o}return n},vi.prototype.enqueueReceive_0=function(t){var e=this.enqueueReceiveInternal_i292ax$(t);return e&&this.onReceiveEnqueued(),e},vi.prototype.receiveOrNull=function(t){var n,i=this.pollInternal();return i===ei||e.isType(i,Ri)?this.receiveSuspend_0(1,t):null==(n=i)||e.isType(n,r)?n:o()},vi.prototype.receiveOrNullResult_0=function(t){var n;if(e.isType(t,Ri)){if(null!=t.closeCause)throw t.closeCause;return null}return null==(n=t)||e.isType(n,r)?n:o()},vi.prototype.receiveOrClosed=function(t){var n,i,a=this.pollInternal();return a!==ei?(e.isType(a,Ri)?n=new Zi(new Qi(a.closeCause)):(er(),n=new Zi(null==(i=a)||e.isType(i,r)?i:o())),n):this.receiveSuspend_0(2,t)},vi.prototype.poll=function(){var t=this.pollInternal();return t===ei?null:this.receiveOrNullResult_0(t)},vi.prototype.cancel_dbl4no$$default=function(t){return this.cancelInternal_fg6mcv$(t)},vi.prototype.cancel_m4sck1$$default=function(t){this.isClosedForReceive||this.cancelInternal_fg6mcv$(null!=t?t:Qs(Fs(this)+" was cancelled"))},vi.prototype.cancelInternal_fg6mcv$=function(t){var e=this.close_dbl4no$(t);return this.onCancelIdempotent_6taknv$(e),e},vi.prototype.onCancelIdempotent_6taknv$=function(t){var n;if(null==(n=this.closedForSend_0))throw S("Cannot happen".toString());for(var i=n,r=new qa;;){var a,s=i._prev;if(e.isType(s,Pl))break;s.remove()?r=r.plus_11rb$(e.isType(a=s,zi)?a:o()):s.helpRemove()}this.onCancelIdempotentList_kji3ae$(r,i)},vi.prototype.onCancelIdempotentList_kji3ae$=function(t,n){var i,a,s;if(null!=(i=t.holder_0))if(e.isType(i,Y))for(var l=e.isType(s=t.holder_0,Y)?s:o(),c=l.size-1|0;c>=0;c--)l.get_za3lpa$(c).resumeSendClosed_1zqbm$(n);else(null==(a=t.holder_0)||e.isType(a,r)?a:o()).resumeSendClosed_1zqbm$(n)},vi.prototype.iterator=function(){return new xi(this)},vi.prototype.describeTryPoll_0=function(){return new gi(this.queue_0)},gi.prototype.failure_l2j9rm$=function(t){return e.isType(t,Ri)?t:e.isType(t,zi)?null:ei},gi.prototype.onPrepare_xe32vn$=function(t){var n,i;return null==(i=(e.isType(n=t.affected,zi)?n:o()).tryResumeSend_uc1cc4$(t))?Ho:i===Fo?Fo:null},gi.prototype.onRemoved_l2j9rm$=function(t){var n;(e.isType(n=t,zi)?n:o()).undeliveredElement()},gi.$metadata$={kind:a,simpleName:"TryPollDesc",interfaces:[zl]},bi.prototype.registerSelectClause1_o3xas4$=function(t,n){var i,r;r=e.isType(i=n,X)?i:o(),this.this$AbstractChannel.registerSelectReceiveMode_0(t,0,r)},bi.$metadata$={kind:a,interfaces:[ss]},Object.defineProperty(vi.prototype,"onReceive",{configurable:!0,get:function(){return new bi(this)}}),wi.prototype.registerSelectClause1_o3xas4$=function(t,n){var i,r;r=e.isType(i=n,X)?i:o(),this.this$AbstractChannel.registerSelectReceiveMode_0(t,1,r)},wi.$metadata$={kind:a,interfaces:[ss]},Object.defineProperty(vi.prototype,"onReceiveOrNull",{configurable:!0,get:function(){return new wi(this)}}),ki.prototype.registerSelectClause1_o3xas4$=function(t,n){var i,r;r=e.isType(i=n,X)?i:o(),this.this$AbstractChannel.registerSelectReceiveMode_0(t,2,r)},ki.$metadata$={kind:a,interfaces:[ss]},Object.defineProperty(vi.prototype,"onReceiveOrClosed",{configurable:!0,get:function(){return new ki(this)}}),vi.prototype.registerSelectReceiveMode_0=function(t,e,n){for(;;){if(t.isSelected)return;if(this.isEmptyImpl_0){if(this.enqueueReceiveSelect_0(t,n,e))return}else{var i=this.pollSelectInternal_y5yyj0$(t);if(i===Ko)return;i!==ei&&i!==Fo&&this.tryStartBlockUnintercepted_0(n,t,e,i)}}},vi.prototype.tryStartBlockUnintercepted_0=function(t,n,i,a){var s,l;if(e.isType(a,Ri))switch(i){case 0:throw a.receiveException;case 2:if(!n.trySelect())return;ts(t,new Zi(new Qi(a.closeCause)),n.completion);break;case 1:if(null!=a.closeCause)throw a.receiveException;if(!n.trySelect())return;ts(t,null,n.completion)}else 2===i?(e.isType(a,Ri)?s=new Zi(new Qi(a.closeCause)):(er(),s=new Zi(null==(l=a)||e.isType(l,r)?l:o())),ts(t,s,n.completion)):ts(t,a,n.completion)},vi.prototype.enqueueReceiveSelect_0=function(t,e,n){var i=new Ni(this,t,e,n),r=this.enqueueReceive_0(i);return r&&t.disposeOnSelect_rvfg84$(i),r},vi.prototype.takeFirstReceiveOrPeekClosed=function(){var t=pi.prototype.takeFirstReceiveOrPeekClosed.call(this);return null==t||e.isType(t,Ri)||this.onReceiveDequeued(),t},vi.prototype.onReceiveEnqueued=function(){},vi.prototype.onReceiveDequeued=function(){},vi.prototype.removeReceiveOnCancel_0=function(t,e){t.invokeOnCancellation_f05bi3$(new Si(this,e))},Si.prototype.invoke=function(t){this.receive_0.remove()&&this.$outer.onReceiveDequeued()},Si.prototype.toString=function(){return"RemoveReceiveOnCancel["+this.receive_0+"]"},Si.$metadata$={kind:a,simpleName:"RemoveReceiveOnCancel",interfaces:[Jt]},xi.prototype.hasNext=function(t){return this.result!==ei?this.hasNextResult_0(this.result):(this.result=this.channel.pollInternal(),this.result!==ei?this.hasNextResult_0(this.result):this.hasNextSuspend_0(t))},xi.prototype.hasNextResult_0=function(t){if(e.isType(t,Ri)){if(null!=t.closeCause)throw t.receiveException;return!1}return!0},xi.prototype.hasNextSuspend_0=function(t){return ui((n=this,function(t){for(var i,a,s,l,c=new Oi(n,t);;){if(n.channel.enqueueReceive_0(c))return void n.channel.removeReceiveOnCancel_0(t,c);var u=n.channel.pollInternal();if(n.result=u,e.isType(u,Ri)){if(null==u.closeCause)t.resumeWith_tl1gpc$(new m(!1));else{var h=u.receiveException;t.resumeWith_tl1gpc$(new m(N(h)))}return}if(u!==ei)return l=n.channel.onUndeliveredElement_0,a=null==(i=u)||e.isType(i,r)?i:o(),s=t.context,void t.resume_q1ktlu$(!0,null!=l?Ba(l,a,s):null)}return p}))(t);var n},xi.prototype.next=function(){var t,n=this.result;if(e.isType(n,Ri))throw n.receiveException;if(n!==ei)return this.result=ei,null==(t=n)||e.isType(t,r)?t:o();throw S("'hasNext' should be called prior to 'next' invocation")},xi.$metadata$={kind:a,simpleName:"Itr",interfaces:[nr]},Ei.prototype.resumeValue_11rb$=function(t){return 2===this.receiveMode?new Zi(t):t},Ei.prototype.tryResumeReceive_j43gjz$=function(t,e){return null==this.cont.tryResume_i8qury$(this.resumeValue_11rb$(t),null!=e?e.desc:null,this.resumeOnCancellationFun_11rb$(t))?null:(null!=e&&e.finishPrepare(),n)},Ei.prototype.completeResumeReceive_11rb$=function(t){this.cont.completeResume_za3rmp$(n)},Ei.prototype.resumeReceiveClosed_1zqbm$=function(t){if(1===this.receiveMode&&null==t.closeCause)this.cont.resumeWith_tl1gpc$(new m(null));else if(2===this.receiveMode){var e=this.cont,n=new Zi(new Qi(t.closeCause));e.resumeWith_tl1gpc$(new m(n))}else{var i=this.cont,r=t.receiveException;i.resumeWith_tl1gpc$(new m(N(r)))}},Ei.prototype.toString=function(){return"ReceiveElement@"+qs(this)+"[receiveMode="+this.receiveMode+"]"},Ei.$metadata$={kind:a,simpleName:"ReceiveElement",interfaces:[Ai]},Ci.prototype.resumeOnCancellationFun_11rb$=function(t){return Ba(this.onUndeliveredElement,t,this.cont.context)},Ci.$metadata$={kind:a,simpleName:"ReceiveElementWithUndeliveredHandler",interfaces:[Ei]},Oi.prototype.tryResumeReceive_j43gjz$=function(t,e){return null==this.cont.tryResume_i8qury$(!0,null!=e?e.desc:null,this.resumeOnCancellationFun_11rb$(t))?null:(null!=e&&e.finishPrepare(),n)},Oi.prototype.completeResumeReceive_11rb$=function(t){this.iterator.result=t,this.cont.completeResume_za3rmp$(n)},Oi.prototype.resumeReceiveClosed_1zqbm$=function(t){var e=null==t.closeCause?this.cont.tryResume_19pj23$(!1):this.cont.tryResumeWithException_tcv7n7$(t.receiveException);null!=e&&(this.iterator.result=t,this.cont.completeResume_za3rmp$(e))},Oi.prototype.resumeOnCancellationFun_11rb$=function(t){var e;return null!=(e=this.iterator.channel.onUndeliveredElement_0)?Ba(e,t,this.cont.context):null},Oi.prototype.toString=function(){return"ReceiveHasNext@"+qs(this)},Oi.$metadata$={kind:a,simpleName:"ReceiveHasNext",interfaces:[Ai]},Ni.prototype.tryResumeReceive_j43gjz$=function(t,n){var i;return null==(i=this.select.trySelectOther_uc1cc4$(n))||e.isType(i,Wa)?i:o()},Ni.prototype.completeResumeReceive_11rb$=function(t){Za(this.block,2===this.receiveMode?new Zi(t):t,this.select.completion,this.resumeOnCancellationFun_11rb$(t))},Ni.prototype.resumeReceiveClosed_1zqbm$=function(t){if(this.select.trySelect())switch(this.receiveMode){case 0:this.select.resumeSelectWithException_tcv7n7$(t.receiveException);break;case 2:Za(this.block,new Zi(new Qi(t.closeCause)),this.select.completion);break;case 1:null==t.closeCause?Za(this.block,null,this.select.completion):this.select.resumeSelectWithException_tcv7n7$(t.receiveException)}},Ni.prototype.dispose=function(){this.remove()&&this.channel.onReceiveDequeued()},Ni.prototype.resumeOnCancellationFun_11rb$=function(t){var e;return null!=(e=this.channel.onUndeliveredElement_0)?Ba(e,t,this.select.completion.context):null},Ni.prototype.toString=function(){return"ReceiveSelect@"+qs(this)+"["+this.select+",receiveMode="+this.receiveMode+"]"},Ni.$metadata$={kind:a,simpleName:"ReceiveSelect",interfaces:[nn,Ai]},vi.$metadata$={kind:a,simpleName:"AbstractChannel",interfaces:[rr,pi]},zi.prototype.undeliveredElement=function(){},zi.$metadata$={kind:a,simpleName:"Send",interfaces:[Ol]},ji.$metadata$={kind:x,simpleName:"ReceiveOrClosed",interfaces:[]},Object.defineProperty(Ti.prototype,"pollResult",{get:function(){return this.pollResult_vo6xxe$_0}}),Ti.prototype.tryResumeSend_uc1cc4$=function(t){return null==this.cont.tryResume_19pj23$(p,null!=t?t.desc:null)?null:(null!=t&&t.finishPrepare(),n)},Ti.prototype.completeResumeSend=function(){this.cont.completeResume_za3rmp$(n)},Ti.prototype.resumeSendClosed_1zqbm$=function(t){var e=this.cont,n=t.sendException;e.resumeWith_tl1gpc$(new m(N(n)))},Ti.prototype.toString=function(){return Fs(this)+"@"+qs(this)+"("+this.pollResult+")"},Ti.$metadata$={kind:a,simpleName:"SendElement",interfaces:[zi]},Pi.prototype.remove=function(){return!!Ti.prototype.remove.call(this)&&(this.undeliveredElement(),!0)},Pi.prototype.undeliveredElement=function(){Ua(this.onUndeliveredElement,this.pollResult,this.cont.context)},Pi.$metadata$={kind:a,simpleName:"SendElementWithUndeliveredHandler",interfaces:[Ti]},Object.defineProperty(Ri.prototype,"sendException",{configurable:!0,get:function(){var t;return null!=(t=this.closeCause)?t:new ur(ar)}}),Object.defineProperty(Ri.prototype,"receiveException",{configurable:!0,get:function(){var t;return null!=(t=this.closeCause)?t:new pr(ar)}}),Object.defineProperty(Ri.prototype,"offerResult",{configurable:!0,get:function(){return this}}),Object.defineProperty(Ri.prototype,"pollResult",{configurable:!0,get:function(){return this}}),Ri.prototype.tryResumeSend_uc1cc4$=function(t){return null!=t&&t.finishPrepare(),n},Ri.prototype.completeResumeSend=function(){},Ri.prototype.tryResumeReceive_j43gjz$=function(t,e){return null!=e&&e.finishPrepare(),n},Ri.prototype.completeResumeReceive_11rb$=function(t){},Ri.prototype.resumeSendClosed_1zqbm$=function(t){},Ri.prototype.toString=function(){return"Closed@"+qs(this)+"["+C(this.closeCause)+"]"},Ri.$metadata$={kind:a,simpleName:"Closed",interfaces:[ji,zi]},Object.defineProperty(Ai.prototype,"offerResult",{configurable:!0,get:function(){return Xn}}),Ai.prototype.resumeOnCancellationFun_11rb$=function(t){return null},Ai.$metadata$={kind:a,simpleName:"Receive",interfaces:[ji,Ol]},Object.defineProperty(Ii.prototype,"head_0",{configurable:!0,get:function(){return this._head_0},set:function(t){this._head_0=t}}),Object.defineProperty(Ii.prototype,"tail_0",{configurable:!0,get:function(){return this._tail_0},set:function(t){this._tail_0=t}}),Object.defineProperty(Ii.prototype,"size_0",{configurable:!0,get:function(){return this._size_0},set:function(t){this._size_0=t}}),Object.defineProperty(Ii.prototype,"isBufferAlwaysFull",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Ii.prototype,"isBufferFull",{configurable:!0,get:function(){return this.size_0>=this.capacity}}),Ii.prototype.openSubscription=function(){var t=new Mi(this);return this.updateHead_0(t),t},Ii.prototype.close_dbl4no$$default=function(t){return!!this.close_dbl4no$(t,pi.prototype.close_dbl4no$$default.bind(this))&&(this.checkSubOffers_0(),!0)},Ii.prototype.cancel_dbl4no$$default=function(t){return this.cancelInternal_0(t)},Ii.prototype.cancel_m4sck1$$default=function(t){this.cancelInternal_0(t)},Ii.prototype.cancelInternal_0=function(t){var e,n=this.close_dbl4no$(t);for(e=this.subscribers_0.iterator();e.hasNext();)e.next().cancelInternal_fg6mcv$(t);return n},Ii.prototype.offerInternal_11rb$=function(t){var n;if(null!=(n=this.closedForSend_0))return n;var i=this.size_0;if(i>=this.capacity)return ti;var r=this.tail_0;return this.buffer_0[r.modulo(e.Long.fromInt(this.capacity)).toInt()]=t,this.size_0=i+1|0,this.tail_0=r.add(e.Long.fromInt(1)),this.checkSubOffers_0(),Xn},Ii.prototype.offerSelectInternal_ys5ufj$=function(t,n){var i;if(null!=(i=this.closedForSend_0))return i;var r=this.size_0;if(r>=this.capacity)return ti;if(!n.trySelect())return Ko;var o=this.tail_0;return this.buffer_0[o.modulo(e.Long.fromInt(this.capacity)).toInt()]=t,this.size_0=r+1|0,this.tail_0=o.add(e.Long.fromInt(1)),this.checkSubOffers_0(),Xn},Ii.prototype.checkSubOffers_0=function(){var t,e=!1,n=!1;for(t=this.subscribers_0.iterator();t.hasNext();)n=!0,t.next().checkOffer()&&(e=!0);!e&&n||this.updateHead_0()},Ii.prototype.updateHead_0=function(t,n){void 0===t&&(t=null),void 0===n&&(n=null);var i={v:null};t:do{var r,a;if(null!=t){t.subHead=this.tail_0;var s=this.subscribers_0.isEmpty();if(this.subscribers_0.add_11rb$(t),!s)return}if(null!=n&&(this.subscribers_0.remove_11rb$(n),!b(this.head_0,n.subHead)))return;var l=this.computeMinHead_0(),c=this.tail_0,u=this.head_0,p=tt(l,c);if(p.compareTo_11rb$(u)<=0)return;for(var h=this.size_0;u.compareTo_11rb$(p)<0;){this.buffer_0[u.modulo(e.Long.fromInt(this.capacity)).toInt()]=null;var f=h>=this.capacity;if(this.head_0=u=u.inc(),this.size_0=h=h-1|0,f)for(;null!=(r=this.takeFirstSendOrPeekClosed_0())&&(i.v=r,!e.isType(i.v,Ri));)if(null!=B(i.v).tryResumeSend_uc1cc4$(null)){this.buffer_0[c.modulo(e.Long.fromInt(this.capacity)).toInt()]=(e.isType(a=i.v,zi)?a:o()).pollResult,this.size_0=h+1|0,this.tail_0=c.add(e.Long.fromInt(1));break t}}return}while(0);B(i.v).completeResumeSend(),this.checkSubOffers_0(),this.updateHead_0()},Ii.prototype.computeMinHead_0=function(){var t,e=D;for(t=this.subscribers_0.iterator();t.hasNext();){var n=t.next();e=tt(e,n.subHead)}return e},Ii.prototype.elementAt_0=function(t){var n;return null==(n=this.buffer_0[t.modulo(e.Long.fromInt(this.capacity)).toInt()])||e.isType(n,r)?n:o()},Object.defineProperty(Mi.prototype,"subHead",{configurable:!0,get:function(){return this._subHead_0},set:function(t){this._subHead_0=t}}),Object.defineProperty(Mi.prototype,"isBufferAlwaysEmpty",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Mi.prototype,"isBufferEmpty",{configurable:!0,get:function(){return this.subHead.compareTo_11rb$(this.broadcastChannel_0.tail_0)>=0}}),Object.defineProperty(Mi.prototype,"isBufferAlwaysFull",{configurable:!0,get:function(){throw S("Should not be used".toString())}}),Object.defineProperty(Mi.prototype,"isBufferFull",{configurable:!0,get:function(){throw S("Should not be used".toString())}}),Mi.prototype.close_dbl4no$$default=function(t){var e=this.close_dbl4no$(t,vi.prototype.close_dbl4no$$default.bind(this));return e&&(this.broadcastChannel_0.updateHead_0(void 0,this),this.subHead=this.broadcastChannel_0.tail_0),e},Mi.prototype.checkOffer=function(){var t,n,i,a=!1,s=null;t:for(;this.needsToCheckOfferWithoutLock_0()&&this.subLock_0.tryLock();){var l,c;try{if((c=this.peekUnderLock_0())===ei)continue t;if(e.isType(c,Ri)){s=c;break t}if(null==(t=this.takeFirstReceiveOrPeekClosed()))break;if(l=t,e.isType(l,Ri))break;if(null==l.tryResumeReceive_j43gjz$(null==(n=c)||e.isType(n,r)?n:o(),null))continue;var u=this.subHead;this.subHead=u.add(e.Long.fromInt(1)),a=!0}finally{this.subLock_0.unlock()}B(l).completeResumeReceive_11rb$(null==(i=c)||e.isType(i,r)?i:o())}return null!=s&&this.close_dbl4no$(s.closeCause),a},Mi.prototype.pollInternal=function(){var t,n,i={v:!1},r=this.peekUnderLock_0();if(!e.isType(r,Ri)&&r!==ei){var o=this.subHead;this.subHead=o.add(e.Long.fromInt(1)),i.v=!0}var a=r;return null!=(n=e.isType(t=a,Ri)?t:null)&&this.close_dbl4no$(n.closeCause),this.checkOffer()&&(i.v=!0),i.v&&this.broadcastChannel_0.updateHead_0(),a},Mi.prototype.pollSelectInternal_y5yyj0$=function(t){var n,i,r={v:!1},o=this.peekUnderLock_0();if(!e.isType(o,Ri)&&o!==ei)if(t.trySelect()){var a=this.subHead;this.subHead=a.add(e.Long.fromInt(1)),r.v=!0}else o=Ko;var s=o;return null!=(i=e.isType(n=s,Ri)?n:null)&&this.close_dbl4no$(i.closeCause),this.checkOffer()&&(r.v=!0),r.v&&this.broadcastChannel_0.updateHead_0(),s},Mi.prototype.needsToCheckOfferWithoutLock_0=function(){return null==this.closedForReceive_0&&(!this.isBufferEmpty||null!=this.broadcastChannel_0.closedForReceive_0)},Mi.prototype.peekUnderLock_0=function(){var t,e=this.subHead,n=this.broadcastChannel_0.closedForReceive_0,i=this.broadcastChannel_0.tail_0;if(e.compareTo_11rb$(i)>=0)return null!=(t=null!=n?n:this.closedForReceive_0)?t:ei;var r=this.broadcastChannel_0.elementAt_0(e),o=this.closedForReceive_0;return null!=o?o:r},Mi.$metadata$={kind:a,simpleName:"Subscriber",interfaces:[vi,Ji]},Object.defineProperty(Ii.prototype,"bufferDebugString",{configurable:!0,get:function(){return"(buffer:capacity="+this.buffer_0.length+",size="+this.size_0+")"}}),Ii.$metadata$={kind:a,simpleName:"ArrayBroadcastChannel",interfaces:[Ui,pi]},Object.defineProperty(Li.prototype,"isBufferAlwaysEmpty",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Li.prototype,"isBufferEmpty",{configurable:!0,get:function(){return 0===this.size_0}}),Object.defineProperty(Li.prototype,"isBufferAlwaysFull",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Li.prototype,"isBufferFull",{configurable:!0,get:function(){return this.size_0===this.capacity_0&&this.onBufferOverflow_0===Ki()}}),Object.defineProperty(Li.prototype,"isFull",{configurable:!0,get:function(){return this.isFullImpl_0}}),Object.defineProperty(Li.prototype,"isEmpty",{configurable:!0,get:function(){return this.isEmptyImpl_0}}),Object.defineProperty(Li.prototype,"isClosedForReceive",{configurable:!0,get:function(){return e.callGetter(this,vi.prototype,"isClosedForReceive")}}),Li.prototype.offerInternal_11rb$=function(t){var n={v:null};t:do{var i,r,o,a=this.size_0;if(null!=(i=this.closedForSend_0))return i;if(null!=(r=this.updateBufferSize_0(a)))return r;if(0===a)for(;null!=(o=this.takeFirstReceiveOrPeekClosed());){if(n.v=o,e.isType(n.v,Ri))return this.size_0=a,B(n.v);if(null!=B(n.v).tryResumeReceive_j43gjz$(t,null)){this.size_0=a;break t}}return this.enqueueElement_0(a,t),Xn}while(0);return B(n.v).completeResumeReceive_11rb$(t),B(n.v).offerResult},Li.prototype.offerSelectInternal_ys5ufj$=function(t,n){var i={v:null};t:do{var r,o,a=this.size_0;if(null!=(r=this.closedForSend_0))return r;if(null!=(o=this.updateBufferSize_0(a)))return o;if(0===a)e:for(;;){var s=this.describeTryOffer_0(t),l=n.performAtomicTrySelect_6q0pxr$(s);if(null==l){this.size_0=a,i.v=s.result;break t}if(l===ti)break e;if(l!==Fo){if(l===Ko||e.isType(l,Ri))return this.size_0=a,l;throw S(("performAtomicTrySelect(describeTryOffer) returned "+C(l)).toString())}}return n.trySelect()?(this.enqueueElement_0(a,t),Xn):(this.size_0=a,Ko)}while(0);return B(i.v).completeResumeReceive_11rb$(t),B(i.v).offerResult},Li.prototype.enqueueSend_vs6846$=function(t){return vi.prototype.enqueueSend_vs6846$.call(this,t)},Li.prototype.updateBufferSize_0=function(t){var n;if(t=this.buffer_0.length){for(var n=2*this.buffer_0.length|0,i=this.capacity_0,r=nt.min(n,i),o=e.newArray(r,null),a=0;a0&&(l=u,c=p)}return l}catch(t){throw e.isType(t,n)?(a=t,t):t}finally{i(t,a)}}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.channels.none_4c38lx$",k((function(){var n=e.kotlin.Unit,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s=null;try{var l;for(l=t.iterator();e.suspendCall(l.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());)if(o(l.next()))return!1}catch(t){throw e.isType(t,i)?(s=t,t):t}finally{r(t,s)}return e.setCoroutineResult(n,e.coroutineReceiver()),!0}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.channels.reduce_vk3vfd$",k((function(){var n=e.kotlin.UnsupportedOperationException_init_pdl1vj$,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s=null;try{var l=t.iterator();if(e.suspendCall(l.hasNext(e.coroutineReceiver())),!e.coroutineResult(e.coroutineReceiver()))throw n("Empty channel can't be reduced.");for(var c=l.next();e.suspendCall(l.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());)c=o(c,l.next());return c}catch(t){throw e.isType(t,i)?(s=t,t):t}finally{r(t,s)}}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.channels.reduceIndexed_a6mkxp$",k((function(){var n=e.kotlin.UnsupportedOperationException_init_pdl1vj$,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s=null;try{var l,c=t.iterator();if(e.suspendCall(c.hasNext(e.coroutineReceiver())),!e.coroutineResult(e.coroutineReceiver()))throw n("Empty channel can't be reduced.");for(var u=1,p=c.next();e.suspendCall(c.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());)p=o((u=(l=u)+1|0,l),p,c.next());return p}catch(t){throw e.isType(t,i)?(s=t,t):t}finally{r(t,s)}}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.channels.sumBy_fl2dz0$",k((function(){var n=e.kotlin.Unit,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s={v:0},l=null;try{var c;for(c=t.iterator();e.suspendCall(c.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());){var u=c.next();s.v=s.v+o(u)|0}}catch(t){throw e.isType(t,i)?(l=t,t):t}finally{r(t,l)}return e.setCoroutineResult(n,e.coroutineReceiver()),s.v}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.channels.sumByDouble_jy8qhg$",k((function(){var n=e.kotlin.Unit,i=Error,r=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,o,a){var s={v:0},l=null;try{var c;for(c=t.iterator();e.suspendCall(c.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());){var u=c.next();s.v+=o(u)}}catch(t){throw e.isType(t,i)?(l=t,t):t}finally{r(t,l)}return e.setCoroutineResult(n,e.coroutineReceiver()),s.v}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.channels.partition_4c38lx$",k((function(){var n=e.kotlin.collections.ArrayList_init_287e2$,i=e.kotlin.Unit,r=e.kotlin.Pair,o=Error,a=t.kotlinx.coroutines.channels.cancelConsumed_v57n85$;return function(t,s,l){var c=n(),u=n(),p=null;try{var h;for(h=t.iterator();e.suspendCall(h.hasNext(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver());){var f=h.next();s(f)?c.add_11rb$(f):u.add_11rb$(f)}}catch(t){throw e.isType(t,o)?(p=t,t):t}finally{a(t,p)}return e.setCoroutineResult(i,e.coroutineReceiver()),new r(c,u)}}))),_r.$metadata$={kind:O,simpleName:"Companion",interfaces:[]};var yr,mr,vr,$r,gr=null;function br(){return null===gr&&new _r,gr}function wr(t,e){this.value=t,this.subscribers=e}function kr(t){this.closeCause=t}function Sr(t){this.this$ConflatedBroadcastChannel=t}function xr(t){Er.call(this,null),this.broadcastChannel_0=t}function Er(t){vi.call(this,t),this.lock_0=new kl,this.value_0=Qn}function Cr(t){vi.call(this,t)}function Or(t){return function(e){var n=new Ht(_(e),1);return n.initCancellability(),t(n),n.getResult()}}function Nr(){}function zr(){return p}function jr(t){return function(e){var n;return t.invokeOnClose_f05bi3$((n=e,function(t){return n.resumeWith_tl1gpc$(new m(p)),p})),p}}function Tr(t,e,n){c.call(this,n),this.exceptionState_0=5,this.local$$receiver=t,this.local$block=e}function Pr(t,e,n,i,r,o,a){void 0===e&&(e=v.EmptyCoroutineContext),void 0===n&&(n=0),void 0===i&&(i=Ki()),void 0===r&&(r=Ae()),void 0===o&&(o=null);var s=cr(n,i),l=new Rr(As(t,e),s);return null!=o&&l.invokeOnCompletion_f05bi3$(o),l.start_b5ul0p$(r,l,a),l}function Rr(t,e){hr.call(this,t,e,!0)}function Ar(t){vi.call(this,t)}function Ir(t){Hr.call(this),this.block_0=t}function Mr(t,e,n){c.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$collector=e}function Lr(t,e,n,i){void 0===e&&(e=v.EmptyCoroutineContext),void 0===n&&(n=-2),void 0===i&&(i=Ki()),yo.call(this,e,n,i),this.block_0=t}function Dr(t,e,n,i){void 0===e&&(e=v.EmptyCoroutineContext),void 0===n&&(n=-2),void 0===i&&(i=Ki()),Lr.call(this,t,e,n,i),this.block_1=t}function qr(t,e,n){c.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$scope=e}function Fr(t,e,n){return r=new Ur(t,e,!0,n),i?r:r.doResume(null);var i,r}function Ur(t,e,n,i){c.call(this,i),this.exceptionState_0=9,this.local$cause=void 0,this.local$result=void 0,this.local$$receiver=t,this.local$channel=e,this.local$consume=n}function Br(){}function Hr(){}function Vr(t,e,n){c.call(this,n),this.exceptionState_0=5,this.$this=t,this.local$safeCollector=void 0,this.local$collector=e}function Kr(){}function Wr(t){return function(e){var n=new Ht(_(e),1);return n.initCancellability(),t(n),n.getResult()}}function Yr(){}function Gr(){}function Jr(){ho.call(this),this.index=pt,this.cont=null}function Zr(t,e,n){fo.call(this),this.replay_0=t,this.bufferCapacity_0=e,this.onBufferOverflow_0=n,this.buffer_0=null,this.replayIndex_0=F,this.minCollectorIndex_0=F,this.bufferSize_0=0,this.queueSize_0=0}function Qr(t,e,n){c.call(this,n),this.exceptionState_0=11,this.$this=t,this.local$slot=void 0,this.local$collectorJob=void 0,this.local$newValue=void 0,this.local$collector=e}function Xr(t,e,n){c.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$value=e}function to(t,e,n,i){this.flow=t,this.index=e,this.value=n,this.cont=i}function eo(t,e){return t[e.toInt()&t.length-1]}function no(t,e,n){t[e.toInt()&t.length-1]=n}function io(t,e,n,i){return 0!==n&&-3!==n||i!==Ki()?new wo(t,e,n,i):t}function ro(){}function oo(){}function ao(t){return new lo(null!=t?t:Do)}function so(){ho.call(this),this._state_0=null}function lo(t){fo.call(this),this._state_0=t,this.sequence_0=0}function co(t,e,n){c.call(this,n),this.exceptionState_0=10,this.$this=t,this.local$slot=void 0,this.local$collectorJob=void 0,this.local$oldState=void 0,this.local$newState=void 0,this.local$collector=e}function uo(t,e){for(;;){var n=t.value;if(t.compareAndSet_xwzc9q$(n,n+e|0))return}}function po(t,e,n,i){return(0<=n&&n<=1||-2===n)&&i===Wi()?t:io(t,e,n,i)}function ho(){}function fo(){this.slots_jbqomn$_0=null,this.nCollectors_uj653m$_0=0,this.nextIndex_0=0,this._subscriptionCount_0=null}function _o(){}function yo(t,e,n){this.context=t,this.capacity=e,this.onBufferOverflow=n}function mo(t,e,n){c.call(this,n),this.exceptionState_0=1,this.local$this$ChannelFlow=t,this.local$it=e}function vo(t,e,n,i,r){c.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$collector=t,this.local$this$ChannelFlow=e,this.local$$receiver=n}function $o(t,e,n,i){yo.call(this,e,n,i),this.flow_0=t}function go(t,e,n){c.call(this,n),this.exceptionState_0=1,this.local$this$ChannelFlowOperator=t,this.local$it=e}function bo(t,e,n){c.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$collectContext=void 0,this.local$newContext=void 0,this.local$collector=e}function wo(t,e,n,i){void 0===e&&(e=v.EmptyCoroutineContext),void 0===n&&(n=-3),void 0===i&&(i=Ki()),$o.call(this,t,e,n,i)}function ko(t,e){var n;this.emitContext_0=e,this.countOrElement_0=(this.emitContext_0,0),this.emitRef_0=(n=t,function(t,e,i){var r=new So(n,t,e);return i?r:r.doResume(null)})}function So(t,e,n){c.call(this,n),this.exceptionState_0=1,this.local$closure$downstream=t,this.local$it=e}function xo(t,e,n,i,r){return void 0===n&&(n=0),(o=t,a=i,s=e,function(t){return a(s,new Eo(t,o),!1)})(r);var o,a,s}function Eo(t,e){this.uCont_0=t,this.context_rbjqds$_0=e}function Co(t,e){return(n=t,function(t){var e=new Oo(t.context,t);return is(e,e,n)})(e);var n}function Oo(t,e){Va.call(this,t,e)}function No(t){this.closure$action=t}function zo(t,e,n,i,r){void 0===n&&(n=v.EmptyCoroutineContext),void 0===i&&(i=-2),void 0===r&&(r=Ki()),$o.call(this,e,n,i,r),this.transform_0=t}function jo(t,e,n,i,r,o){c.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$collector=t,this.local$this$ChannelFlowTransformLatest=e,this.local$closure$value=n}function To(t,e,n){return function(i,r,o){var a=new jo(t,e,n,i,this,r);return o?a:a.doResume(null)}}function Po(t,e,n,i,r,o){c.call(this,o),this.exceptionState_0=1,this.local$closure$previousFlow=t,this.local$closure$collector=e,this.local$this$ChannelFlowTransformLatest=n,this.local$this$=i,this.local$value=r}function Ro(t,e,n,i){return function(r,o,a){var s=new Po(t,e,n,i,r,o);return a?s:s.doResume(null)}}function Ao(t,e,n,i,r){c.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$this$ChannelFlowTransformLatest=t,this.local$closure$collector=e,this.local$$receiver=n}function Io(t,e){return function(n,i,r){var o=new Ao(t,e,n,this,i);return r?o:o.doResume(null)}}function Mo(t,e,n){c.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$collector=e}function Lo(){aa=this}wr.$metadata$={kind:a,simpleName:"State",interfaces:[]},Object.defineProperty(kr.prototype,"sendException",{configurable:!0,get:function(){var t;return null!=(t=this.closeCause)?t:new ur(ar)}}),Object.defineProperty(kr.prototype,"valueException",{configurable:!0,get:function(){var t;return null!=(t=this.closeCause)?t:S(ar)}}),kr.$metadata$={kind:a,simpleName:"Closed",interfaces:[]},Object.defineProperty(dr.prototype,"value",{configurable:!0,get:function(){for(this._state_0;;){var t,n=this._state_0;if(e.isType(n,kr))throw n.valueException;if(e.isType(n,wr)){if(n.value===br().UNDEFINED_0)throw S("No value");return null==(t=n.value)||e.isType(t,r)?t:o()}throw S(("Invalid state "+n.toString()).toString())}}}),Object.defineProperty(dr.prototype,"valueOrNull",{configurable:!0,get:function(){var t=this._state_0;if(e.isType(t,kr))return null;if(e.isType(t,wr)){var n,i=t.value;return i===br().UNDEFINED_0?null:null==(n=i)||e.isType(n,r)?n:o()}throw S(("Invalid state "+t.toString()).toString())}}),Object.defineProperty(dr.prototype,"isClosedForSend",{configurable:!0,get:function(){return e.isType(this._state_0,kr)}}),Object.defineProperty(dr.prototype,"isFull",{configurable:!0,get:function(){return!1}}),dr.prototype.openSubscription=function(){var t,n=new xr(this);for(this._state_0;;){var i,a,s=this._state_0;if(e.isType(s,kr))return n.close_dbl4no$(s.closeCause),n;if(!e.isType(s,wr))throw S(("Invalid state "+s.toString()).toString());s.value!==br().UNDEFINED_0&&n.offerInternal_11rb$(null==(i=s.value)||e.isType(i,r)?i:o());var l=new wr(s.value,this.addSubscriber_0((e.isType(a=s,wr)?a:o()).subscribers,n));if((t=this)._state_0===s&&(t._state_0=l,1))return n}},dr.prototype.closeSubscriber_0=function(t){var n;for(this._state_0;;){var i,r=this._state_0;if(e.isType(r,kr))return;if(!e.isType(r,wr))throw S(("Invalid state "+r.toString()).toString());var a=new wr(r.value,this.removeSubscriber_0(B((e.isType(i=r,wr)?i:o()).subscribers),t));if((n=this)._state_0===r&&(n._state_0=a,1))return}},dr.prototype.addSubscriber_0=function(t,e){if(null==t){var n,i=d(1);n=i.length-1|0;for(var r=0;r<=n;r++)i[r]=e;return i}return t.concat([e])},dr.prototype.removeSubscriber_0=function(t,n){var i,r=t.length,a=lt(t,n);if(1===r)return null;var s=e.newArray(r-1|0,null);return ct(t,s,0,0,a),ct(t,s,a,a+1|0,t.length),e.isArray(i=s)?i:o()},dr.prototype.close_dbl4no$$default=function(t){var n;for(this._state_0;;){var i,r,a=this._state_0;if(e.isType(a,kr))return!1;if(!e.isType(a,wr))throw S(("Invalid state "+a.toString()).toString());var s=null==t?br().CLOSED_0:new kr(t);if((n=this)._state_0===a&&(n._state_0=s,1)){var l;if(null!=(r=(e.isType(i=a,wr)?i:o()).subscribers))for(l=0;l!==r.length;++l)r[l].close_dbl4no$(t);return this.invokeOnCloseHandler_0(t),!0}}},dr.prototype.invokeOnCloseHandler_0=function(t){var e,n,i=this.onCloseHandler_0;null!==i&&i!==ii&&(n=this).onCloseHandler_0===i&&(n.onCloseHandler_0=ii,1)&&("function"==typeof(e=i)?e:o())(t)},dr.prototype.invokeOnClose_f05bi3$=function(t){if(null!=(i=this).onCloseHandler_0||(i.onCloseHandler_0=t,0)){var n=this.onCloseHandler_0;throw S(n===ii?"Another handler was already registered and successfully invoked":"Another handler was already registered: "+C(n))}var i,r=this._state_0;e.isType(r,kr)&&function(e){return e.onCloseHandler_0===t&&(e.onCloseHandler_0=ii,!0)}(this)&&t(r.closeCause)},dr.prototype.cancel_dbl4no$$default=function(t){return this.close_dbl4no$(t)},dr.prototype.cancel_m4sck1$$default=function(t){this.close_dbl4no$(t)},dr.prototype.send_11rb$=function(t,e){var n;if(null!=(n=this.offerInternal_0(t)))throw n.sendException},dr.prototype.offer_11rb$=function(t){var e;if(null!=(e=this.offerInternal_0(t)))throw e.sendException;return!0},dr.prototype.offerInternal_0=function(t){if(0!==(n=this)._updating_0||(n._updating_0=1,0))return null;var n;try{for(this._state_0;;){var i,r,a=this._state_0;if(e.isType(a,kr))return a;if(!e.isType(a,wr))throw S(("Invalid state "+a.toString()).toString());var s=new wr(t,(e.isType(i=a,wr)?i:o()).subscribers);if(function(t){return t._state_0===a&&(t._state_0=s,!0)}(this)){var l;if(null!=(r=a.subscribers))for(l=0;l!==r.length;++l)r[l].offerInternal_11rb$(t);return null}}}finally{this._updating_0=0}},Sr.prototype.registerSelectClause2_rol3se$=function(t,e,n){this.this$ConflatedBroadcastChannel.registerSelectSend_0(t,e,n)},Sr.$metadata$={kind:a,interfaces:[ls]},Object.defineProperty(dr.prototype,"onSend",{configurable:!0,get:function(){return new Sr(this)}}),dr.prototype.registerSelectSend_0=function(t,e,n){var i;t.trySelect()&&(null==(i=this.offerInternal_0(e))?ts(n,this,t.completion):t.resumeSelectWithException_tcv7n7$(i.sendException))},xr.prototype.onCancelIdempotent_6taknv$=function(t){t&&this.broadcastChannel_0.closeSubscriber_0(this)},xr.prototype.offerInternal_11rb$=function(t){return Er.prototype.offerInternal_11rb$.call(this,t)},xr.$metadata$={kind:a,simpleName:"Subscriber",interfaces:[Er,Ji]},dr.$metadata$={kind:a,simpleName:"ConflatedBroadcastChannel",interfaces:[Ui]},Object.defineProperty(Er.prototype,"isBufferAlwaysEmpty",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Er.prototype,"isBufferEmpty",{configurable:!0,get:function(){return this.value_0===Qn}}),Object.defineProperty(Er.prototype,"isBufferAlwaysFull",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Er.prototype,"isBufferFull",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Er.prototype,"isEmpty",{configurable:!0,get:function(){return this.isEmptyImpl_0}}),Er.prototype.offerInternal_11rb$=function(t){var n={v:null};t:do{var i,r,o;if(null!=(i=this.closedForSend_0))return i;if(this.value_0===Qn)for(;null!=(r=this.takeFirstReceiveOrPeekClosed());){if(n.v=r,e.isType(n.v,Ri))return B(n.v);if(null!=B(n.v).tryResumeReceive_j43gjz$(t,null))break t}if(null!=(o=this.updateValueLocked_0(t)))throw o;return Xn}while(0);return B(n.v).completeResumeReceive_11rb$(t),B(n.v).offerResult},Er.prototype.offerSelectInternal_ys5ufj$=function(t,n){var i={v:null};t:do{var r,o;if(null!=(r=this.closedForSend_0))return r;if(this.value_0===Qn)e:for(;;){var a=this.describeTryOffer_0(t),s=n.performAtomicTrySelect_6q0pxr$(a);if(null==s){i.v=a.result;break t}if(s===ti)break e;if(s!==Fo){if(s===Ko||e.isType(s,Ri))return s;throw S(("performAtomicTrySelect(describeTryOffer) returned "+C(s)).toString())}}if(!n.trySelect())return Ko;if(null!=(o=this.updateValueLocked_0(t)))throw o;return Xn}while(0);return B(i.v).completeResumeReceive_11rb$(t),B(i.v).offerResult},Er.prototype.pollInternal=function(){var t,e={v:null};return this.value_0===Qn?null!=(t=this.closedForSend_0)?t:ei:(e.v=this.value_0,this.value_0=Qn,e.v)},Er.prototype.pollSelectInternal_y5yyj0$=function(t){var e,n={v:null};return this.value_0===Qn?null!=(e=this.closedForSend_0)?e:ei:t.trySelect()?(n.v=this.value_0,this.value_0=Qn,n.v):Ko},Er.prototype.onCancelIdempotent_6taknv$=function(t){var e,n={v:null};if(n.v=this.updateValueLocked_0(Qn),vi.prototype.onCancelIdempotent_6taknv$.call(this,t),null!=(e=n.v))throw e},Er.prototype.updateValueLocked_0=function(t){var n,i,a,s,l=this.value_0;l===Qn?s=null:(a=this.onUndeliveredElement_0,i=null==(n=l)||e.isType(n,r)?n:o(),s=null!=a?Fa(a,i):null);var c=s;return this.value_0=t,c},Er.prototype.enqueueReceiveInternal_i292ax$=function(t){return vi.prototype.enqueueReceiveInternal_i292ax$.call(this,t)},Object.defineProperty(Er.prototype,"bufferDebugString",{configurable:!0,get:function(){return"(value="+C(this.value_0)+")"}}),Er.$metadata$={kind:a,simpleName:"ConflatedChannel",interfaces:[vi]},Object.defineProperty(Cr.prototype,"isBufferAlwaysEmpty",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Cr.prototype,"isBufferEmpty",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Cr.prototype,"isBufferAlwaysFull",{configurable:!0,get:function(){return!1}}),Object.defineProperty(Cr.prototype,"isBufferFull",{configurable:!0,get:function(){return!1}}),Cr.prototype.offerInternal_11rb$=function(t){for(;;){var n=vi.prototype.offerInternal_11rb$.call(this,t);if(n===Xn)return Xn;if(n!==ti){if(e.isType(n,Ri))return n;throw S(("Invalid offerInternal result "+n.toString()).toString())}var i=this.sendBuffered_0(t);if(null==i)return Xn;if(e.isType(i,Ri))return i}},Cr.prototype.offerSelectInternal_ys5ufj$=function(t,n){for(var i;;){var r=this.hasReceiveOrClosed_0?vi.prototype.offerSelectInternal_ys5ufj$.call(this,t,n):null!=(i=n.performAtomicTrySelect_6q0pxr$(this.describeSendBuffered_0(t)))?i:Xn;if(r===Ko)return Ko;if(r===Xn)return Xn;if(r!==ti&&r!==Fo){if(e.isType(r,Ri))return r;throw S(("Invalid result "+r.toString()).toString())}}},Cr.prototype.onCancelIdempotentList_kji3ae$=function(t,n){var i,a,s,l,c={v:null};if(null!=(a=t.holder_0))if(e.isType(a,Y))for(var u=e.isType(l=t.holder_0,Y)?l:o(),p=u.size-1|0;p>=0;p--){var h,f,d,_,y=u.get_za3lpa$(p);e.isType(y,mi)?(_=this.onUndeliveredElement_0,f=null==(h=y.element)||e.isType(h,r)?h:o(),d=c.v,c.v=null!=_?Fa(_,f,d):null):y.resumeSendClosed_1zqbm$(n)}else{var m,v,$,g,b=null==(s=t.holder_0)||e.isType(s,r)?s:o();e.isType(b,mi)?(g=this.onUndeliveredElement_0,v=null==(m=b.element)||e.isType(m,r)?m:o(),$=c.v,c.v=null!=g?Fa(g,v,$):null):b.resumeSendClosed_1zqbm$(n)}if(null!=(i=c.v))throw i},Cr.$metadata$={kind:a,simpleName:"LinkedListChannel",interfaces:[vi]},Nr.$metadata$={kind:x,simpleName:"ProducerScope",interfaces:[Gi,Se]},Tr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Tr.prototype=Object.create(c.prototype),Tr.prototype.constructor=Tr,Tr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(void 0===this.local$block&&(this.local$block=zr),this.context.get_j3r2sn$(tn())!==this.local$$receiver)throw S("awaitClose() can only be invoked from the producer context".toString());if(this.exceptionState_0=3,this.state_0=1,this.result_0=Or(jr(this.local$$receiver))(this),this.result_0===l)return l;continue;case 1:this.exceptionState_0=5,this.finallyPath_0=[2],this.state_0=4;continue;case 2:return;case 3:this.finallyPath_0=[5],this.state_0=4;continue;case 4:this.exceptionState_0=5,this.local$block(),this.state_0=this.finallyPath_0.shift();continue;case 5:throw this.exception_0;default:throw this.state_0=5,new Error("State Machine Unreachable execution")}}catch(t){if(5===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(Rr.prototype,"isActive",{configurable:!0,get:function(){return e.callGetter(this,hr.prototype,"isActive")}}),Rr.prototype.onCompleted_11rb$=function(t){this._channel_0.close_dbl4no$()},Rr.prototype.onCancelled_z1nxw$=function(t,e){this._channel_0.close_dbl4no$(t)||e||de(this.context,t)},Rr.$metadata$={kind:a,simpleName:"ProducerCoroutine",interfaces:[Nr,hr]},Object.defineProperty(Ar.prototype,"isBufferAlwaysEmpty",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Ar.prototype,"isBufferEmpty",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Ar.prototype,"isBufferAlwaysFull",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Ar.prototype,"isBufferFull",{configurable:!0,get:function(){return!0}}),Ar.$metadata$={kind:a,simpleName:"RendezvousChannel",interfaces:[vi]},Mr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Mr.prototype=Object.create(c.prototype),Mr.prototype.constructor=Mr,Mr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.block_0(this.local$collector,this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ir.prototype.collectSafely_42ocv1$=function(t,e,n){var i=new Mr(this,t,e);return n?i:i.doResume(null)},Ir.$metadata$={kind:a,simpleName:"SafeFlow",interfaces:[Hr]},Lr.prototype.create_5k3f3z$=function(t,e,n){return new Lr(this.block_0,t,e,n)},Lr.prototype.collectTo_sz7tnc$=function(t,e){return this.block_0(t,e)},Lr.prototype.toString=function(){return"block["+this.block_0+"] -> "+yo.prototype.toString.call(this)},Lr.$metadata$={kind:a,simpleName:"ChannelFlowBuilder",interfaces:[yo]},qr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},qr.prototype=Object.create(c.prototype),qr.prototype.constructor=qr,qr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Lr.prototype.collectTo_sz7tnc$.call(this.$this,this.local$scope,this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:if(!this.local$scope.isClosedForSend)throw S(ut("\n 'awaitClose { yourCallbackOrListener.cancel() }' should be used in the end of callbackFlow block.\n Otherwise, a callback/listener may leak in case of external cancellation.\n See callbackFlow API documentation for the details.\n "));return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Dr.prototype.collectTo_sz7tnc$=function(t,e,n){var i=new qr(this,t,e);return n?i:i.doResume(null)},Dr.prototype.create_5k3f3z$=function(t,e,n){return new Dr(this.block_1,t,e,n)},Dr.$metadata$={kind:a,simpleName:"CallbackFlowBuilder",interfaces:[Lr]},Ur.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Ur.prototype=Object.create(c.prototype),Ur.prototype.constructor=Ur,Ur.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;this.local$cause=null,this.exceptionState_0=6,this.state_0=1;continue;case 1:if(this.state_0=2,this.result_0=this.local$channel.receiveOrClosed(this),this.result_0===l)return l;continue;case 2:if(this.local$result=this.result_0,this.local$result.isClosed){if(null!=(t=this.local$result.closeCause))throw t;this.state_0=5;continue}this.state_0=3;continue;case 3:if(this.state_0=4,this.result_0=this.local$$receiver.emit_11rb$(this.local$result.value,this),this.result_0===l)return l;continue;case 4:this.state_0=1;continue;case 5:this.exceptionState_0=9,this.finallyPath_0=[8],this.state_0=7;continue;case 6:this.finallyPath_0=[9],this.exceptionState_0=7;var n=this.exception_0;throw e.isType(n,E)?(this.local$cause=n,n):n;case 7:this.exceptionState_0=9,this.local$consume&&fr(this.local$channel,this.local$cause),this.state_0=this.finallyPath_0.shift();continue;case 8:return;case 9:throw this.exception_0;default:throw this.state_0=9,new Error("State Machine Unreachable execution")}}catch(n){if(9===this.state_0)throw this.exceptionState_0=this.state_0,n;this.state_0=this.exceptionState_0,this.exception_0=n}},Br.$metadata$={kind:x,simpleName:"Flow",interfaces:[]},Vr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Vr.prototype=Object.create(c.prototype),Vr.prototype.constructor=Vr,Vr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$safeCollector=new gl(this.local$collector,this.context),this.exceptionState_0=3,this.state_0=1,this.result_0=this.$this.collectSafely_42ocv1$(this.local$safeCollector,this),this.result_0===l)return l;continue;case 1:this.exceptionState_0=5,this.finallyPath_0=[2],this.state_0=4;continue;case 2:return;case 3:this.finallyPath_0=[5],this.state_0=4;continue;case 4:this.exceptionState_0=5,this.local$safeCollector.releaseIntercepted(),this.state_0=this.finallyPath_0.shift();continue;case 5:throw this.exception_0;default:throw this.state_0=5,new Error("State Machine Unreachable execution")}}catch(t){if(5===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Hr.prototype.collect_42ocv1$=function(t,e,n){var i=new Vr(this,t,e);return n?i:i.doResume(null)},Hr.$metadata$={kind:a,simpleName:"AbstractFlow",interfaces:[ha,Br]},Kr.$metadata$={kind:x,simpleName:"FlowCollector",interfaces:[]},Yr.$metadata$={kind:x,simpleName:"SharedFlow",interfaces:[Br]},Gr.$metadata$={kind:x,simpleName:"MutableSharedFlow",interfaces:[Kr,Yr]},Jr.prototype.allocateLocked_11rb$=function(t){return!(this.index.toNumber()>=0||(this.index=t.updateNewCollectorIndexLocked_8be2vx$(),0))},Jr.prototype.freeLocked_11rb$=function(t){var e=this.index;return this.index=pt,this.cont=null,t.updateCollectorIndexLocked_8e33dg$(e)},Jr.$metadata$={kind:a,simpleName:"SharedFlowSlot",interfaces:[ho]},Object.defineProperty(Zr.prototype,"head_0",{configurable:!0,get:function(){var t=this.minCollectorIndex_0,e=this.replayIndex_0;return t.compareTo_11rb$(e)<=0?t:e}}),Object.defineProperty(Zr.prototype,"replaySize_0",{configurable:!0,get:function(){return this.head_0.add(e.Long.fromInt(this.bufferSize_0)).subtract(this.replayIndex_0).toInt()}}),Object.defineProperty(Zr.prototype,"totalSize_0",{configurable:!0,get:function(){return this.bufferSize_0+this.queueSize_0|0}}),Object.defineProperty(Zr.prototype,"bufferEndIndex_0",{configurable:!0,get:function(){return this.head_0.add(e.Long.fromInt(this.bufferSize_0))}}),Object.defineProperty(Zr.prototype,"queueEndIndex_0",{configurable:!0,get:function(){return this.head_0.add(e.Long.fromInt(this.bufferSize_0)).add(e.Long.fromInt(this.queueSize_0))}}),Object.defineProperty(Zr.prototype,"replayCache",{configurable:!0,get:function(){var t=this.replaySize_0;if(0===t)return u();for(var n=y(t),i=B(this.buffer_0),a=0;a=this.bufferCapacity_0&&this.minCollectorIndex_0.compareTo_11rb$(this.replayIndex_0)<=0)switch(this.onBufferOverflow_0.name){case"SUSPEND":return!1;case"DROP_LATEST":return!0}return this.enqueueLocked_0(t),this.bufferSize_0=this.bufferSize_0+1|0,this.bufferSize_0>this.bufferCapacity_0&&this.dropOldestLocked_0(),this.replaySize_0>this.replay_0&&this.updateBufferLocked_0(this.replayIndex_0.add(e.Long.fromInt(1)),this.minCollectorIndex_0,this.bufferEndIndex_0,this.queueEndIndex_0),!0},Zr.prototype.tryEmitNoCollectorsLocked_0=function(t){return 0===this.replay_0||(this.enqueueLocked_0(t),this.bufferSize_0=this.bufferSize_0+1|0,this.bufferSize_0>this.replay_0&&this.dropOldestLocked_0(),this.minCollectorIndex_0=this.head_0.add(e.Long.fromInt(this.bufferSize_0))),!0},Zr.prototype.dropOldestLocked_0=function(){no(B(this.buffer_0),this.head_0,null),this.bufferSize_0=this.bufferSize_0-1|0;var t=this.head_0.add(e.Long.fromInt(1));this.replayIndex_0.compareTo_11rb$(t)<0&&(this.replayIndex_0=t),this.minCollectorIndex_0.compareTo_11rb$(t)<0&&this.correctCollectorIndexesOnDropOldest_0(t)},Zr.prototype.correctCollectorIndexesOnDropOldest_0=function(t){var e;this.forEachSlotLocked_0((e=t,function(t){return t.index.toNumber()>=0&&t.index.compareTo_11rb$(e)<0&&(t.index=e),p})),this.minCollectorIndex_0=t},Zr.prototype.enqueueLocked_0=function(t){var n=this.totalSize_0,i=this.buffer_0;no(null==i?this.growBuffer_0(null,0,2):n>=i.length?this.growBuffer_0(i,n,2*i.length|0):i,this.head_0.add(e.Long.fromInt(n)),t)},Zr.prototype.growBuffer_0=function(t,n,i){if(!(i>0))throw S("Buffer size overflow".toString());var r=e.newArray(i,null);this.buffer_0=r;var o=r;if(null==t)return o;for(var a=this.head_0,s=0;s0)return $r;var a,s=this.head_0,l={v:s.add(e.Long.fromInt(this.bufferSize_0))};if(0===this.bufferCapacity_0&&this.queueSize_0>0&&(l.v=l.v.inc()),this.forEachSlotLocked_0((a=l,function(t){return t.index.toNumber()>=0&&t.index.compareTo_11rb$(a.v)<0&&(a.v=t.index),p})),l.v.compareTo_11rb$(this.minCollectorIndex_0)<=0)return $r;var c=this.bufferEndIndex_0;if(this.nCollectors_0>0){var u=c.subtract(l.v).toInt(),h=this.queueSize_0,f=this.bufferCapacity_0-u|0;n=nt.min(h,f)}else n=this.queueSize_0;var d=n,_=$r,y=c.add(e.Long.fromInt(this.queueSize_0));if(d>0){_=e.newArray(d,null);var m=0,v=B(this.buffer_0);for(i=ht(c,y).iterator();i.hasNext();){var $=i.next(),g=eo(v,$);if(g!==yr&&(e.isType(g,to)||o(),_[(r=m,m=r+1|0,r)]=g.cont,no(v,$,yr),no(v,c,g.value),c=c.inc(),m>=d))break}}var w=c.subtract(s).toInt();0===this.nCollectors_0&&(l.v=c);var k=this.replayIndex_0,S=c,x=this.replay_0,E=S.subtract(e.Long.fromInt(nt.min(x,w))),C=k.compareTo_11rb$(E)>=0?k:E;return 0===this.bufferCapacity_0&&C.compareTo_11rb$(y)<0&&b(eo(B(this.buffer_0),C),yr)&&(c=c.inc(),C=C.inc()),this.updateBufferLocked_0(C,l.v,c,y),this.cleanupTailLocked_0(),0!==_.length&&(_=this.findSlotsToResumeLocked_0(_)),_},Zr.prototype.updateBufferLocked_0=function(t,e,n,i){var r,o=e.compareTo_11rb$(t)<=0?e:t;for(r=ht(this.head_0,o).iterator();r.hasNext();){var a=r.next();no(B(this.buffer_0),a,null)}this.replayIndex_0=t,this.minCollectorIndex_0=e,this.bufferSize_0=n.subtract(o).toInt(),this.queueSize_0=i.subtract(n).toInt()},Zr.prototype.cleanupTailLocked_0=function(){if(!(0===this.bufferCapacity_0&&this.queueSize_0<=1))for(var t=B(this.buffer_0);this.queueSize_0>0&&eo(t,this.head_0.add(e.Long.fromInt(this.totalSize_0)).subtract(e.Long.fromInt(1)))===yr;)this.queueSize_0=this.queueSize_0-1|0,no(t,this.head_0.add(e.Long.fromInt(this.totalSize_0)),null)},Zr.prototype.tryTakeValue_0=function(t){var n,i,r,o={v:$r},a=this.tryPeekLocked_0(t);if(a.toNumber()<0)r=yr;else{var s=t.index,l=this.getPeekedValueLockedAt_0(a);t.index=a.add(e.Long.fromInt(1)),o.v=this.updateCollectorIndexLocked_8e33dg$(s),r=l}var c=r;for(n=o.v,i=0;i!==n.length;++i){var u=n[i];null!=u&&u.resumeWith_tl1gpc$(new m(p))}return c},Zr.prototype.tryPeekLocked_0=function(t){var e=t.index;return e.compareTo_11rb$(this.bufferEndIndex_0)<0?e:this.bufferCapacity_0>0||e.compareTo_11rb$(this.head_0)>0||0===this.queueSize_0?pt:e},Zr.prototype.getPeekedValueLockedAt_0=function(t){var n=eo(B(this.buffer_0),t);return e.isType(n,to)?n.value:n},Zr.prototype.awaitValue_0=function(t,e){return Wr((n=this,i=t,function(t){var e=i,r=n;t:do{if(!(r.tryPeekLocked_0(e).toNumber()<0)){t.resumeWith_tl1gpc$(new m(p));break t}e.cont=t,e.cont=t}while(0);return p}))(e);var n,i},Zr.prototype.findSlotsToResumeLocked_0=function(t){var e,n,i,r={v:t},o={v:t.length};return this.forEachSlotLocked_0((e=this,n=o,i=r,function(t){var r,o;if(null!=(r=t.cont)){var a=r;if(!(e.tryPeekLocked_0(t).toNumber()<0)){if(n.v>=i.v.length){var s=i,l=i.v,c=2*i.v.length|0;s.v=ft(l,nt.max(2,c))}return i.v[(o=n.v,n.v=o+1|0,o)]=a,t.cont=null,p}}})),r.v},Zr.prototype.createSlot=function(){return new Jr},Zr.prototype.createSlotArray_za3lpa$=function(t){return e.newArray(t,null)},Zr.prototype.resetReplayCache=function(){this.updateBufferLocked_0(this.bufferEndIndex_0,this.minCollectorIndex_0,this.bufferEndIndex_0,this.queueEndIndex_0)},Zr.prototype.fuse_5k3f3z$$default=function(t,e,n){return io(this,t,e,n)},to.prototype.dispose=function(){this.flow.cancelEmitter_0(this)},to.$metadata$={kind:a,simpleName:"Emitter",interfaces:[nn]},Zr.$metadata$={kind:a,simpleName:"SharedFlowImpl",interfaces:[_o,ha,Gr,fo]},ro.$metadata$={kind:x,simpleName:"StateFlow",interfaces:[Yr]},oo.$metadata$={kind:x,simpleName:"MutableStateFlow",interfaces:[Gr,ro]},so.prototype.allocateLocked_11rb$=function(t){return null==this._state_0&&(this._state_0=mr,!0)},so.prototype.freeLocked_11rb$=function(t){return this._state_0=null,$r},so.prototype.makePending=function(){var t;for(this._state_0;;){var n,i=this._state_0;if(null==i)return;if(i===vr)return;if(i===mr){if((t=this)._state_0===i&&(t._state_0=vr,1))return}else if(function(t){return t._state_0===i&&(t._state_0=mr,!0)}(this))return void(e.isType(n=i,Ht)?n:o()).resumeWith_tl1gpc$(new m(p))}},so.prototype.takePending=function(){return B((e=(t=this)._state_0,t._state_0=mr,e))===vr;var t,e},so.prototype.awaitPending=function(t){return(n=this,e=function(t){if(n._state_0!==mr||(n._state_0=t,0))return t.resumeWith_tl1gpc$(new m(p)),p},function(t){var n=new Ht(_(t),1);return n.initCancellability(),e(n),n.getResult()})(t);var e,n},so.$metadata$={kind:a,simpleName:"StateFlowSlot",interfaces:[ho]},Object.defineProperty(lo.prototype,"value",{configurable:!0,get:function(){var t,n=this._state_0;return n===Do?null:null==(t=n)||e.isType(t,r)?t:o()},set:function(t){this.updateState_0(null,null!=t?t:Do)}}),lo.prototype.compareAndSet_xwzc9q$=function(t,e){return this.updateState_0(null!=t?t:Do,null!=e?e:Do)},lo.prototype.updateState_0=function(t,e){var n,i={v:0},r={v:this.slots_0},o=this._state_0;if(null!=t&&!b(o,t))return!1;if(b(o,e))return!0;if(this._state_0=e,i.v=this.sequence_0,0!=(1&i.v))return this.sequence_0=i.v+2|0,!0;for(i.v=i.v+1|0,this.sequence_0=i.v,r.v=this.slots_0;;){var a;if(null!=(n=r.v))for(a=0;a!==n.length;++a){var s=n[a];null!=s&&s.makePending()}if(this.sequence_0===i.v)return this.sequence_0=i.v+1|0,!0;i.v=this.sequence_0,r.v=this.slots_0}},Object.defineProperty(lo.prototype,"replayCache",{configurable:!0,get:function(){return _t(this.value)}}),lo.prototype.tryEmit_11rb$=function(t){return this.value=t,!0},lo.prototype.emit_11rb$=function(t,e){this.value=t},lo.prototype.resetReplayCache=function(){throw Z("MutableStateFlow.resetReplayCache is not supported")},co.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},co.prototype=Object.create(c.prototype),co.prototype.constructor=co,co.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$slot=this.$this.allocateSlot_0(),this.exceptionState_0=8,e.isType(this.local$collector,ya)){if(this.state_0=1,this.result_0=this.local$collector.onSubscription(this),this.result_0===l)return l;continue}this.state_0=2;continue;case 1:this.state_0=2;continue;case 2:this.result_0=this.context,this.local$collectorJob=this.result_0.get_j3r2sn$(tn()),this.local$oldState=null,this.state_0=3;continue;case 3:if(this.local$newState=this.$this._state_0,null!=this.local$collectorJob&&sn(this.local$collectorJob),null!=this.local$oldState&&b(this.local$oldState,this.local$newState)){this.state_0=5;continue}var t;if(this.state_0=4,this.result_0=this.local$collector.emit_11rb$(this.local$newState===Do?null:null==(t=this.local$newState)||e.isType(t,r)?t:o(),this),this.result_0===l)return l;continue;case 4:this.local$oldState=this.local$newState,this.state_0=5;continue;case 5:if(this.local$slot.takePending()){this.state_0=7;continue}if(this.state_0=6,this.result_0=this.local$slot.awaitPending(this),this.result_0===l)return l;continue;case 6:this.state_0=7;continue;case 7:this.state_0=3;continue;case 8:this.finallyPath_0=[10],this.state_0=9;continue;case 9:this.exceptionState_0=10,this.$this.freeSlot_0(this.local$slot),this.state_0=this.finallyPath_0.shift();continue;case 10:throw this.exception_0;default:throw this.state_0=10,new Error("State Machine Unreachable execution")}}catch(t){if(10===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},lo.prototype.collect_42ocv1$=function(t,e,n){var i=new co(this,t,e);return n?i:i.doResume(null)},lo.prototype.createSlot=function(){return new so},lo.prototype.createSlotArray_za3lpa$=function(t){return e.newArray(t,null)},lo.prototype.fuse_5k3f3z$$default=function(t,e,n){return po(this,t,e,n)},lo.$metadata$={kind:a,simpleName:"StateFlowImpl",interfaces:[_o,ha,oo,fo]},ho.$metadata$={kind:a,simpleName:"AbstractSharedFlowSlot",interfaces:[]},Object.defineProperty(fo.prototype,"slots_0",{configurable:!0,get:function(){return this.slots_jbqomn$_0},set:function(t){this.slots_jbqomn$_0=t}}),Object.defineProperty(fo.prototype,"nCollectors_0",{configurable:!0,get:function(){return this.nCollectors_uj653m$_0},set:function(t){this.nCollectors_uj653m$_0=t}}),Object.defineProperty(fo.prototype,"subscriptionCount",{configurable:!0,get:function(){var t,e;if(null!=(t=this._subscriptionCount_0))e=t;else{var n=ao(this.nCollectors_0);this._subscriptionCount_0=n,e=n}return e}}),fo.prototype.allocateSlot_0=function(){var t,n,i,r,a={v:null},s=this.slots_0;if(null==s){var l=this.createSlotArray_za3lpa$(2);this.slots_0=l,n=l}else if(this.nCollectors_0>=s.length){var c=ft(s,2*s.length|0);this.slots_0=c,n=c}else n=s;for(var u,p={v:n},h={v:this.nextIndex_0};;){var f;if(null!=(i=p.v[h.v]))f=i;else{var d=this.createSlot();p.v[h.v]=d,f=d}if(u=f,h.v=h.v+1|0,h.v>=p.v.length&&(h.v=0),(e.isType(r=u,ho)?r:o()).allocateLocked_11rb$(this))break}this.nextIndex_0=h.v,this.nCollectors_0=this.nCollectors_0+1|0,a.v=this._subscriptionCount_0;var _=u;return null!=(t=a.v)&&uo(t,1),_},fo.prototype.freeSlot_0=function(t){var n,i,r,a={v:null};this.nCollectors_0=this.nCollectors_0-1|0,a.v=this._subscriptionCount_0,0===this.nCollectors_0&&(this.nextIndex_0=0);var s=(e.isType(r=t,ho)?r:o()).freeLocked_11rb$(this);for(n=0;n!==s.length;++n){var l=s[n];null!=l&&l.resumeWith_tl1gpc$(new m(p))}null!=(i=a.v)&&uo(i,-1)},fo.prototype.forEachSlotLocked_0=function(t){var e,n;if(0!==this.nCollectors_0&&null!=(e=this.slots_0))for(n=0;n!==e.length;++n){var i=e[n];null!=i&&t(i)}},fo.$metadata$={kind:a,simpleName:"AbstractSharedFlow",interfaces:[]},_o.prototype.fuse_5k3f3z$=function(t,e,n,i){return void 0===t&&(t=v.EmptyCoroutineContext),void 0===e&&(e=-3),void 0===n&&(n=Ki()),i?i(t,e,n):this.fuse_5k3f3z$$default(t,e,n)},_o.$metadata$={kind:x,simpleName:"FusibleFlow",interfaces:[Br]},mo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},mo.prototype=Object.create(c.prototype),mo.prototype.constructor=mo,mo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$this$ChannelFlow.collectTo_sz7tnc$(this.local$it,this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(yo.prototype,"collectToFun_8be2vx$",{configurable:!0,get:function(){return t=this,function(e,n,i){var r=new mo(t,e,n);return i?r:r.doResume(null)};var t}}),Object.defineProperty(yo.prototype,"produceCapacity_ik5e2$_0",{configurable:!0,get:function(){return-3===this.capacity?-2:this.capacity}}),yo.prototype.dropChannelOperators=function(){return null},yo.prototype.fuse_5k3f3z$$default=function(t,e,n){var i,r,o,a=t.plus_1fupul$(this.context);if(n!==Ki())r=e,o=n;else{if(-3===this.capacity)i=e;else if(-3===e)i=this.capacity;else if(-2===this.capacity)i=e;else if(-2===e)i=this.capacity;else{var s=this.capacity+e|0;i=s>=0?s:2147483647}r=i,o=this.onBufferOverflow}return b(a,this.context)&&r===this.capacity&&o===this.onBufferOverflow?this:this.create_5k3f3z$(a,r,o)},yo.prototype.broadcastImpl_uicbxq$=function(t,n){var i;switch(this.onBufferOverflow.name){case"SUSPEND":i=this.produceCapacity_ik5e2$_0;break;case"DROP_OLDEST":i=-1;break;case"DROP_LATEST":throw H("Broadcast channel does not support BufferOverflow.DROP_LATEST");default:i=e.noWhenBranchMatched()}var r=i;return Di(t,this.context,r,n,void 0,this.collectToFun_8be2vx$)},yo.prototype.produceImpl_gkk88$=function(t){return Pr(t,this.context,this.produceCapacity_ik5e2$_0,this.onBufferOverflow,Me(),void 0,this.collectToFun_8be2vx$)},vo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},vo.prototype=Object.create(c.prototype),vo.prototype.constructor=vo,vo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Fr(this.local$closure$collector,this.local$this$ChannelFlow.produceImpl_gkk88$(this.local$$receiver),this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},yo.prototype.collect_42ocv1$=function(t,e){return je((n=t,i=this,function(t,e,r){var o=new vo(n,i,t,this,e);return r?o:o.doResume(null)}),e);var n,i},yo.prototype.additionalToStringProps=function(){return null},yo.prototype.toString=function(){var t,e=y(4);return null!=(t=this.additionalToStringProps())&&e.add_11rb$(t),this.context!==v.EmptyCoroutineContext&&e.add_11rb$("context="+this.context),-3!==this.capacity&&e.add_11rb$("capacity="+this.capacity),this.onBufferOverflow!==Ki()&&e.add_11rb$("onBufferOverflow="+this.onBufferOverflow),Fs(this)+"["+dt(e,", ")+"]"},yo.$metadata$={kind:a,simpleName:"ChannelFlow",interfaces:[_o]},go.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},go.prototype=Object.create(c.prototype),go.prototype.constructor=go,go.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$this$ChannelFlowOperator.flowCollect_42ocu6$(this.local$it,this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},$o.prototype.collectWithContextUndispatched_0=function(t,n,i){var r,o,a;return xo(n,(r=t,o=i.context,e.isType(r,ua)||e.isType(r,Lo)?r:new ko(r,o)),void 0,(a=this,function(t,e,n){var i=new go(a,t,e);return n?i:i.doResume(null)}),i)},$o.prototype.collectTo_sz7tnc$=function(t,e){return this.flowCollect_42ocu6$(new ua(t),e)},bo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},bo.prototype=Object.create(c.prototype),bo.prototype.constructor=bo,bo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(-3===this.$this.capacity){if(this.local$collectContext=this.context,this.local$newContext=this.local$collectContext.plus_1fupul$(this.$this.context),b(this.local$newContext,this.local$collectContext)){if(this.state_0=2,this.result_0=this.$this.flowCollect_42ocu6$(this.local$collector,this),this.result_0===l)return l;continue}this.state_0=3;continue}this.state_0=6;continue;case 1:throw this.exception_0;case 2:return this.result_0;case 3:if(b(this.local$newContext.get_j3r2sn$(g.Key),this.local$collectContext.get_j3r2sn$(g.Key))){if(this.state_0=4,this.result_0=this.$this.collectWithContextUndispatched_0(this.local$collector,this.local$newContext,this),this.result_0===l)return l;continue}this.state_0=5;continue;case 4:return this.result_0;case 5:this.state_0=6;continue;case 6:if(this.state_0=7,this.result_0=yo.prototype.collect_42ocv1$.call(this.$this,this.local$collector,this),this.result_0===l)return l;continue;case 7:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},$o.prototype.collect_42ocv1$=function(t,e,n){var i=new bo(this,t,e);return n?i:i.doResume(null)},$o.prototype.toString=function(){return this.flow_0.toString()+" -> "+yo.prototype.toString.call(this)},$o.$metadata$={kind:a,simpleName:"ChannelFlowOperator",interfaces:[yo]},wo.prototype.create_5k3f3z$=function(t,e,n){return new wo(this.flow_0,t,e,n)},wo.prototype.dropChannelOperators=function(){return this.flow_0},wo.prototype.flowCollect_42ocu6$=function(t,e){return this.flow_0.collect_42ocv1$(t,e)},wo.$metadata$={kind:a,simpleName:"ChannelFlowOperatorImpl",interfaces:[$o]},ko.prototype.emit_11rb$=function(t,e){return xo(this.emitContext_0,t,this.countOrElement_0,this.emitRef_0,e)},So.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},So.prototype=Object.create(c.prototype),So.prototype.constructor=So,So.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$downstream.emit_11rb$(this.local$it,this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ko.$metadata$={kind:a,simpleName:"UndispatchedContextCollector",interfaces:[Kr]},Object.defineProperty(Eo.prototype,"context",{get:function(){return this.context_rbjqds$_0}}),Object.defineProperty(Eo.prototype,"callerFrame",{configurable:!0,get:function(){var t;return e.isType(t=this.uCont_0,Ml)?t:null}}),Eo.prototype.resumeWith_tl1gpc$=function(t){this.uCont_0.resumeWith_tl1gpc$(t)},Eo.prototype.getStackTraceElement=function(){return null},Eo.$metadata$={kind:a,simpleName:"StackFrameContinuation",interfaces:[Ml,s]},Oo.prototype.childCancelled_tcv7n7$=function(t){return!!e.isType(t,$l)||this.cancelImpl_8ea4ql$(t)},Oo.$metadata$={kind:a,simpleName:"FlowCoroutine",interfaces:[Va]},No.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},No.$metadata$={kind:a,interfaces:[Kr]},zo.prototype.create_5k3f3z$=function(t,e,n){return new zo(this.transform_0,this.flow_0,t,e,n)},jo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},jo.prototype=Object.create(c.prototype),jo.prototype.constructor=jo,jo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$this$ChannelFlowTransformLatest.transform_0(this.local$closure$collector,this.local$closure$value,this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Po.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Po.prototype=Object.create(c.prototype),Po.prototype.constructor=Po,Po.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(null!=(t=this.local$closure$previousFlow.v)){if(t.cancel_m4sck1$(new $l),this.state_0=2,this.result_0=t.join(this),this.result_0===l)return l;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.state_0=3;continue;case 3:return this.local$closure$previousFlow.v=jt(this.local$this$,void 0,Le(),To(this.local$closure$collector,this.local$this$ChannelFlowTransformLatest,this.local$value)),p;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ao.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Ao.prototype=Object.create(c.prototype),Ao.prototype.constructor=Ao,Ao.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$this$ChannelFlowTransformLatest.flow_0.collect_42ocv1$(new No(Ro({v:null},this.local$closure$collector,this.local$this$ChannelFlowTransformLatest,this.local$$receiver)),this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Mo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Mo.prototype=Object.create(c.prototype),Mo.prototype.constructor=Mo,Mo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Co(Io(this.$this,this.local$collector),this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},zo.prototype.flowCollect_42ocu6$=function(t,e,n){var i=new Mo(this,t,e);return n?i:i.doResume(null)},zo.$metadata$={kind:a,simpleName:"ChannelFlowTransformLatest",interfaces:[$o]},Lo.prototype.emit_11rb$=function(t,e){},Lo.$metadata$={kind:O,simpleName:"NopCollector",interfaces:[Kr]};var Do,qo,Fo,Uo,Bo,Ho,Vo,Ko,Wo,Yo,Go,Jo,Zo,Qo,Xo,ta,ea,na,ia,ra,oa,aa=null;function sa(){return null===aa&&new Lo,aa}function la(t,n){var i;if(n.fold_3cc69b$(0,(i=t,function(t,n){var r,a,s=n.key,l=i.collectContext_8be2vx$.get_j3r2sn$(s);if(s!==tn())return n!==l?-2147483648:t+1|0;var c=null==(r=l)||e.isType(r,Ze)?r:o(),u=ca(e.isType(a=n,Ze)?a:o(),c);if(u!==c)throw S(("Flow invariant is violated:\n\t\tEmission from another coroutine is detected.\n\t\tChild of "+C(u)+", expected child of "+C(c)+".\n\t\tFlowCollector is not thread-safe and concurrent emissions are prohibited.\n\t\tTo mitigate this restriction please use 'channelFlow' builder instead of 'flow'").toString());return null==c?t:t+1|0}))!==t.collectContextSize_8be2vx$)throw S(("Flow invariant is violated:\n\t\tFlow was collected in "+t.collectContext_8be2vx$+",\n\t\tbut emission happened in "+n+".\n\t\tPlease refer to 'flow' documentation or use 'flowOn' instead").toString())}function ca(t,n){return null===t?null:t===n?t:e.isType(t,Va)?ca(t.parent_8be2vx$,n):t}function ua(t){this.channel_0=t}function pa(t,n,i){if(void 0===n&&(n=-2),void 0===i&&(i=Ki()),!(n>=0||-2===n||-1===n))throw H(("Buffer size should be non-negative, BUFFERED, or CONFLATED, but was "+n).toString());if(-1===n&&i!==Ki())throw H("CONFLATED capacity cannot be used with non-default onBufferOverflow".toString());var r=n,o=i;return-1===r&&(r=0,o=Wi()),e.isType(t,_o)?t.fuse_5k3f3z$(void 0,r,o):new wo(t,void 0,r,o)}function ha(){}function fa(t,e){return new zo(e,t)}function da(t,e,n,i,r){c.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$transform=t,this.local$$receiver=e,this.local$it=n}function _a(t,e){return fa(t,(n=e,function(t,e,i,r){var o=new da(n,t,e,this,i);return r?o:o.doResume(null)}));var n}function ya(t,e){this.collector_0=t,this.action_0=e}function ma(t,e){c.call(this,e),this.exceptionState_0=7,this.$this=t,this.local$safeCollector=void 0}function va(t,e){return t.collect_42ocv1$(sa(),e)}function $a(t,e,n){c.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$action=e}function ga(t){this.closure$action=t}function ba(t,e,n){c.call(this,n),this.exceptionState_0=1,this.local$closure$destination=t,this.local$value=e}function wa(t){return function(e,n,i){var r=new ba(t,e,n);return i?r:r.doResume(null)}}function ka(t,e,n){c.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$destination=e}function Sa(t,e,n,i){var r=new ka(t,e,n);return i?r:r.doResume(null)}function xa(t){this.closure$action=t}function Ea(t,e,n){c.call(this,n),this.exceptionState_0=1,this.local$closure$i=t}function Ca(t){return function(e,n,i){var r=new Ea(t,e,n);return i?r:r.doResume(null)}}function Oa(t,e){c.call(this,e),this.exceptionState_0=1,this.local$i=void 0,this.local$$receiver=t}function Na(){this.elements_0=e.newArray(16,null),this.head_0=0,this.tail_0=0}function za(){}function ja(){za.call(this),this._consensus_c6dvpx$_0=qo}function Ta(){this.atomicOp_ss7ttb$_0=this.atomicOp_ss7ttb$_0}function Pa(t,e){Ma.call(this,-1),this.dispatcher=t,this.continuation=e,this._state_8be2vx$=Uo,this.countOrElement_8be2vx$=(this.context,0),this._reusableCancellableContinuation_0=null}function Ra(t,n,i){if(void 0===i&&(i=null),e.isType(t,Pa)){var r=ie(n,i);if(t.dispatcher.isDispatchNeeded_1fupul$(t.context))t._state_8be2vx$=r,t.resumeMode=1,t.dispatcher.dispatch_5bn72i$(t.context,t);else{var o=We().eventLoop_8be2vx$;if(o.isUnconfinedLoopActive)t._state_8be2vx$=r,t.resumeMode=1,o.dispatchUnconfined_4avnfa$(t);else{o.incrementUseCount_6taknv$(!0);try{var a;t:do{var s=t.context.get_j3r2sn$(Ze.Key);if(null!=s&&!s.isActive){var l=s.getCancellationException();t.cancelCompletedResult_83a7kv$(r,l),t.resumeWith_tl1gpc$(new m(N(l))),a=!0;break t}a=!1}while(0);for(a||t.continuation.resumeWith_tl1gpc$(n);o.processUnconfinedEvent(););}catch(n){if(!e.isType(n,E))throw n;t.handleFatalException_pr7uss$(n,null)}finally{o.decrementUseCount_6taknv$(!0)}}}}else t.resumeWith_tl1gpc$(n)}function Aa(t){return 1===t||2===t}function Ia(t){return 2===t}function Ma(t){_l.call(this),this.resumeMode=t}function La(t,n){var i=t.delegate,r=4===n;if(!r&&e.isType(i,Pa)&&Aa(n)===Aa(t.resumeMode)){var o=i.dispatcher,a=i.context;o.isDispatchNeeded_1fupul$(a)?o.dispatch_5bn72i$(a,t):function(t){var n=We().eventLoop_8be2vx$;if(n.isUnconfinedLoopActive)n.dispatchUnconfined_4avnfa$(t);else{n.incrementUseCount_6taknv$(!0);try{for(Da(t,t.delegate,!0);n.processUnconfinedEvent(););}catch(n){if(!e.isType(n,E))throw n;t.handleFatalException_pr7uss$(n,null)}finally{n.decrementUseCount_6taknv$(!0)}}}(t)}else Da(t,i,r)}function Da(t,n,i){var r,a=t.takeState(),s=t.getExceptionalResult_s8jyv4$(a),l=new m(null!=s?N(s):t.getSuccessfulResult_tpy1pm$(a));i?(e.isType(r=n,Pa)?r:o()).continuation.resumeWith_tl1gpc$(l):n.resumeWith_tl1gpc$(l)}function qa(t){void 0===t&&(t=null),this.holder_0=t}function Fa(t,n,i){void 0===i&&(i=null);try{t(n)}catch(t){if(!e.isType(t,E))throw t;if(null==i||i.cause===t)return new Ha("Exception in undelivered element handler for "+n,t)}return i}function Ua(t,e,n){var i;null!=(i=Fa(t,e,null))&&de(n,i)}function Ba(t,e,n){return i=e,r=n,o=t,function(t){return Ua(o,i,r),p};var i,r,o}function Ha(t,e){T.call(this,t,e),this.name="UndeliveredElementException"}function Va(t,e){Et.call(this,t,!0),this.uCont=e}function Ka(t){this.coroutineContext_glfhxt$_0=t}function Wa(t){this.symbol=t}function Ya(t,n,i,r){return void 0===i&&(i=1),void 0===r&&(r=2147483647),Ga(0,e.Long.fromInt(n),e.Long.fromInt(i),e.Long.fromInt(r)).toInt()}function Ga(t,e,n,i){return void 0===n&&(n=q),void 0===i&&(i=D),e}function Ja(t,n){try{Ra(_(yt(t,n)),new m(p))}catch(t){if(!e.isType(t,E))throw t;n.resumeWith_tl1gpc$(new m(N(t)))}}function Za(t,n,i,r){void 0===r&&(r=null);try{Ra(_($(t,n,i)),new m(p),r)}catch(t){if(!e.isType(t,E))throw t;i.resumeWith_tl1gpc$(new m(N(t)))}}function Qa(t,n){try{Ra(_(t),new m(p))}catch(t){if(!e.isType(t,E))throw t;n.resumeWith_tl1gpc$(new m(N(t)))}}function Xa(t,n){t:do{var i,a,s=n;try{i=t(s,!1)}catch(t){if(e.isType(t,E)){var c=t;s.resumeWith_tl1gpc$(new m(N(c)));break t}throw t}if(i!==l){var u=null==(a=i)||e.isType(a,r)?a:o();s.resumeWith_tl1gpc$(new m(u))}}while(0)}function ts(t,n,i){t:do{var a,s,c=i;try{a=t(n,c,!1)}catch(t){if(e.isType(t,E)){var u=t;c.resumeWith_tl1gpc$(new m(N(u)));break t}throw t}if(a!==l){var p=null==(s=a)||e.isType(s,r)?s:o();c.resumeWith_tl1gpc$(new m(p))}}while(0)}function es(t,n){t:do{var i,a,s=n;try{n.context,i=t(s,!1)}catch(t){if(e.isType(t,E)){var c=t;s.resumeWith_tl1gpc$(new m(N(c)));break t}throw t}if(i!==l){var u=null==(a=i)||e.isType(a,r)?a:o();s.resumeWith_tl1gpc$(new m(u))}}while(0)}function ns(t,n,i){t:do{var a,s,c=i;try{i.context,a=t(n,c,!1)}catch(t){if(e.isType(t,E)){var u=t;c.resumeWith_tl1gpc$(new m(N(u)));break t}throw t}if(a!==l){var p=null==(s=a)||e.isType(s,r)?s:o();c.resumeWith_tl1gpc$(new m(p))}}while(0)}function is(t,n,i){var r;t.initParentJob_8be2vx$();t:do{var o;try{o=i(n,t,!1)}catch(t){if(!e.isType(t,E))throw t;o=new se(t)}var a=o;if(a===l){r=l;break t}var s=t.makeCompletingOnce_8ea4ql$(a);if(s===pn){r=l;break t}if(e.isType(s,se))throw Rl(s.cause,t.uCont);r=Cn(s)}while(0);return r}function rs(t){this.closure$block=t}function os(){}function as(){}function ss(){}function ls(){}function cs(){}function us(){this.number_0=q}function ps(t){Pl.call(this),this.uCont_0=t,this._state_0=Vo,this._result_0=Wo,this._parentHandle_0=null}function hs(t){this.$outer=t,Dn.call(this)}function fs(t){za.call(this),this.otherOp=t}function ds(t,e){ja.call(this),this.impl=t,this.desc=e,this.opSequence_oe6pw4$_0=Go.next(),this.desc.atomicOp=this}function _s(t){Ol.call(this),this.handle=t}function ys(t){this.instance=new ps(t),this.clauses=at()}function ms(){}function vs(t){this.locked=t}function $s(t){this._state_0=t?ea:na}function gs(t,e){return function(n){return e.unlock_s8jyv4$(t),p}}function bs(t,e){return function(){return t._state_0===e}}function ws(t,e){return function(){return t._state_0===e}}function ks(t,e){Ta.call(this),this.mutex=t,this.owner=e}function Ss(t,e){this.$outer=t,za.call(this),this.atomicOp_o4bkb9$_0=e}function xs(t){Pl.call(this),this.owner=t}function Es(t,e){this.$outer=t,Ol.call(this),this.owner=e}function Cs(t,e,n){this.$outer=t,Es.call(this,this.$outer,e),this.cont=n}function Os(t,e,n,i){this.$outer=t,Es.call(this,this.$outer,e),this.select=n,this.block=i}function Ns(t){ja.call(this),this.queue=t}function zs(){Ol.call(this)}function js(){}function Ts(t,e){b(typeof t,"function")?t(e):t.invoke(e)}function Ps(){if(b(typeof navigator,ia)||null==navigator||"ReactNative"!=navigator.product){if(function(){var t=!b(typeof navigator,ia)&&null!=navigator&&null!=navigator.userAgent;t&&(t=!b(typeof navigator.userAgent,ia));var e=t;return e&&(e=!b(typeof navigator.userAgent.match,ia)),e&&navigator.userAgent.match("\\bjsdom\\b")}())return ol();var t=!b(typeof window,ia)&&null!=window;return t&&(t=!b(typeof window.addEventListener,ia)),t?ml(window):b(typeof i,ia)?ll():ol()}return ol()}function Rs(){var t;return e.isType(t=Vs().Default,Ue)?t:o()}function As(t,e){var n=t.coroutineContext.plus_1fupul$(e);return n!==Vs().Default&&null==n.get_j3r2sn$(g.Key)?n.plus_1fupul$(Vs().Default):n}function Is(t){return t.toString()}function Ms(t){return null}function Ls(t,e){Va.call(this,t,e)}function Ds(t,e){console.error(e)}function qs(t){var e,n=t.__debug_counter;return"number"!=typeof n&&(n=ra=ra+1|0,t.__debug_counter=n),("number"==typeof(e=n)?e:o()).toString()}function Fs(t){var n;return null!=(n=e.getKClassFromExpression(t).simpleName)?n:"Unknown"}function Us(){Hs=this,this.Default=Ps(),this.Main=new Ks(this.Default,!1),this.Unconfined=Gn()}ua.prototype.emit_11rb$=function(t,e){return this.channel_0.send_11rb$(t,e)},ua.$metadata$={kind:a,simpleName:"SendingCollector",interfaces:[Kr]},ha.$metadata$={kind:x,simpleName:"CancellableFlow",interfaces:[Br]},w("kotlinx-coroutines-core.kotlinx.coroutines.flow.collectWhile_rysrwq$",k((function(){var n=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,i=e.kotlin.coroutines.CoroutineImpl,r=t.kotlinx.coroutines.flow.internal.AbortFlowException,o=e.Kind.CLASS,a=t.kotlinx.coroutines.flow.FlowCollector,s=t.kotlinx.coroutines.flow.internal.checkOwnership_ygf9h9$;function l(t){this.closure$predicate=t}function c(t,e,n){i.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$value=e}return c.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[i]},c.prototype=Object.create(i.prototype),c.prototype.constructor=c,c.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.closure$predicate(this.local$value,this),this.result_0===n)return n;continue;case 1:throw this.exception_0;case 2:if(!this.result_0)throw new r(this.$this);return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},l.prototype.emit_11rb$=function(t,e,n){var i=new c(this,t,e);return n?i:i.doResume(null)},l.$metadata$={kind:o,interfaces:[a]},function(t,n,i){var o=new l(n);try{e.suspendCall(t.collect_42ocv1$(o,e.coroutineReceiver()))}catch(t){if(!e.isType(t,r))throw t;s(t,o)}}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.flow.toList_qzmi91$",k((function(){var n=t.kotlinx.coroutines.flow.Flow,i=e.throwCCE,r=t.kotlinx.coroutines.flow.toList_7a0s5y$;return function(t,o){var a;return e.suspendCall(r(e.isType(a=t,n)?a:i(),void 0,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.flow.toSet_qzmi91$",k((function(){var n=t.kotlinx.coroutines.flow.Flow,i=e.throwCCE,r=t.kotlinx.coroutines.flow.toSet_a3q90u$;return function(t,o){var a;return e.suspendCall(r(e.isType(a=t,n)?a:i(),void 0,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.flow.count_qzmi91$",k((function(){var n=t.kotlinx.coroutines.flow.Flow,i=e.throwCCE,r=t.kotlinx.coroutines.flow.count_x2ftfk$;return function(t,o){var a;return e.suspendCall(r(e.isType(a=t,n)?a:i(),e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),da.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},da.prototype=Object.create(c.prototype),da.prototype.constructor=da,da.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$transform(this.local$it,this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.local$$receiver.emit_11rb$(this.result_0,this),this.result_0===l)return l;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ma.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},ma.prototype=Object.create(c.prototype),ma.prototype.constructor=ma,ma.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=this.$this.collector_0,this.result_0=this.context,this.local$safeCollector=new gl(t,this.result_0),this.exceptionState_0=5,this.state_0=1,this.result_0=this.$this.action_0(this.local$safeCollector,this),this.result_0===l)return l;continue;case 1:this.exceptionState_0=7,this.finallyPath_0=[2],this.state_0=6;continue;case 2:if(e.isType(this.$this.collector_0,ya)){if(this.state_0=3,this.result_0=this.$this.collector_0.onSubscription(this),this.result_0===l)return l;continue}this.state_0=4;continue;case 3:this.state_0=4;continue;case 4:return;case 5:this.finallyPath_0=[7],this.state_0=6;continue;case 6:this.exceptionState_0=7,this.local$safeCollector.releaseIntercepted(),this.state_0=this.finallyPath_0.shift();continue;case 7:throw this.exception_0;default:throw this.state_0=7,new Error("State Machine Unreachable execution")}}catch(t){if(7===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ya.prototype.onSubscription=function(t,e){var n=new ma(this,t);return e?n:n.doResume(null)},ya.prototype.emit_11rb$=function(t,e){return this.collector_0.emit_11rb$(t,e)},ya.$metadata$={kind:a,simpleName:"SubscribedFlowCollector",interfaces:[Kr]},w("kotlinx-coroutines-core.kotlinx.coroutines.flow.collect_706ovd$",k((function(){var n=e.Kind.CLASS,i=t.kotlinx.coroutines.flow.FlowCollector;function r(t){this.closure$action=t}return r.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},r.$metadata$={kind:n,interfaces:[i]},function(t,n,i){return e.suspendCall(t.collect_42ocv1$(new r(n),e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),w("kotlinx-coroutines-core.kotlinx.coroutines.flow.collectIndexed_57beod$",k((function(){var n=e.Kind.CLASS,i=t.kotlinx.coroutines.flow.FlowCollector,r=e.kotlin.ArithmeticException;function o(t){this.closure$action=t,this.index_0=0}return o.prototype.emit_11rb$=function(t,e){var n,i;i=this.closure$action;var o=(n=this.index_0,this.index_0=n+1|0,n);if(o<0)throw new r("Index overflow has happened");return i(o,t,e)},o.$metadata$={kind:n,interfaces:[i]},function(t,n,i){return e.suspendCall(t.collect_42ocv1$(new o(n),e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),$a.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},$a.prototype=Object.create(c.prototype),$a.prototype.constructor=$a,$a.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=va(pa(_a(this.local$$receiver,this.local$action),0),this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("kotlinx-coroutines-core.kotlinx.coroutines.flow.emitAll_c14n1u$",(function(t,n,i){return e.suspendCall(n.collect_42ocv1$(t,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())})),ga.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},ga.$metadata$={kind:a,interfaces:[Kr]},ba.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},ba.prototype=Object.create(c.prototype),ba.prototype.constructor=ba,ba.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return this.local$closure$destination.add_11rb$(this.local$value);case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ka.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},ka.prototype=Object.create(c.prototype),ka.prototype.constructor=ka,ka.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.collect_42ocv1$(new ga(wa(this.local$destination)),this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.local$destination;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},xa.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},xa.$metadata$={kind:a,interfaces:[Kr]},Ea.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Ea.prototype=Object.create(c.prototype),Ea.prototype.constructor=Ea,Ea.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return this.local$closure$i.v=this.local$closure$i.v+1|0,this.local$closure$i.v;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Oa.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[c]},Oa.prototype=Object.create(c.prototype),Oa.prototype.constructor=Oa,Oa.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$i={v:0},this.state_0=2,this.result_0=this.local$$receiver.collect_42ocv1$(new xa(Ca(this.local$i)),this),this.result_0===l)return l;continue;case 1:throw this.exception_0;case 2:return this.local$i.v;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("kotlinx-coroutines-core.kotlinx.coroutines.flow.fold_usjyvu$",k((function(){var n=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,i=e.kotlin.coroutines.CoroutineImpl,r=e.kotlin.Unit,o=e.Kind.CLASS,a=t.kotlinx.coroutines.flow.FlowCollector;function s(t){this.closure$action=t}function l(t,e,n,r){i.call(this,r),this.exceptionState_0=1,this.local$closure$operation=t,this.local$closure$accumulator=e,this.local$value=n}return s.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},s.$metadata$={kind:o,interfaces:[a]},l.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[i]},l.prototype=Object.create(i.prototype),l.prototype.constructor=l,l.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$operation(this.local$closure$accumulator.v,this.local$value,this),this.result_0===n)return n;continue;case 1:throw this.exception_0;case 2:return this.local$closure$accumulator.v=this.result_0,r;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},function(t,n,i,r){var o,a,c={v:n};return e.suspendCall(t.collect_42ocv1$(new s((o=i,a=c,function(t,e,n){var i=new l(o,a,t,e);return n?i:i.doResume(null)})),e.coroutineReceiver())),c.v}}))),Object.defineProperty(Na.prototype,"isEmpty",{configurable:!0,get:function(){return this.head_0===this.tail_0}}),Na.prototype.addLast_trkh7z$=function(t){this.elements_0[this.tail_0]=t,this.tail_0=this.tail_0+1&this.elements_0.length-1,this.tail_0===this.head_0&&this.ensureCapacity_0()},Na.prototype.removeFirstOrNull=function(){var t;if(this.head_0===this.tail_0)return null;var n=this.elements_0[this.head_0];return this.elements_0[this.head_0]=null,this.head_0=this.head_0+1&this.elements_0.length-1,e.isType(t=n,r)?t:o()},Na.prototype.clear=function(){this.head_0=0,this.tail_0=0,this.elements_0=e.newArray(this.elements_0.length,null)},Na.prototype.ensureCapacity_0=function(){var t=this.elements_0.length,n=t<<1,i=e.newArray(n,null),r=this.elements_0;ct(r,i,0,this.head_0,r.length),ct(this.elements_0,i,this.elements_0.length-this.head_0|0,0,this.head_0),this.elements_0=i,this.head_0=0,this.tail_0=t},Na.$metadata$={kind:a,simpleName:"ArrayQueue",interfaces:[]},za.prototype.toString=function(){return Fs(this)+"@"+qs(this)},za.prototype.isEarlierThan_bfmzsr$=function(t){var e,n;if(null==(e=this.atomicOp))return!1;var i=e;if(null==(n=t.atomicOp))return!1;var r=n;return i.opSequence.compareTo_11rb$(r.opSequence)<0},za.$metadata$={kind:a,simpleName:"OpDescriptor",interfaces:[]},Object.defineProperty(ja.prototype,"consensus",{configurable:!0,get:function(){return this._consensus_c6dvpx$_0}}),Object.defineProperty(ja.prototype,"isDecided",{configurable:!0,get:function(){return this._consensus_c6dvpx$_0!==qo}}),Object.defineProperty(ja.prototype,"opSequence",{configurable:!0,get:function(){return F}}),Object.defineProperty(ja.prototype,"atomicOp",{configurable:!0,get:function(){return this}}),ja.prototype.decide_s8jyv4$=function(t){var e,n=this._consensus_c6dvpx$_0;return n!==qo?n:(e=this)._consensus_c6dvpx$_0===qo&&(e._consensus_c6dvpx$_0=t,1)?t:this._consensus_c6dvpx$_0},ja.prototype.perform_s8jyv4$=function(t){var n,i,a=this._consensus_c6dvpx$_0;return a===qo&&(a=this.decide_s8jyv4$(this.prepare_11rb$(null==(n=t)||e.isType(n,r)?n:o()))),this.complete_19pj23$(null==(i=t)||e.isType(i,r)?i:o(),a),a},ja.$metadata$={kind:a,simpleName:"AtomicOp",interfaces:[za]},Object.defineProperty(Ta.prototype,"atomicOp",{configurable:!0,get:function(){return null==this.atomicOp_ss7ttb$_0?h("atomicOp"):this.atomicOp_ss7ttb$_0},set:function(t){this.atomicOp_ss7ttb$_0=t}}),Ta.$metadata$={kind:a,simpleName:"AtomicDesc",interfaces:[]},Object.defineProperty(Pa.prototype,"callerFrame",{configurable:!0,get:function(){var t;return e.isType(t=this.continuation,Ml)?t:null}}),Pa.prototype.getStackTraceElement=function(){return null},Object.defineProperty(Pa.prototype,"reusableCancellableContinuation",{configurable:!0,get:function(){var t;return e.isType(t=this._reusableCancellableContinuation_0,Ht)?t:null}}),Pa.prototype.isReusable_pmw987$=function(t){var n;if(null==(n=this._reusableCancellableContinuation_0))return!1;var i=n;return!e.isType(i,Ht)||i===t},Pa.prototype.claimReusableCancellableContinuation=function(){var t;for(this._reusableCancellableContinuation_0;;){var n,i=this._reusableCancellableContinuation_0;if(null===i)return this._reusableCancellableContinuation_0=Bo,null;if(!e.isType(i,Ht))throw S(("Inconsistent state "+C(i)).toString());if((t=this)._reusableCancellableContinuation_0===i&&(t._reusableCancellableContinuation_0=Bo,1))return e.isType(n=i,Ht)?n:o()}},Pa.prototype.checkPostponedCancellation_jp3215$=function(t){var n;for(this._reusableCancellableContinuation_0;;){var i=this._reusableCancellableContinuation_0;if(i!==Bo){if(null===i)return null;if(e.isType(i,E)){if(!function(t){return t._reusableCancellableContinuation_0===i&&(t._reusableCancellableContinuation_0=null,!0)}(this))throw H("Failed requirement.".toString());return i}throw S(("Inconsistent state "+C(i)).toString())}if((n=this)._reusableCancellableContinuation_0===Bo&&(n._reusableCancellableContinuation_0=t,1))return null}},Pa.prototype.postponeCancellation_tcv7n7$=function(t){var n;for(this._reusableCancellableContinuation_0;;){var i=this._reusableCancellableContinuation_0;if(b(i,Bo)){if((n=this)._reusableCancellableContinuation_0===Bo&&(n._reusableCancellableContinuation_0=t,1))return!0}else{if(e.isType(i,E))return!0;if(function(t){return t._reusableCancellableContinuation_0===i&&(t._reusableCancellableContinuation_0=null,!0)}(this))return!1}}},Pa.prototype.takeState=function(){var t=this._state_8be2vx$;return this._state_8be2vx$=Uo,t},Object.defineProperty(Pa.prototype,"delegate",{configurable:!0,get:function(){return this}}),Pa.prototype.resumeWith_tl1gpc$=function(t){var n=this.continuation.context,i=ie(t);if(this.dispatcher.isDispatchNeeded_1fupul$(n))this._state_8be2vx$=i,this.resumeMode=0,this.dispatcher.dispatch_5bn72i$(n,this);else{var r=We().eventLoop_8be2vx$;if(r.isUnconfinedLoopActive)this._state_8be2vx$=i,this.resumeMode=0,r.dispatchUnconfined_4avnfa$(this);else{r.incrementUseCount_6taknv$(!0);try{for(this.context,this.continuation.resumeWith_tl1gpc$(t);r.processUnconfinedEvent(););}catch(t){if(!e.isType(t,E))throw t;this.handleFatalException_pr7uss$(t,null)}finally{r.decrementUseCount_6taknv$(!0)}}}},Pa.prototype.resumeCancellableWith_rdpv6h$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.DispatchedContinuation.resumeCancellableWith_rdpv6h$",k((function(){var n=t.kotlinx.coroutines.toState_fbj1ua$,i=e.kotlin.Unit,r=e.wrapFunction,o=Error,a=t.kotlinx.coroutines.Job,s=e.kotlin.Result,l=e.kotlin.createFailure_tcv7n7$;return r((function(){var n=t.kotlinx.coroutines.Job,r=e.kotlin.Result,o=e.kotlin.createFailure_tcv7n7$;return function(t,e,a){return function(){var s,l=e,c=t;t:do{var u=l.context.get_j3r2sn$(n.Key);if(null!=u&&!u.isActive){var p=u.getCancellationException();l.cancelCompletedResult_83a7kv$(c,p),l.resumeWith_tl1gpc$(new r(o(p))),s=!0;break t}s=!1}while(0);return s||e.continuation.resumeWith_tl1gpc$(a),i}}})),function(t,i){var r=n(t,i);if(this.dispatcher.isDispatchNeeded_1fupul$(this.context))this._state_8be2vx$=r,this.resumeMode=1,this.dispatcher.dispatch_5bn72i$(this.context,this);else{var c=We().eventLoop_8be2vx$;if(c.isUnconfinedLoopActive)this._state_8be2vx$=r,this.resumeMode=1,c.dispatchUnconfined_4avnfa$(this);else{c.incrementUseCount_6taknv$(!0);try{var u;t:do{var p=this.context.get_j3r2sn$(a.Key);if(null!=p&&!p.isActive){var h=p.getCancellationException();this.cancelCompletedResult_83a7kv$(r,h),this.resumeWith_tl1gpc$(new s(l(h))),u=!0;break t}u=!1}while(0);for(u||this.continuation.resumeWith_tl1gpc$(t);c.processUnconfinedEvent(););}catch(t){if(!e.isType(t,o))throw t;this.handleFatalException_pr7uss$(t,null)}finally{c.decrementUseCount_6taknv$(!0)}}}}}))),Pa.prototype.cancelCompletedResult_83a7kv$=function(t,n){e.isType(t,ae)&&t.onCancellation(n)},Pa.prototype.resumeCancelled_s8jyv4$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.DispatchedContinuation.resumeCancelled_s8jyv4$",k((function(){var n=t.kotlinx.coroutines.Job,i=e.kotlin.Result,r=e.kotlin.createFailure_tcv7n7$;return function(t){var e=this.context.get_j3r2sn$(n.Key);if(null!=e&&!e.isActive){var o=e.getCancellationException();return this.cancelCompletedResult_83a7kv$(t,o),this.resumeWith_tl1gpc$(new i(r(o))),!0}return!1}}))),Pa.prototype.resumeUndispatchedWith_tl1gpc$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.DispatchedContinuation.resumeUndispatchedWith_tl1gpc$",(function(t){this.continuation.resumeWith_tl1gpc$(t)})),Pa.prototype.dispatchYield_6v298r$=function(t,e){this._state_8be2vx$=e,this.resumeMode=1,this.dispatcher.dispatchYield_5bn72i$(t,this)},Pa.prototype.toString=function(){return"DispatchedContinuation["+this.dispatcher+", "+Is(this.continuation)+"]"},Object.defineProperty(Pa.prototype,"context",{configurable:!0,get:function(){return this.continuation.context}}),Pa.$metadata$={kind:a,simpleName:"DispatchedContinuation",interfaces:[s,Ml,Ma]},Ma.prototype.cancelCompletedResult_83a7kv$=function(t,e){},Ma.prototype.getSuccessfulResult_tpy1pm$=function(t){var n;return null==(n=t)||e.isType(n,r)?n:o()},Ma.prototype.getExceptionalResult_s8jyv4$=function(t){var n,i;return null!=(i=e.isType(n=t,se)?n:null)?i.cause:null},Ma.prototype.run=function(){var t,n=null;try{var i=(e.isType(t=this.delegate,Pa)?t:o()).continuation,r=i.context,a=this.takeState(),s=this.getExceptionalResult_s8jyv4$(a),l=null==s&&Aa(this.resumeMode)?r.get_j3r2sn$(tn()):null;if(null==l||l.isActive)if(null!=s)i.resumeWith_tl1gpc$(new m(N(s)));else{var c=this.getSuccessfulResult_tpy1pm$(a);i.resumeWith_tl1gpc$(new m(c))}else{var u=l.getCancellationException();this.cancelCompletedResult_83a7kv$(a,u),i.resumeWith_tl1gpc$(new m(N(Rl(u))))}}catch(t){if(!e.isType(t,E))throw t;n=t}finally{var h;try{h=new m(p)}catch(t){if(!e.isType(t,E))throw t;h=new m(N(t))}var f=h;this.handleFatalException_pr7uss$(n,f.exceptionOrNull())}},Ma.prototype.handleFatalException_pr7uss$=function(t,e){if(null!==t||null!==e){var n=new Je("Fatal exception in coroutines machinery for "+this+". Please read KDoc to 'handleFatalException' method and report this incident to maintainers",B(null!=t?t:e));de(this.delegate.context,n)}},Ma.$metadata$={kind:a,simpleName:"DispatchedTask",interfaces:[_l]},qa.prototype.plus_11rb$=function(t){var n,i,a,s;if(null==(n=this.holder_0))s=new qa(t);else if(e.isType(n,Y))(e.isType(i=this.holder_0,Y)?i:o()).add_11rb$(t),s=new qa(this.holder_0);else{var l=y(4);l.add_11rb$(null==(a=this.holder_0)||e.isType(a,r)?a:o()),l.add_11rb$(t),s=new qa(l)}return s},qa.prototype.forEachReversed_qlkmfe$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.InlineList.forEachReversed_qlkmfe$",k((function(){var t=Object,n=e.throwCCE,i=e.kotlin.collections.ArrayList;return function(r){var o,a,s;if(null!=(o=this.holder_0))if(e.isType(o,i))for(var l=e.isType(s=this.holder_0,i)?s:n(),c=l.size-1|0;c>=0;c--)r(l.get_za3lpa$(c));else r(null==(a=this.holder_0)||e.isType(a,t)?a:n())}}))),qa.$metadata$={kind:a,simpleName:"InlineList",interfaces:[]},qa.prototype.unbox=function(){return this.holder_0},qa.prototype.toString=function(){return"InlineList(holder="+e.toString(this.holder_0)+")"},qa.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.holder_0)|0},qa.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.holder_0,t.holder_0)},Ha.$metadata$={kind:a,simpleName:"UndeliveredElementException",interfaces:[T]},Object.defineProperty(Va.prototype,"callerFrame",{configurable:!0,get:function(){var t;return e.isType(t=this.uCont,Ml)?t:null}}),Va.prototype.getStackTraceElement=function(){return null},Object.defineProperty(Va.prototype,"isScopedCoroutine",{configurable:!0,get:function(){return!0}}),Object.defineProperty(Va.prototype,"parent_8be2vx$",{configurable:!0,get:function(){return this.parentContext.get_j3r2sn$(tn())}}),Va.prototype.afterCompletion_s8jyv4$=function(t){Ra(_(this.uCont),oe(t,this.uCont))},Va.prototype.afterResume_s8jyv4$=function(t){this.uCont.resumeWith_tl1gpc$(oe(t,this.uCont))},Va.$metadata$={kind:a,simpleName:"ScopeCoroutine",interfaces:[Ml,Et]},Object.defineProperty(Ka.prototype,"coroutineContext",{configurable:!0,get:function(){return this.coroutineContext_glfhxt$_0}}),Ka.prototype.toString=function(){return"CoroutineScope(coroutineContext="+this.coroutineContext+")"},Ka.$metadata$={kind:a,simpleName:"ContextScope",interfaces:[Se]},Wa.prototype.toString=function(){return"<"+this.symbol+">"},Wa.prototype.unbox_tpy1pm$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.Symbol.unbox_tpy1pm$",k((function(){var t=Object,n=e.throwCCE;return function(i){var r;return i===this?null:null==(r=i)||e.isType(r,t)?r:n()}}))),Wa.$metadata$={kind:a,simpleName:"Symbol",interfaces:[]},rs.prototype.run=function(){this.closure$block()},rs.$metadata$={kind:a,interfaces:[dl]},os.prototype.invoke_en0wgx$=function(t,e){this.invoke_ha2bmj$(t,null,e)},os.$metadata$={kind:x,simpleName:"SelectBuilder",interfaces:[]},as.$metadata$={kind:x,simpleName:"SelectClause0",interfaces:[]},ss.$metadata$={kind:x,simpleName:"SelectClause1",interfaces:[]},ls.$metadata$={kind:x,simpleName:"SelectClause2",interfaces:[]},cs.$metadata$={kind:x,simpleName:"SelectInstance",interfaces:[]},w("kotlinx-coroutines-core.kotlinx.coroutines.selects.select_wd2ujs$",k((function(){var n=t.kotlinx.coroutines.selects.SelectBuilderImpl,i=Error;return function(t,r){var o;return e.suspendCall((o=t,function(t){var r=new n(t);try{o(r)}catch(t){if(!e.isType(t,i))throw t;r.handleBuilderException_tcv7n7$(t)}return r.getResult()})(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),us.prototype.next=function(){return(t=this).number_0=t.number_0.inc();var t},us.$metadata$={kind:a,simpleName:"SeqNumber",interfaces:[]},Object.defineProperty(ps.prototype,"callerFrame",{configurable:!0,get:function(){var t;return e.isType(t=this.uCont_0,Ml)?t:null}}),ps.prototype.getStackTraceElement=function(){return null},Object.defineProperty(ps.prototype,"parentHandle_0",{configurable:!0,get:function(){return this._parentHandle_0},set:function(t){this._parentHandle_0=t}}),Object.defineProperty(ps.prototype,"context",{configurable:!0,get:function(){return this.uCont_0.context}}),Object.defineProperty(ps.prototype,"completion",{configurable:!0,get:function(){return this}}),ps.prototype.doResume_0=function(t,e){var n;for(this._result_0;;){var i=this._result_0;if(i===Wo){var r=t();if((n=this)._result_0===Wo&&(n._result_0=r,1))return}else{if(i!==l)throw S("Already resumed");if(function(t){return t._result_0===l&&(t._result_0=Yo,!0)}(this))return void e()}}},ps.prototype.resumeWith_tl1gpc$=function(t){t:do{for(this._result_0;;){var e=this._result_0;if(e===Wo){var n=ie(t);if((r=this)._result_0===Wo&&(r._result_0=n,1))break t}else{if(e!==l)throw S("Already resumed");if(function(t){return t._result_0===l&&(t._result_0=Yo,!0)}(this)){if(t.isFailure){var i=this.uCont_0;i.resumeWith_tl1gpc$(new m(N(Rl(B(t.exceptionOrNull())))))}else this.uCont_0.resumeWith_tl1gpc$(t);break t}}}}while(0);var r},ps.prototype.resumeSelectWithException_tcv7n7$=function(t){t:do{for(this._result_0;;){var e=this._result_0;if(e===Wo){var n=new se(Rl(t,this.uCont_0));if((i=this)._result_0===Wo&&(i._result_0=n,1))break t}else{if(e!==l)throw S("Already resumed");if(function(t){return t._result_0===l&&(t._result_0=Yo,!0)}(this)){_(this.uCont_0).resumeWith_tl1gpc$(new m(N(t)));break t}}}}while(0);var i},ps.prototype.getResult=function(){this.isSelected||this.initCancellability_0();var t,n=this._result_0;if(n===Wo){if((t=this)._result_0===Wo&&(t._result_0=l,1))return l;n=this._result_0}if(n===Yo)throw S("Already resumed");if(e.isType(n,se))throw n.cause;return n},ps.prototype.initCancellability_0=function(){var t;if(null!=(t=this.context.get_j3r2sn$(tn()))){var e=t.invokeOnCompletion_ct2b2z$(!0,void 0,new hs(this));this.parentHandle_0=e,this.isSelected&&e.dispose()}},hs.prototype.invoke=function(t){this.$outer.trySelect()&&this.$outer.resumeSelectWithException_tcv7n7$(this.job.getCancellationException())},hs.$metadata$={kind:a,simpleName:"SelectOnCancelling",interfaces:[Dn]},ps.prototype.handleBuilderException_tcv7n7$=function(t){if(this.trySelect())this.resumeWith_tl1gpc$(new m(N(t)));else if(!e.isType(t,Zs)){var n=this.getResult();e.isType(n,se)&&n.cause===t||de(this.context,t)}},Object.defineProperty(ps.prototype,"isSelected",{configurable:!0,get:function(){for(this._state_0;;){var t=this._state_0;if(t===Vo)return!1;if(!e.isType(t,za))return!0;t.perform_s8jyv4$(this)}}}),ps.prototype.disposeOnSelect_rvfg84$=function(t){var e=new _s(t);(this.isSelected||(this.addLast_l2j9rm$(e),this.isSelected))&&t.dispose()},ps.prototype.doAfterSelect_0=function(){var t;null!=(t=this.parentHandle_0)&&t.dispose();for(var n=this._next;!b(n,this);)e.isType(n,_s)&&n.handle.dispose(),n=n._next},ps.prototype.trySelect=function(){var t,e=this.trySelectOther_uc1cc4$(null);if(e===n)t=!0;else{if(null!=e)throw S(("Unexpected trySelectIdempotent result "+C(e)).toString());t=!1}return t},ps.prototype.trySelectOther_uc1cc4$=function(t){var i;for(this._state_0;;){var r=this._state_0;t:do{if(r===Vo){if(null==t){if((i=this)._state_0!==Vo||(i._state_0=null,0))break t}else{var o=new fs(t);if(!function(t){return t._state_0===Vo&&(t._state_0=o,!0)}(this))break t;var a=o.perform_s8jyv4$(this);if(null!==a)return a}return this.doAfterSelect_0(),n}if(!e.isType(r,za))return null==t?null:r===t.desc?n:null;if(null!=t){var s=t.atomicOp;if(e.isType(s,ds)&&s.impl===this)throw S("Cannot use matching select clauses on the same object".toString());if(s.isEarlierThan_bfmzsr$(r))return Fo}r.perform_s8jyv4$(this)}while(0)}},fs.prototype.perform_s8jyv4$=function(t){var n,i=e.isType(n=t,ps)?n:o();this.otherOp.finishPrepare();var r,a=this.otherOp.atomicOp.decide_s8jyv4$(null),s=null==a?this.otherOp.desc:Vo;return r=this,i._state_0===r&&(i._state_0=s),a},Object.defineProperty(fs.prototype,"atomicOp",{configurable:!0,get:function(){return this.otherOp.atomicOp}}),fs.$metadata$={kind:a,simpleName:"PairSelectOp",interfaces:[za]},ps.prototype.performAtomicTrySelect_6q0pxr$=function(t){return new ds(this,t).perform_s8jyv4$(null)},ps.prototype.toString=function(){return"SelectInstance(state="+C(this._state_0)+", result="+C(this._result_0)+")"},Object.defineProperty(ds.prototype,"opSequence",{configurable:!0,get:function(){return this.opSequence_oe6pw4$_0}}),ds.prototype.prepare_11rb$=function(t){var n;if(null==t&&null!=(n=this.prepareSelectOp_0()))return n;try{return this.desc.prepare_4uxf5b$(this)}catch(n){throw e.isType(n,E)?(null==t&&this.undoPrepare_0(),n):n}},ds.prototype.complete_19pj23$=function(t,e){this.completeSelect_0(e),this.desc.complete_ayrq83$(this,e)},ds.prototype.prepareSelectOp_0=function(){var t;for(this.impl._state_0;;){var n=this.impl._state_0;if(n===this)return null;if(e.isType(n,za))n.perform_s8jyv4$(this.impl);else{if(n!==Vo)return Ko;if((t=this).impl._state_0===Vo&&(t.impl._state_0=t,1))return null}}},ds.prototype.undoPrepare_0=function(){var t;(t=this).impl._state_0===t&&(t.impl._state_0=Vo)},ds.prototype.completeSelect_0=function(t){var e,n=null==t,i=n?null:Vo;(e=this).impl._state_0===e&&(e.impl._state_0=i,1)&&n&&this.impl.doAfterSelect_0()},ds.prototype.toString=function(){return"AtomicSelectOp(sequence="+this.opSequence.toString()+")"},ds.$metadata$={kind:a,simpleName:"AtomicSelectOp",interfaces:[ja]},ps.prototype.invoke_nd4vgy$=function(t,e){t.registerSelectClause0_s9h9qd$(this,e)},ps.prototype.invoke_veq140$=function(t,e){t.registerSelectClause1_o3xas4$(this,e)},ps.prototype.invoke_ha2bmj$=function(t,e,n){t.registerSelectClause2_rol3se$(this,e,n)},ps.prototype.onTimeout_7xvrws$=function(t,e){if(t.compareTo_11rb$(F)<=0)this.trySelect()&&Xa(e,this.completion);else{var n,i,r=new rs((n=this,i=e,function(){return n.trySelect()&&Ja(i,n.completion),p}));this.disposeOnSelect_rvfg84$(Be(this.context).invokeOnTimeout_oczv3n$(t,r,this.context))}},_s.$metadata$={kind:a,simpleName:"DisposeNode",interfaces:[Ol]},ps.$metadata$={kind:a,simpleName:"SelectBuilderImpl",interfaces:[Ml,s,cs,os,Pl]},w("kotlinx-coroutines-core.kotlinx.coroutines.selects.selectUnbiased_wd2ujs$",k((function(){var n=t.kotlinx.coroutines.selects.UnbiasedSelectBuilderImpl,i=Error;return function(t,r){var o;return e.suspendCall((o=t,function(t){var r=new n(t);try{o(r)}catch(t){if(!e.isType(t,i))throw t;r.handleBuilderException_tcv7n7$(t)}return r.initSelectResult()})(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),ys.prototype.handleBuilderException_tcv7n7$=function(t){this.instance.handleBuilderException_tcv7n7$(t)},ys.prototype.initSelectResult=function(){if(!this.instance.isSelected)try{var t;for(mt(this.clauses),t=this.clauses.iterator();t.hasNext();)t.next()()}catch(t){if(!e.isType(t,E))throw t;this.instance.handleBuilderException_tcv7n7$(t)}return this.instance.getResult()},ys.prototype.invoke_nd4vgy$=function(t,e){var n,i,r;this.clauses.add_11rb$((n=this,i=e,r=t,function(){return r.registerSelectClause0_s9h9qd$(n.instance,i),p}))},ys.prototype.invoke_veq140$=function(t,e){var n,i,r;this.clauses.add_11rb$((n=this,i=e,r=t,function(){return r.registerSelectClause1_o3xas4$(n.instance,i),p}))},ys.prototype.invoke_ha2bmj$=function(t,e,n){var i,r,o,a;this.clauses.add_11rb$((i=this,r=e,o=n,a=t,function(){return a.registerSelectClause2_rol3se$(i.instance,r,o),p}))},ys.prototype.onTimeout_7xvrws$=function(t,e){var n,i,r;this.clauses.add_11rb$((n=this,i=t,r=e,function(){return n.instance.onTimeout_7xvrws$(i,r),p}))},ys.$metadata$={kind:a,simpleName:"UnbiasedSelectBuilderImpl",interfaces:[os]},w("kotlinx-coroutines-core.kotlinx.coroutines.selects.whileSelect_vmyjlh$",k((function(){var n=t.kotlinx.coroutines.selects.SelectBuilderImpl,i=Error;function r(t){return function(r){var o=new n(r);try{t(o)}catch(t){if(!e.isType(t,i))throw t;o.handleBuilderException_tcv7n7$(t)}return o.getResult()}}return function(t,n){for(;e.suspendCall(r(t)(e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver()););}}))),ms.prototype.tryLock_s8jyv4$=function(t,e){return void 0===t&&(t=null),e?e(t):this.tryLock_s8jyv4$$default(t)},ms.prototype.lock_s8jyv4$=function(t,e,n){return void 0===t&&(t=null),n?n(t,e):this.lock_s8jyv4$$default(t,e)},ms.prototype.unlock_s8jyv4$=function(t,e){void 0===t&&(t=null),e?e(t):this.unlock_s8jyv4$$default(t)},ms.$metadata$={kind:x,simpleName:"Mutex",interfaces:[]},w("kotlinx-coroutines-core.kotlinx.coroutines.sync.withLock_8701tb$",(function(t,n,i,r){void 0===n&&(n=null),e.suspendCall(t.lock_s8jyv4$(n,e.coroutineReceiver()));try{return i()}finally{t.unlock_s8jyv4$(n)}})),vs.prototype.toString=function(){return"Empty["+this.locked.toString()+"]"},vs.$metadata$={kind:a,simpleName:"Empty",interfaces:[]},Object.defineProperty($s.prototype,"isLocked",{configurable:!0,get:function(){for(this._state_0;;){var t=this._state_0;if(e.isType(t,vs))return t.locked!==ta;if(e.isType(t,xs))return!0;if(!e.isType(t,za))throw S(("Illegal state "+C(t)).toString());t.perform_s8jyv4$(this)}}}),Object.defineProperty($s.prototype,"isLockedEmptyQueueState_8be2vx$",{configurable:!0,get:function(){var t=this._state_0;return e.isType(t,xs)&&t.isEmpty}}),$s.prototype.tryLock_s8jyv4$$default=function(t){var n;for(this._state_0;;){var i=this._state_0;if(e.isType(i,vs)){if(i.locked!==ta)return!1;var r=null==t?ea:new vs(t);if((n=this)._state_0===i&&(n._state_0=r,1))return!0}else{if(e.isType(i,xs)){if(i.owner===t){var o="Already locked by "+C(t);throw S(o.toString())}return!1}if(!e.isType(i,za))throw S(("Illegal state "+C(i)).toString());i.perform_s8jyv4$(this)}}},$s.prototype.lock_s8jyv4$$default=function(t,e){if(!this.tryLock_s8jyv4$(t))return this.lockSuspend_0(t,e)},$s.prototype.lockSuspend_0=function(t,n){return(r=t,o=this,i=function(t){var n=new Cs(o,r,t);for(o._state_0;;){var i=o,a=r,s=o._state_0;if(e.isType(s,vs))if(s.locked!==ta)i._state_0===s&&(i._state_0=new xs(s.locked));else{var l=null==a?ea:new vs(a);if(i._state_0===s&&(i._state_0=l,1))return void t.resume_q1ktlu$(p,gs(a,i))}else if(e.isType(s,xs)){if(s.owner===a){var c="Already locked by "+C(a);throw S(c.toString())}var u,h=bs(i,s);t:do{if(!h()){u=!1;break t}s.addLast_l2j9rm$(n),u=!0}while(0);if(u)return void qt(t,n)}else{if(!e.isType(s,za))throw S(("Illegal state "+C(s)).toString());s.perform_s8jyv4$(i)}}return p},function(t){var e=Dt(_(t));return i(e),e.getResult()})(n);var i,r,o},Object.defineProperty($s.prototype,"onLock",{configurable:!0,get:function(){return this}}),$s.prototype.registerSelectClause2_rol3se$=function(t,n,i){for(;;){if(t.isSelected)return;var r=this._state_0;if(e.isType(r,vs))if(r.locked!==ta)(c=this)._state_0===r&&(c._state_0=new xs(r.locked));else{var o=t.performAtomicTrySelect_6q0pxr$(new ks(this,n));if(null==o)return void ts(i,this,t.completion);if(o===Ko)return;if(o!==Jo&&o!==Fo)throw S(("performAtomicTrySelect(TryLockDesc) returned "+C(o)).toString())}else if(e.isType(r,xs)){if(r.owner===n){var a="Already locked by "+C(n);throw S(a.toString())}var s,l=new Os(this,n,t,i);t:do{if(!ws(this,r)()){s=!1;break t}r.addLast_l2j9rm$(l),s=!0}while(0);if(s)return void t.disposeOnSelect_rvfg84$(l)}else{if(!e.isType(r,za))throw S(("Illegal state "+C(r)).toString());r.perform_s8jyv4$(this)}}var c},Object.defineProperty(Ss.prototype,"atomicOp",{get:function(){return this.atomicOp_o4bkb9$_0}}),Ss.prototype.perform_s8jyv4$=function(t){var n,i,r=this.atomicOp.isDecided?na:this.atomicOp;return i=this,(e.isType(n=t,$s)?n:o())._state_0===i&&((e.isType(n=t,$s)?n:o())._state_0=r),null},Ss.$metadata$={kind:a,simpleName:"PrepareOp",interfaces:[za]},ks.prototype.prepare_4uxf5b$=function(t){var e,n=new Ss(this,t);return(e=this).mutex._state_0!==na||(e.mutex._state_0=n,0)?Jo:n.perform_s8jyv4$(this.mutex)},ks.prototype.complete_ayrq83$=function(t,e){var n,i=null!=e?na:null==this.owner?ea:new vs(this.owner);(n=this).mutex._state_0===t&&(n.mutex._state_0=i)},ks.$metadata$={kind:a,simpleName:"TryLockDesc",interfaces:[Ta]},$s.prototype.holdsLock_za3rmp$=function(t){var n=this._state_0;return e.isType(n,vs)?n.locked===t:!!e.isType(n,xs)&&n.owner===t},$s.prototype.unlock_s8jyv4$$default=function(t){var n;for(this._state_0;;){var i,r,a=this._state_0;if(e.isType(a,vs)){if(null==t){if(a.locked===ta)throw S("Mutex is not locked".toString())}else if(a.locked!==t){var s="Mutex is locked by "+a.locked.toString()+" but expected "+C(t);throw S(s.toString())}if((n=this)._state_0===a&&(n._state_0=na,1))return}else if(e.isType(a,za))a.perform_s8jyv4$(this);else{if(!e.isType(a,xs))throw S(("Illegal state "+C(a)).toString());if(null!=t&&a.owner!==t){var l="Mutex is locked by "+a.owner.toString()+" but expected "+C(t);throw S(l.toString())}var c=a.removeFirstOrNull();if(null==c){var u=new Ns(a);if(function(t){return t._state_0===a&&(t._state_0=u,!0)}(this)&&null==u.perform_s8jyv4$(this))return}else{var p=(e.isType(i=c,Es)?i:o()).tryResumeLockWaiter();if(null!=p)return a.owner=null!=(r=c.owner)?r:Xo,void c.completeResumeLockWaiter_za3rmp$(p)}}}},$s.prototype.toString=function(){for(this._state_0;;){var t=this._state_0;if(e.isType(t,vs))return"Mutex["+t.locked.toString()+"]";if(!e.isType(t,za)){if(e.isType(t,xs))return"Mutex["+t.owner.toString()+"]";throw S(("Illegal state "+C(t)).toString())}t.perform_s8jyv4$(this)}},xs.prototype.toString=function(){return"LockedQueue["+this.owner.toString()+"]"},xs.$metadata$={kind:a,simpleName:"LockedQueue",interfaces:[Pl]},Es.prototype.dispose=function(){this.remove()},Es.$metadata$={kind:a,simpleName:"LockWaiter",interfaces:[nn,Ol]},Cs.prototype.tryResumeLockWaiter=function(){return this.cont.tryResume_i8qury$(p,null,(t=this,e=this.$outer,function(n){return e.unlock_s8jyv4$(t.owner),p}));var t,e},Cs.prototype.completeResumeLockWaiter_za3rmp$=function(t){this.cont.completeResume_za3rmp$(t)},Cs.prototype.toString=function(){return"LockCont["+C(this.owner)+", "+this.cont+"] for "+this.$outer},Cs.$metadata$={kind:a,simpleName:"LockCont",interfaces:[Es]},Os.prototype.tryResumeLockWaiter=function(){return this.select.trySelect()?Qo:null},Os.prototype.completeResumeLockWaiter_za3rmp$=function(t){var e,n;Za(this.block,this.$outer,this.select.completion,(e=this,n=this.$outer,function(t){return n.unlock_s8jyv4$(e.owner),p}))},Os.prototype.toString=function(){return"LockSelect["+C(this.owner)+", "+this.select+"] for "+this.$outer},Os.$metadata$={kind:a,simpleName:"LockSelect",interfaces:[Es]},Ns.prototype.prepare_11rb$=function(t){return this.queue.isEmpty?null:Zo},Ns.prototype.complete_19pj23$=function(t,e){var n,i=null==e?na:this.queue;n=this,t._state_0===n&&(t._state_0=i)},Ns.$metadata$={kind:a,simpleName:"UnlockOp",interfaces:[ja]},$s.$metadata$={kind:a,simpleName:"MutexImpl",interfaces:[ls,ms]},w("kotlinx-coroutines-core.kotlinx.coroutines.sync.withPermit_103m5a$",(function(t,n,i){e.suspendCall(t.acquire(e.coroutineReceiver()));try{return n()}finally{t.release()}})),zs.$metadata$={kind:a,simpleName:"CompletionHandlerBase",interfaces:[Ol]},js.$metadata$={kind:a,simpleName:"CancelHandlerBase",interfaces:[]},Ls.prototype.afterResume_s8jyv4$=function(t){this.uCont.resumeWith_tl1gpc$(oe(t,this.uCont))},Ls.$metadata$={kind:a,simpleName:"UndispatchedCoroutine",interfaces:[Va]},Us.$metadata$={kind:O,simpleName:"Dispatchers",interfaces:[]};var Bs,Hs=null;function Vs(){return null===Hs&&new Us,Hs}function Ks(t,e){Bn.call(this),this.delegate=t,this.invokeImmediately_0=e,this.immediate_iydbla$_0=this.invokeImmediately_0?this:new Ks(this.delegate,!0)}function Ws(){return new Ys}function Ys(){He.call(this)}function Gs(){He.call(this)}function Js(){throw Z("runBlocking event loop is not supported")}function Zs(t,e){K.call(this,t,e),this.name="CancellationException"}function Qs(t,e){return e=e||Object.create(Zs.prototype),Zs.call(e,t,null),e}function Xs(t,e,n){Zs.call(this,t,e),this.job_8be2vx$=n,this.name="JobCancellationException"}function tl(t){return $t(t,F,Bs).toInt()}function el(){ce.call(this),this.messageQueue_8be2vx$=new nl(this)}function nl(t){var e;this.$outer=t,fl.call(this),this.processQueue_8be2vx$=(e=this,function(){return e.process(),p})}function il(){rl=this,el.call(this)}Object.defineProperty(Ks.prototype,"immediate",{configurable:!0,get:function(){return this.immediate_iydbla$_0}}),Ks.prototype.isDispatchNeeded_1fupul$=function(t){return!this.invokeImmediately_0},Ks.prototype.dispatch_5bn72i$=function(t,e){this.delegate.dispatch_5bn72i$(t,e)},Ks.prototype.dispatchYield_5bn72i$=function(t,e){this.delegate.dispatchYield_5bn72i$(t,e)},Ks.prototype.toString=function(){var t;return null!=(t=this.toStringInternalImpl())?t:this.delegate.toString()},Ks.$metadata$={kind:a,simpleName:"JsMainDispatcher",interfaces:[Bn]},Ys.prototype.dispatch_5bn72i$=function(t,e){Js()},Ys.$metadata$={kind:a,simpleName:"UnconfinedEventLoop",interfaces:[He]},Gs.prototype.unpark_0=function(){Js()},Gs.prototype.reschedule_0=function(t,e){Js()},Gs.$metadata$={kind:a,simpleName:"EventLoopImplPlatform",interfaces:[He]},Zs.$metadata$={kind:a,simpleName:"CancellationException",interfaces:[K]},Xs.prototype.toString=function(){return Zs.prototype.toString.call(this)+"; job="+this.job_8be2vx$},Xs.prototype.equals=function(t){return t===this||e.isType(t,Xs)&&b(t.message,this.message)&&b(t.job_8be2vx$,this.job_8be2vx$)&&b(t.cause,this.cause)},Xs.prototype.hashCode=function(){var t,e;return(31*((31*rt(B(this.message))|0)+rt(this.job_8be2vx$)|0)|0)+(null!=(e=null!=(t=this.cause)?rt(t):null)?e:0)|0},Xs.$metadata$={kind:a,simpleName:"JobCancellationException",interfaces:[Zs]},nl.prototype.schedule=function(){this.$outer.scheduleQueueProcessing()},nl.prototype.reschedule=function(){setTimeout(this.processQueue_8be2vx$,0)},nl.$metadata$={kind:a,simpleName:"ScheduledMessageQueue",interfaces:[fl]},el.prototype.dispatch_5bn72i$=function(t,e){this.messageQueue_8be2vx$.enqueue_771g0p$(e)},el.prototype.invokeOnTimeout_oczv3n$=function(t,e,n){var i;return new cl(setTimeout((i=e,function(){return i.run(),p}),tl(t)))},el.prototype.scheduleResumeAfterDelay_egqmvs$=function(t,e){var n,i,r=setTimeout((n=e,i=this,function(){return n.resumeUndispatched_hyuxa3$(i,p),p}),tl(t));e.invokeOnCancellation_f05bi3$(new cl(r))},el.$metadata$={kind:a,simpleName:"SetTimeoutBasedDispatcher",interfaces:[Ue,ce]},il.prototype.scheduleQueueProcessing=function(){i.nextTick(this.messageQueue_8be2vx$.processQueue_8be2vx$)},il.$metadata$={kind:O,simpleName:"NodeDispatcher",interfaces:[el]};var rl=null;function ol(){return null===rl&&new il,rl}function al(){sl=this,el.call(this)}al.prototype.scheduleQueueProcessing=function(){setTimeout(this.messageQueue_8be2vx$.processQueue_8be2vx$,0)},al.$metadata$={kind:O,simpleName:"SetTimeoutDispatcher",interfaces:[el]};var sl=null;function ll(){return null===sl&&new al,sl}function cl(t){Gt.call(this),this.handle_0=t}function ul(t){ce.call(this),this.window_0=t,this.queue_0=new hl(this.window_0)}function pl(t,e){this.this$WindowDispatcher=t,this.closure$handle=e}function hl(t){var e;fl.call(this),this.window_0=t,this.messageName_0="dispatchCoroutine",this.window_0.addEventListener("message",(e=this,function(t){return t.source==e.window_0&&t.data==e.messageName_0&&(t.stopPropagation(),e.process()),p}),!0)}function fl(){Na.call(this),this.yieldEvery=16,this.scheduled_0=!1}function dl(){}function _l(){}function yl(t){}function ml(t){var e,n;if(null!=(e=t.coroutineDispatcher))n=e;else{var i=new ul(t);t.coroutineDispatcher=i,n=i}return n}function vl(t){Qs("Flow was aborted, no more elements needed",this),this.owner=t,this.name="AbortFlowException"}function $l(){Qs("Child of the scoped flow was cancelled",this),this.name="ChildCancelledException"}function gl(t,e){this.collector_8be2vx$=t,this.collectContext_8be2vx$=e,this.collectContextSize_8be2vx$=this.collectContext_8be2vx$.fold_3cc69b$(0,wl),this.lastEmissionContext_0=null}function bl(t,e,n){c.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$value=e}function wl(t,e){return t+1|0}function kl(){}function Sl(){return new El}function xl(t){return gt(t)}function El(t){void 0===t&&(t=[]),St.call(this),this.array_0=t}function Cl(t){this.array_0=t,this.current_0=0}function Ol(){this._next=this,this._prev=this,this._removed=!1}function Nl(t,e){jl.call(this),this.queue=t,this.node=e}function zl(t){jl.call(this),this.queue=t,this.affectedNode_rjf1fm$_0=this.queue._next}function jl(){Ta.call(this)}function Tl(t,e,n){za.call(this),this.affected=t,this.desc=e,this.atomicOp_khy6pf$_0=n}function Pl(){Ol.call(this)}function Rl(t,e){return t}function Al(t){return t}function Il(t){return t}function Ml(){}function Ll(t,e){}function Dl(t){return null}function ql(t){return 0}function Fl(){this.value_0=null}cl.prototype.dispose=function(){clearTimeout(this.handle_0)},cl.prototype.invoke=function(t){this.dispose()},cl.prototype.toString=function(){return"ClearTimeout["+this.handle_0+"]"},cl.$metadata$={kind:a,simpleName:"ClearTimeout",interfaces:[nn,Gt]},ul.prototype.dispatch_5bn72i$=function(t,e){this.queue_0.enqueue_771g0p$(e)},ul.prototype.scheduleResumeAfterDelay_egqmvs$=function(t,e){var n,i;this.window_0.setTimeout((n=e,i=this,function(){return n.resumeUndispatched_hyuxa3$(i,p),p}),tl(t))},pl.prototype.dispose=function(){this.this$WindowDispatcher.window_0.clearTimeout(this.closure$handle)},pl.$metadata$={kind:a,interfaces:[nn]},ul.prototype.invokeOnTimeout_oczv3n$=function(t,e,n){var i;return new pl(this,this.window_0.setTimeout((i=e,function(){return i.run(),p}),tl(t)))},ul.$metadata$={kind:a,simpleName:"WindowDispatcher",interfaces:[Ue,ce]},hl.prototype.schedule=function(){var t;Promise.resolve(p).then((t=this,function(e){return t.process(),p}))},hl.prototype.reschedule=function(){this.window_0.postMessage(this.messageName_0,"*")},hl.$metadata$={kind:a,simpleName:"WindowMessageQueue",interfaces:[fl]},fl.prototype.enqueue_771g0p$=function(t){this.addLast_trkh7z$(t),this.scheduled_0||(this.scheduled_0=!0,this.schedule())},fl.prototype.process=function(){try{for(var t=this.yieldEvery,e=0;ethis.size)throw new ot("index: "+t+", size: "+this.size)},El.prototype.rangeCheck_0=function(t){if(t<0||t>=this.size)throw new ot("index: "+t+", size: "+this.size);return t},El.$metadata$={kind:a,simpleName:"CopyOnWriteList",interfaces:[St]},Object.defineProperty(Ol.prototype,"nextNode",{configurable:!0,get:w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListNode.get_nextNode",(function(){return this._next}))}),Object.defineProperty(Ol.prototype,"prevNode",{configurable:!0,get:w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListNode.get_prevNode",(function(){return this._prev}))}),Object.defineProperty(Ol.prototype,"isRemoved",{configurable:!0,get:w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListNode.get_isRemoved",(function(){return this._removed}))}),Ol.prototype.addLast_l2j9rm$=function(t){var e=this._prev;t._next=this,t._prev=e,e._next=t,this._prev=t},Ol.prototype.remove=function(){if(this._removed)return!1;var t=this._prev,e=this._next;return t._next=e,e._prev=t,this._removed=!0,!0},Ol.prototype.addOneIfEmpty_l2j9rm$=function(t){return this._next===this&&(this.addLast_l2j9rm$(t),!0)},Ol.prototype.addLastIf_w327v9$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListNode.addLastIf_w327v9$",(function(t,e){return!!e()&&(this.addLast_l2j9rm$(t),!0)})),Ol.prototype.addLastIfPrev_s8xlln$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListNode.addLastIfPrev_s8xlln$",(function(t,e){return!!e(this._prev)&&(this.addLast_l2j9rm$(t),!0)})),Ol.prototype.addLastIfPrevAndIf_dzcug$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListNode.addLastIfPrevAndIf_dzcug$",(function(t,e,n){return!!e(this._prev)&&!!n()&&(this.addLast_l2j9rm$(t),!0)})),Ol.prototype.helpRemove=function(){},Ol.prototype.removeFirstOrNull=function(){var t=this._next;if(t===this)return null;if(!t.remove())throw S("Should remove".toString());return t},Ol.prototype.removeFirstIfIsInstanceOfOrPeekIf_14urrv$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListNode.removeFirstIfIsInstanceOfOrPeekIf_14urrv$",k((function(){var t=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e,n,i){var r=this._next;if(r===this)return null;if(!n(r))return null;if(i(r))return r;if(!r.remove())throw t("Should remove".toString());return r}}))),Ol.$metadata$={kind:a,simpleName:"LinkedListNode",interfaces:[]},Object.defineProperty(Nl.prototype,"affectedNode",{configurable:!0,get:function(){return this.queue._prev}}),Nl.prototype.finishPrepare_xe32vn$=function(t){},Nl.prototype.onComplete=function(){this.queue.addLast_l2j9rm$(this.node)},Nl.prototype.finishOnSuccess_bpl3tg$=function(t,e){},Nl.$metadata$={kind:a,simpleName:"AddLastDesc",interfaces:[jl]},Object.defineProperty(zl.prototype,"result",{configurable:!0,get:function(){var t;return null==(t=this.affectedNode)||e.isType(t,r)?t:o()}}),Object.defineProperty(zl.prototype,"affectedNode",{configurable:!0,get:function(){return this.affectedNode_rjf1fm$_0}}),zl.prototype.finishPrepare_xe32vn$=function(t){},zl.prototype.onComplete=function(){this.queue.removeFirstOrNull()},zl.prototype.finishOnSuccess_bpl3tg$=function(t,e){},zl.$metadata$={kind:a,simpleName:"RemoveFirstDesc",interfaces:[jl]},jl.prototype.onPrepare_xe32vn$=function(t){return this.finishPrepare_xe32vn$(t),null},jl.prototype.onRemoved_l2j9rm$=function(t){},jl.prototype.prepare_4uxf5b$=function(t){var e=this.affectedNode,n=this.failure_l2j9rm$(e);return null!=n?n:this.onPrepare_xe32vn$(new Tl(e,this,t))},jl.prototype.complete_ayrq83$=function(t,e){this.onComplete()},jl.prototype.failure_l2j9rm$=function(t){return null},jl.prototype.retry_ru8hrx$=function(t,e){return!1},jl.$metadata$={kind:a,simpleName:"AbstractAtomicDesc",interfaces:[Ta]},Object.defineProperty(Tl.prototype,"atomicOp",{get:function(){return this.atomicOp_khy6pf$_0}}),Tl.prototype.perform_s8jyv4$=function(t){return null},Tl.prototype.finishPrepare=function(){},Tl.$metadata$={kind:a,simpleName:"PrepareOp",interfaces:[za]},Object.defineProperty(Pl.prototype,"isEmpty",{configurable:!0,get:function(){return this._next===this}}),Pl.prototype.forEach_jgwmnf$=w("kotlinx-coroutines-core.kotlinx.coroutines.internal.LinkedListHead.forEach_jgwmnf$",k((function(){var t=e.equals;return function(e,n,i){for(var r=this._next;!t(r,this);)n(r)&&i(r),r=r._next}}))),Pl.prototype.remove=function(){throw xt()},Pl.$metadata$={kind:a,simpleName:"LinkedListHead",interfaces:[Ol]},w("kotlinx-coroutines-core.kotlinx.coroutines.internal.recoverAndThrow_8o0b5c$",(function(t,e){throw t})),Ml.$metadata$={kind:x,simpleName:"CoroutineStackFrame",interfaces:[]},Fl.prototype.get=function(){var t;return null==(t=this.value_0)||e.isType(t,r)?t:o()},Fl.prototype.set_11rb$=function(t){this.value_0=t},Fl.$metadata$={kind:a,simpleName:"CommonThreadLocal",interfaces:[]};var Ul=t.kotlinx||(t.kotlinx={}),Bl=Ul.coroutines||(Ul.coroutines={});Bl.AbstractCoroutine=Et,Bl.awaitAll_60afti$=function(t,e,n){var i=new Ct(t,e);return n?i:i.doResume(null)},Bl.launch_s496o7$=jt,Bl.async_pda6u4$=function(t,e,n,i){void 0===e&&(e=v.EmptyCoroutineContext),void 0===n&&(n=Ae());var r=As(t,e),o=n.isLazy?new Rt(r,i):new Tt(r,!0);return o.start_b5ul0p$(n,o,i),o},Bl.withContext_i5cbzn$=function(t,e,n){return(i=t,r=e,function(t){var e=t.context,n=e.plus_1fupul$(i);if(ci(n),n===e){var o=new Va(n,t);return is(o,o,r)}if(b(n.get_j3r2sn$(g.Key),e.get_j3r2sn$(g.Key))){var a=new Ls(n,t);return is(a,a,r)}var s=new Mt(n,t);return s.initParentJob_8be2vx$(),Za(r,s,s),s.getResult()})(n);var i,r},Bl.DispatchedCoroutine=Mt,Bl.CancellableContinuation=Lt,Bl.getOrCreateCancellableContinuation_3j0xf1$=Dt,Bl.removeOnCancellation_1u31dd$=qt,Bl.disposeOnCancellation_xredcy$=Ft,Bl.CancellableContinuationImpl=Ht,Bl.NotCompleted=Vt,Bl.CancelHandler=Gt,Bl.BeforeResumeCancelHandler=Jt,Bl.CompletableDeferred=Xt,Bl.CompletableDeferred_xptg6w$=function(t){return void 0===t&&(t=null),new te(t)},Bl.CompletableJob=ne,Bl.toState_fbj1ua$=ie,Bl.toState_bd49bs$=re,Bl.recoverResult_nnrdi1$=oe,Bl.CompletedWithCancellation=ae,Bl.CompletedExceptionally=se,Bl.CancelledContinuation=le,Object.defineProperty(ce,"Key",{get:fe}),Bl.CoroutineDispatcher=ce,Bl.handleCoroutineException_1ur55u$=de,Bl.handlerException_l3aqr5$=_e,Bl.CoroutineExceptionHandler=ye,Object.defineProperty(ye,"Key",{get:$e}),Object.defineProperty(ge,"Key",{get:ke}),Bl.CoroutineName=ge,Bl.CoroutineScope=Se,Bl.get_isActive_e9pf1l$=function(t){var e,n;return null==(n=null!=(e=t.coroutineContext.get_j3r2sn$(tn()))?e.isActive:null)||n},Object.defineProperty(Bl,"GlobalScope",{get:function(){return null===ze&&new xe,ze}}),Bl.coroutineScope_awg8ri$=je,Bl.CoroutineScope_1fupul$=function(t){return new Ka(null!=t.get_j3r2sn$(tn())?t:t.plus_1fupul$(en()))},Bl.cancel_jnvdxk$=Te,Bl.cancel_n4wjt3$=function(t,e,n){void 0===n&&(n=null),Te(t,new Zs(e,n))},Object.defineProperty(Pe,"DEFAULT",{get:Ae}),Object.defineProperty(Pe,"LAZY",{get:Ie}),Object.defineProperty(Pe,"ATOMIC",{get:Me}),Object.defineProperty(Pe,"UNDISPATCHED",{get:Le}),Bl.CoroutineStart=Pe,Bl.CopyableThrowable=De,Bl.Deferred=qe,Bl.Delay=Ue,Bl.delay_s8cxhz$=function(t,e){var n;if(!(t.toNumber()<=0))return Fe((n=t,function(t){return n.compareTo_11rb$(D)<0&&Be(t.context).scheduleResumeAfterDelay_egqmvs$(n,t),p}))(e)},Bl.get_delay_tcgsej$=Be,Bl.EventLoop=He,Object.defineProperty(Bl,"ThreadLocalEventLoop",{get:We}),Bl.EventLoopImplBase=Ye,Bl.CompletionHandlerException=Ge,Bl.CoroutinesInternalError=Je,Object.defineProperty(Ze,"Key",{get:tn}),Bl.Job=Ze,Bl.Job_5dx9e$=en,Bl.DisposableHandle=nn,Bl.ChildJob=rn,Bl.ParentJob=on,Bl.ChildHandle=an,Bl.cancel_x105z1$=function(t,e){var n;void 0===e&&(e=null),null!=(n=t.get_j3r2sn$(tn()))&&n.cancel_m4sck1$(e)},Bl.ensureActive_5dx9u$=sn,Bl.ensureActive_qdnslq$=ln,Bl.cancel_6dgle8$=function(t,e,n){void 0===n&&(n=null),t.cancel_m4sck1$(new Zs(e,n))},Object.defineProperty(Bl,"NonDisposableHandle",{get:vn}),Bl.JobSupport=$n,Bl.boxIncomplete_ntq51o$=En,Bl.unboxState_ntq51o$=Cn,Bl.JobImpl=Nn,Bl.Incomplete=zn,Bl.JobNode=jn,Bl.NodeList=Tn,Bl.InactiveNodeList=Pn,Bl.JobCancellingNode=Dn,Bl.ChildHandleNode=Fn,Bl.ChildContinuation=Un,Bl.MainCoroutineDispatcher=Bn,Bl.SupervisorJob_5dx9e$=function(t){return void 0===t&&(t=null),new Vn(t)},Bl.TimeoutCancellationException=Kn,Object.defineProperty(Bl,"Unconfined",{get:Gn}),Object.defineProperty(Jn,"Key",{get:li}),Bl.YieldContext=Jn,Bl.checkCompletion_tcgsej$=ci,pi.SendBuffered=mi;var Hl=Bl.channels||(Bl.channels={});Hl.AbstractSendChannel=pi,Hl.AbstractChannel=vi,Hl.Send=zi,Hl.ReceiveOrClosed=ji,Hl.SendElement=Ti,Hl.SendElementWithUndeliveredHandler=Pi,Hl.Closed=Ri,Hl.Receive=Ai,Hl.ArrayBroadcastChannel=Ii,Hl.ArrayChannel=Li,Hl.broadcast_sgee0c$=Di,Hl.BroadcastChannel=Ui,Hl.BroadcastChannel_ww73n8$=Bi,Object.defineProperty(Hi,"SUSPEND",{get:Ki}),Object.defineProperty(Hi,"DROP_OLDEST",{get:Wi}),Object.defineProperty(Hi,"DROP_LATEST",{get:Yi}),Hl.BufferOverflow=Hi,Hl.SendChannel=Gi,Hl.ReceiveChannel=Ji,Zi.Closed=Qi,Object.defineProperty(Zi,"Companion",{get:er}),Hl.ValueOrClosed=Zi,Hl.ChannelIterator=nr,Object.defineProperty(rr,"Factory",{get:lr}),Hl.Channel=rr,Hl.Channel_lsve6m$=cr,Hl.Channel_ww73n8$=function(t){return void 0===t&&(t=0),cr(t)},Hl.ClosedSendChannelException=ur,Hl.ClosedReceiveChannelException=pr,Hl.ChannelCoroutine=hr,Hl.cancelConsumed_v57n85$=fr,Hl.ConflatedBroadcastChannel=dr,Hl.ConflatedChannel=Er,Hl.LinkedListChannel=Cr,Hl.ProducerScope=Nr,Hl.awaitClose_msfyrq$=function(t,e,n,i){var r=new Tr(t,e,n);return i?r:r.doResume(null)},Hl.produce_tndwgj$=Pr,Hl.ProducerCoroutine=Rr,Hl.RendezvousChannel=Ar;var Vl=Bl.flow||(Bl.flow={});Vl.flow_sxz0o1$=function(t){return new Ir(t)},Vl.callbackFlow_b9ud7o$=function(t){return new Dr(t)},Vl.emitAll_s9b6ou$=Fr,Vl.Flow=Br,Vl.AbstractFlow=Hr,Vl.FlowCollector=Kr,Vl.SharedFlow=Yr,Vl.MutableSharedFlow=Gr,Vl.MutableSharedFlow_ympafm$=function(t,e,n){if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===n&&(n=Ki()),!(t>=0))throw H(("replay cannot be negative, but was "+t).toString());if(!(e>=0))throw H(("extraBufferCapacity cannot be negative, but was "+e).toString());if(!(t>0||e>0||n===Ki()))throw H(("replay or extraBufferCapacity must be positive with non-default onBufferOverflow strategy "+n).toString());var i=t+e|0;return new Zr(t,i<0?2147483647:i,n)},Vl.fuseSharedFlow_mxe5lp$=io,Vl.StateFlow=ro,Vl.MutableStateFlow=oo,Vl.MutableStateFlow_mh5how$=ao,Vl.increment_u8peyx$=uo,Vl.fuseStateFlow_j7j1gt$=po;var Kl=Vl.internal||(Vl.internal={});Kl.AbstractSharedFlowSlot=ho,Kl.AbstractSharedFlow=fo,Kl.FusibleFlow=_o,Kl.ChannelFlow=yo,Kl.ChannelFlowOperator=$o,Kl.ChannelFlowOperatorImpl=wo,Kl.withContextUndispatched_z68y1q$=xo,Kl.flowScope_730rnf$=Co,Kl.checkOwnership_ygf9h9$=function(t,e){if(t.owner!==e)throw t},Kl.ChannelFlowTransformLatest=zo,Object.defineProperty(Kl,"NopCollector",{get:sa}),Kl.checkContext_2zo4vg$=la,Kl.transitiveCoroutineParent_c7vj00$=ca,Kl.SendingCollector=ua,Vl.buffer_g16sm6$=pa,Vl.CancellableFlow=ha,Vl.toList_7a0s5y$=function(t,e,n){return void 0===e&&(e=at()),Sa(t,e,n)},Vl.toSet_a3q90u$=function(t,e,n){return void 0===e&&(e=st()),Sa(t,e,n)},Vl.count_x2ftfk$=function(t,e,n){var i=new Oa(t,e);return n?i:i.doResume(null)},Vl.transformLatest_ig04k9$=fa,Vl.mapLatest_516il8$=_a,Vl.SubscribedFlowCollector=ya,Vl.collect_wkex2n$=va,Vl.collectLatest_706ovd$=function(t,e,n,i){var r=new $a(t,e,n);return i?r:r.doResume(null)},Vl.toCollection_eyr3lx$=Sa;var Wl=Bl.internal||(Bl.internal={});Wl.ArrayQueue=Na,Wl.OpDescriptor=za,Wl.AtomicOp=ja,Wl.AtomicDesc=Ta,Wl.DispatchedContinuation=Pa,Wl.resumeCancellableWith_udi45l$=Ra,Bl.get_isCancellableMode_8e50z4$=Aa,Bl.get_isReusableMode_8e50z4$=Ia,Bl.DispatchedTask=Ma,Bl.dispatch_h66hf9$=La,Bl.resume_h7ljpe$=Da,Wl.recoverStackTrace_ak2v6d$=Rl,Wl.InlineList=qa,Wl.callUndeliveredElementCatchingException_xmr2eb$=Fa,Wl.callUndeliveredElement_ku137g$=Ua,Wl.bindCancellationFun_ku137g$=Ba,Wl.UndeliveredElementException=Ha,Wl.ScopeCoroutine=Va,Wl.ContextScope=Ka,Wl.Symbol=Wa,Wl.systemProp_vrsuct$=Ya,Wl.systemProp_ornks8$=Ga;var Yl=Bl.intrinsics||(Bl.intrinsics={});Yl.startCoroutineCancellable_x18nsh$=Ja,Yl.startCoroutineCancellable_7jvlzs$=Za,Yl.startCoroutineCancellable_he7xzw$=Qa,Yl.startCoroutineUnintercepted_81hn2s$=Xa,Yl.startCoroutineUnintercepted_kew4v3$=ts,Yl.startCoroutineUndispatched_81hn2s$=es,Yl.startCoroutineUndispatched_kew4v3$=ns,Yl.startUndispatchedOrReturn_nxbeil$=is;var Gl=Bl.selects||(Bl.selects={});Gl.SelectBuilder=os,Gl.SelectClause0=as,Gl.SelectClause1=ss,Gl.SelectClause2=ls,Gl.SelectInstance=cs,Gl.SeqNumber=us,Gl.SelectBuilderImpl=ps,Gl.UnbiasedSelectBuilderImpl=ys;var Jl=Bl.sync||(Bl.sync={});return Jl.Mutex=ms,Jl.Mutex_6taknv$=function(t){return void 0===t&&(t=!1),new $s(t)},Jl.MutexImpl=$s,Bl.CompletionHandlerBase=zs,Bl.CancelHandlerBase=js,Bl.invokeIt_beznmj$=Ts,Bl.createDefaultDispatcher_8be2vx$=Ps,Object.defineProperty(Bl,"DefaultDelay_8be2vx$",{get:Rs}),Bl.newCoroutineContext_7n4184$=As,Bl.toDebugString_u0ddlz$=Is,Bl.get_coroutineName_tcgsej$=Ms,Bl.UndispatchedCoroutine=Ls,Bl.handleCoroutineExceptionImpl_yfv4gr$=Ds,Bl.get_hexAddress_8ea4r1$=qs,Bl.get_classSimpleName_8ea4r1$=Fs,Object.defineProperty(Bl,"Dispatchers",{get:Vs}),Bl.createEventLoop_8be2vx$=Ws,Bl.UnconfinedEventLoop=Ys,Bl.EventLoopImplPlatform=Gs,Bl.CancellationException_init_pdl1vj$=Qs,Bl.CancellationException=Zs,Bl.JobCancellationException=Xs,el.ScheduledMessageQueue=nl,Bl.SetTimeoutBasedDispatcher=el,Object.defineProperty(Bl,"NodeDispatcher",{get:ol}),Object.defineProperty(Bl,"SetTimeoutDispatcher",{get:ll}),Bl.WindowDispatcher=ul,Bl.MessageQueue=fl,Bl.Runnable=dl,Bl.SchedulerTask=_l,Bl.get_taskContext_5sfo4y$=yl,Bl.asCoroutineDispatcher_nz12v2$=ml,Kl.AbortFlowException=vl,Kl.ChildCancelledException=$l,Kl.SafeCollector=gl,Wl.NoOpLock=kl,Wl.subscriberList_tnbmyv$=Sl,Wl.identitySet_46rbr$=xl,Wl.CopyOnWriteList=El,Wl.LinkedListNode=Ol,Wl.AddLastDesc=Nl,Wl.RemoveFirstDesc=zl,Wl.AbstractAtomicDesc=jl,Wl.PrepareOp=Tl,Wl.LinkedListHead=Pl,Wl.recoverStackTrace_87698k$=Al,Wl.unwrap_87698k$=Il,Wl.CoroutineStackFrame=Ml,Wl.initCause_oz8fe6$=Ll,Wl.systemProp_y4putb$=Dl,Wl.threadContextElements_v4qu62$=ql,Wl.CommonThreadLocal=Fl,Ze.prototype.plus_1fupul$=R.prototype.plus_1fupul$,Ze.prototype.fold_3cc69b$=R.prototype.fold_3cc69b$,Ze.prototype.get_j3r2sn$=R.prototype.get_j3r2sn$,Ze.prototype.minusKey_yeqjby$=R.prototype.minusKey_yeqjby$,rn.prototype.cancel=Ze.prototype.cancel,rn.prototype.plus_dqr1mp$=Ze.prototype.plus_dqr1mp$,rn.prototype.plus_1fupul$=Ze.prototype.plus_1fupul$,rn.prototype.fold_3cc69b$=Ze.prototype.fold_3cc69b$,rn.prototype.get_j3r2sn$=Ze.prototype.get_j3r2sn$,rn.prototype.minusKey_yeqjby$=Ze.prototype.minusKey_yeqjby$,rn.prototype.cancel_m4sck1$=Ze.prototype.cancel_m4sck1$,rn.prototype.cancel_dbl4no$=Ze.prototype.cancel_dbl4no$,rn.prototype.invokeOnCompletion_ct2b2z$=Ze.prototype.invokeOnCompletion_ct2b2z$,on.prototype.cancel=Ze.prototype.cancel,on.prototype.plus_dqr1mp$=Ze.prototype.plus_dqr1mp$,on.prototype.plus_1fupul$=Ze.prototype.plus_1fupul$,on.prototype.fold_3cc69b$=Ze.prototype.fold_3cc69b$,on.prototype.get_j3r2sn$=Ze.prototype.get_j3r2sn$,on.prototype.minusKey_yeqjby$=Ze.prototype.minusKey_yeqjby$,on.prototype.cancel_m4sck1$=Ze.prototype.cancel_m4sck1$,on.prototype.cancel_dbl4no$=Ze.prototype.cancel_dbl4no$,on.prototype.invokeOnCompletion_ct2b2z$=Ze.prototype.invokeOnCompletion_ct2b2z$,$n.prototype.cancel=Ze.prototype.cancel,$n.prototype.plus_dqr1mp$=Ze.prototype.plus_dqr1mp$,$n.prototype.plus_1fupul$=Ze.prototype.plus_1fupul$,$n.prototype.fold_3cc69b$=Ze.prototype.fold_3cc69b$,$n.prototype.get_j3r2sn$=Ze.prototype.get_j3r2sn$,$n.prototype.minusKey_yeqjby$=Ze.prototype.minusKey_yeqjby$,$n.prototype.invokeOnCompletion_ct2b2z$=Ze.prototype.invokeOnCompletion_ct2b2z$,$n.prototype.cancel_m4sck1$=Ze.prototype.cancel_m4sck1$,$n.prototype.cancel_dbl4no$=Ze.prototype.cancel_dbl4no$,qe.prototype.cancel=Ze.prototype.cancel,qe.prototype.plus_dqr1mp$=Ze.prototype.plus_dqr1mp$,qe.prototype.plus_1fupul$=Ze.prototype.plus_1fupul$,qe.prototype.fold_3cc69b$=Ze.prototype.fold_3cc69b$,qe.prototype.get_j3r2sn$=Ze.prototype.get_j3r2sn$,qe.prototype.minusKey_yeqjby$=Ze.prototype.minusKey_yeqjby$,qe.prototype.cancel_m4sck1$=Ze.prototype.cancel_m4sck1$,qe.prototype.cancel_dbl4no$=Ze.prototype.cancel_dbl4no$,qe.prototype.invokeOnCompletion_ct2b2z$=Ze.prototype.invokeOnCompletion_ct2b2z$,Ht.prototype.cancel_dbl4no$=Lt.prototype.cancel_dbl4no$,Ht.prototype.tryResume_19pj23$=Lt.prototype.tryResume_19pj23$,Xt.prototype.cancel=qe.prototype.cancel,Xt.prototype.plus_dqr1mp$=qe.prototype.plus_dqr1mp$,Xt.prototype.plus_1fupul$=qe.prototype.plus_1fupul$,Xt.prototype.fold_3cc69b$=qe.prototype.fold_3cc69b$,Xt.prototype.get_j3r2sn$=qe.prototype.get_j3r2sn$,Xt.prototype.minusKey_yeqjby$=qe.prototype.minusKey_yeqjby$,Xt.prototype.cancel_m4sck1$=qe.prototype.cancel_m4sck1$,Xt.prototype.cancel_dbl4no$=qe.prototype.cancel_dbl4no$,Xt.prototype.invokeOnCompletion_ct2b2z$=qe.prototype.invokeOnCompletion_ct2b2z$,ne.prototype.cancel=Ze.prototype.cancel,ne.prototype.plus_dqr1mp$=Ze.prototype.plus_dqr1mp$,ne.prototype.plus_1fupul$=Ze.prototype.plus_1fupul$,ne.prototype.fold_3cc69b$=Ze.prototype.fold_3cc69b$,ne.prototype.get_j3r2sn$=Ze.prototype.get_j3r2sn$,ne.prototype.minusKey_yeqjby$=Ze.prototype.minusKey_yeqjby$,ne.prototype.cancel_m4sck1$=Ze.prototype.cancel_m4sck1$,ne.prototype.cancel_dbl4no$=Ze.prototype.cancel_dbl4no$,ne.prototype.invokeOnCompletion_ct2b2z$=Ze.prototype.invokeOnCompletion_ct2b2z$,ce.prototype.get_j3r2sn$=g.prototype.get_j3r2sn$,ce.prototype.minusKey_yeqjby$=g.prototype.minusKey_yeqjby$,ye.prototype.fold_3cc69b$=R.prototype.fold_3cc69b$,ye.prototype.get_j3r2sn$=R.prototype.get_j3r2sn$,ye.prototype.minusKey_yeqjby$=R.prototype.minusKey_yeqjby$,ye.prototype.plus_1fupul$=R.prototype.plus_1fupul$,Ye.prototype.delay_s8cxhz$=Ue.prototype.delay_s8cxhz$,Ye.prototype.invokeOnTimeout_oczv3n$=Ue.prototype.invokeOnTimeout_oczv3n$,Hn.prototype.cancel=Ze.prototype.cancel,Hn.prototype.plus_dqr1mp$=Ze.prototype.plus_dqr1mp$,Hn.prototype.invokeOnCompletion_ct2b2z$=Ze.prototype.invokeOnCompletion_ct2b2z$,Hn.prototype.cancel_m4sck1$=Ze.prototype.cancel_m4sck1$,Hn.prototype.cancel_dbl4no$=Ze.prototype.cancel_dbl4no$,pi.prototype.close_dbl4no$=Gi.prototype.close_dbl4no$,xi.prototype.next0=nr.prototype.next0,rr.prototype.cancel=Ji.prototype.cancel,rr.prototype.close_dbl4no$=Gi.prototype.close_dbl4no$,rr.prototype.cancel_m4sck1$=Ji.prototype.cancel_m4sck1$,rr.prototype.cancel_dbl4no$=Ji.prototype.cancel_dbl4no$,vi.prototype.cancel=rr.prototype.cancel,vi.prototype.cancel_dbl4no$=rr.prototype.cancel_dbl4no$,vi.prototype.cancel_m4sck1$=rr.prototype.cancel_m4sck1$,Ui.prototype.close_dbl4no$=Gi.prototype.close_dbl4no$,Ii.prototype.cancel_dbl4no$=Ui.prototype.cancel_dbl4no$,Ii.prototype.cancel_m4sck1$=Ui.prototype.cancel_m4sck1$,Nr.prototype.close_dbl4no$=Gi.prototype.close_dbl4no$,qi.prototype.close_dbl4no$=Nr.prototype.close_dbl4no$,hr.prototype.close_dbl4no$=rr.prototype.close_dbl4no$,dr.prototype.close_dbl4no$=Ui.prototype.close_dbl4no$,dr.prototype.cancel_dbl4no$=Ui.prototype.cancel_dbl4no$,dr.prototype.cancel_m4sck1$=Ui.prototype.cancel_m4sck1$,yo.prototype.fuse_5k3f3z$=_o.prototype.fuse_5k3f3z$,Zr.prototype.fuse_5k3f3z$=_o.prototype.fuse_5k3f3z$,lo.prototype.fuse_5k3f3z$=_o.prototype.fuse_5k3f3z$,_o.prototype.fuse_5k3f3z$,_o.prototype.fuse_5k3f3z$,ps.prototype.invoke_en0wgx$=os.prototype.invoke_en0wgx$,ys.prototype.invoke_en0wgx$=os.prototype.invoke_en0wgx$,$s.prototype.tryLock_s8jyv4$=ms.prototype.tryLock_s8jyv4$,$s.prototype.lock_s8jyv4$=ms.prototype.lock_s8jyv4$,$s.prototype.unlock_s8jyv4$=ms.prototype.unlock_s8jyv4$,el.prototype.delay_s8cxhz$=Ue.prototype.delay_s8cxhz$,ul.prototype.delay_s8cxhz$=Ue.prototype.delay_s8cxhz$,n=new Wa("RESUME_TOKEN"),new Wa("REMOVED_TASK"),new Wa("CLOSED_EMPTY"),un=new Wa("COMPLETING_ALREADY"),pn=new Wa("COMPLETING_WAITING_CHILDREN"),hn=new Wa("COMPLETING_RETRY"),fn=new Wa("TOO_LATE_TO_CANCEL"),dn=new Wa("SEALED"),_n=new On(!1),yn=new On(!0),Qn=new Wa("EMPTY"),Xn=new Wa("OFFER_SUCCESS"),ti=new Wa("OFFER_FAILED"),ei=new Wa("POLL_FAILED"),ni=new Wa("ENQUEUE_FAILED"),ii=new Wa("ON_CLOSE_HANDLER_INVOKED"),ar="Channel was closed",yr=new Wa("NO_VALUE"),mr=new Wa("NONE"),vr=new Wa("PENDING"),$r=e.newArray(0,null),Do=new Wa("NULL"),new Wa("UNINITIALIZED"),new Wa("DONE"),Ya("kotlinx.coroutines.flow.defaultConcurrency",16,1,2147483647),qo=new Wa("NO_DECISION"),Fo=new Wa("RETRY_ATOMIC"),new Wa("CLOSED"),Uo=new Wa("UNDEFINED"),Bo=new Wa("REUSABLE_CLAIMED"),Ho=new Wa("REMOVE_PREPARED"),Vo=new Wa("NOT_SELECTED"),Ko=new Wa("ALREADY_SELECTED"),Wo=new Wa("UNDECIDED"),Yo=new Wa("RESUMED"),Go=new us,Jo=new Wa("LOCK_FAIL"),Zo=new Wa("UNLOCK_FAIL"),Qo=new Wa("SELECT_SUCCESS"),Xo=new Wa("LOCKED"),ta=new Wa("UNLOCKED"),ea=new vs(Xo),na=new vs(ta),Ya("kotlinx.coroutines.semaphore.maxSpinCycles",100),new Wa("PERMIT"),new Wa("TAKEN"),new Wa("BROKEN"),new Wa("CANCELLED"),Ya("kotlinx.coroutines.semaphore.segmentSize",16),ia="undefined",ra=0,oa=!1,Bs=vt,t})?r.apply(e,o):r)||(t.exports=a)}).call(this,n(4))},function(t,e){function n(t,e){if(!t)throw new Error(e||"Assertion failed")}t.exports=n,n.equal=function(t,e,n){if(t!=e)throw new Error(n||"Assertion failed: "+t+" != "+e)}},function(t,e,n){"use strict";var i=e,r=n(5),o=n(9),a=n(113);i.assert=o,i.toArray=a.toArray,i.zero2=a.zero2,i.toHex=a.toHex,i.encode=a.encode,i.getNAF=function(t,e,n){var i=new Array(Math.max(t.bitLength(),n)+1);i.fill(0);for(var r=1<(r>>1)-1?(r>>1)-l:l,o.isubn(s)):s=0,i[a]=s,o.iushrn(1)}return i},i.getJSF=function(t,e){var n=[[],[]];t=t.clone(),e=e.clone();for(var i,r=0,o=0;t.cmpn(-r)>0||e.cmpn(-o)>0;){var a,s,l=t.andln(3)+r&3,c=e.andln(3)+o&3;3===l&&(l=-1),3===c&&(c=-1),a=0==(1&l)?0:3!==(i=t.andln(7)+r&7)&&5!==i||2!==c?l:-l,n[0].push(a),s=0==(1&c)?0:3!==(i=e.andln(7)+o&7)&&5!==i||2!==l?c:-c,n[1].push(s),2*r===a+1&&(r=1-r),2*o===s+1&&(o=1-o),t.iushrn(1),e.iushrn(1)}return n},i.cachedProperty=function(t,e,n){var i="_"+e;t.prototype[e]=function(){return void 0!==this[i]?this[i]:this[i]=n.call(this)}},i.parseBytes=function(t){return"string"==typeof t?i.toArray(t,"hex"):t},i.intFromLE=function(t){return new r(t,"hex","le")}},function(t,e,n){"use strict";var i=n(9),r=n(0);function o(t,e){return 55296==(64512&t.charCodeAt(e))&&(!(e<0||e+1>=t.length)&&56320==(64512&t.charCodeAt(e+1)))}function a(t){return(t>>>24|t>>>8&65280|t<<8&16711680|(255&t)<<24)>>>0}function s(t){return 1===t.length?"0"+t:t}function l(t){return 7===t.length?"0"+t:6===t.length?"00"+t:5===t.length?"000"+t:4===t.length?"0000"+t:3===t.length?"00000"+t:2===t.length?"000000"+t:1===t.length?"0000000"+t:t}e.inherits=r,e.toArray=function(t,e){if(Array.isArray(t))return t.slice();if(!t)return[];var n=[];if("string"==typeof t)if(e){if("hex"===e)for((t=t.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(t="0"+t),r=0;r>6|192,n[i++]=63&a|128):o(t,r)?(a=65536+((1023&a)<<10)+(1023&t.charCodeAt(++r)),n[i++]=a>>18|240,n[i++]=a>>12&63|128,n[i++]=a>>6&63|128,n[i++]=63&a|128):(n[i++]=a>>12|224,n[i++]=a>>6&63|128,n[i++]=63&a|128)}else for(r=0;r>>0}return a},e.split32=function(t,e){for(var n=new Array(4*t.length),i=0,r=0;i>>24,n[r+1]=o>>>16&255,n[r+2]=o>>>8&255,n[r+3]=255&o):(n[r+3]=o>>>24,n[r+2]=o>>>16&255,n[r+1]=o>>>8&255,n[r]=255&o)}return n},e.rotr32=function(t,e){return t>>>e|t<<32-e},e.rotl32=function(t,e){return t<>>32-e},e.sum32=function(t,e){return t+e>>>0},e.sum32_3=function(t,e,n){return t+e+n>>>0},e.sum32_4=function(t,e,n,i){return t+e+n+i>>>0},e.sum32_5=function(t,e,n,i,r){return t+e+n+i+r>>>0},e.sum64=function(t,e,n,i){var r=t[e],o=i+t[e+1]>>>0,a=(o>>0,t[e+1]=o},e.sum64_hi=function(t,e,n,i){return(e+i>>>0>>0},e.sum64_lo=function(t,e,n,i){return e+i>>>0},e.sum64_4_hi=function(t,e,n,i,r,o,a,s){var l=0,c=e;return l+=(c=c+i>>>0)>>0)>>0)>>0},e.sum64_4_lo=function(t,e,n,i,r,o,a,s){return e+i+o+s>>>0},e.sum64_5_hi=function(t,e,n,i,r,o,a,s,l,c){var u=0,p=e;return u+=(p=p+i>>>0)>>0)>>0)>>0)>>0},e.sum64_5_lo=function(t,e,n,i,r,o,a,s,l,c){return e+i+o+s+c>>>0},e.rotr64_hi=function(t,e,n){return(e<<32-n|t>>>n)>>>0},e.rotr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0},e.shr64_hi=function(t,e,n){return t>>>n},e.shr64_lo=function(t,e,n){return(t<<32-n|e>>>n)>>>0}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){return"string"==typeof t&&i.test(t)};var i=/-webkit-|-moz-|-ms-/;t.exports=e.default},function(t,e,n){var i,r,o;r=[e,n(1),n(8)],void 0===(o="function"==typeof(i=function(t,e,n){"use strict";var i,r=e.Kind.INTERFACE,o=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,a=e.kotlin.coroutines.CoroutineImpl,s=e.Long.MAX_VALUE,l=e.Long.fromInt(4088),c=e.ensureNotNull,u=e.kotlin.Unit,p=e.throwCCE,h=e.Kind.CLASS,f=e.Long.ZERO,d=e.equals,_=e.toByte,y=e.kotlin.text.StringBuilder_init,m=n.kotlinx.coroutines.CancellationException_init_pdl1vj$,v=e.kotlin.ranges.coerceAtMost_2p08ub$,$=Object,g=Math,b=e.kotlin.IllegalArgumentException_init_pdl1vj$,w=e.defineInlineFunction,k=e.wrapFunction,S=e.toShort,x=n.kotlinx.coroutines.CancellationException,E=Error,C=n.kotlinx.coroutines.Job,O=n.kotlinx.coroutines.CoroutineScope,N=e.kotlin.coroutines,z=n.kotlinx.coroutines,j=(n.kotlinx.coroutines.newCoroutineContext_7n4184$,n.kotlinx.coroutines.CoroutineScope_1fupul$,n.kotlinx.coroutines.CoroutineDispatcher),T=n.kotlinx.coroutines.launch_s496o7$,P=e.kotlin.ranges.coerceAtMost_dqglrj$,R=e.kotlin.IllegalStateException_init_pdl1vj$,A=e.kotlin.UnsupportedOperationException_init_pdl1vj$,I=e.kotlin.UShort,M=(e.kotlin.UInt,e.kotlin.ULong,e.Long.fromInt(16)),L=e.kotlin.text.StringBuilder_init_za3lpa$,D=e.kotlin.UnsupportedOperationException_init,q=e.kotlin.text.Appendable,F=e.kotlin.ranges.coerceAtLeast_dqglrj$,U=e.unboxChar,B=e.Kind.OBJECT,H=e.toChar,V=e.toBoxedChar,K=e.kotlin.Exception_init_pdl1vj$,W=e.kotlin.Exception,Y=(e.kotlin.UByte,new e.Long(-1,0)),G=(e.kotlin.Annotation,e.Long.NEG_ONE),J=e.kotlin.ranges.until_ebnic$,Z=e.floatToRawBits,Q=e.doubleToRawBits,X=(e.kotlin.text.contains_sgbm27$,e.kotlin.collections.copyOf_mrm5p$,e.Long.fromInt(2147483647)),tt=e.PropertyMetadata,et=e.kotlin.properties.ReadWriteProperty,nt=e.kotlin.IndexOutOfBoundsException,it=e.kotlin.CharSequence,rt=e.kotlin.text.isLowSurrogate_myv2d0$,ot=e.kotlin.text.isHighSurrogate_myv2d0$,at=(e.kotlin.Error_init_pdl1vj$,e.kotlin.NotImplementedError,n.kotlinx.coroutines.Job_5dx9e$),st=e.toString,lt=e.hashCode,ct=e.Long.ONE,ut=e.kotlin.lazy_klfg04$,pt=(e.kotlin.Result,e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,e.kotlin.coroutines.SafeContinuation_init_wj8d80$,e.kotlin.io.println_s8jyv4$,e.kotlin.text.replace_r2fvfm$),ht=Int8Array,ft=e.kotlin.properties.ReadOnlyProperty,dt=e.kotlin.Enum,_t=e.throwISE,yt=e.kotlin.IndexOutOfBoundsException_init,mt=e.kotlin.collections.setOf_i5x0yv$,vt=e.kotlin.text.decodeToString_964n91$,$t=e.kotlin.text.trim_gw00vp$;function gt(){}function bt(t){this.closure$message=t,uo.call(this)}function wt(t,e,n){void 0===n&&(n=ao().Pool),this.autoFlush_tqevpj$_0=e,this.state_9883ul$_0=new Qo,this.writable=new Mi(0,n),this.readable=Ui(t,n),this.slot_2l2jew$_0=new Io,this.flushMutex_pw64cr$_0=new $,this.flushBuffer_1r7aq2$_0=el()}function kt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$count=e}function St(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$count=e}function xt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$b=e}function Et(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$s=e}function Ct(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$i=e}function Ot(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$l=e}function Nt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$f=e}function zt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$d=e}function jt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$packet=e}function Tt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$src=e}function Pt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$src=e}function Rt(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$currentIndex=void 0,this.local$endIndex=void 0,this.local$src=e,this.local$offset=n,this.local$length=i}function At(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$currentIndex=void 0,this.local$memory=e,this.local$startIndex=n,this.local$endIndex=i}function It(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$srcRemaining=void 0,this.local$src=e}function Mt(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$src=e,this.local$offset=n,this.local$length=i}function Lt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$visitor=e}function Dt(t){this.this$ByteChannelSequentialBase=t}function qt(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$n=e}function Ft(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function Ut(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Bt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function Ht(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Vt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function Kt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Wt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function Yt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Gt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Jt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Zt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Qt(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Xt(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$limit=e,this.local$headerSizeHint=n}function te(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$builder=e,this.local$limit=n}function ee(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$size=e,this.local$headerSizeHint=n}function ne(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$remaining=void 0,this.local$builder=e,this.local$size=n}function ie(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$dst=e}function re(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$dst=e}function oe(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$dst=e,this.local$n=n}function ae(t){return function(){return"Not enough space in the destination buffer to write "+t+" bytes"}}function se(){return"n shouldn't be negative"}function le(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$dst=e,this.local$n=n}function ce(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$dst=e,this.local$n=n}function ue(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$dst=e,this.local$offset=n,this.local$length=i}function pe(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$dst=e,this.local$offset=n,this.local$length=i}function he(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$rc=void 0,this.local$dst=e,this.local$offset=n,this.local$length=i}function fe(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$written=void 0,this.local$dst=e,this.local$offset=n,this.local$length=i}function de(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0}function _e(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function ye(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function me(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$atLeast=e}function ve(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$max=e}function $e(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$discarded=void 0,this.local$max=e,this.local$discarded0=n}function ge(t,e,n){a.call(this,n),this.exceptionState_0=5,this.$this=t,this.local$consumer=e}function be(t,e,n){a.call(this,n),this.exceptionState_0=1,this.local$this$ByteChannelSequentialBase=t,this.local$size=e}function we(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$sb=void 0,this.local$limit=e}function ke(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$n=e,this.local$block=n}function Se(t,e,n){a.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$src=e}function xe(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$src=e,this.local$offset=n,this.local$length=i}function Ee(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Ce(t,e,n,i,r,o,s,l,c){a.call(this,c),this.$controller=l,this.exceptionState_0=1,this.local$closure$min=t,this.local$closure$offset=e,this.local$closure$max=n,this.local$closure$destination=i,this.local$closure$destinationOffset=r,this.local$closure$bytesCopied=o,this.local$$receiver=s}function Oe(t,e,n,i,r,o){return function(a,s,l){var c=new Ce(t,e,n,i,r,o,a,this,s);return l?c:c.doResume(null)}}function Ne(t,e,n,i,r,o,s){a.call(this,s),this.exceptionState_0=1,this.$this=t,this.local$bytesCopied=void 0,this.local$destination=e,this.local$destinationOffset=n,this.local$offset=i,this.local$min=r,this.local$max=o}function ze(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.local$$receiver=t,this.local$dst=e,this.local$limit=n}function je(t){return t.close_dbl4no$(null)}function Te(t){m(t,this),this.name="ClosedWriteChannelException"}function Pe(){}function Re(){}function Ae(){}function Ie(){}function Me(t,e,n,i,r,o,s){a.call(this,s),this.$controller=o,this.exceptionState_0=5,this.local$closure$attachJob=t,this.local$closure$channel=e,this.local$closure$block=n,this.local$closure$dispatcher=i,this.local$$receiver=r}function Le(t,e){this.channel_79cwt9$_0=e,this.$delegate_h3p63m$_0=t}function De(t,e){this.delegate_0=t,this.channel_zg1n2y$_0=e}function qe(){}function Fe(){}function Ue(t,e,n){a.call(this,n),this.exceptionState_0=1,this.local$readSession=void 0,this.local$$receiver=t,this.local$desiredSize=e}function Be(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.local$$receiver=t,this.local$buffer=e,this.local$bytesRead=n}function He(t,e,n){a.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$desiredSize=e}function Ve(t,e,n){a.call(this,n),this.exceptionState_0=1,this.local$chunk=void 0,this.local$$receiver=t,this.local$desiredSize=e}function Ke(t,e,n,i){var r=new Ve(t,e,n);return i?r:r.doResume(null)}function We(){}function Ye(){}function Ge(){}function Je(){}function Ze(t,e,n){a.call(this,n),this.exceptionState_0=1,this.local$session=void 0,this.local$$receiver=t,this.local$desiredSpace=e}function Qe(t,e,n){a.call(this,n),this.exceptionState_0=1,this.local$$receiver=t,this.local$buffer=e}function Xe(t,e,n){a.call(this,n),this.exceptionState_0=1,this.local$session=t,this.local$desiredSpace=e}function tn(){}function en(t,e,n,i,r){var o={v:n};if(!(o.v>=i)){var a=To(r,1,null);try{for(var s;;){var l=rn(t,e,o.v,i,a);if(!(l>=0))throw R("Check failed.".toString());if(o.v=o.v+l|0,(s=o.v>=i?0:0===l?8:1)<=0)break;a=To(r,s,a)}}finally{Po(r,a)}sn(0,r)}}function nn(t,n,i){void 0===i&&(i=2147483647);var r=e.Long.fromInt(i),o=an(n),a=L((r.compareTo_11rb$(o)<=0?r:o).toInt());return Za(t,n,a,i),a.toString()}function rn(t,e,n,i,r){var o=i-n|0;return Ka(t,new yo(e,n,o),0,o,r)}function on(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length);var o={v:i};if(o.v>=r)return ro;var a=ao().Pool.borrow();try{var s,l=Ka(t,n,o.v,r,a);if(o.v=o.v+l|0,o.v===r){var c=new Int8Array(a.writePosition-a.readPosition|0);return ii(a,c),c}var u=el(0);try{u.appendSingleChunk_pvnryh$(a.duplicate()),ln(t,u,n,o.v,r),s=u.build()}catch(t){throw e.isType(t,E)?(u.release(),t):t}return Fr(s)}finally{a.release_2bs5fo$(ao().Pool)}}function an(t){if(e.isType(t,Li))return t.remaining;if(e.isType(t,un)){var n=t.remaining,i=M;return n.compareTo_11rb$(i)>=0?n:i}return M}function sn(t,e){var n={v:1},i={v:0},r=To(e,1,null);try{for(;;){var o=r,a=o.limit-o.writePosition|0;if(n.v=0,i.v=i.v+(a-(o.limit-o.writePosition|0))|0,!(n.v>0))break;r=To(e,1,r)}}finally{Po(e,r)}return i.v}function ln(t,e,n,i,r){var o={v:i};if(o.v>=r)return 0;var a={v:0},s=To(e,1,null);try{for(var l;;){var c=s,u=c.limit-c.writePosition|0,p=Ka(t,n,o.v,r,c);if(!(p>=0))throw R("Check failed.".toString());if(o.v=o.v+p|0,a.v=a.v+(u-(c.limit-c.writePosition|0))|0,(l=o.v>=r?0:0===p?8:1)<=0)break;s=To(e,l,s)}}finally{Po(e,s)}return a.v=a.v+sn(0,e)|0,a.v}function cn(t){this.closure$message=t,uo.call(this)}function un(t,e,n){_n(),void 0===t&&(t=ao().Empty),void 0===e&&(e=ji(t)),void 0===n&&(n=ao().Pool),this.pool=n,this.state_8q4rcd$_0=new us(t,e),this.noMoreChunksAvailable_2n0tap$_0=!1}function pn(t,e){this.closure$destination=t,this.idx_0=e}function hn(){throw R("It should be no tail remaining bytes if current tail is EmptyBuffer")}function fn(){dn=this}Te.prototype=Object.create(x.prototype),Te.prototype.constructor=Te,os.prototype=Object.create(E.prototype),os.prototype.constructor=os,Pn.prototype=Object.create(W.prototype),Pn.prototype.constructor=Pn,Bn.prototype=Object.create(dl.prototype),Bn.prototype.constructor=Bn,xi.prototype=Object.create(Bo.prototype),xi.prototype.constructor=xi,Pi.prototype=Object.create(W.prototype),Pi.prototype.constructor=Pi,Ai.prototype=Object.create(yn.prototype),Ai.prototype.constructor=Ai,Ri.prototype=Object.create(Ai.prototype),Ri.prototype.constructor=Ri,Mi.prototype=Object.create(Ri.prototype),Mi.prototype.constructor=Mi,Ar.prototype=Object.create(un.prototype),Ar.prototype.constructor=Ar,Bi.prototype=Object.create(Ar.prototype),Bi.prototype.constructor=Bi,Li.prototype=Object.create(Bi.prototype),Li.prototype.constructor=Li,no.prototype=Object.create(Bo.prototype),no.prototype.constructor=no,io.prototype=Object.create(Bo.prototype),io.prototype.constructor=io,Gr.prototype=Object.create($n.prototype),Gr.prototype.constructor=Gr,Co.prototype=Object.create(W.prototype),Co.prototype.constructor=Co,Yo.prototype=Object.create(wt.prototype),Yo.prototype.constructor=Yo,Ha.prototype=Object.create(Ba.prototype),Ha.prototype.constructor=Ha,Ga.prototype=Object.create(Ya.prototype),Ga.prototype.constructor=Ga,rs.prototype=Object.create(La.prototype),rs.prototype.constructor=rs,fs.prototype=Object.create(dt.prototype),fs.prototype.constructor=fs,qs.prototype=Object.create(dl.prototype),qs.prototype.constructor=qs,Us.prototype=Object.create(Bo.prototype),Us.prototype.constructor=Us,Is.prototype=Object.create(Gr.prototype),Is.prototype.constructor=Is,rl.prototype=Object.create(W.prototype),rl.prototype.constructor=rl,al.prototype=Object.create(rl.prototype),al.prototype.constructor=al,gt.$metadata$={kind:r,simpleName:"ByteChannel",interfaces:[ra,Xo]},bt.prototype=Object.create(uo.prototype),bt.prototype.constructor=bt,bt.prototype.doFail=function(){throw b(this.closure$message())},bt.$metadata$={kind:h,interfaces:[uo]},Object.defineProperty(wt.prototype,"autoFlush",{get:function(){return this.autoFlush_tqevpj$_0}}),Object.defineProperty(wt.prototype,"closed",{configurable:!0,get:function(){return this.state_9883ul$_0.closed},set:function(t){this.state_9883ul$_0.closed=t}}),wt.prototype.totalPending_82umvh$_0=function(){return this.availableForRead+this.writable.size|0},Object.defineProperty(wt.prototype,"flushSize_sv6emv$_0",{configurable:!0,get:function(){return this.flushBuffer_1r7aq2$_0.size}}),Object.defineProperty(wt.prototype,"availableForRead",{configurable:!0,get:function(){return this.flushSize_sv6emv$_0+this.readable.remaining.toInt()|0}}),Object.defineProperty(wt.prototype,"availableForWrite",{configurable:!0,get:function(){var t=4088-(this.availableForRead+this.writable.size|0)|0;return g.max(0,t)}}),Object.defineProperty(wt.prototype,"readByteOrder",{configurable:!0,get:function(){return this.state_9883ul$_0.readByteOrder},set:function(t){this.state_9883ul$_0.readByteOrder=t}}),Object.defineProperty(wt.prototype,"writeByteOrder",{configurable:!0,get:function(){return this.state_9883ul$_0.writeByteOrder},set:function(t){this.state_9883ul$_0.writeByteOrder=t}}),Object.defineProperty(wt.prototype,"isClosedForRead",{configurable:!0,get:function(){var t=this.closed;return t&&(t=this.readable.endOfInput),t&&0===this.flushSize_sv6emv$_0&&this.writable.isEmpty}}),Object.defineProperty(wt.prototype,"isClosedForWrite",{configurable:!0,get:function(){return this.closed}}),Object.defineProperty(wt.prototype,"_totalBytesRead_mx8dwu$_0",{configurable:!0,get:function(){return this.state_9883ul$_0.totalBytesRead},set:function(t){this.state_9883ul$_0.totalBytesRead=t}}),Object.defineProperty(wt.prototype,"totalBytesRead",{configurable:!0,get:function(){return this.state_9883ul$_0.totalBytesRead}}),Object.defineProperty(wt.prototype,"_totalBytesWritten_s86f3f$_0",{configurable:!0,get:function(){return this.state_9883ul$_0.totalBytesWritten},set:function(t){this.state_9883ul$_0.totalBytesWritten=t}}),Object.defineProperty(wt.prototype,"totalBytesWritten",{configurable:!0,get:function(){return this.state_9883ul$_0.totalBytesWritten}}),Object.defineProperty(wt.prototype,"closedCause",{configurable:!0,get:function(){return this.state_9883ul$_0.closedCause},set:function(t){this.state_9883ul$_0.closedCause=t}}),kt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},kt.prototype=Object.create(a.prototype),kt.prototype.constructor=kt,kt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.$this.availableForWrite>=this.local$count||this.$this.closed){this.state_0=5;continue}if(this.$this.flushImpl_t0lzva$_0()){this.state_0=4;continue}if(this.state_0=3,this.result_0=this.$this.slot_2l2jew$_0.sleep(this),this.result_0===o)return o;continue;case 3:this.state_0=4;continue;case 4:this.state_0=2;continue;case 5:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.awaitAtLeastNBytesAvailableForWrite_kcn2v3$=function(t,e,n){var i=new kt(this,t,e);return n?i:i.doResume(null)},St.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},St.prototype=Object.create(a.prototype),St.prototype.constructor=St,St.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.$this.availableForRead>=this.local$count||this.$this.closed){this.state_0=4;continue}if(this.state_0=3,this.result_0=this.$this.slot_2l2jew$_0.sleep(this),this.result_0===o)return o;continue;case 3:this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.awaitAtLeastNBytesAvailableForRead_kcn2v3$=function(t,e,n){var i=new St(this,t,e);return n?i:i.doResume(null)},wt.prototype.flush=function(){this.flushImpl_t0lzva$_0()},wt.prototype.flushImpl_t0lzva$_0=function(){return!this.writable.isEmpty&&(this.flushWrittenBytes_2bgxqi$_0(),this.slot_2l2jew$_0.resume(),!0)},wt.prototype.flushWrittenBytes_2bgxqi$_0=function(){var t=c(this.writable.stealAll_8be2vx$());this.flushBuffer_1r7aq2$_0.writeChunkBuffer_pvnryh$(t)},wt.prototype.prepareFlushedBytes=function(){Oo(this.readable,this.flushBuffer_1r7aq2$_0)},wt.prototype.ensureNotClosed_ozgwi5$_0=function(){var t;if(this.closed)throw null!=(t=this.closedCause)?t:new Te("Channel is already closed")},wt.prototype.ensureNotFailed_7bddlw$_0=function(){var t;if(null!=(t=this.closedCause))throw t},wt.prototype.ensureNotFailed_2bmfsh$_0=function(t){var e;if(null!=(e=this.closedCause))throw t.release(),e},xt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},xt.prototype=Object.create(a.prototype),xt.prototype.constructor=xt,xt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return this.$this.writable.writeByte_s8j3t7$(this.local$b),void this.$this.afterWrite_za3lpa$(1);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeByte_s8j3t7$=function(t,e,n){var i=new xt(this,t,e);return n?i:i.doResume(null)},wt.prototype.reverseWrite_hkpayy$_0=function(t,e){return this.writeByteOrder===_s()?t():e()},Et.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Et.prototype=Object.create(a.prototype),Et.prototype.constructor=Et,Et.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(2,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return Cr(this.$this.writable,this.$this.writeByteOrder===_s()?this.local$s:aa(this.local$s)),void this.$this.afterWrite_za3lpa$(2);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeShort_mq22fl$=function(t,e,n){var i=new Et(this,t,e);return n?i:i.doResume(null)},Ct.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ct.prototype=Object.create(a.prototype),Ct.prototype.constructor=Ct,Ct.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(4,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return Or(this.$this.writable,this.$this.writeByteOrder===_s()?this.local$i:sa(this.local$i)),void this.$this.afterWrite_za3lpa$(4);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeInt_za3lpa$=function(t,e,n){var i=new Ct(this,t,e);return n?i:i.doResume(null)},Ot.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ot.prototype=Object.create(a.prototype),Ot.prototype.constructor=Ot,Ot.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(8,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return jr(this.$this.writable,this.$this.writeByteOrder===_s()?this.local$l:la(this.local$l)),void this.$this.afterWrite_za3lpa$(8);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeLong_s8cxhz$=function(t,e,n){var i=new Ot(this,t,e);return n?i:i.doResume(null)},Nt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Nt.prototype=Object.create(a.prototype),Nt.prototype.constructor=Nt,Nt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(4,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return Pr(this.$this.writable,this.$this.writeByteOrder===_s()?this.local$f:ca(this.local$f)),void this.$this.afterWrite_za3lpa$(4);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeFloat_mx4ult$=function(t,e,n){var i=new Nt(this,t,e);return n?i:i.doResume(null)},zt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},zt.prototype=Object.create(a.prototype),zt.prototype.constructor=zt,zt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(8,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return Rr(this.$this.writable,this.$this.writeByteOrder===_s()?this.local$d:ua(this.local$d)),void this.$this.afterWrite_za3lpa$(8);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeDouble_14dthe$=function(t,e,n){var i=new zt(this,t,e);return n?i:i.doResume(null)},jt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},jt.prototype=Object.create(a.prototype),jt.prototype.constructor=jt,jt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:var t=this.local$packet.remaining.toInt();return this.$this.writable.writePacket_3uq2w4$(this.local$packet),void this.$this.afterWrite_za3lpa$(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writePacket_3uq2w4$=function(t,e,n){var i=new jt(this,t,e);return n?i:i.doResume(null)},Tt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Tt.prototype=Object.create(a.prototype),Tt.prototype.constructor=Tt,Tt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.writeFully_b4g5fm$(e.isType(t=this.local$src,$n)?t:p(),this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeFully_99qa0s$=function(t,e,n){var i=new Tt(this,t,e);return n?i:i.doResume(null)},Pt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Pt.prototype=Object.create(a.prototype),Pt.prototype.constructor=Pt,Pt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:var t=this.local$src.writePosition-this.local$src.readPosition|0;return kr(this.$this.writable,this.local$src),void this.$this.afterWrite_za3lpa$(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeFully_b4g5fm$=function(t,e,n){var i=new Pt(this,t,e);return n?i:i.doResume(null)},Rt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Rt.prototype=Object.create(a.prototype),Rt.prototype.constructor=Rt,Rt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$currentIndex=this.local$offset,this.local$endIndex=this.local$offset+this.local$length|0,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$currentIndex>=this.local$endIndex){this.state_0=4;continue}if(this.state_0=3,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 3:var t=this.$this.availableForWrite,e=this.local$endIndex-this.local$currentIndex|0,n=g.min(t,e);mr(this.$this.writable,this.local$src,this.local$currentIndex,n),this.local$currentIndex=this.local$currentIndex+n|0,this.$this.afterWrite_za3lpa$(n),this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeFully_mj6st8$=function(t,e,n,i,r){var o=new Rt(this,t,e,n,i);return r?o:o.doResume(null)},At.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},At.prototype=Object.create(a.prototype),At.prototype.constructor=At,At.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$currentIndex=this.local$startIndex,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$currentIndex>=this.local$endIndex){this.state_0=4;continue}if(this.state_0=3,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 3:var t=this.$this.availableForWrite,e=this.local$endIndex-this.local$currentIndex|0,n=g.min(t,e);Sr(this.$this.writable,this.local$memory,this.local$currentIndex,n),this.local$currentIndex=this.local$currentIndex+n|0,this.$this.afterWrite_za3lpa$(n),this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeFully_9etqdk$=function(t,e,n,i,r){var o=new At(this,t,e,n,i);return r?o:o.doResume(null)},It.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},It.prototype=Object.create(a.prototype),It.prototype.constructor=It,It.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$srcRemaining=this.local$src.writePosition-this.local$src.readPosition|0,0===this.local$srcRemaining)return 0;this.state_0=2;continue;case 1:throw this.exception_0;case 2:var t=this.$this.availableForWrite,e=g.min(this.local$srcRemaining,t);if(0===e){if(this.state_0=3,this.result_0=this.$this.writeAvailableSuspend_5fukw0$_0(this.local$src,this),this.result_0===o)return o;continue}kr(this.$this.writable,this.local$src,e),this.$this.afterWrite_za3lpa$(e),this.local$tmp$=e,this.state_0=4;continue;case 3:this.local$tmp$=this.result_0,this.state_0=4;continue;case 4:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeAvailable_99qa0s$=function(t,e,n){var i=new It(this,t,e);return n?i:i.doResume(null)},Mt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Mt.prototype=Object.create(a.prototype),Mt.prototype.constructor=Mt,Mt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(0===this.local$length)return 0;this.state_0=2;continue;case 1:throw this.exception_0;case 2:var t=this.$this.availableForWrite,e=g.min(this.local$length,t);if(0===e){if(this.state_0=3,this.result_0=this.$this.writeAvailableSuspend_1zn44g$_0(this.local$src,this.local$offset,this.local$length,this),this.result_0===o)return o;continue}mr(this.$this.writable,this.local$src,this.local$offset,e),this.$this.afterWrite_za3lpa$(e),this.local$tmp$=e,this.state_0=4;continue;case 3:this.local$tmp$=this.result_0,this.state_0=4;continue;case 4:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeAvailable_mj6st8$=function(t,e,n,i,r){var o=new Mt(this,t,e,n,i);return r?o:o.doResume(null)},Lt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Lt.prototype=Object.create(a.prototype),Lt.prototype.constructor=Lt,Lt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=this.$this.beginWriteSession();if(this.state_0=2,this.result_0=this.local$visitor(t,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeSuspendSession_8dv01$=function(t,e,n){var i=new Lt(this,t,e);return n?i:i.doResume(null)},Dt.prototype.request_za3lpa$=function(t){var n;return 0===this.this$ByteChannelSequentialBase.availableForWrite?null:e.isType(n=this.this$ByteChannelSequentialBase.writable.prepareWriteHead_za3lpa$(t),Is)?n:p()},Dt.prototype.written_za3lpa$=function(t){this.this$ByteChannelSequentialBase.writable.afterHeadWrite(),this.this$ByteChannelSequentialBase.afterWrite_za3lpa$(t)},Dt.prototype.flush=function(){this.this$ByteChannelSequentialBase.flush()},qt.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},qt.prototype=Object.create(a.prototype),qt.prototype.constructor=qt,qt.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.this$ByteChannelSequentialBase.availableForWrite=this.local$limit.toNumber()){this.state_0=5;continue}var t=this.local$limit.subtract(e.Long.fromInt(this.local$builder.size)),n=this.$this.readable.remaining,i=t.compareTo_11rb$(n)<=0?t:n;if(this.local$builder.writePacket_pi0yjl$(this.$this.readable,i),this.$this.afterRead_za3lpa$(i.toInt()),this.$this.ensureNotFailed_2bmfsh$_0(this.local$builder),this.$this.isClosedForRead||this.local$builder.size===this.local$limit.toInt()){this.state_0=5;continue}this.state_0=3;continue;case 3:if(this.state_0=4,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===o)return o;continue;case 4:this.state_0=2;continue;case 5:return this.$this.ensureNotFailed_2bmfsh$_0(this.local$builder),this.local$builder.build();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readRemainingSuspend_gfhva8$_0=function(t,e,n,i){var r=new te(this,t,e,n);return i?r:r.doResume(null)},ee.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ee.prototype=Object.create(a.prototype),ee.prototype.constructor=ee,ee.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=el(this.local$headerSizeHint),n=this.local$size,i=e.Long.fromInt(n),r=this.$this.readable.remaining,a=(i.compareTo_11rb$(r)<=0?i:r).toInt();if(n=n-a|0,t.writePacket_f7stg6$(this.$this.readable,a),this.$this.afterRead_za3lpa$(a),n>0){if(this.state_0=2,this.result_0=this.$this.readPacketSuspend_2ns5o1$_0(t,n,this),this.result_0===o)return o;continue}this.local$tmp$=t.build(),this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readPacket_vux9f0$=function(t,e,n,i){var r=new ee(this,t,e,n);return i?r:r.doResume(null)},ne.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ne.prototype=Object.create(a.prototype),ne.prototype.constructor=ne,ne.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$remaining=this.local$size,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$remaining<=0){this.state_0=5;continue}var t=e.Long.fromInt(this.local$remaining),n=this.$this.readable.remaining,i=(t.compareTo_11rb$(n)<=0?t:n).toInt();if(this.local$remaining=this.local$remaining-i|0,this.local$builder.writePacket_f7stg6$(this.$this.readable,i),this.$this.afterRead_za3lpa$(i),this.local$remaining>0){if(this.state_0=3,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===o)return o;continue}this.state_0=4;continue;case 3:this.state_0=4;continue;case 4:this.state_0=2;continue;case 5:return this.local$builder.build();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readPacketSuspend_2ns5o1$_0=function(t,e,n,i){var r=new ne(this,t,e,n);return i?r:r.doResume(null)},wt.prototype.readAvailableClosed=function(){var t;if(null!=(t=this.closedCause))throw t;return-1},wt.prototype.readAvailable_99qa0s$=function(t,n){var i;return this.readAvailable_lh221x$(e.isType(i=t,$n)?i:p(),n)},ie.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ie.prototype=Object.create(a.prototype),ie.prototype.constructor=ie,ie.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(null!=this.$this.closedCause)throw c(this.$this.closedCause);if(this.$this.readable.canRead()){var t=e.Long.fromInt(this.local$dst.limit-this.local$dst.writePosition|0),n=this.$this.readable.remaining,i=(t.compareTo_11rb$(n)<=0?t:n).toInt();return Qi(this.$this.readable,this.local$dst,i),this.$this.afterRead_za3lpa$(i),i}if(this.$this.closed)return this.$this.readAvailableClosed();if(this.local$dst.limit>this.local$dst.writePosition){if(this.state_0=2,this.result_0=this.$this.readAvailableSuspend_b4eait$_0(this.local$dst,this),this.result_0===o)return o;continue}return 0;case 1:throw this.exception_0;case 2:return this.result_0;case 3:this.state_0=4;continue;case 4:this.state_0=5;continue;case 5:this.state_0=6;continue;case 6:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readAvailable_lh221x$=function(t,e,n){var i=new ie(this,t,e);return n?i:i.doResume(null)},re.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},re.prototype=Object.create(a.prototype),re.prototype.constructor=re,re.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.readAvailable_lh221x$(this.local$dst,this),this.result_0===o)return o;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readAvailableSuspend_b4eait$_0=function(t,e,n){var i=new re(this,t,e);return n?i:i.doResume(null)},oe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},oe.prototype=Object.create(a.prototype),oe.prototype.constructor=oe,oe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.readFully_bkznnu$_0(e.isType(t=this.local$dst,$n)?t:p(),this.local$n,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readFully_qr0era$=function(t,e,n,i){var r=new oe(this,t,e,n);return i?r:r.doResume(null)},le.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},le.prototype=Object.create(a.prototype),le.prototype.constructor=le,le.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$n<=(this.local$dst.limit-this.local$dst.writePosition|0)||new bt(ae(this.local$n)).doFail(),this.local$n>=0||new bt(se).doFail(),null!=this.$this.closedCause)throw c(this.$this.closedCause);if(this.$this.readable.remaining.toNumber()>=this.local$n){var t=(Qi(this.$this.readable,this.local$dst,this.local$n),u);this.$this.afterRead_za3lpa$(this.local$n),this.local$tmp$=t,this.state_0=4;continue}if(this.$this.closed)throw new al("Channel is closed and not enough bytes available: required "+this.local$n+" but "+this.$this.availableForRead+" available");if(this.state_0=2,this.result_0=this.$this.readFullySuspend_8xotw2$_0(this.local$dst,this.local$n,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:this.state_0=4;continue;case 4:this.state_0=5;continue;case 5:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readFully_bkznnu$_0=function(t,e,n,i){var r=new le(this,t,e,n);return i?r:r.doResume(null)},ce.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ce.prototype=Object.create(a.prototype),ce.prototype.constructor=ce,ce.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitSuspend_za3lpa$(this.local$n,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.readFully_bkznnu$_0(this.local$dst,this.local$n,this),this.result_0===o)return o;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readFullySuspend_8xotw2$_0=function(t,e,n,i){var r=new ce(this,t,e,n);return i?r:r.doResume(null)},ue.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ue.prototype=Object.create(a.prototype),ue.prototype.constructor=ue,ue.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.readable.canRead()){var t=e.Long.fromInt(this.local$length),n=this.$this.readable.remaining,i=(t.compareTo_11rb$(n)<=0?t:n).toInt();return Ki(this.$this.readable,this.local$dst,this.local$offset,i),this.$this.afterRead_za3lpa$(i),i}if(this.$this.closed)return this.$this.readAvailableClosed();if(this.state_0=2,this.result_0=this.$this.readAvailableSuspend_v6ah9b$_0(this.local$dst,this.local$offset,this.local$length,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return this.result_0;case 3:this.state_0=4;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readAvailable_mj6st8$=function(t,e,n,i,r){var o=new ue(this,t,e,n,i);return r?o:o.doResume(null)},pe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},pe.prototype=Object.create(a.prototype),pe.prototype.constructor=pe,pe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.readAvailable_mj6st8$(this.local$dst,this.local$offset,this.local$length,this),this.result_0===o)return o;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readAvailableSuspend_v6ah9b$_0=function(t,e,n,i,r){var o=new pe(this,t,e,n,i);return r?o:o.doResume(null)},he.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},he.prototype=Object.create(a.prototype),he.prototype.constructor=he,he.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.readAvailable_mj6st8$(this.local$dst,this.local$offset,this.local$length,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.local$rc=this.result_0,this.local$rc===this.local$length)return;this.state_0=3;continue;case 3:if(-1===this.local$rc)throw new al("Unexpected end of stream");if(this.state_0=4,this.result_0=this.$this.readFullySuspend_ayq7by$_0(this.local$dst,this.local$offset+this.local$rc|0,this.local$length-this.local$rc|0,this),this.result_0===o)return o;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readFully_mj6st8$=function(t,e,n,i,r){var o=new he(this,t,e,n,i);return r?o:o.doResume(null)},fe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},fe.prototype=Object.create(a.prototype),fe.prototype.constructor=fe,fe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$written=0,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$written>=this.local$length){this.state_0=4;continue}if(this.state_0=3,this.result_0=this.$this.readAvailable_mj6st8$(this.local$dst,this.local$offset+this.local$written|0,this.local$length-this.local$written|0,this),this.result_0===o)return o;continue;case 3:var t=this.result_0;if(-1===t)throw new al("Unexpected end of stream");this.local$written=this.local$written+t|0,this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readFullySuspend_ayq7by$_0=function(t,e,n,i,r){var o=new fe(this,t,e,n,i);return r?o:o.doResume(null)},de.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},de.prototype=Object.create(a.prototype),de.prototype.constructor=de,de.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.readable.canRead()){var t=this.$this.readable.readByte()===_(1);this.$this.afterRead_za3lpa$(1),this.local$tmp$=t,this.state_0=3;continue}if(this.state_0=2,this.result_0=this.$this.readBooleanSlow_cbbszf$_0(this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readBoolean=function(t,e){var n=new de(this,t);return e?n:n.doResume(null)},_e.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},_e.prototype=Object.create(a.prototype),_e.prototype.constructor=_e,_e.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.$this.checkClosed_ldvyyk$_0(1),this.state_0=3,this.result_0=this.$this.readBoolean(this),this.result_0===o)return o;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readBooleanSlow_cbbszf$_0=function(t,e){var n=new _e(this,t);return e?n:n.doResume(null)},Object.defineProperty(wt.prototype,"lastReadAvailable_1j890x$_0",{configurable:!0,get:function(){return this.state_9883ul$_0.lastReadAvailable},set:function(t){this.state_9883ul$_0.lastReadAvailable=t}}),Object.defineProperty(wt.prototype,"lastReadView_92ta1h$_0",{configurable:!0,get:function(){return this.state_9883ul$_0.lastReadView},set:function(t){this.state_9883ul$_0.lastReadView=t}}),wt.prototype.completeReading_um9rnf$_0=function(){var t=this.lastReadView_92ta1h$_0,e=t.writePosition-t.readPosition|0,n=this.lastReadAvailable_1j890x$_0-e|0;this.lastReadView_92ta1h$_0!==kn().Empty&&zo(this.readable,this.lastReadView_92ta1h$_0),n>0&&this.afterRead_za3lpa$(n),this.lastReadAvailable_1j890x$_0=0,this.lastReadView_92ta1h$_0=ao().Empty},wt.prototype.await_za3lpa$$default=function(t,e){var n;return t>=0||new bt((n=t,function(){return"atLeast parameter shouldn't be negative: "+n})).doFail(),t<=i.toNumber()||new bt(function(t){return function(){return"atLeast parameter shouldn't be larger than max buffer size of "+i.toString()+": "+t}}(t)).doFail(),this.completeReading_um9rnf$_0(),0===t?!this.isClosedForRead:this.readable.remaining.toNumber()>=t||this.awaitSuspend_za3lpa$(t,e)},ye.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ye.prototype=Object.create(a.prototype),ye.prototype.constructor=ye,ye.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.readable.endOfInput){if(this.state_0=2,this.result_0=this.$this.awaitSuspend_za3lpa$(1,this),this.result_0===o)return o;continue}return!0;case 1:throw this.exception_0;case 2:return this.result_0;case 3:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.awaitInternalAtLeast1_8be2vx$=function(t,e){var n=new ye(this,t);return e?n:n.doResume(null)},me.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},me.prototype=Object.create(a.prototype),me.prototype.constructor=me,me.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(!(this.local$atLeast>=0))throw b("Failed requirement.".toString());if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForRead_kcn2v3$(this.local$atLeast,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.$this.prepareFlushedBytes(),null!=(t=this.$this.closedCause))throw t;return!this.$this.isClosedForRead&&this.$this.availableForRead>=this.local$atLeast;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.awaitSuspend_za3lpa$=function(t,e,n){var i=new me(this,t,e);return n?i:i.doResume(null)},wt.prototype.discard_za3lpa$=function(t){var e;if(null!=(e=this.closedCause))throw e;if(0===t)return 0;var n=this.readable.discard_za3lpa$(t);return this.afterRead_za3lpa$(t),this.requestNextView_id8q5z$_0(1),n},wt.prototype.request_za3lpa$$default=function(t){var e;if(null!=(e=this.closedCause))throw e;return this.completeReading_um9rnf$_0(),this.requestNextView_id8q5z$_0(t)},wt.prototype.requestNextView_id8q5z$_0=function(t){var n;this.readable.endOfInput&&this.prepareFlushedBytes();var i=null==(n=this.readable.prepareReadHead_za3lpa$(t))||e.isType(n,Is)?n:p();return null==i?(this.lastReadView_92ta1h$_0=ao().Empty,this.lastReadAvailable_1j890x$_0=0):(this.lastReadView_92ta1h$_0=i,this.lastReadAvailable_1j890x$_0=i.writePosition-i.readPosition|0),i},ve.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ve.prototype=Object.create(a.prototype),ve.prototype.constructor=ve,ve.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=this.$this.readable.discard_s8cxhz$(this.local$max);if(d(t,this.local$max)||this.$this.isClosedForRead)return this.$this.ensureNotFailed_7bddlw$_0(),t;if(this.state_0=2,this.result_0=this.$this.discardSuspend_7c0j1e$_0(this.local$max,t,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:return this.local$tmp$;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.discard_s8cxhz$=function(t,e,n){var i=new ve(this,t,e);return n?i:i.doResume(null)},$e.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},$e.prototype=Object.create(a.prototype),$e.prototype.constructor=$e,$e.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$discarded=this.local$discarded0,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.await_za3lpa$(1,this),this.result_0===o)return o;continue;case 3:if(this.result_0){this.state_0=4;continue}this.state_0=5;continue;case 4:if(this.local$discarded=this.local$discarded.add(this.$this.readable.discard_s8cxhz$(this.local$max.subtract(this.local$discarded))),this.local$discarded.compareTo_11rb$(this.local$max)>=0||this.$this.isClosedForRead){this.state_0=5;continue}this.state_0=2;continue;case 5:return this.$this.ensureNotFailed_7bddlw$_0(),this.local$discarded;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.discardSuspend_7c0j1e$_0=function(t,e,n,i){var r=new $e(this,t,e,n);return i?r:r.doResume(null)},wt.prototype.readSession_m70re0$=function(t){try{t(this)}finally{this.completeReading_um9rnf$_0()}},wt.prototype.startReadSession=function(){return this},wt.prototype.endReadSession=function(){this.completeReading_um9rnf$_0()},ge.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ge.prototype=Object.create(a.prototype),ge.prototype.constructor=ge,ge.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=3,this.state_0=1,this.result_0=this.local$consumer(this.$this,this),this.result_0===o)return o;continue;case 1:this.exceptionState_0=5,this.finallyPath_0=[2],this.state_0=4;continue;case 2:return;case 3:this.finallyPath_0=[5],this.state_0=4;continue;case 4:this.exceptionState_0=5,this.$this.completeReading_um9rnf$_0(),this.state_0=this.finallyPath_0.shift();continue;case 5:throw this.exception_0;default:throw this.state_0=5,new Error("State Machine Unreachable execution")}}catch(t){if(5===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readSuspendableSession_kiqllg$=function(t,e,n){var i=new ge(this,t,e);return n?i:i.doResume(null)},be.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},be.prototype=Object.create(a.prototype),be.prototype.constructor=be,be.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$this$ByteChannelSequentialBase.afterRead_za3lpa$(this.local$size),this.state_0=2,this.result_0=this.local$this$ByteChannelSequentialBase.await_za3lpa$(this.local$size,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return this.result_0?this.local$this$ByteChannelSequentialBase.readable:null;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readUTF8LineTo_yhx0yw$=function(t,e,n){if(this.isClosedForRead){var i=this.closedCause;if(null!=i)throw i;return!1}return fo(t,e,(r=this,function(t,e,n){var i=new be(r,t,e);return n?i:i.doResume(null)}),n);var r},we.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},we.prototype=Object.create(a.prototype),we.prototype.constructor=we,we.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$sb=y(),this.state_0=2,this.result_0=this.$this.readUTF8LineTo_yhx0yw$(this.local$sb,this.local$limit,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.result_0){this.state_0=3;continue}return null;case 3:return this.local$sb.toString();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readUTF8Line_za3lpa$=function(t,e,n){var i=new we(this,t,e);return n?i:i.doResume(null)},wt.prototype.cancel_dbl4no$=function(t){return null==this.closedCause&&!this.closed&&this.close_dbl4no$(null!=t?t:m("Channel cancelled"))},wt.prototype.close_dbl4no$=function(t){return!this.closed&&null==this.closedCause&&(this.closedCause=t,this.closed=!0,null!=t?(this.readable.release(),this.writable.release(),this.flushBuffer_1r7aq2$_0.release()):this.flush(),this.slot_2l2jew$_0.cancel_dbl4no$(t),!0)},wt.prototype.transferTo_pxvbjg$=function(t,e){var n,i=this.readable.remaining;return i.compareTo_11rb$(e)<=0?(t.writable.writePacket_3uq2w4$(this.readable),t.afterWrite_za3lpa$(i.toInt()),this.afterRead_za3lpa$(i.toInt()),n=i):n=f,n},ke.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ke.prototype=Object.create(a.prototype),ke.prototype.constructor=ke,ke.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.awaitSuspend_za3lpa$(this.local$n,this),this.result_0===o)return o;continue;case 3:this.$this.readable.hasBytes_za3lpa$(this.local$n)&&this.local$block(),this.$this.checkClosed_ldvyyk$_0(this.local$n),this.state_0=2;continue;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.readNSlow_2lkm5r$_0=function(t,e,n,i){var r=new ke(this,t,e,n);return i?r:r.doResume(null)},Se.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Se.prototype=Object.create(a.prototype),Se.prototype.constructor=Se,Se.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.writeAvailable_99qa0s$(this.local$src,this),this.result_0===o)return o;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeAvailableSuspend_5fukw0$_0=function(t,e,n){var i=new Se(this,t,e);return n?i:i.doResume(null)},xe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},xe.prototype=Object.create(a.prototype),xe.prototype.constructor=xe,xe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.writeAvailable_mj6st8$(this.local$src,this.local$offset,this.local$length,this),this.result_0===o)return o;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.writeAvailableSuspend_1zn44g$_0=function(t,e,n,i,r){var o=new xe(this,t,e,n,i);return r?o:o.doResume(null)},wt.prototype.afterWrite=function(){this.afterWrite_za3lpa$(0)},wt.prototype.afterWrite_za3lpa$=function(t){this._totalBytesWritten_s86f3f$_0=this._totalBytesWritten_s86f3f$_0.add(e.Long.fromInt(t)),this.closed&&(this.writable.release(),this.ensureNotClosed_ozgwi5$_0()),(this.autoFlush||0===this.availableForWrite)&&this.flush()},Ee.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ee.prototype=Object.create(a.prototype),Ee.prototype.constructor=Ee,Ee.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.$this.flush(),this.state_0=2,this.result_0=this.$this.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return void this.$this.ensureNotClosed_ozgwi5$_0();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.awaitFreeSpace=function(t,e){var n=new Ee(this,t);return e?n:n.doResume(null)},Ce.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ce.prototype=Object.create(a.prototype),Ce.prototype.constructor=Ce,Ce.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=v(this.local$closure$min.add(this.local$closure$offset),i).toInt();if(this.state_0=2,this.result_0=this.local$$receiver.await_za3lpa$(n,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:var r=null!=(t=this.local$$receiver.request_za3lpa$(1))?t:Ys().Empty;if((r.writePosition-r.readPosition|0)>this.local$closure$offset.toNumber()){var a=this.local$closure$bytesCopied,s=e.Long.fromInt(r.writePosition-r.readPosition|0).subtract(this.local$closure$offset),l=this.local$closure$max,c=e.Long.fromInt(this.local$closure$destination.view.byteLength).subtract(this.local$closure$destinationOffset),p=l.compareTo_11rb$(c)<=0?l:c;return a.v=s.compareTo_11rb$(p)<=0?s:p,r.memory.copyTo_q2ka7j$(this.local$closure$destination,this.local$closure$offset,this.local$closure$bytesCopied.v,this.local$closure$destinationOffset),u}this.state_0=3;continue;case 3:return u;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ne.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ne.prototype=Object.create(a.prototype),Ne.prototype.constructor=Ne,Ne.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$bytesCopied={v:f},this.state_0=2,this.result_0=this.$this.readSuspendableSession_kiqllg$(Oe(this.local$min,this.local$offset,this.local$max,this.local$destination,this.local$destinationOffset,this.local$bytesCopied),this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return this.local$bytesCopied.v;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},wt.prototype.peekTo_afjyek$$default=function(t,e,n,i,r,o,a){var s=new Ne(this,t,e,n,i,r,o);return a?s:s.doResume(null)},wt.$metadata$={kind:h,simpleName:"ByteChannelSequentialBase",interfaces:[Je,We,Fe,gt,ra,Xo]},w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.discardExact_b56lbm$",k((function(){var n=e.equals,i=t.io.ktor.utils.io.errors.EOFException;return function(t,r,o){if(e.suspendCall(t.discard_s8cxhz$(r,e.coroutineReceiver())),!n(e.coroutineResult(e.coroutineReceiver()),r))throw new i("Unable to discard "+r.toString()+" bytes")}}))),ze.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ze.prototype=Object.create(a.prototype),ze.prototype.constructor=ze,ze.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(void 0===this.local$limit&&(this.local$limit=s),this.state_0=2,this.result_0=Wo(this.local$$receiver,this.local$dst,this.local$limit,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return je(this.local$dst),t;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.writePacket_c7ucec$",k((function(){var n=t.io.ktor.utils.io.core.BytePacketBuilder_za3lpa$,i=Error;return function(t,r,o,a){var s;void 0===r&&(r=0);var l=n(r);try{o(l),s=l.build()}catch(t){throw e.isType(t,i)?(l.release(),t):t}return e.suspendCall(t.writePacket_3uq2w4$(s,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}}))),Te.$metadata$={kind:h,simpleName:"ClosedWriteChannelException",interfaces:[x]},w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readShort_e2pdtf$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_5vcgdc$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readShort(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readInt_e2pdtf$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_s8ev3n$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readInt(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readLong_e2pdtf$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_mts6qi$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readLong(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readFloat_e2pdtf$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_81szk$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readFloat(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readDouble_e2pdtf$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_yrwdxr$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o,a){e.suspendCall(t.readDouble(e.coroutineReceiver()));var s=e.coroutineResult(e.coroutineReceiver());return r(o,i.BIG_ENDIAN)?s:n(s)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readShortLittleEndian_3dmw3p$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_5vcgdc$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readShort(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readIntLittleEndian_3dmw3p$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_s8ev3n$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readInt(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readLongLittleEndian_3dmw3p$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_mts6qi$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readLong(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readFloatLittleEndian_3dmw3p$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_81szk$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readFloat(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.readDoubleLittleEndian_3dmw3p$",k((function(){var n=t.io.ktor.utils.io.bits.reverseByteOrder_yrwdxr$,i=t.io.ktor.utils.io.core.ByteOrder,r=e.equals;return function(t,o){e.suspendCall(t.readDouble(e.coroutineReceiver()));var a=e.coroutineResult(e.coroutineReceiver());return r(t.readByteOrder,i.LITTLE_ENDIAN)?a:n(a)}}))),Pe.$metadata$={kind:r,simpleName:"ReaderJob",interfaces:[C]},Re.$metadata$={kind:r,simpleName:"WriterJob",interfaces:[C]},Ae.$metadata$={kind:r,simpleName:"ReaderScope",interfaces:[O]},Ie.$metadata$={kind:r,simpleName:"WriterScope",interfaces:[O]},Me.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Me.prototype=Object.create(a.prototype),Me.prototype.constructor=Me,Me.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;this.local$closure$attachJob&&this.local$closure$channel.attachJob_dqr1mp$(c(this.local$$receiver.coroutineContext.get_j3r2sn$(C.Key)));var n=e.isType(t=new Le(this.local$$receiver,this.local$closure$channel),O)?t:p();if(this.exceptionState_0=2,this.state_0=1,this.result_0=this.local$closure$block(n,this),this.result_0===o)return o;continue;case 1:return this.result_0;case 2:this.exceptionState_0=5;var i=this.exception_0;if(e.isType(i,E)){if(!d(this.local$closure$dispatcher,z.Dispatchers.Unconfined)&&null!=this.local$closure$dispatcher)throw i;return this.local$closure$channel.cancel_dbl4no$(i)}throw i;case 3:this.state_0=4;continue;case 4:return;case 5:throw this.exception_0;default:throw this.state_0=5,new Error("State Machine Unreachable execution")}}catch(t){if(5===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(Le.prototype,"channel",{get:function(){return this.channel_79cwt9$_0}}),Object.defineProperty(Le.prototype,"coroutineContext",{configurable:!0,get:function(){return this.$delegate_h3p63m$_0.coroutineContext}}),Le.$metadata$={kind:h,simpleName:"ChannelScope",interfaces:[Ie,Ae,O]},Object.defineProperty(De.prototype,"channel",{get:function(){return this.channel_zg1n2y$_0}}),De.prototype.toString=function(){return"ChannelJob["+this.delegate_0+"]"},Object.defineProperty(De.prototype,"children",{configurable:!0,get:function(){return this.delegate_0.children}}),Object.defineProperty(De.prototype,"isActive",{configurable:!0,get:function(){return this.delegate_0.isActive}}),Object.defineProperty(De.prototype,"isCancelled",{configurable:!0,get:function(){return this.delegate_0.isCancelled}}),Object.defineProperty(De.prototype,"isCompleted",{configurable:!0,get:function(){return this.delegate_0.isCompleted}}),Object.defineProperty(De.prototype,"key",{configurable:!0,get:function(){return this.delegate_0.key}}),Object.defineProperty(De.prototype,"onJoin",{configurable:!0,get:function(){return this.delegate_0.onJoin}}),De.prototype.attachChild_kx8v25$=function(t){return this.delegate_0.attachChild_kx8v25$(t)},De.prototype.cancel=function(){return this.delegate_0.cancel()},De.prototype.cancel_dbl4no$$default=function(t){return this.delegate_0.cancel_dbl4no$$default(t)},De.prototype.cancel_m4sck1$$default=function(t){return this.delegate_0.cancel_m4sck1$$default(t)},De.prototype.fold_3cc69b$=function(t,e){return this.delegate_0.fold_3cc69b$(t,e)},De.prototype.get_j3r2sn$=function(t){return this.delegate_0.get_j3r2sn$(t)},De.prototype.getCancellationException=function(){return this.delegate_0.getCancellationException()},De.prototype.invokeOnCompletion_ct2b2z$$default=function(t,e,n){return this.delegate_0.invokeOnCompletion_ct2b2z$$default(t,e,n)},De.prototype.invokeOnCompletion_f05bi3$=function(t){return this.delegate_0.invokeOnCompletion_f05bi3$(t)},De.prototype.join=function(t){return this.delegate_0.join(t)},De.prototype.minusKey_yeqjby$=function(t){return this.delegate_0.minusKey_yeqjby$(t)},De.prototype.plus_1fupul$=function(t){return this.delegate_0.plus_1fupul$(t)},De.prototype.plus_dqr1mp$=function(t){return this.delegate_0.plus_dqr1mp$(t)},De.prototype.start=function(){return this.delegate_0.start()},De.$metadata$={kind:h,simpleName:"ChannelJob",interfaces:[Re,Pe,C]},w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.read_ons6h$",k((function(){var n=t.io.ktor.utils.io.requestBuffer_78elpf$,i=t.io.ktor.utils.io.core.Buffer,r=t.io.ktor.utils.io.completeReadingFromBuffer_6msh3s$,o=Error;return function(t,a,s,l){var c;void 0===a&&(a=1),e.suspendCall(n(t,a,e.coroutineReceiver()));var u=null!=(c=e.coroutineResult(e.coroutineReceiver()))?c:i.Companion.Empty;try{var p=s(u.memory,e.Long.fromInt(u.readPosition),e.Long.fromInt(u.writePosition));return e.suspendCall(r(t,u,p,e.coroutineReceiver())),p}catch(n){throw e.isType(n,o)?(e.suspendCall(r(t,u,0,e.coroutineReceiver())),n):n}}}))),qe.prototype.request_za3lpa$=function(t,e){return void 0===t&&(t=1),e?e(t):this.request_za3lpa$$default(t)},qe.$metadata$={kind:r,simpleName:"ReadSession",interfaces:[]},Fe.prototype.await_za3lpa$=function(t,e,n){return void 0===t&&(t=1),n?n(t,e):this.await_za3lpa$$default(t,e)},Fe.$metadata$={kind:r,simpleName:"SuspendableReadSession",interfaces:[qe]},Ue.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ue.prototype=Object.create(a.prototype),Ue.prototype.constructor=Ue,Ue.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=e.isType(this.local$$receiver,Fe)?this.local$$receiver:e.isType(this.local$$receiver,We)?this.local$$receiver.startReadSession():null,this.local$readSession=t,null!=this.local$readSession){var n=this.local$readSession.request_za3lpa$(P(this.local$desiredSize,8));if(null!=n)return n;this.state_0=2;continue}this.state_0=4;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=(i=this.local$readSession,r=this.local$desiredSize,a=void 0,s=void 0,s=new He(i,r,this),a?s:s.doResume(null)),this.result_0===o)return o;continue;case 3:return this.result_0;case 4:if(this.state_0=5,this.result_0=Ke(this.local$$receiver,this.local$desiredSize,this),this.result_0===o)return o;continue;case 5:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var i,r,a,s},Be.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Be.prototype=Object.create(a.prototype),Be.prototype.constructor=Be,Be.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(!(this.local$bytesRead>=0)){var t="bytesRead shouldn't be negative: "+this.local$bytesRead;throw R(t.toString())}var n;if(null!=(n=e.isType(this.local$$receiver,We)?this.local$$receiver.startReadSession():null))return n.discard_za3lpa$(this.local$bytesRead),void(e.isType(this.local$$receiver,We)&&this.local$$receiver.endReadSession());this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(e.isType(this.local$buffer,Gr)&&this.local$buffer!==ao().Empty){if(this.local$buffer.release_2bs5fo$(ao().Pool),this.state_0=3,this.result_0=this.local$$receiver.discard_s8cxhz$(e.Long.fromInt(this.local$bytesRead),this),this.result_0===o)return o;continue}this.state_0=4;continue;case 3:this.state_0=4;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},He.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},He.prototype=Object.create(a.prototype),He.prototype.constructor=He,He.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$$receiver.await_za3lpa$(this.local$desiredSize,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return this.local$$receiver.request_za3lpa$(1);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ve.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ve.prototype=Object.create(a.prototype),Ve.prototype.constructor=Ve,Ve.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$chunk=ao().Pool.borrow(),this.state_0=2,this.result_0=this.local$$receiver.peekTo_afjyek$(this.local$chunk.memory,e.Long.fromInt(this.local$chunk.writePosition),f,e.Long.fromInt(this.local$desiredSize),e.Long.fromInt(this.local$chunk.limit-this.local$chunk.writePosition|0),this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return this.local$chunk.commitWritten_za3lpa$(t.toInt()),this.local$chunk;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},We.$metadata$={kind:r,simpleName:"HasReadSession",interfaces:[]},w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.write_k0oolq$",k((function(){var n=t.io.ktor.utils.io.requestWriteBuffer_9tm6dw$,i=t.io.ktor.utils.io.core.Buffer,r=t.io.ktor.utils.io.completeWriting_oczduq$;return function(t,o,a,s){var l;void 0===o&&(o=1),e.suspendCall(n(t,o,e.coroutineReceiver()));var c=null!=(l=e.coroutineResult(e.coroutineReceiver()))?l:i.Companion.Empty,u=0;try{return u=a(c.memory,e.Long.fromInt(c.writePosition),e.Long.fromInt(c.limit)),c.commitWritten_za3lpa$(u),u}finally{e.suspendCall(r(t,c,u,e.coroutineReceiver()))}}}))),Ye.$metadata$={kind:r,simpleName:"WriterSession",interfaces:[]},Ge.$metadata$={kind:r,simpleName:"WriterSuspendSession",interfaces:[Ye]},Je.$metadata$={kind:r,simpleName:"HasWriteSession",interfaces:[]},Ze.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Ze.prototype=Object.create(a.prototype),Ze.prototype.constructor=Ze,Ze.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(t=e.isType(this.local$$receiver,Je)?this.local$$receiver.beginWriteSession():null,this.local$session=t,null!=this.local$session){var n=this.local$session.request_za3lpa$(this.local$desiredSpace);if(null!=n)return n;this.state_0=2;continue}this.state_0=4;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=(r=this.local$session,a=this.local$desiredSpace,s=void 0,l=void 0,l=new Xe(r,a,this),s?l:l.doResume(null)),this.result_0===o)return o;continue;case 3:return this.result_0;case 4:return i=void 0,(i=ao().Pool.borrow()).resetForWrite(),i.reserveEndGap_za3lpa$(8),i;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var i,r,a,s,l},Qe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Qe.prototype=Object.create(a.prototype),Qe.prototype.constructor=Qe,Qe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(e.isType(this.local$buffer,Is)){if(this.state_0=2,this.result_0=this.local$$receiver.writeFully_99qa0s$(this.local$buffer,this),this.result_0===o)return o;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:return void this.local$buffer.release_duua06$(Ys().Pool);case 3:throw A("Only IoBuffer instance is supported.");default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Xe.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Xe.prototype=Object.create(a.prototype),Xe.prototype.constructor=Xe,Xe.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.local$session.tryAwait_za3lpa$(this.local$desiredSpace,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:return null!=(t=this.local$session.request_za3lpa$(this.local$desiredSpace))?t:this.local$session.request_za3lpa$(1);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},tn.$metadata$={kind:r,simpleName:"Allocator",interfaces:[]},cn.prototype=Object.create(uo.prototype),cn.prototype.constructor=cn,cn.prototype.doFail=function(){throw b(this.closure$message())},cn.$metadata$={kind:h,interfaces:[uo]},Object.defineProperty(un.prototype,"_head_xb1tt$_0",{configurable:!0,get:function(){return this.state_8q4rcd$_0.head},set:function(t){this.state_8q4rcd$_0.head=t,this.state_8q4rcd$_0.headMemory=t.memory,this.state_8q4rcd$_0.headPosition=t.readPosition,this.state_8q4rcd$_0.headEndExclusive=t.writePosition}}),Object.defineProperty(un.prototype,"head",{configurable:!0,get:function(){var t=this._head_xb1tt$_0;return t.discardUntilIndex_kcn2v3$(this.headPosition),t},set:function(t){this._head_xb1tt$_0=t}}),Object.defineProperty(un.prototype,"headMemory",{configurable:!0,get:function(){return this.state_8q4rcd$_0.headMemory},set:function(t){this.state_8q4rcd$_0.headMemory=t}}),Object.defineProperty(un.prototype,"headPosition",{configurable:!0,get:function(){return this.state_8q4rcd$_0.headPosition},set:function(t){this.state_8q4rcd$_0.headPosition=t}}),Object.defineProperty(un.prototype,"headEndExclusive",{configurable:!0,get:function(){return this.state_8q4rcd$_0.headEndExclusive},set:function(t){this.state_8q4rcd$_0.headEndExclusive=t}}),Object.defineProperty(un.prototype,"headRemaining",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.AbstractInput.get_headRemaining",(function(){return this.headEndExclusive-this.headPosition|0})),set:function(t){this.updateHeadRemaining_za3lpa$(t)}}),Object.defineProperty(un.prototype,"tailRemaining_l8ht08$_0",{configurable:!0,get:function(){return this.state_8q4rcd$_0.tailRemaining},set:function(t){var e;t.toNumber()>=0||new cn((e=t,function(){return"tailRemaining shouldn't be negative: "+e.toString()})).doFail(),this.state_8q4rcd$_0.tailRemaining=t}}),Object.defineProperty(un.prototype,"byteOrder",{configurable:!0,get:function(){return _s()},set:function(t){if(t!==_s())throw b("Only BIG_ENDIAN is supported.")}}),un.prototype.prefetch_8e33dg$=function(t){if(t.toNumber()<=0)return!0;var n=this.headEndExclusive-this.headPosition|0;return n>=t.toNumber()||e.Long.fromInt(n).add(this.tailRemaining_l8ht08$_0).compareTo_11rb$(t)>=0||this.doPrefetch_15sylx$_0(t)},un.prototype.peekTo_afjyek$$default=function(t,n,i,r,o){var a;this.prefetch_8e33dg$(r.add(i));for(var s=this.head,l=f,c=i,u=n,p=e.Long.fromInt(t.view.byteLength).subtract(n),h=o.compareTo_11rb$(p)<=0?o:p;l.compareTo_11rb$(r)<0&&l.compareTo_11rb$(h)<0;){var d=s,_=d.writePosition-d.readPosition|0;if(_>c.toNumber()){var y=e.Long.fromInt(_).subtract(c),m=h.subtract(l),v=y.compareTo_11rb$(m)<=0?y:m;s.memory.copyTo_q2ka7j$(t,e.Long.fromInt(s.readPosition).add(c),v,u),c=f,l=l.add(v),u=u.add(v)}else c=c.subtract(e.Long.fromInt(_));if(null==(a=s.next))break;s=a}return l},un.prototype.doPrefetch_15sylx$_0=function(t){var n=zi(this._head_xb1tt$_0),i=e.Long.fromInt(this.headEndExclusive-this.headPosition|0).add(this.tailRemaining_l8ht08$_0);do{var r=this.fill();if(null==r)return this.noMoreChunksAvailable_2n0tap$_0=!0,!1;var o=r.writePosition-r.readPosition|0;n===ao().Empty?(this._head_xb1tt$_0=r,n=r):(n.next=r,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.add(e.Long.fromInt(o))),i=i.add(e.Long.fromInt(o))}while(i.compareTo_11rb$(t)<0);return!0},Object.defineProperty(un.prototype,"remaining",{configurable:!0,get:function(){return e.Long.fromInt(this.headEndExclusive-this.headPosition|0).add(this.tailRemaining_l8ht08$_0)}}),un.prototype.canRead=function(){return this.headPosition!==this.headEndExclusive||!d(this.tailRemaining_l8ht08$_0,f)},un.prototype.hasBytes_za3lpa$=function(t){return e.Long.fromInt(this.headEndExclusive-this.headPosition|0).add(this.tailRemaining_l8ht08$_0).toNumber()>=t},Object.defineProperty(un.prototype,"isEmpty",{configurable:!0,get:function(){return this.endOfInput}}),Object.defineProperty(un.prototype,"isNotEmpty",{configurable:!0,get:function(){return Dr(this)}}),Object.defineProperty(un.prototype,"endOfInput",{configurable:!0,get:function(){return 0==(this.headEndExclusive-this.headPosition|0)&&d(this.tailRemaining_l8ht08$_0,f)&&(this.noMoreChunksAvailable_2n0tap$_0||null==this.doFill_nh863c$_0())}}),un.prototype.release=function(){var t=this.head,e=ao().Empty;t!==e&&(this._head_xb1tt$_0=e,this.tailRemaining_l8ht08$_0=f,Oi(t,this.pool))},un.prototype.close=function(){this.release(),this.noMoreChunksAvailable_2n0tap$_0||(this.noMoreChunksAvailable_2n0tap$_0=!0),this.closeSource()},un.prototype.stealAll_8be2vx$=function(){var t=this.head,e=ao().Empty;return t===e?null:(this._head_xb1tt$_0=e,this.tailRemaining_l8ht08$_0=f,t)},un.prototype.steal_8be2vx$=function(){var t=this.head,n=t.next,i=ao().Empty;return t===i?null:(null==n?(this._head_xb1tt$_0=i,this.tailRemaining_l8ht08$_0=f):(this._head_xb1tt$_0=n,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt(n.writePosition-n.readPosition|0))),t.next=null,t)},un.prototype.append_pvnryh$=function(t){if(t!==ao().Empty){var n=ji(t);this._head_xb1tt$_0===ao().Empty?(this._head_xb1tt$_0=t,this.tailRemaining_l8ht08$_0=n.subtract(e.Long.fromInt(this.headEndExclusive-this.headPosition|0))):(zi(this._head_xb1tt$_0).next=t,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.add(n))}},un.prototype.tryWriteAppend_pvnryh$=function(t){var n=zi(this.head),i=t.writePosition-t.readPosition|0,r=0===i;return r||(r=(n.limit-n.writePosition|0)=0||new cn((e=t,function(){return"Negative discard is not allowed: "+e})).doFail(),this.discardAsMuchAsPossible_3xuwvm$_0(t,0)},un.prototype.discardExact_za3lpa$=function(t){if(this.discard_za3lpa$(t)!==t)throw new al("Unable to discard "+t+" bytes due to end of packet")},un.prototype.read_wbh1sp$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.AbstractInput.read_wbh1sp$",k((function(){var n=t.io.ktor.utils.io.core.prematureEndOfStream_za3lpa$,i=e.kotlin.IllegalStateException_init_pdl1vj$;return function(t){var e,r=null!=(e=this.prepareRead_za3lpa$(1))?e:n(1),o=r.readPosition;try{t(r)}finally{var a=r.readPosition;if(a0?n.tryPeekByte():d(this.tailRemaining_l8ht08$_0,f)&&this.noMoreChunksAvailable_2n0tap$_0?-1:null!=(e=null!=(t=this.prepareReadLoop_3ilf5z$_0(1,n))?t.tryPeekByte():null)?e:-1},un.prototype.peekTo_99qa0s$=function(t){var n,i;if(null==(n=this.prepareReadHead_za3lpa$(1)))return-1;var r=n,o=t.limit-t.writePosition|0,a=r.writePosition-r.readPosition|0,s=g.min(o,a);return ki(e.isType(i=t,$n)?i:p(),r,s),s},un.prototype.discard_s8cxhz$=function(t){return t.toNumber()<=0?f:this.discardAsMuchAsPossible_s35ayg$_0(t,f)},pn.prototype.append_s8itvh$=function(t){var e;return this.closure$destination[(e=this.idx_0,this.idx_0=e+1|0,e)]=t,this},pn.prototype.append_gw00v9$=function(t){var e,n;if("string"==typeof t)il(t,this.closure$destination,this.idx_0),this.idx_0=this.idx_0+t.length|0;else if(null!=t){e=t.length;for(var i=0;i=0){var r=Ur(this,this.remaining.toInt());return t.append_gw00v9$(r),r.length}return this.readASCII_ka9uwb$_0(t,n,i)},un.prototype.readTextExact_a5kscm$=function(t,e){this.readText_5dvtqg$(t,e,e)},un.prototype.readText_vux9f0$=function(t,n){if(void 0===t&&(t=0),void 0===n&&(n=2147483647),0===t&&(0===n||this.endOfInput))return"";var i=this.remaining;if(i.toNumber()>0&&e.Long.fromInt(n).compareTo_11rb$(i)>=0)return Ur(this,i.toInt());var r=L(P(F(t,16),n));return this.readASCII_ka9uwb$_0(r,t,n),r.toString()},un.prototype.readTextExact_za3lpa$=function(t){return this.readText_vux9f0$(t,t)},un.prototype.readASCII_ka9uwb$_0=function(t,e,n){if(0===n&&0===e)return 0;if(this.endOfInput){if(0===e)return 0;this.atLeastMinCharactersRequire_tmg3q9$_0(e)}else n=l)try{var h,f=s;n:do{for(var d={v:0},_={v:0},y={v:0},m=f.memory,v=f.readPosition,$=f.writePosition,g=v;g<$;g++){var b=255&m.view.getInt8(g);if(0==(128&b)){0!==d.v&&go(d.v);var w,k=V(H(b));if(i.v===n?w=!1:(t.append_s8itvh$(U(k)),i.v=i.v+1|0,w=!0),!w){f.discardExact_za3lpa$(g-v|0),h=-1;break n}}else if(0===d.v){var S=128;_.v=b;for(var x=1;x<=6&&0!=(_.v&S);x++)_.v=_.v&~S,S>>=1,d.v=d.v+1|0;if(y.v=d.v,d.v=d.v-1|0,y.v>($-g|0)){f.discardExact_za3lpa$(g-v|0),h=y.v;break n}}else if(_.v=_.v<<6|127&b,d.v=d.v-1|0,0===d.v){if(wo(_.v)){var E,C=V(H(_.v));if(i.v===n?E=!1:(t.append_s8itvh$(U(C)),i.v=i.v+1|0,E=!0),!E){f.discardExact_za3lpa$(g-v-y.v+1|0),h=-1;break n}}else if(ko(_.v)){var O,N=V(H(xo(_.v)));i.v===n?O=!1:(t.append_s8itvh$(U(N)),i.v=i.v+1|0,O=!0);var z=!O;if(!z){var j,T=V(H(So(_.v)));i.v===n?j=!1:(t.append_s8itvh$(U(T)),i.v=i.v+1|0,j=!0),z=!j}if(z){f.discardExact_za3lpa$(g-v-y.v+1|0),h=-1;break n}}else bo(_.v);_.v=0}}var P=$-v|0;f.discardExact_za3lpa$(P),h=0}while(0);l=0===h?1:h>0?h:0}finally{var R=s;c=R.writePosition-R.readPosition|0}else c=p;if(a=!1,0===c)o=jo(this,s);else{var A=c0)}finally{a&&zo(this,s)}}while(0);return i.va?(t.releaseEndGap_8be2vx$(),this.headEndExclusive=t.writePosition,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.add(e.Long.fromInt(a))):(this._head_xb1tt$_0=i,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt((i.writePosition-i.readPosition|0)-a|0)),t.cleanNext(),t.release_2bs5fo$(this.pool))},un.prototype.fixGapAfterReadFallback_q485vf$_0=function(t){if(this.noMoreChunksAvailable_2n0tap$_0&&null==t.next)return this.headPosition=t.readPosition,this.headEndExclusive=t.writePosition,void(this.tailRemaining_l8ht08$_0=f);var e=t.writePosition-t.readPosition|0,n=8-(t.capacity-t.limit|0)|0,i=g.min(e,n);if(e>i)this.fixGapAfterReadFallbackUnreserved_13fwc$_0(t,e,i);else{var r=this.pool.borrow();r.reserveEndGap_za3lpa$(8),r.next=t.cleanNext(),An(r,t,e),this._head_xb1tt$_0=r}t.release_2bs5fo$(this.pool)},un.prototype.fixGapAfterReadFallbackUnreserved_13fwc$_0=function(t,e,n){var i=this.pool.borrow(),r=this.pool.borrow();i.reserveEndGap_za3lpa$(8),r.reserveEndGap_za3lpa$(8),i.next=r,r.next=t.cleanNext(),An(i,t,e-n|0),An(r,t,n),this._head_xb1tt$_0=i,this.tailRemaining_l8ht08$_0=ji(r)},un.prototype.ensureNext_pxb5qx$_0=function(t,n){var i;if(t===n)return this.doFill_nh863c$_0();var r=t.cleanNext();return t.release_2bs5fo$(this.pool),null==r?(this._head_xb1tt$_0=n,this.tailRemaining_l8ht08$_0=f,i=this.ensureNext_pxb5qx$_0(n,n)):r.writePosition>r.readPosition?(this._head_xb1tt$_0=r,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt(r.writePosition-r.readPosition|0)),i=r):i=this.ensureNext_pxb5qx$_0(r,n),i},un.prototype.fill=function(){var t=this.pool.borrow();try{t.reserveEndGap_za3lpa$(8);var n=this.fill_9etqdk$(t.memory,t.writePosition,t.limit-t.writePosition|0);return 0!==n||(this.noMoreChunksAvailable_2n0tap$_0=!0,t.writePosition>t.readPosition)?(t.commitWritten_za3lpa$(n),t):(t.release_2bs5fo$(this.pool),null)}catch(n){throw e.isType(n,E)?(t.release_2bs5fo$(this.pool),n):n}},un.prototype.markNoMoreChunksAvailable=function(){this.noMoreChunksAvailable_2n0tap$_0||(this.noMoreChunksAvailable_2n0tap$_0=!0)},un.prototype.doFill_nh863c$_0=function(){if(this.noMoreChunksAvailable_2n0tap$_0)return null;var t=this.fill();return null==t?(this.noMoreChunksAvailable_2n0tap$_0=!0,null):(this.appendView_4be14h$_0(t),t)},un.prototype.appendView_4be14h$_0=function(t){var e,n,i=zi(this._head_xb1tt$_0);i===ao().Empty?(this._head_xb1tt$_0=t,d(this.tailRemaining_l8ht08$_0,f)||new cn(hn).doFail(),this.tailRemaining_l8ht08$_0=null!=(n=null!=(e=t.next)?ji(e):null)?n:f):(i.next=t,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.add(ji(t)))},un.prototype.prepareRead_za3lpa$=function(t){var e=this.head;return(this.headEndExclusive-this.headPosition|0)>=t?e:this.prepareReadLoop_3ilf5z$_0(t,e)},un.prototype.prepareRead_cvuqs$=function(t,e){return(this.headEndExclusive-this.headPosition|0)>=t?e:this.prepareReadLoop_3ilf5z$_0(t,e)},un.prototype.prepareReadLoop_3ilf5z$_0=function(t,n){var i,r,o=this.headEndExclusive-this.headPosition|0;if(o>=t)return n;if(null==(r=null!=(i=n.next)?i:this.doFill_nh863c$_0()))return null;var a=r;if(0===o)return n!==ao().Empty&&this.releaseHead_pvnryh$(n),this.prepareReadLoop_3ilf5z$_0(t,a);var s=An(n,a,t-o|0);return this.headEndExclusive=n.writePosition,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt(s)),a.writePosition>a.readPosition?a.reserveStartGap_za3lpa$(s):(n.next=null,n.next=a.cleanNext(),a.release_2bs5fo$(this.pool)),(n.writePosition-n.readPosition|0)>=t?n:(t>8&&this.minSizeIsTooBig_5ot22f$_0(t),this.prepareReadLoop_3ilf5z$_0(t,n))},un.prototype.minSizeIsTooBig_5ot22f$_0=function(t){throw R("minSize of "+t+" is too big (should be less than 8)")},un.prototype.afterRead_3wtcpm$_0=function(t){0==(t.writePosition-t.readPosition|0)&&this.releaseHead_pvnryh$(t)},un.prototype.releaseHead_pvnryh$=function(t){var n,i=null!=(n=t.cleanNext())?n:ao().Empty;return this._head_xb1tt$_0=i,this.tailRemaining_l8ht08$_0=this.tailRemaining_l8ht08$_0.subtract(e.Long.fromInt(i.writePosition-i.readPosition|0)),t.release_2bs5fo$(this.pool),i},fn.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var dn=null;function _n(){return null===dn&&new fn,dn}function yn(t,e){this.headerSizeHint_8gle5k$_0=t,this.pool=e,this.state_80zwyy$_0=new ps,this.byteOrder_t3hxpd$_0=_s()}function mn(t,e){return e=e||Object.create(yn.prototype),yn.call(e,0,t),e}function vn(t){this.closure$message=t,uo.call(this)}function $n(t){kn(),this.memory=t,this.bufferState_jauu7b$_0=new hs(this.memory.view.byteLength),this.capacity=this.memory.view.byteLength}function gn(){wn=this,this.ReservedSize=8}un.$metadata$={kind:h,simpleName:"AbstractInput",interfaces:[Rs]},Object.defineProperty(yn.prototype,"_head_hofq54$_0",{configurable:!0,get:function(){return this.state_80zwyy$_0.head},set:function(t){this.state_80zwyy$_0.head=t}}),Object.defineProperty(yn.prototype,"_tail_hhwkug$_0",{configurable:!0,get:function(){return this.state_80zwyy$_0.tail},set:function(t){this.state_80zwyy$_0.tail=t}}),Object.defineProperty(yn.prototype,"head_8be2vx$",{configurable:!0,get:function(){var t;return null!=(t=this._head_hofq54$_0)?t:ao().Empty}}),Object.defineProperty(yn.prototype,"tail",{configurable:!0,get:function(){return this.prepareWriteHead_za3lpa$(1)}}),Object.defineProperty(yn.prototype,"currentTail",{configurable:!0,get:function(){return this.prepareWriteHead_za3lpa$(1)},set:function(t){this.appendChain_pvnryh$(t)}}),Object.defineProperty(yn.prototype,"tailMemory_8be2vx$",{configurable:!0,get:function(){return this.state_80zwyy$_0.tailMemory},set:function(t){this.state_80zwyy$_0.tailMemory=t}}),Object.defineProperty(yn.prototype,"tailPosition_8be2vx$",{configurable:!0,get:function(){return this.state_80zwyy$_0.tailPosition},set:function(t){this.state_80zwyy$_0.tailPosition=t}}),Object.defineProperty(yn.prototype,"tailEndExclusive_8be2vx$",{configurable:!0,get:function(){return this.state_80zwyy$_0.tailEndExclusive},set:function(t){this.state_80zwyy$_0.tailEndExclusive=t}}),Object.defineProperty(yn.prototype,"tailInitialPosition_f6hjsm$_0",{configurable:!0,get:function(){return this.state_80zwyy$_0.tailInitialPosition},set:function(t){this.state_80zwyy$_0.tailInitialPosition=t}}),Object.defineProperty(yn.prototype,"chainedSize_8c83kq$_0",{configurable:!0,get:function(){return this.state_80zwyy$_0.chainedSize},set:function(t){this.state_80zwyy$_0.chainedSize=t}}),Object.defineProperty(yn.prototype,"tailRemaining_8be2vx$",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.AbstractOutput.get_tailRemaining_8be2vx$",(function(){return this.tailEndExclusive_8be2vx$-this.tailPosition_8be2vx$|0}))}),Object.defineProperty(yn.prototype,"_size",{configurable:!0,get:function(){return this.chainedSize_8c83kq$_0+(this.tailPosition_8be2vx$-this.tailInitialPosition_f6hjsm$_0)|0},set:function(t){}}),Object.defineProperty(yn.prototype,"byteOrder",{configurable:!0,get:function(){return this.byteOrder_t3hxpd$_0},set:function(t){if(this.byteOrder_t3hxpd$_0=t,t!==_s())throw b("Only BIG_ENDIAN is supported. Use corresponding functions to read/writein the little endian")}}),yn.prototype.flush=function(){this.flushChain_iwxacw$_0()},yn.prototype.flushChain_iwxacw$_0=function(){var t;if(null!=(t=this.stealAll_8be2vx$())){var e=t;try{for(var n,i=e;;){var r=i;if(this.flush_9etqdk$(r.memory,r.readPosition,r.writePosition-r.readPosition|0),null==(n=i.next))break;i=n}}finally{Oi(e,this.pool)}}},yn.prototype.stealAll_8be2vx$=function(){var t,e;if(null==(t=this._head_hofq54$_0))return null;var n=t;return null!=(e=this._tail_hhwkug$_0)&&e.commitWrittenUntilIndex_za3lpa$(this.tailPosition_8be2vx$),this._head_hofq54$_0=null,this._tail_hhwkug$_0=null,this.tailPosition_8be2vx$=0,this.tailEndExclusive_8be2vx$=0,this.tailInitialPosition_f6hjsm$_0=0,this.chainedSize_8c83kq$_0=0,this.tailMemory_8be2vx$=ba().Empty,n},yn.prototype.afterBytesStolen_8be2vx$=function(){var t=this.head_8be2vx$;if(t!==ao().Empty){if(null!=t.next)throw R("Check failed.".toString());t.resetForWrite(),t.reserveStartGap_za3lpa$(this.headerSizeHint_8gle5k$_0),t.reserveEndGap_za3lpa$(8),this.tailPosition_8be2vx$=t.writePosition,this.tailInitialPosition_f6hjsm$_0=this.tailPosition_8be2vx$,this.tailEndExclusive_8be2vx$=t.limit}},yn.prototype.appendSingleChunk_pvnryh$=function(t){if(null!=t.next)throw R("It should be a single buffer chunk.".toString());this.appendChainImpl_gq6rjy$_0(t,t,0)},yn.prototype.appendChain_pvnryh$=function(t){var n=zi(t),i=ji(t).subtract(e.Long.fromInt(n.writePosition-n.readPosition|0));i.toNumber()>=2147483647&&co(i,"total size increase");var r=i.toInt();this.appendChainImpl_gq6rjy$_0(t,n,r)},yn.prototype.appendNewChunk_oskcze$_0=function(){var t=this.pool.borrow();return t.reserveEndGap_za3lpa$(8),this.appendSingleChunk_pvnryh$(t),t},yn.prototype.appendChainImpl_gq6rjy$_0=function(t,e,n){var i=this._tail_hhwkug$_0;if(null==i)this._head_hofq54$_0=t,this.chainedSize_8c83kq$_0=0;else{i.next=t;var r=this.tailPosition_8be2vx$;i.commitWrittenUntilIndex_za3lpa$(r),this.chainedSize_8c83kq$_0=this.chainedSize_8c83kq$_0+(r-this.tailInitialPosition_f6hjsm$_0)|0}this._tail_hhwkug$_0=e,this.chainedSize_8c83kq$_0=this.chainedSize_8c83kq$_0+n|0,this.tailMemory_8be2vx$=e.memory,this.tailPosition_8be2vx$=e.writePosition,this.tailInitialPosition_f6hjsm$_0=e.readPosition,this.tailEndExclusive_8be2vx$=e.limit},yn.prototype.writeByte_s8j3t7$=function(t){var e=this.tailPosition_8be2vx$;return e=3){var n,i=this.tailMemory_8be2vx$,r=0|t;0<=r&&r<=127?(i.view.setInt8(e,_(r)),n=1):128<=r&&r<=2047?(i.view.setInt8(e,_(192|r>>6&31)),i.view.setInt8(e+1|0,_(128|63&r)),n=2):2048<=r&&r<=65535?(i.view.setInt8(e,_(224|r>>12&15)),i.view.setInt8(e+1|0,_(128|r>>6&63)),i.view.setInt8(e+2|0,_(128|63&r)),n=3):65536<=r&&r<=1114111?(i.view.setInt8(e,_(240|r>>18&7)),i.view.setInt8(e+1|0,_(128|r>>12&63)),i.view.setInt8(e+2|0,_(128|r>>6&63)),i.view.setInt8(e+3|0,_(128|63&r)),n=4):n=bo(r);var o=n;return this.tailPosition_8be2vx$=e+o|0,this}return this.appendCharFallback_r92zh4$_0(t),this},yn.prototype.appendCharFallback_r92zh4$_0=function(t){var e=this.prepareWriteHead_za3lpa$(3);try{var n,i=e.memory,r=e.writePosition,o=0|t;0<=o&&o<=127?(i.view.setInt8(r,_(o)),n=1):128<=o&&o<=2047?(i.view.setInt8(r,_(192|o>>6&31)),i.view.setInt8(r+1|0,_(128|63&o)),n=2):2048<=o&&o<=65535?(i.view.setInt8(r,_(224|o>>12&15)),i.view.setInt8(r+1|0,_(128|o>>6&63)),i.view.setInt8(r+2|0,_(128|63&o)),n=3):65536<=o&&o<=1114111?(i.view.setInt8(r,_(240|o>>18&7)),i.view.setInt8(r+1|0,_(128|o>>12&63)),i.view.setInt8(r+2|0,_(128|o>>6&63)),i.view.setInt8(r+3|0,_(128|63&o)),n=4):n=bo(o);var a=n;if(e.commitWritten_za3lpa$(a),!(a>=0))throw R("The returned value shouldn't be negative".toString())}finally{this.afterHeadWrite()}},yn.prototype.append_gw00v9$=function(t){return null==t?this.append_ezbsdh$("null",0,4):this.append_ezbsdh$(t,0,t.length),this},yn.prototype.append_ezbsdh$=function(t,e,n){return null==t?this.append_ezbsdh$("null",e,n):(Br(this,t,e,n,is().UTF_8),this)},yn.prototype.writePacket_3uq2w4$=function(t){var e=t.stealAll_8be2vx$();if(null!=e){var n=this._tail_hhwkug$_0;null!=n?this.writePacketMerging_mvdkrn$_0(n,e,t.pool):this.appendChain_pvnryh$(e)}else t.release()},yn.prototype.writeChunkBuffer_pvnryh$=function(t){var e=this._tail_hhwkug$_0;null!=e?this.writePacketMerging_mvdkrn$_0(e,t,this.pool):this.appendChain_pvnryh$(t)},yn.prototype.writePacketMerging_mvdkrn$_0=function(t,e,n){var i;t.commitWrittenUntilIndex_za3lpa$(this.tailPosition_8be2vx$);var r=t.writePosition-t.readPosition|0,o=e.writePosition-e.readPosition|0,a=Bs,s=o0;){var r=t.headEndExclusive-t.headPosition|0;if(!(r<=i.v)){var o,a=null!=(o=t.prepareRead_za3lpa$(1))?o:Kr(1),s=a.readPosition;try{kr(this,a,i.v)}finally{var l=a.readPosition;if(l0;){var o=e.Long.fromInt(t.headEndExclusive-t.headPosition|0);if(!(o.compareTo_11rb$(r.v)<=0)){var a,s=null!=(a=t.prepareRead_za3lpa$(1))?a:Kr(1),l=s.readPosition;try{kr(this,s,r.v.toInt())}finally{var c=s.readPosition;if(c=e)return i;for(i=n(this.prepareWriteHead_za3lpa$(1),i),this.afterHeadWrite();i2047){var i=t.memory,r=t.writePosition,o=t.limit-r|0;if(o<3)throw e("3 bytes character",3,o);var a=i,s=r;return a.view.setInt8(s,_(224|n>>12&15)),a.view.setInt8(s+1|0,_(128|n>>6&63)),a.view.setInt8(s+2|0,_(128|63&n)),t.commitWritten_za3lpa$(3),3}var l=t.memory,c=t.writePosition,u=t.limit-c|0;if(u<2)throw e("2 bytes character",2,u);var p=l,h=c;return p.view.setInt8(h,_(192|n>>6&31)),p.view.setInt8(h+1|0,_(128|63&n)),t.commitWritten_za3lpa$(2),2}})),yn.prototype.release=function(){this.close()},yn.prototype.prepareWriteHead_za3lpa$=function(t){var e;return(this.tailEndExclusive_8be2vx$-this.tailPosition_8be2vx$|0)>=t&&null!=(e=this._tail_hhwkug$_0)?(e.commitWrittenUntilIndex_za3lpa$(this.tailPosition_8be2vx$),e):this.appendNewChunk_oskcze$_0()},yn.prototype.afterHeadWrite=function(){var t;null!=(t=this._tail_hhwkug$_0)&&(this.tailPosition_8be2vx$=t.writePosition)},yn.prototype.write_rtdvbs$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.AbstractOutput.write_rtdvbs$",k((function(){var t=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e,n){var i=this.prepareWriteHead_za3lpa$(e);try{var r=n(i);if(!(r>=0))throw t("The returned value shouldn't be negative".toString());return r}finally{this.afterHeadWrite()}}}))),yn.prototype.addSize_za3lpa$=function(t){if(!(t>=0))throw R(("It should be non-negative size increment: "+t).toString());if(!(t<=(this.tailEndExclusive_8be2vx$-this.tailPosition_8be2vx$|0))){var e="Unable to mark more bytes than available: "+t+" > "+(this.tailEndExclusive_8be2vx$-this.tailPosition_8be2vx$|0);throw R(e.toString())}this.tailPosition_8be2vx$=this.tailPosition_8be2vx$+t|0},yn.prototype.last_99qa0s$=function(t){var n;this.appendSingleChunk_pvnryh$(e.isType(n=t,Gr)?n:p())},yn.prototype.appendNewBuffer=function(){var t;return e.isType(t=this.appendNewChunk_oskcze$_0(),Is)?t:p()},yn.prototype.reset=function(){},yn.$metadata$={kind:h,simpleName:"AbstractOutput",interfaces:[tl,q]},vn.prototype=Object.create(uo.prototype),vn.prototype.constructor=vn,vn.prototype.doFail=function(){throw b(this.closure$message())},vn.$metadata$={kind:h,interfaces:[uo]},Object.defineProperty($n.prototype,"readPosition",{configurable:!0,get:function(){return this.bufferState_jauu7b$_0.readPosition},set:function(t){this.bufferState_jauu7b$_0.readPosition=t}}),Object.defineProperty($n.prototype,"writePosition",{configurable:!0,get:function(){return this.bufferState_jauu7b$_0.writePosition},set:function(t){this.bufferState_jauu7b$_0.writePosition=t}}),Object.defineProperty($n.prototype,"startGap",{configurable:!0,get:function(){return this.bufferState_jauu7b$_0.startGap},set:function(t){this.bufferState_jauu7b$_0.startGap=t}}),Object.defineProperty($n.prototype,"limit",{configurable:!0,get:function(){return this.bufferState_jauu7b$_0.limit},set:function(t){this.bufferState_jauu7b$_0.limit=t}}),Object.defineProperty($n.prototype,"endGap",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.Buffer.get_endGap",(function(){return this.capacity-this.limit|0}))}),Object.defineProperty($n.prototype,"readRemaining",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.Buffer.get_readRemaining",(function(){return this.writePosition-this.readPosition|0}))}),Object.defineProperty($n.prototype,"writeRemaining",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.Buffer.get_writeRemaining",(function(){return this.limit-this.writePosition|0}))}),Object.defineProperty($n.prototype,"attachment",{configurable:!0,get:function(){return this.bufferState_jauu7b$_0.attachment},set:function(t){this.bufferState_jauu7b$_0.attachment=t}}),$n.prototype.discardExact_za3lpa$=function(t){if(void 0===t&&(t=this.writePosition-this.readPosition|0),0!==t){var e=this.readPosition+t|0;(t<0||e>this.writePosition)&&Sn(t,this.writePosition-this.readPosition|0),this.readPosition=e}},$n.prototype.discard_za3lpa$=function(t){var e=this.writePosition-this.readPosition|0,n=g.min(t,e);return this.discardExact_za3lpa$(n),n},$n.prototype.discard_s8cxhz$=function(t){var n=e.Long.fromInt(this.writePosition-this.readPosition|0),i=(t.compareTo_11rb$(n)<=0?t:n).toInt();return this.discardExact_za3lpa$(i),e.Long.fromInt(i)},$n.prototype.commitWritten_za3lpa$=function(t){var e=this.writePosition+t|0;(t<0||e>this.limit)&&xn(t,this.limit-this.writePosition|0),this.writePosition=e},$n.prototype.commitWrittenUntilIndex_za3lpa$=function(t){var e=this.limit;if(t=e){if(t===e)return this.writePosition=t,!1;xn(t-this.writePosition|0,this.limit-this.writePosition|0)}return this.writePosition=t,!0},$n.prototype.discardUntilIndex_kcn2v3$=function(t){(t<0||t>this.writePosition)&&Sn(t-this.readPosition|0,this.writePosition-this.readPosition|0),this.readPosition!==t&&(this.readPosition=t)},$n.prototype.rewind_za3lpa$=function(t){void 0===t&&(t=this.readPosition-this.startGap|0);var e=this.readPosition-t|0;e=0||new vn((e=t,function(){return"startGap shouldn't be negative: "+e})).doFail(),!(this.readPosition>=t))return this.readPosition===this.writePosition?(t>this.limit&&Cn(this,t),this.writePosition=t,this.readPosition=t,void(this.startGap=t)):void On(this,t);this.startGap=t},$n.prototype.reserveEndGap_za3lpa$=function(t){var e;t>=0||new vn((e=t,function(){return"endGap shouldn't be negative: "+e})).doFail();var n=this.capacity-t|0;if(n>=this.writePosition)this.limit=n;else{if(n<0&&Nn(this,t),n=0||new vn((e=t,function(){return"newReadPosition shouldn't be negative: "+e})).doFail(),t<=this.readPosition||new vn(function(t,e){return function(){return"newReadPosition shouldn't be ahead of the read position: "+t+" > "+e.readPosition}}(t,this)).doFail(),this.readPosition=t,this.startGap>t&&(this.startGap=t)},$n.prototype.duplicateTo_b4g5fm$=function(t){t.limit=this.limit,t.startGap=this.startGap,t.readPosition=this.readPosition,t.writePosition=this.writePosition},$n.prototype.duplicate=function(){var t=new $n(this.memory);return t.duplicateTo_b4g5fm$(t),t},$n.prototype.tryPeekByte=function(){var t=this.readPosition;return t===this.writePosition?-1:255&this.memory.view.getInt8(t)},$n.prototype.tryReadByte=function(){var t=this.readPosition;return t===this.writePosition?-1:(this.readPosition=t+1|0,255&this.memory.view.getInt8(t))},$n.prototype.readByte=function(){var t=this.readPosition;if(t===this.writePosition)throw new al("No readable bytes available.");return this.readPosition=t+1|0,this.memory.view.getInt8(t)},$n.prototype.writeByte_s8j3t7$=function(t){var e=this.writePosition;if(e===this.limit)throw new Pn("No free space in the buffer to write a byte");this.memory.view.setInt8(e,t),this.writePosition=e+1|0},$n.prototype.reset=function(){this.releaseGaps_8be2vx$(),this.resetForWrite()},$n.prototype.toString=function(){return"Buffer("+(this.writePosition-this.readPosition|0)+" used, "+(this.limit-this.writePosition|0)+" free, "+(this.startGap+(this.capacity-this.limit|0)|0)+" reserved of "+this.capacity+")"},Object.defineProperty(gn.prototype,"Empty",{configurable:!0,get:function(){return Ys().Empty}}),gn.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var bn,wn=null;function kn(){return null===wn&&new gn,wn}function Sn(t,e){throw new al("Unable to discard "+t+" bytes: only "+e+" available for reading")}function xn(t,e){throw new al("Unable to discard "+t+" bytes: only "+e+" available for writing")}function En(t,e){throw b("Unable to rewind "+t+" bytes: only "+e+" could be rewinded")}function Cn(t,e){if(e>t.capacity)throw b("Start gap "+e+" is bigger than the capacity "+t.capacity);throw R("Unable to reserve "+e+" start gap: there are already "+(t.capacity-t.limit|0)+" bytes reserved in the end")}function On(t,e){throw R("Unable to reserve "+e+" start gap: there are already "+(t.writePosition-t.readPosition|0)+" content bytes starting at offset "+t.readPosition)}function Nn(t,e){throw b("End gap "+e+" is too big: capacity is "+t.capacity)}function zn(t,e){throw b("End gap "+e+" is too big: there are already "+t.startGap+" bytes reserved in the beginning")}function jn(t,e){throw b("Unable to reserve end gap "+e+": there are already "+(t.writePosition-t.readPosition|0)+" content bytes at offset "+t.readPosition)}function Tn(t,e){t.releaseStartGap_kcn2v3$(t.readPosition-e|0)}function Pn(t){void 0===t&&(t="Not enough free space"),K(t,this),this.name="InsufficientSpaceException"}function Rn(t,e,n,i){return i=i||Object.create(Pn.prototype),Pn.call(i,"Not enough free space to write "+t+" of "+e+" bytes, available "+n+" bytes."),i}function An(t,e,n){var i=e.writePosition-e.readPosition|0,r=g.min(i,n);(t.limit-t.writePosition|0)<=r&&function(t,e){if(((t.limit-t.writePosition|0)+(t.capacity-t.limit|0)|0)0&&t.releaseEndGap_8be2vx$()}(t,r);var o=t.memory,a=t.writePosition;t.limit;var s=e.memory,l=e.readPosition;e.writePosition,s.copyTo_ubllm2$(o,l,r,a);var c=r;e.discardExact_za3lpa$(c);var u=c;return t.commitWritten_za3lpa$(u),u}function In(t,e){var n=e.writePosition-e.readPosition|0,i=t.readPosition;if(i=0||new Mn((i=e,function(){return"times shouldn't be negative: "+i})).doFail(),e<=(t.limit-t.writePosition|0)||new Mn(function(t,e){return function(){var n=e;return"times shouldn't be greater than the write remaining space: "+t+" > "+(n.limit-n.writePosition|0)}}(e,t)).doFail(),ka(t.memory,t.writePosition,e,n),t.commitWritten_za3lpa$(e)}function Dn(t,e,n){e.toNumber()>=2147483647&&co(e,"n"),Ln(t,e.toInt(),n)}function qn(t,e,n,i){return Fn(t,new yo(e,0,e.length),n,i)}function Fn(t,e,n,i){var r={v:null},o=$o(t.memory,e,n,i,t.writePosition,t.limit);r.v=65535&new I(S(o.value>>>16)).data;var a=65535&new I(S(65535&o.value)).data;return t.commitWritten_za3lpa$(a),n+r.v|0}function Un(t,e){var n,i=t.memory,r=t.writePosition,o=t.limit,a=0|e;0<=a&&a<=127?(i.view.setInt8(r,_(a)),n=1):128<=a&&a<=2047?(i.view.setInt8(r,_(192|a>>6&31)),i.view.setInt8(r+1|0,_(128|63&a)),n=2):2048<=a&&a<=65535?(i.view.setInt8(r,_(224|a>>12&15)),i.view.setInt8(r+1|0,_(128|a>>6&63)),i.view.setInt8(r+2|0,_(128|63&a)),n=3):65536<=a&&a<=1114111?(i.view.setInt8(r,_(240|a>>18&7)),i.view.setInt8(r+1|0,_(128|a>>12&63)),i.view.setInt8(r+2|0,_(128|a>>6&63)),i.view.setInt8(r+3|0,_(128|63&a)),n=4):n=bo(a);var s=n,l=s>(o-r|0)?function(t){throw new Pi("Not enough free space available to write "+t+" character(s).")}(1):s;return t.commitWritten_za3lpa$(l),t}function Bn(t,e,n){void 0===t&&(t=4096),void 0===e&&(e=1e3),void 0===n&&(n=ya()),dl.call(this,e),this.bufferSize_0=t,this.allocator_0=n}function Hn(t){this.closure$message=t,uo.call(this)}function Vn(t,e){return function(){throw new al("Not enough bytes to read a "+t+" of size "+e+".")}}function Kn(t){this.closure$message=t,uo.call(this)}function Wn(t){var e={v:null},n=t.memory,i=t.readPosition;return(t.writePosition-i|0)>=2||new Hn(Vn("short integer",2)).doFail(),e.v=n.view.getInt16(i,!1),t.discardExact_za3lpa$(2),e.v}function Yn(t){var e={v:null},n=t.memory,i=t.readPosition;return(t.writePosition-i|0)>=4||new Hn(Vn("regular integer",4)).doFail(),e.v=n.view.getInt32(i,!1),t.discardExact_za3lpa$(4),e.v}function Gn(t){var n={v:null},i=t.memory,r=t.readPosition;(t.writePosition-r|0)>=8||new Hn(Vn("long integer",8)).doFail();var o=i,a=r;return n.v=e.Long.fromInt(o.view.getUint32(a,!1)).shiftLeft(32).or(e.Long.fromInt(o.view.getUint32(a+4|0,!1))),t.discardExact_za3lpa$(8),n.v}function Jn(t){var e={v:null},n=t.memory,i=t.readPosition;return(t.writePosition-i|0)>=4||new Hn(Vn("floating point number",4)).doFail(),e.v=n.view.getFloat32(i,!1),t.discardExact_za3lpa$(4),e.v}function Zn(t){var e={v:null},n=t.memory,i=t.readPosition;return(t.writePosition-i|0)>=8||new Hn(Vn("long floating point number",8)).doFail(),e.v=n.view.getFloat64(i,!1),t.discardExact_za3lpa$(8),e.v}function Qn(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<2)throw Rn("short integer",2,r);n.view.setInt16(i,e,!1),t.commitWritten_za3lpa$(2)}function Xn(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<4)throw Rn("regular integer",4,r);n.view.setInt32(i,e,!1),t.commitWritten_za3lpa$(4)}function ti(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<8)throw Rn("long integer",8,r);var o=n,a=i;o.view.setInt32(a,e.shiftRight(32).toInt(),!1),o.view.setInt32(a+4|0,e.and(Y).toInt(),!1),t.commitWritten_za3lpa$(8)}function ei(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<4)throw Rn("floating point number",4,r);n.view.setFloat32(i,e,!1),t.commitWritten_za3lpa$(4)}function ni(t,e){var n=t.memory,i=t.writePosition,r=t.limit-i|0;if(r<8)throw Rn("long floating point number",8,r);n.view.setFloat64(i,e,!1),t.commitWritten_za3lpa$(8)}function ii(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:null},o=t.memory,a=t.readPosition;(t.writePosition-a|0)>=i||new Hn(Vn("byte array",i)).doFail(),wa(o,e,a,i,n),r.v=u;var s=i;t.discardExact_za3lpa$(s),r.v}function ri(t,e,n,i){var r,o;if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Kn((r=n,function(){return"offset shouldn't be negative: "+r})).doFail(),i>=0||new Kn((o=i,function(){return"length shouldn't be negative: "+o})).doFail(),(n+i|0)<=e.length||new Kn(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var a=t.writePosition-t.readPosition|0,s=g.min(i,a);return ii(t,e,n,s),s}function oi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=t.memory,o=t.writePosition,a=t.limit-o|0;if(a=r||new Hn(Vn("short integers array",r)).doFail(),Oa(a,s,e,n,i),o.v=u;var l=r;t.discardExact_za3lpa$(l),o.v}function si(t,e,n,i){var r,o;if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Kn((r=n,function(){return"offset shouldn't be negative: "+r})).doFail(),i>=0||new Kn((o=i,function(){return"length shouldn't be negative: "+o})).doFail(),(n+i|0)<=e.length||new Kn(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var a=i/2|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return ai(t,e,n,l),l}function li(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=2*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=r||new Hn(Vn("integers array",r)).doFail(),Na(a,s,e,n,i),o.v=u;var l=r;t.discardExact_za3lpa$(l),o.v}function ui(t,e,n,i){var r,o;if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Kn((r=n,function(){return"offset shouldn't be negative: "+r})).doFail(),i>=0||new Kn((o=i,function(){return"length shouldn't be negative: "+o})).doFail(),(n+i|0)<=e.length||new Kn(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var a=i/4|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return ci(t,e,n,l),l}function pi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=4*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=r||new Hn(Vn("long integers array",r)).doFail(),za(a,s,e,n,i),o.v=u;var l=r;t.discardExact_za3lpa$(l),o.v}function fi(t,e,n,i){var r,o;if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Kn((r=n,function(){return"offset shouldn't be negative: "+r})).doFail(),i>=0||new Kn((o=i,function(){return"length shouldn't be negative: "+o})).doFail(),(n+i|0)<=e.length||new Kn(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var a=i/8|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return hi(t,e,n,l),l}function di(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=8*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=r||new Hn(Vn("floating point numbers array",r)).doFail(),ja(a,s,e,n,i),o.v=u;var l=r;t.discardExact_za3lpa$(l),o.v}function yi(t,e,n,i){var r,o;if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Kn((r=n,function(){return"offset shouldn't be negative: "+r})).doFail(),i>=0||new Kn((o=i,function(){return"length shouldn't be negative: "+o})).doFail(),(n+i|0)<=e.length||new Kn(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var a=i/4|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return _i(t,e,n,l),l}function mi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=4*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=r||new Hn(Vn("floating point numbers array",r)).doFail(),Ta(a,s,e,n,i),o.v=u;var l=r;t.discardExact_za3lpa$(l),o.v}function $i(t,e,n,i){var r,o;if(void 0===n&&(n=0),void 0===i&&(i=e.length-n|0),n>=0||new Kn((r=n,function(){return"offset shouldn't be negative: "+r})).doFail(),i>=0||new Kn((o=i,function(){return"length shouldn't be negative: "+o})).doFail(),(n+i|0)<=e.length||new Kn(function(t,e,n){return function(){return"offset + length should be less than the destination size: "+t+" + "+e+" > "+n.length}}(n,i,e)).doFail(),!(t.writePosition>t.readPosition))return-1;var a=i/8|0,s=t.writePosition-t.readPosition|0,l=g.min(a,s);return vi(t,e,n,l),l}function gi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=8*i|0,o=t.memory,a=t.writePosition,s=t.limit-a|0;if(s=0))throw b("Failed requirement.".toString());if(!(n<=(e.limit-e.writePosition|0)))throw b("Failed requirement.".toString());var i={v:null},r=t.memory,o=t.readPosition;(t.writePosition-o|0)>=n||new Hn(Vn("buffer content",n)).doFail(),r.copyTo_ubllm2$(e.memory,o,n,e.writePosition),e.commitWritten_za3lpa$(n),i.v=u;var a=n;return t.discardExact_za3lpa$(a),i.v,n}function wi(t,e,n){if(void 0===n&&(n=e.limit-e.writePosition|0),!(t.writePosition>t.readPosition))return-1;var i=e.limit-e.writePosition|0,r=t.writePosition-t.readPosition|0,o=g.min(i,r,n),a={v:null},s=t.memory,l=t.readPosition;(t.writePosition-l|0)>=o||new Hn(Vn("buffer content",o)).doFail(),s.copyTo_ubllm2$(e.memory,l,o,e.writePosition),e.commitWritten_za3lpa$(o),a.v=u;var c=o;return t.discardExact_za3lpa$(c),a.v,o}function ki(t,e,n){var i;n>=0||new Kn((i=n,function(){return"length shouldn't be negative: "+i})).doFail(),n<=(e.writePosition-e.readPosition|0)||new Kn(function(t,e){return function(){var n=e;return"length shouldn't be greater than the source read remaining: "+t+" > "+(n.writePosition-n.readPosition|0)}}(n,e)).doFail(),n<=(t.limit-t.writePosition|0)||new Kn(function(t,e){return function(){var n=e;return"length shouldn't be greater than the destination write remaining space: "+t+" > "+(n.limit-n.writePosition|0)}}(n,t)).doFail();var r=t.memory,o=t.writePosition,a=t.limit-o|0;if(a=0||new Ii((n=this,function(){return"shouldn't be negative: headerSizeHint = "+n.headerSizeHint_0})).doFail()}function Li(t,e,n){Fi(),Bi.call(this,t,e,n),this.markNoMoreChunksAvailable()}function Di(){qi=this,this.Empty=new Li(ao().Empty,f,ao().EmptyPool)}Pi.$metadata$={kind:h,simpleName:"BufferLimitExceededException",interfaces:[W]},Ri.$metadata$={kind:h,simpleName:"BytePacketBuilderPlatformBase",interfaces:[Ai]},Ai.$metadata$={kind:h,simpleName:"BytePacketBuilderBase",interfaces:[yn]},Ii.prototype=Object.create(uo.prototype),Ii.prototype.constructor=Ii,Ii.prototype.doFail=function(){throw b(this.closure$message())},Ii.$metadata$={kind:h,interfaces:[uo]},Object.defineProperty(Mi.prototype,"size",{configurable:!0,get:function(){return this._size}}),Object.defineProperty(Mi.prototype,"isEmpty",{configurable:!0,get:function(){return 0===this._size}}),Object.defineProperty(Mi.prototype,"isNotEmpty",{configurable:!0,get:function(){return this._size>0}}),Object.defineProperty(Mi.prototype,"_pool",{configurable:!0,get:function(){return this.pool}}),Mi.prototype.closeDestination=function(){},Mi.prototype.flush_9etqdk$=function(t,e,n){},Mi.prototype.append_s8itvh$=function(t){var n;return e.isType(n=Ri.prototype.append_s8itvh$.call(this,t),Mi)?n:p()},Mi.prototype.append_gw00v9$=function(t){var n;return e.isType(n=Ri.prototype.append_gw00v9$.call(this,t),Mi)?n:p()},Mi.prototype.append_ezbsdh$=function(t,n,i){var r;return e.isType(r=Ri.prototype.append_ezbsdh$.call(this,t,n,i),Mi)?r:p()},Mi.prototype.appendOld_s8itvh$=function(t){return this.append_s8itvh$(t)},Mi.prototype.appendOld_gw00v9$=function(t){return this.append_gw00v9$(t)},Mi.prototype.appendOld_ezbsdh$=function(t,e,n){return this.append_ezbsdh$(t,e,n)},Mi.prototype.preview_chaoki$=function(t){var e,n=qr(this);try{e=t(n)}finally{n.release()}return e},Mi.prototype.build=function(){var t=this.size,n=this.stealAll_8be2vx$();return null==n?Fi().Empty:new Li(n,e.Long.fromInt(t),this.pool)},Mi.prototype.reset=function(){this.release()},Mi.prototype.preview=function(){return qr(this)},Mi.prototype.toString=function(){return"BytePacketBuilder("+this.size+" bytes written)"},Mi.$metadata$={kind:h,simpleName:"BytePacketBuilder",interfaces:[Ri]},Li.prototype.copy=function(){return new Li(Ni(this.head),this.remaining,this.pool)},Li.prototype.fill=function(){return null},Li.prototype.fill_9etqdk$=function(t,e,n){return 0},Li.prototype.closeSource=function(){},Li.prototype.toString=function(){return"ByteReadPacket("+this.remaining.toString()+" bytes remaining)"},Object.defineProperty(Di.prototype,"ReservedSize",{configurable:!0,get:function(){return 8}}),Di.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var qi=null;function Fi(){return null===qi&&new Di,qi}function Ui(t,e,n){return n=n||Object.create(Li.prototype),Li.call(n,t,ji(t),e),n}function Bi(t,e,n){Ar.call(this,t,e,n)}function Hi(t,e){var n=t.discard_s8cxhz$(e);if(!d(n,e))throw R("Only "+n.toString()+" bytes were discarded of "+e.toString()+" requested")}function Vi(t,n){Hi(t,e.Long.fromInt(n))}function Ki(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a;try{for(;;){var u=c,p=r.v,h=u.writePosition-u.readPosition|0,f=g.min(p,h);if(ii(u,e,o.v,f),r.v=r.v-f|0,o.v=o.v+f|0,!(r.v>0))break;if(l=!1,null==(s=jo(t,c)))break;c=s,l=!0}}finally{l&&zo(t,c)}}while(0);var d=r.v;d>0&&Kr(d)}function Wi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/2|0,m=g.min(_,y);ai(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?2:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);var k=r.v;k>0&&Kr(k)}function Yi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/4|0,m=g.min(_,y);ci(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?4:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);var k=r.v;k>0&&Kr(k)}function Gi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/8|0,m=g.min(_,y);hi(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?8:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);var k=r.v;k>0&&Kr(k)}function Ji(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/4|0,m=g.min(_,y);_i(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?4:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);var k=r.v;k>0&&Kr(k)}function Zi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/8|0,m=g.min(_,y);vi(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?8:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);var k=r.v;k>0&&Kr(k)}function Qi(t,e,n){void 0===n&&(n=e.limit-e.writePosition|0);var i={v:n},r={v:0};t:do{var o,a,s=!0;if(null==(o=No(t,1)))break t;var l=o;try{for(;;){var c=l,u=i.v,p=c.writePosition-c.readPosition|0,h=g.min(u,p);if(bi(c,e,h),i.v=i.v-h|0,r.v=r.v+h|0,!(i.v>0))break;if(s=!1,null==(a=jo(t,l)))break;l=a,s=!0}}finally{s&&zo(t,l)}}while(0);var f=i.v;f>0&&Kr(f)}function Xi(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a;try{for(;;){var u=c,p=r.v,h=u.writePosition-u.readPosition|0,f=g.min(p,h);if(ii(u,e,o.v,f),r.v=r.v-f|0,o.v=o.v+f|0,!(r.v>0))break;if(l=!1,null==(s=jo(t,c)))break;c=s,l=!0}}finally{l&&zo(t,c)}}while(0);return i-r.v|0}function tr(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/2|0,m=g.min(_,y);ai(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?2:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);return i-r.v|0}function er(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/4|0,m=g.min(_,y);ci(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?4:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);return i-r.v|0}function nr(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/8|0,m=g.min(_,y);hi(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?8:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);return i-r.v|0}function ir(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/4|0,m=g.min(_,y);_i(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?4:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);return i-r.v|0}function rr(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:i},o={v:n};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a,u=1;try{do{var p,h=c,f=h.writePosition-h.readPosition|0;if(f>=u)try{var d=c,_=r.v,y=(d.writePosition-d.readPosition|0)/8|0,m=g.min(_,y);vi(d,e,o.v,m),r.v=r.v-m|0,o.v=o.v+m|0,u=r.v>0?8:0}finally{var v=c;p=v.writePosition-v.readPosition|0}else p=f;if(l=!1,0===p)s=jo(t,c);else{var $=p0)}finally{l&&zo(t,c)}}while(0);return i-r.v|0}function or(t,e,n){void 0===n&&(n=e.limit-e.writePosition|0);var i={v:n},r={v:0};t:do{var o,a,s=!0;if(null==(o=No(t,1)))break t;var l=o;try{for(;;){var c=l,u=i.v,p=c.writePosition-c.readPosition|0,h=g.min(u,p);if(bi(c,e,h),i.v=i.v-h|0,r.v=r.v+h|0,!(i.v>0))break;if(s=!1,null==(a=jo(t,l)))break;l=a,s=!0}}finally{s&&zo(t,l)}}while(0);return n-i.v|0}function ar(t,n,i,r,o){void 0===i&&(i=0),void 0===r&&(r=1),void 0===o&&(o=2147483647),Ao(n,i,r,o);var a=t.peekTo_afjyek$(n.memory,e.Long.fromInt(n.writePosition),e.Long.fromInt(i),e.Long.fromInt(r),e.Long.fromInt(P(o,n.limit-n.writePosition|0))).toInt();return n.commitWritten_za3lpa$(a),a}function sr(t){var n;t:do{var i=e.isType(t,un);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>2),i){var r=t.headPosition;t.headPosition=r+2|0,n=t.headMemory.view.getInt16(r,!1);break t}n=lr(t)}while(0);return n}function lr(t){var e,n=null!=(e=No(t,2))?e:Kr(2),i=Wn(n);return zo(t,n),i}function cr(t){var n;t:do{var i=e.isType(t,un);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>4),i){var r=t.headPosition;t.headPosition=r+4|0,n=t.headMemory.view.getInt32(r,!1);break t}n=ur(t)}while(0);return n}function ur(t){var e,n=null!=(e=No(t,4))?e:Kr(4),i=Yn(n);return zo(t,n),i}function pr(t){var n;t:do{var i=e.isType(t,un);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>8),i){var r=t.headPosition;t.headPosition=r+8|0;var o=t.headMemory;n=e.Long.fromInt(o.view.getUint32(r,!1)).shiftLeft(32).or(e.Long.fromInt(o.view.getUint32(r+4|0,!1)));break t}n=hr(t)}while(0);return n}function hr(t){var e,n=null!=(e=No(t,8))?e:Kr(8),i=Gn(n);return zo(t,n),i}function fr(t){var n;t:do{var i=e.isType(t,un);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>4),i){var r=t.headPosition;t.headPosition=r+4|0,n=t.headMemory.view.getFloat32(r,!1);break t}n=dr(t)}while(0);return n}function dr(t){var e,n=null!=(e=No(t,4))?e:Kr(4),i=Jn(n);return zo(t,n),i}function _r(t){var n;t:do{var i=e.isType(t,un);if(i&&(i=(t.headEndExclusive-t.headPosition|0)>8),i){var r=t.headPosition;t.headPosition=r+8|0,n=t.headMemory.view.getFloat64(r,!1);break t}n=yr(t)}while(0);return n}function yr(t){var e,n=null!=(e=No(t,8))?e:Kr(8),i=Zn(n);return zo(t,n),i}function mr(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r={v:n},o={v:i},a=To(t,1,null);try{for(;;){var s=a,l=o.v,c=s.limit-s.writePosition|0,u=g.min(l,c);if(oi(s,e,r.v,u),r.v=r.v+u|0,o.v=o.v-u|0,!(o.v>0))break;a=To(t,1,a)}}finally{Po(t,a)}}function vr(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=To(t,2,null);try{for(var l;;){var c=s,u=a.v,p=c.limit-c.writePosition|0,h=g.min(u,p);if(li(c,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,2))<=0)break;s=To(t,l,s)}}finally{Po(t,s)}}function $r(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=To(t,4,null);try{for(var l;;){var c=s,u=a.v,p=c.limit-c.writePosition|0,h=g.min(u,p);if(pi(c,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,4))<=0)break;s=To(t,l,s)}}finally{Po(t,s)}}function gr(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=To(t,8,null);try{for(var l;;){var c=s,u=a.v,p=c.limit-c.writePosition|0,h=g.min(u,p);if(di(c,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,8))<=0)break;s=To(t,l,s)}}finally{Po(t,s)}}function br(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=To(t,4,null);try{for(var l;;){var c=s,u=a.v,p=c.limit-c.writePosition|0,h=g.min(u,p);if(mi(c,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,4))<=0)break;s=To(t,l,s)}}finally{Po(t,s)}}function wr(t,n,i,r){void 0===i&&(i=0),void 0===r&&(r=n.length-i|0);var o={v:i},a={v:r},s=To(t,8,null);try{for(var l;;){var c=s,u=a.v,p=c.limit-c.writePosition|0,h=g.min(u,p);if(gi(c,n,o.v,h),o.v=o.v+h|0,a.v=a.v-h|0,(l=e.imul(a.v,8))<=0)break;s=To(t,l,s)}}finally{Po(t,s)}}function kr(t,e,n){void 0===n&&(n=e.writePosition-e.readPosition|0);var i={v:0},r={v:n},o=To(t,1,null);try{for(;;){var a=o,s=r.v,l=a.limit-a.writePosition|0,c=g.min(s,l);if(ki(a,e,c),i.v=i.v+c|0,r.v=r.v-c|0,!(r.v>0))break;o=To(t,1,o)}}finally{Po(t,o)}}function Sr(t,n,i,r){xr(t,n,e.Long.fromInt(i),e.Long.fromInt(r))}function xr(t,n,i,r){var o={v:i},a={v:r},s=To(t,1,null);try{for(;;){var l=s,c=a.v,u=e.Long.fromInt(l.limit-l.writePosition|0),p=c.compareTo_11rb$(u)<=0?c:u;if(n.copyTo_q2ka7j$(l.memory,o.v,p,e.Long.fromInt(l.writePosition)),l.commitWritten_za3lpa$(p.toInt()),o.v=o.v.add(p),a.v=a.v.subtract(p),!(a.v.toNumber()>0))break;s=To(t,1,s)}}finally{Po(t,s)}}function Er(t,n,i){if(void 0===i&&(i=0),e.isType(t,yn)){var r={v:f},o=To(t,1,null);try{for(;;){var a=o,s=e.Long.fromInt(a.limit-a.writePosition|0),l=n.subtract(r.v),c=(s.compareTo_11rb$(l)<=0?s:l).toInt();if(Ln(a,c,i),r.v=r.v.add(e.Long.fromInt(c)),!(r.v.compareTo_11rb$(n)<0))break;o=To(t,1,o)}}finally{Po(t,o)}}else!function(t,e,n){var i;for(i=J(0,e).iterator();i.hasNext();)i.next(),t.writeByte_s8j3t7$(n)}(t,n,i)}function Cr(t,n){var i;t:do{if(e.isType(t,yn)){var r=t.tailPosition_8be2vx$;if((t.tailEndExclusive_8be2vx$-r|0)>2){t.tailPosition_8be2vx$=r+2|0,t.tailMemory_8be2vx$.view.setInt16(r,n,!1),i=!0;break t}}i=!1}while(0);i||function(t,n){var i;t:do{if(e.isType(t,yn)){Qn(t.prepareWriteHead_za3lpa$(2),n),t.afterHeadWrite(),i=!0;break t}i=!1}while(0);i||(t.writeByte_s8j3t7$(_(n>>>8)),t.writeByte_s8j3t7$(_(255&n)))}(t,n)}function Or(t,n){var i;t:do{if(e.isType(t,yn)){var r=t.tailPosition_8be2vx$;if((t.tailEndExclusive_8be2vx$-r|0)>4){t.tailPosition_8be2vx$=r+4|0,t.tailMemory_8be2vx$.view.setInt32(r,n,!1),i=!0;break t}}i=!1}while(0);i||Nr(t,n)}function Nr(t,n){var i;t:do{if(e.isType(t,yn)){Xn(t.prepareWriteHead_za3lpa$(4),n),t.afterHeadWrite(),i=!0;break t}i=!1}while(0);i||zr(t,n)}function zr(t,e){var n=S(e>>>16);t.writeByte_s8j3t7$(_(n>>>8)),t.writeByte_s8j3t7$(_(255&n));var i=S(65535&e);t.writeByte_s8j3t7$(_(i>>>8)),t.writeByte_s8j3t7$(_(255&i))}function jr(t,n){var i;t:do{if(e.isType(t,yn)){var r=t.tailPosition_8be2vx$;if((t.tailEndExclusive_8be2vx$-r|0)>8){t.tailPosition_8be2vx$=r+8|0;var o=t.tailMemory_8be2vx$;o.view.setInt32(r,n.shiftRight(32).toInt(),!1),o.view.setInt32(r+4|0,n.and(Y).toInt(),!1),i=!0;break t}}i=!1}while(0);i||Tr(t,n)}function Tr(t,n){var i;t:do{if(e.isType(t,yn)){ti(t.prepareWriteHead_za3lpa$(8),n),t.afterHeadWrite(),i=!0;break t}i=!1}while(0);i||(zr(t,n.shiftRightUnsigned(32).toInt()),zr(t,n.and(Y).toInt()))}function Pr(t,n){var i;t:do{if(e.isType(t,yn)){var r=t.tailPosition_8be2vx$;if((t.tailEndExclusive_8be2vx$-r|0)>4){t.tailPosition_8be2vx$=r+4|0,t.tailMemory_8be2vx$.view.setFloat32(r,n,!1),i=!0;break t}}i=!1}while(0);i||Nr(t,Z(n))}function Rr(t,n){var i;t:do{if(e.isType(t,yn)){var r=t.tailPosition_8be2vx$;if((t.tailEndExclusive_8be2vx$-r|0)>8){t.tailPosition_8be2vx$=r+8|0,t.tailMemory_8be2vx$.view.setFloat64(r,n,!1),i=!0;break t}}i=!1}while(0);i||Tr(t,Q(n))}function Ar(t,e,n){Lr(),un.call(this,t,e,n)}function Ir(){Mr=this}Li.$metadata$={kind:h,simpleName:"ByteReadPacket",interfaces:[Bi,Rs]},Bi.$metadata$={kind:h,simpleName:"ByteReadPacketPlatformBase",interfaces:[Ar]},Object.defineProperty(Ir.prototype,"Empty",{configurable:!0,get:function(){return Fi().Empty}}),Ir.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var Mr=null;function Lr(){return null===Mr&&new Ir,Mr}function Dr(t){var e;return!t.endOfInput&&null!=(e=No(t,1))&&(zo(t,e),!0)}function qr(t){var e=t.head_8be2vx$;return e===ao().Empty?Fi().Empty:Ui(Ni(e),t._pool)}function Fr(t,e){if(void 0===e){var n=t.remaining;if(n.compareTo_11rb$(X)>0)throw b("Unable to convert to a ByteArray: packet is too big");e=n.toInt()}if(0!==e){var i=new Int8Array(e);return Ki(t,i,0,e),i}return ro}function Ur(t,e,n){return void 0===n&&(n=is().UTF_8),Qa(n.newDecoder(),t,e)}function Br(t,e,n,i,r){if(void 0===n&&(n=0),void 0===i&&(i=e.length),void 0===r&&(r=is().UTF_8),r===is().UTF_8)return Vr(t,e,n,i);ln(r.newEncoder(),t,e,n,i)}function Hr(t,e,n,i,r){if(void 0===n&&(n=0),void 0===i&&(i=e.length),void 0===r&&(r=is().UTF_8),r===is().UTF_8)return Vr(t,new yo(e,0,e.length),n,i);en(r.newEncoder(),e,n,i,t)}function Vr(t,e,n,i){var r={v:n},o=To(t,1,null);try{for(var a;;){var s=o,l=s.memory,c=s.writePosition,u=s.limit,p=$o(l,e,r.v,i,c,u),h=new I(S(p.value>>>16)),f=new I(S(65535&p.value));if(r.v=r.v+(65535&h.data)|0,s.commitWritten_za3lpa$(65535&f.data),(a=0==(65535&h.data)&&r.v0)throw R("This instance is already in use but somehow appeared in the pool.");if((t=this).refCount_yk3bl6$_0===e&&(t.refCount_yk3bl6$_0=1,1))break t}}while(0)},Gr.prototype.release_8be2vx$=function(){var t,e;this.refCount_yk3bl6$_0;t:do{for(;;){var n=this.refCount_yk3bl6$_0;if(n<=0)throw R("Unable to release: it is already released.");var i=n-1|0;if((e=this).refCount_yk3bl6$_0===n&&(e.refCount_yk3bl6$_0=i,1)){t=i;break t}}}while(0);return 0===t},Gr.prototype.reset=function(){null!=this.origin&&new Wr(Zr).doFail(),$n.prototype.reset.call(this),this.attachment=null,this.nextRef_43oo9e$_0=null},Object.defineProperty(Qr.prototype,"Empty",{configurable:!0,get:function(){return Ys().Empty}}),Object.defineProperty(Xr.prototype,"capacity",{configurable:!0,get:function(){return bn.capacity}}),Xr.prototype.borrow=function(){return bn.borrow()},Xr.prototype.recycle_trkh7z$=function(t){if(!e.isType(t,Is))throw b("Only IoBuffer instances can be recycled.");bn.recycle_trkh7z$(t)},Xr.prototype.dispose=function(){bn.dispose()},Xr.$metadata$={kind:h,interfaces:[Uo]},Object.defineProperty(to.prototype,"capacity",{configurable:!0,get:function(){return 1}}),to.prototype.borrow=function(){return ao().Empty},to.prototype.recycle_trkh7z$=function(t){t!==ao().Empty&&new Wr(eo).doFail()},to.prototype.dispose=function(){},to.$metadata$={kind:h,interfaces:[Uo]},no.prototype.borrow=function(){return new Is(ya().alloc_za3lpa$(4096),null)},no.prototype.recycle_trkh7z$=function(t){if(!e.isType(t,Is))throw b("Only IoBuffer instances can be recycled.");ya().free_vn6nzs$(t.memory)},no.$metadata$={kind:h,interfaces:[Bo]},io.prototype.borrow=function(){throw A("This pool doesn't support borrow")},io.prototype.recycle_trkh7z$=function(t){},io.$metadata$={kind:h,interfaces:[Bo]},Qr.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var ro,oo=null;function ao(){return null===oo&&new Qr,oo}function so(){return"A chunk couldn't be a view of itself."}function lo(t){return 1===t.referenceCount}function co(t,e){throw b("Long value "+t.toString()+" of "+e+" doesn't fit into 32-bit integer")}function uo(){}function po(t){this.closure$message=t,uo.call(this)}function ho(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.local$tmp$=void 0,this.local$decoded=void 0,this.local$size=void 0,this.local$cr=void 0,this.local$end=void 0,this.local$out=t,this.local$limit=e,this.local$nextChunk=n}function fo(t,e,n,i,r){var o=new ho(t,e,n,i);return r?o:o.doResume(null)}function _o(t){throw new al("Premature end of stream: expected "+t+" bytes to decode UTF-8 char")}function yo(t,e,n){this.array_0=t,this.offset_0=e,this.length_xy9hzd$_0=n}function mo(t){this.value=t}function vo(t,e,n){return n=n||Object.create(mo.prototype),mo.call(n,(65535&t.data)<<16|65535&e.data),n}function $o(t,e,n,i,r,o){for(var a,s,l=n+(65535&I.Companion.MAX_VALUE.data)|0,c=g.min(i,l),u=P(o,65535&I.Companion.MAX_VALUE.data),p=r,h=n;;){if(p>=u||h>=c)return vo(new I(S(h-n|0)),new I(S(p-r|0)));var f=65535&(0|e.charCodeAt((h=(a=h)+1|0,a)));if(0!=(65408&f))break;t.view.setInt8((p=(s=p)+1|0,s),_(f))}return function(t,e,n,i,r,o,a,s){for(var l,c,u=n,p=o,h=a-3|0;!((h-p|0)<=0||u>=i);){var f,d=e.charCodeAt((u=(l=u)+1|0,l)),y=ot(d)?u!==i&&rt(e.charCodeAt(u))?Eo(d,e.charCodeAt((u=(c=u)+1|0,c))):63:0|d,m=p;0<=y&&y<=127?(t.view.setInt8(m,_(y)),f=1):128<=y&&y<=2047?(t.view.setInt8(m,_(192|y>>6&31)),t.view.setInt8(m+1|0,_(128|63&y)),f=2):2048<=y&&y<=65535?(t.view.setInt8(m,_(224|y>>12&15)),t.view.setInt8(m+1|0,_(128|y>>6&63)),t.view.setInt8(m+2|0,_(128|63&y)),f=3):65536<=y&&y<=1114111?(t.view.setInt8(m,_(240|y>>18&7)),t.view.setInt8(m+1|0,_(128|y>>12&63)),t.view.setInt8(m+2|0,_(128|y>>6&63)),t.view.setInt8(m+3|0,_(128|63&y)),f=4):f=bo(y),p=p+f|0}return p===h?function(t,e,n,i,r,o,a,s){for(var l,c,u=n,p=o;;){var h=a-p|0;if(h<=0||u>=i)break;var f=e.charCodeAt((u=(l=u)+1|0,l)),d=ot(f)?u!==i&&rt(e.charCodeAt(u))?Eo(f,e.charCodeAt((u=(c=u)+1|0,c))):63:0|f;if((1<=d&&d<=127?1:128<=d&&d<=2047?2:2048<=d&&d<=65535?3:65536<=d&&d<=1114111?4:bo(d))>h){u=u-1|0;break}var y,m=p;0<=d&&d<=127?(t.view.setInt8(m,_(d)),y=1):128<=d&&d<=2047?(t.view.setInt8(m,_(192|d>>6&31)),t.view.setInt8(m+1|0,_(128|63&d)),y=2):2048<=d&&d<=65535?(t.view.setInt8(m,_(224|d>>12&15)),t.view.setInt8(m+1|0,_(128|d>>6&63)),t.view.setInt8(m+2|0,_(128|63&d)),y=3):65536<=d&&d<=1114111?(t.view.setInt8(m,_(240|d>>18&7)),t.view.setInt8(m+1|0,_(128|d>>12&63)),t.view.setInt8(m+2|0,_(128|d>>6&63)),t.view.setInt8(m+3|0,_(128|63&d)),y=4):y=bo(d),p=p+y|0}return vo(new I(S(u-r|0)),new I(S(p-s|0)))}(t,e,u,i,r,p,a,s):vo(new I(S(u-r|0)),new I(S(p-s|0)))}(t,e,h=h-1|0,c,n,p,u,r)}function go(t){throw new Co("Expected "+t+" more character bytes")}function bo(t){throw b("Malformed code-point "+t+" found")}function wo(t){return t>>>16==0}function ko(t){return t<=1114111}function So(t){return 56320+(1023&t)|0}function xo(t){return 55232+(t>>>10)|0}function Eo(t,e){return((0|t)-55232|0)<<10|(0|e)-56320|0}function Co(t){K(t,this),this.name="MalformedUTF8InputException"}function Oo(t,e){var n,i=e.size;if(null==(n=e.stealAll_8be2vx$()))return 0;var r=n;return i<=Bs&&null==r.next&&t.tryWriteAppend_pvnryh$(r)?(e.afterBytesStolen_8be2vx$(),i):(t.append_pvnryh$(r),i)}function No(t,n){return e.isType(t,un)?t.prepareReadHead_za3lpa$(n):e.isType(t,Gr)?t.writePosition>t.readPosition?t:null:function(t,n){if(t.endOfInput)return null;var i=ao().Pool.borrow(),r=t.peekTo_afjyek$(i.memory,e.Long.fromInt(i.writePosition),f,e.Long.fromInt(n),e.Long.fromInt(i.limit-i.writePosition|0)).toInt();return i.commitWritten_za3lpa$(r),rn.readPosition?(n.capacity-n.limit|0)<8?t.fixGapAfterRead_j2u0py$(n):t.headPosition=n.readPosition:t.ensureNext_j2u0py$(n):function(t,e){var n=e.capacity-(e.limit-e.writePosition|0)-(e.writePosition-e.readPosition|0)|0;Vi(t,n),e.release_2bs5fo$(ao().Pool)}(t,n))}function jo(t,n){return n===t?t.writePosition>t.readPosition?t:null:e.isType(t,un)?t.ensureNextHead_j2u0py$(n):function(t,e){var n=e.capacity-(e.limit-e.writePosition|0)-(e.writePosition-e.readPosition|0)|0;return Vi(t,n),e.resetForWrite(),t.endOfInput||ar(t,e)<=0?(e.release_2bs5fo$(ao().Pool),null):e}(t,n)}function To(t,n,i){return e.isType(t,yn)?(null!=i&&t.afterHeadWrite(),t.prepareWriteHead_za3lpa$(n)):function(t,e){return null!=e?(kr(t,e),e.resetForWrite(),e):ao().Pool.borrow()}(t,i)}function Po(t,n){if(e.isType(t,yn))return t.afterHeadWrite();!function(t,e){kr(t,e),e.release_2bs5fo$(ao().Pool)}(t,n)}function Ro(t){this.closure$message=t,uo.call(this)}function Ao(t,e,n,i){var r,o;e>=0||new Ro((r=e,function(){return"offset shouldn't be negative: "+r+"."})).doFail(),n>=0||new Ro((o=n,function(){return"min shouldn't be negative: "+o+"."})).doFail(),i>=n||new Ro(function(t,e){return function(){return"max should't be less than min: max = "+t+", min = "+e+"."}}(i,n)).doFail(),n<=(t.limit-t.writePosition|0)||new Ro(function(t,e){return function(){var n=e;return"Not enough free space in the destination buffer to write the specified minimum number of bytes: min = "+t+", free = "+(n.limit-n.writePosition|0)+"."}}(n,t)).doFail()}function Io(){this.suspension_0=null}function Mo(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t}function Lo(t,e){a.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$suspended=void 0}function Do(t,e,n,i){a.call(this,i),this.exceptionState_0=1,this.local$tmp$=void 0,this.local$remainingLimit=void 0,this.local$transferred=void 0,this.local$tail=void 0,this.local$$receiver=t,this.local$dst=e,this.local$limit=n}function qo(t,e,n,i,r){var o=new Do(t,e,n,i);return r?o:o.doResume(null)}function Fo(t,e,n,i){a.call(this,i),this.exceptionState_0=9,this.local$lastPiece=void 0,this.local$rc=void 0,this.local$$receiver=t,this.local$dst=e,this.local$limit=n}function Uo(){}function Bo(){}function Ho(){this.borrowed_m1d2y6$_0=0,this.disposed_rxrbhb$_0=!1,this.instance_vlsx8v$_0=null}function Vo(t){return void 0===t&&(t=!1),new Yo(Ys().Empty,t)}function Ko(t,n,i){var r;if(0===t.length)return ia().Empty;for(var o=Ys().Pool.borrow(),a=o,s=n,l=s+i|0;;){a.reserveEndGap_za3lpa$(8);var c=l-s|0,u=a,h=u.limit-u.writePosition|0,f=g.min(c,h);if(oi(e.isType(r=a,$n)?r:p(),t,s,f),(s=s+f|0)===l)break;var d=a;a=Ys().Pool.borrow(),d.next=a}var _=new Yo(o,!1);return je(_),_}function Wo(t,n,i,r){var o,a;return qo(e.isType(o=t,wt)?o:p(),e.isType(a=n,wt)?a:p(),i,r)}function Yo(t,e){wt.call(this,t,e),this.attachedJob_0=null}function Go(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$tmp$_0=void 0,this.local$dst=e,this.local$offset=n,this.local$length=i}function Jo(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$dst=e,this.local$offset=n,this.local$length=i}function Zo(t,e,n,i,r){a.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$start=void 0,this.local$end=void 0,this.local$remaining=void 0,this.local$dst=e,this.local$offset=n,this.local$length=i}function Qo(){this.closed=!1,this.readByteOrder=_s(),this.writeByteOrder=_s(),this.totalBytesRead=f,this.totalBytesWritten=f,this.closedCause=null,this.lastReadAvailable=0,this.lastReadView=ao().Empty}function Xo(){ia()}function ta(){na=this,this.Empty_wsx8uv$_0=ut(ea)}function ea(){var t=new Yo(Ys().Empty,!1);return t.close_dbl4no$(null),t}Gr.$metadata$={kind:h,simpleName:"ChunkBuffer",interfaces:[$n]},uo.$metadata$={kind:h,simpleName:"RequireFailureCapture",interfaces:[]},po.prototype=Object.create(uo.prototype),po.prototype.constructor=po,po.prototype.doFail=function(){throw b(this.closure$message())},po.$metadata$={kind:h,interfaces:[uo]},ho.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},ho.prototype=Object.create(a.prototype),ho.prototype.constructor=ho,ho.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$decoded={v:0},this.local$size={v:1},this.local$cr={v:!1},this.local$end={v:!1},this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$end.v||0===this.local$size.v){this.state_0=5;continue}if(this.state_0=3,this.result_0=this.local$nextChunk(this.local$size.v,this),this.result_0===o)return o;continue;case 3:if(this.local$tmp$=this.result_0,null==this.local$tmp$){this.state_0=5;continue}this.state_0=4;continue;case 4:var t=this.local$tmp$;t:do{var e,n,i=!0;if(null==(e=No(t,1)))break t;var r=e,a=1;try{e:do{var s,l=r,c=l.writePosition-l.readPosition|0;if(c>=a)try{var u,p=r,h={v:0};n:do{for(var f={v:0},d={v:0},_={v:0},y=p.memory,m=p.readPosition,v=p.writePosition,$=m;$>=1,f.v=f.v+1|0;if(_.v=f.v,f.v=f.v-1|0,_.v>(v-$|0)){p.discardExact_za3lpa$($-m|0),u=_.v;break n}}else if(d.v=d.v<<6|127&g,f.v=f.v-1|0,0===f.v){if(wo(d.v)){var x,E=V(H(d.v));i:do{switch(U(E)){case 13:if(this.local$cr.v){this.local$end.v=!0,x=!1;break i}this.local$cr.v=!0,x=!0;break i;case 10:this.local$end.v=!0,h.v=1,x=!1;break i;default:if(this.local$cr.v){this.local$end.v=!0,x=!1;break i}if(this.local$decoded.v===this.local$limit)throw new Pi("Too many characters in line: limit "+this.local$limit+" exceeded");this.local$decoded.v=this.local$decoded.v+1|0,this.local$out.append_s8itvh$(U(E)),x=!0;break i}}while(0);if(!x){p.discardExact_za3lpa$($-m-_.v+1|0),u=-1;break n}}else if(ko(d.v)){var C,O=V(H(xo(d.v)));i:do{switch(U(O)){case 13:if(this.local$cr.v){this.local$end.v=!0,C=!1;break i}this.local$cr.v=!0,C=!0;break i;case 10:this.local$end.v=!0,h.v=1,C=!1;break i;default:if(this.local$cr.v){this.local$end.v=!0,C=!1;break i}if(this.local$decoded.v===this.local$limit)throw new Pi("Too many characters in line: limit "+this.local$limit+" exceeded");this.local$decoded.v=this.local$decoded.v+1|0,this.local$out.append_s8itvh$(U(O)),C=!0;break i}}while(0);var N=!C;if(!N){var z,j=V(H(So(d.v)));i:do{switch(U(j)){case 13:if(this.local$cr.v){this.local$end.v=!0,z=!1;break i}this.local$cr.v=!0,z=!0;break i;case 10:this.local$end.v=!0,h.v=1,z=!1;break i;default:if(this.local$cr.v){this.local$end.v=!0,z=!1;break i}if(this.local$decoded.v===this.local$limit)throw new Pi("Too many characters in line: limit "+this.local$limit+" exceeded");this.local$decoded.v=this.local$decoded.v+1|0,this.local$out.append_s8itvh$(U(j)),z=!0;break i}}while(0);N=!z}if(N){p.discardExact_za3lpa$($-m-_.v+1|0),u=-1;break n}}else bo(d.v);d.v=0}}var T=v-m|0;p.discardExact_za3lpa$(T),u=0}while(0);this.local$size.v=u,h.v>0&&p.discardExact_za3lpa$(h.v),this.local$size.v=this.local$end.v?0:F(this.local$size.v,1),a=this.local$size.v}finally{var P=r;s=P.writePosition-P.readPosition|0}else s=c;if(i=!1,0===s)n=jo(t,r);else{var R=s0)}finally{i&&zo(t,r)}}while(0);this.state_0=2;continue;case 5:return this.local$size.v>1&&_o(this.local$size.v),this.local$cr.v&&(this.local$end.v=!0),this.local$decoded.v>0||this.local$end.v;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(yo.prototype,"length",{get:function(){return this.length_xy9hzd$_0}}),yo.prototype.charCodeAt=function(t){return t>=this.length&&this.indexOutOfBounds_0(t),this.array_0[t+this.offset_0|0]},yo.prototype.subSequence_vux9f0$=function(t,e){var n,i,r;return t>=0||new po((n=t,function(){return"startIndex shouldn't be negative: "+n})).doFail(),t<=this.length||new po(function(t,e){return function(){return"startIndex is too large: "+t+" > "+e.length}}(t,this)).doFail(),(t+e|0)<=this.length||new po((i=e,r=this,function(){return"endIndex is too large: "+i+" > "+r.length})).doFail(),e>=t||new po(function(t,e){return function(){return"endIndex should be greater or equal to startIndex: "+t+" > "+e}}(t,e)).doFail(),new yo(this.array_0,this.offset_0+t|0,e-t|0)},yo.prototype.indexOutOfBounds_0=function(t){throw new nt("String index out of bounds: "+t+" > "+this.length)},yo.$metadata$={kind:h,simpleName:"CharArraySequence",interfaces:[it]},Object.defineProperty(mo.prototype,"characters",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.internal.EncodeResult.get_characters",k((function(){var t=e.toShort,n=e.kotlin.UShort;return function(){return new n(t(this.value>>>16))}})))}),Object.defineProperty(mo.prototype,"bytes",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.internal.EncodeResult.get_bytes",k((function(){var t=e.toShort,n=e.kotlin.UShort;return function(){return new n(t(65535&this.value))}})))}),mo.prototype.component1=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.internal.EncodeResult.component1",k((function(){var t=e.toShort,n=e.kotlin.UShort;return function(){return new n(t(this.value>>>16))}}))),mo.prototype.component2=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.internal.EncodeResult.component2",k((function(){var t=e.toShort,n=e.kotlin.UShort;return function(){return new n(t(65535&this.value))}}))),mo.$metadata$={kind:h,simpleName:"EncodeResult",interfaces:[]},mo.prototype.unbox=function(){return this.value},mo.prototype.toString=function(){return"EncodeResult(value="+e.toString(this.value)+")"},mo.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.value)|0},mo.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.value,t.value)},Co.$metadata$={kind:h,simpleName:"MalformedUTF8InputException",interfaces:[W]},Ro.prototype=Object.create(uo.prototype),Ro.prototype.constructor=Ro,Ro.prototype.doFail=function(){throw b(this.closure$message())},Ro.$metadata$={kind:h,interfaces:[uo]},Mo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Mo.prototype=Object.create(a.prototype),Mo.prototype.constructor=Mo,Mo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.trySuspend_0(this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.result_0)return;this.state_0=3;continue;case 3:return void this.$this.resume();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Io.prototype.sleep=function(t,e){var n=new Mo(this,t);return e?n:n.doResume(null)},Io.prototype.resume=function(){var t,e,n;null!=(n=(e=this).suspension_0,e.suspension_0=null,t=n)&&t.complete()},Io.prototype.cancel_dbl4no$=function(t){var e,n,i;if(i=(n=this).suspension_0,n.suspension_0=null,null!=(e=i)){var r=e;null!=t?r.completeExceptionally_tcv7n7$(t):r.complete()}},Lo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Lo.prototype=Object.create(a.prototype),Lo.prototype.constructor=Lo,Lo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$suspended=!1;var t=at();if(null==(e=this).$this.suspension_0&&(e.$this.suspension_0=t,1)){if(this.local$suspended=!0,this.state_0=2,this.result_0=t.join(this),this.result_0===o)return o;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.state_0=3;continue;case 3:return this.local$suspended;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var e},Io.prototype.trySuspend_0=function(t,e){var n=new Lo(this,t);return e?n:n.doResume(null)},Io.$metadata$={kind:h,simpleName:"AwaitingSlot",interfaces:[]},Do.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Do.prototype=Object.create(a.prototype),Do.prototype.constructor=Do,Do.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$$receiver===this.local$dst)throw b("Failed requirement.".toString());if(null!=this.local$$receiver.closedCause)return this.local$dst.close_dbl4no$(this.local$$receiver.closedCause),f;this.state_0=2;continue;case 1:throw this.exception_0;case 2:this.local$remainingLimit=this.local$limit,this.state_0=3;continue;case 3:if(this.local$remainingLimit.toNumber()<=0){this.state_0=11;continue}if(this.state_0=4,this.result_0=this.local$$receiver.awaitInternalAtLeast1_8be2vx$(this),this.result_0===o)return o;continue;case 4:if(this.result_0){this.state_0=5;continue}this.state_0=11;continue;case 5:if(this.local$transferred=this.local$$receiver.transferTo_pxvbjg$(this.local$dst,this.local$remainingLimit),d(this.local$transferred,f)){if(this.state_0=8,this.result_0=(e=this.local$$receiver,n=this.local$dst,i=this.local$remainingLimit,r=void 0,a=void 0,a=new Fo(e,n,i,this),r?a:a.doResume(null)),this.result_0===o)return o;continue}if(0===this.local$dst.availableForWrite){if(this.state_0=6,this.result_0=this.local$dst.awaitAtLeastNBytesAvailableForWrite_kcn2v3$(1,this),this.result_0===o)return o;continue}this.state_0=7;continue;case 6:this.state_0=7;continue;case 7:this.local$tmp$=this.local$transferred,this.state_0=10;continue;case 8:if(this.local$tail=this.result_0,d(this.local$tail,f)){this.state_0=11;continue}this.state_0=9;continue;case 9:this.local$tmp$=this.local$tail,this.state_0=10;continue;case 10:var t=this.local$tmp$;this.local$remainingLimit=this.local$remainingLimit.subtract(t),this.state_0=3;continue;case 11:return this.local$limit.subtract(this.local$remainingLimit);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var e,n,i,r,a},Fo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Fo.prototype=Object.create(a.prototype),Fo.prototype.constructor=Fo,Fo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$lastPiece=ao().Pool.borrow(),this.exceptionState_0=7,this.local$lastPiece.resetForWrite_za3lpa$(v(this.local$limit,e.Long.fromInt(this.local$lastPiece.capacity)).toInt()),this.state_0=1,this.result_0=this.local$$receiver.readAvailable_lh221x$(this.local$lastPiece,this),this.result_0===o)return o;continue;case 1:if(this.local$rc=this.result_0,-1===this.local$rc){this.local$lastPiece.release_2bs5fo$(ao().Pool),this.exceptionState_0=9,this.finallyPath_0=[2],this.state_0=8,this.$returnValue=f;continue}this.state_0=3;continue;case 2:return this.$returnValue;case 3:if(this.state_0=4,this.result_0=this.local$dst.writeFully_b4g5fm$(this.local$lastPiece,this),this.result_0===o)return o;continue;case 4:this.exceptionState_0=9,this.finallyPath_0=[5],this.state_0=8,this.$returnValue=e.Long.fromInt(this.local$rc);continue;case 5:return this.$returnValue;case 6:return;case 7:this.finallyPath_0=[9],this.state_0=8;continue;case 8:this.exceptionState_0=9,this.local$lastPiece.release_2bs5fo$(ao().Pool),this.state_0=this.finallyPath_0.shift();continue;case 9:throw this.exception_0;default:throw this.state_0=9,new Error("State Machine Unreachable execution")}}catch(t){if(9===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Uo.prototype.close=function(){this.dispose()},Uo.$metadata$={kind:r,simpleName:"ObjectPool",interfaces:[gs]},Object.defineProperty(Bo.prototype,"capacity",{configurable:!0,get:function(){return 0}}),Bo.prototype.recycle_trkh7z$=function(t){},Bo.prototype.dispose=function(){},Bo.$metadata$={kind:h,simpleName:"NoPoolImpl",interfaces:[Uo]},Yo.prototype.attachJob_dqr1mp$=function(t){var e,n;null!=(e=this.attachedJob_0)&&e.cancel_m4sck1$(),this.attachedJob_0=t,t.invokeOnCompletion_ct2b2z$(!0,void 0,(n=this,function(t){return n.attachedJob_0=null,null!=t&&n.cancel_dbl4no$(t),u}))},Go.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Go.prototype=Object.create(a.prototype),Go.prototype.constructor=Go,Go.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.$this.readable.endOfInput){if(this.state_0=2,this.result_0=this.$this.readAvailableSuspend_0(this.local$dst,this.local$offset,this.local$length,this),this.result_0===o)return o;continue}if(null!=(t=this.$this.closedCause))throw t;this.local$tmp$_0=Ts(this.$this.readable,this.local$dst,this.local$offset,this.local$length),this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.local$tmp$_0=this.result_0,this.state_0=3;continue;case 3:return this.local$tmp$_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Yo.prototype.readAvailable_qmgm5g$=function(t,e,n,i,r){var o=new Go(this,t,e,n,i);return r?o:o.doResume(null)},Jo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Jo.prototype=Object.create(a.prototype),Jo.prototype.constructor=Jo,Jo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.await_za3lpa$(1,this),this.result_0===o)return o;continue;case 1:throw this.exception_0;case 2:if(this.result_0){this.state_0=3;continue}return-1;case 3:if(this.state_0=4,this.result_0=this.$this.readAvailable_qmgm5g$(this.local$dst,this.local$offset,this.local$length,this),this.result_0===o)return o;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Yo.prototype.readAvailableSuspend_0=function(t,e,n,i,r){var o=new Jo(this,t,e,n,i);return r?o:o.doResume(null)},Yo.prototype.readFully_qmgm5g$=function(t,e,n,i){var r;if(!(this.availableForRead>=n))return this.readFullySuspend_0(t,e,n,i);if(null!=(r=this.closedCause))throw r;Ns(this.readable,t,e,n)},Zo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[a]},Zo.prototype=Object.create(a.prototype),Zo.prototype.constructor=Zo,Zo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$start=this.local$offset,this.local$end=this.local$offset+this.local$length|0,this.local$remaining=this.local$length,this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$start>=this.local$end){this.state_0=4;continue}if(this.state_0=3,this.result_0=this.$this.readAvailable_qmgm5g$(this.local$dst,this.local$start,this.local$remaining,this),this.result_0===o)return o;continue;case 3:var t=this.result_0;if(-1===t)throw new al("Premature end of stream: required "+this.local$remaining+" more bytes");this.local$start=this.local$start+t|0,this.local$remaining=this.local$remaining-t|0,this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Yo.prototype.readFullySuspend_0=function(t,e,n,i,r){var o=new Zo(this,t,e,n,i);return r?o:o.doResume(null)},Yo.prototype.toString=function(){return"ByteChannel["+st(this.attachedJob_0)+", "+lt(this)+"]"},Yo.$metadata$={kind:h,simpleName:"ByteChannelJS",interfaces:[wt]},Qo.$metadata$={kind:h,simpleName:"ByteChannelSequentialBaseSharedState",interfaces:[]},Xo.prototype.peekTo_afjyek$=function(t,e,n,i,r,o,a){return void 0===n&&(n=f),void 0===i&&(i=ct),void 0===r&&(r=s),a?a(t,e,n,i,r,o):this.peekTo_afjyek$$default(t,e,n,i,r,o)},Object.defineProperty(ta.prototype,"Empty",{configurable:!0,get:function(){return this.Empty_wsx8uv$_0.value}}),ta.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var na=null;function ia(){return null===na&&new ta,na}function ra(){}function oa(t){}function aa(t){return S((255&t)<<8|(65535&t)>>>8)}function sa(t){var e=S(65535&t),n=S((255&e)<<8|(65535&e)>>>8)<<16,i=S(t>>>16);return n|65535&S((255&i)<<8|(65535&i)>>>8)}function la(t){var n=t.and(Y).toInt(),i=S(65535&n),r=S((255&i)<<8|(65535&i)>>>8)<<16,o=S(n>>>16),a=e.Long.fromInt(r|65535&S((255&o)<<8|(65535&o)>>>8)).shiftLeft(32),s=t.shiftRightUnsigned(32).toInt(),l=S(65535&s),c=S((255&l)<<8|(65535&l)>>>8)<<16,u=S(s>>>16);return a.or(e.Long.fromInt(c|65535&S((255&u)<<8|(65535&u)>>>8)).and(Y))}function ca(t){var n=Z(t),i=S(65535&n),r=S((255&i)<<8|(65535&i)>>>8)<<16,o=S(n>>>16),a=r|65535&S((255&o)<<8|(65535&o)>>>8);return e.floatFromBits(a)}function ua(t){var n=Q(t),i=n.and(Y).toInt(),r=S(65535&i),o=S((255&r)<<8|(65535&r)>>>8)<<16,a=S(i>>>16),s=e.Long.fromInt(o|65535&S((255&a)<<8|(65535&a)>>>8)).shiftLeft(32),l=n.shiftRightUnsigned(32).toInt(),c=S(65535&l),u=S((255&c)<<8|(65535&c)>>>8)<<16,p=S(l>>>16),h=s.or(e.Long.fromInt(u|65535&S((255&p)<<8|(65535&p)>>>8)).and(Y));return e.doubleFromBits(h)}function pa(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.length-n|0);var r=e;return fa(ba(),r,n,i)}function ha(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.byteLength-n|0),new ma(new DataView(e,n,i))}function fa(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.byteLength),ha(ba(),e.buffer,e.byteOffset+n|0,i)}function da(){_a=this}Xo.$metadata$={kind:r,simpleName:"ByteReadChannel",interfaces:[]},ra.$metadata$={kind:r,simpleName:"ByteWriteChannel",interfaces:[]},da.prototype.alloc_za3lpa$=function(t){return new ma(new DataView(new ArrayBuffer(t)))},da.prototype.alloc_s8cxhz$=function(t){return t.toNumber()>=2147483647&&co(t,"size"),new ma(new DataView(new ArrayBuffer(t.toInt())))},da.prototype.free_vn6nzs$=function(t){},da.$metadata$={kind:B,simpleName:"DefaultAllocator",interfaces:[tn]};var _a=null;function ya(){return null===_a&&new da,_a}function ma(t){ba(),this.view=t}function va(){ga=this,this.Empty=new ma(new DataView(new ArrayBuffer(0)))}Object.defineProperty(ma.prototype,"size",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.bits.Memory.get_size",(function(){return e.Long.fromInt(this.view.byteLength)}))}),Object.defineProperty(ma.prototype,"size32",{configurable:!0,get:w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.bits.Memory.get_size32",(function(){return this.view.byteLength}))}),ma.prototype.loadAt_za3lpa$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.bits.Memory.loadAt_za3lpa$",(function(t){return this.view.getInt8(t)})),ma.prototype.loadAt_s8cxhz$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.bits.Memory.loadAt_s8cxhz$",k((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t){var n=this.view;return t.toNumber()>=2147483647&&e(t,"index"),n.getInt8(t.toInt())}}))),ma.prototype.storeAt_6t1wet$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.bits.Memory.storeAt_6t1wet$",(function(t,e){this.view.setInt8(t,e)})),ma.prototype.storeAt_3pq026$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.bits.Memory.storeAt_3pq026$",k((function(){var e=t.io.ktor.utils.io.core.internal.failLongToIntConversion_a4hdmt$;return function(t,n){var i=this.view;t.toNumber()>=2147483647&&e(t,"index"),i.setInt8(t.toInt(),n)}}))),ma.prototype.slice_vux9f0$=function(t,n){if(!(t>=0))throw b(("offset shouldn't be negative: "+t).toString());if(!(n>=0))throw b(("length shouldn't be negative: "+n).toString());if((t+n|0)>e.Long.fromInt(this.view.byteLength).toNumber())throw new nt("offset + length > size: "+t+" + "+n+" > "+e.Long.fromInt(this.view.byteLength).toString());return new ma(new DataView(this.view.buffer,this.view.byteOffset+t|0,n))},ma.prototype.slice_3pjtqy$=function(t,e){t.toNumber()>=2147483647&&co(t,"offset");var n=t.toInt();return e.toNumber()>=2147483647&&co(e,"length"),this.slice_vux9f0$(n,e.toInt())},ma.prototype.copyTo_ubllm2$=function(t,e,n,i){var r=new Int8Array(this.view.buffer,this.view.byteOffset+e|0,n);new Int8Array(t.view.buffer,t.view.byteOffset+i|0,n).set(r)},ma.prototype.copyTo_q2ka7j$=function(t,e,n,i){e.toNumber()>=2147483647&&co(e,"offset");var r=e.toInt();n.toNumber()>=2147483647&&co(n,"length");var o=n.toInt();i.toNumber()>=2147483647&&co(i,"destinationOffset"),this.copyTo_ubllm2$(t,r,o,i.toInt())},va.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var $a,ga=null;function ba(){return null===ga&&new va,ga}function wa(t,e,n,i,r){var o=e,a=new Int8Array(t.view.buffer,t.view.byteOffset+n|0,i);o.set(a,r)}function ka(t,e,n,i){var r;r=e+n|0;for(var o=e;o0;){var c=r-s|0,u=l/6|0,p=F(g.min(c,u),1),h=ot(n.charCodeAt(s+p-1|0)),f=h&&1===p?s+2|0:h?s+p-1|0:s+p|0,_=s,y=a.encode(e.subSequence(n,_,f).toString());if(y.length>l)break;Xs(o,y),s=f,l=l-y.length|0}return s-i|0}function Wa(t,e){return!0}function Ya(t){this._charset_8be2vx$=t}function Ga(t){Ya.call(this,t),this.charset_0=t}function Ja(t){return t._charset_8be2vx$}function Za(t,n,i,r){var o=sl(Ua(Ja(t)),!0),a={v:0};t:do{var s,l,c=!0;if(null==(s=No(n,1)))break t;var u=s,p=1;try{e:do{var h,f=u,d=f.writePosition-f.readPosition|0;if(d>=p)try{var _,y=u;n:do{var m,v=r-a.v|0,$=y.writePosition-y.readPosition|0;if(v<$){_=0;break n}var g,b=y.memory,w=y.readPosition,k=y.writePosition,S=new ht(b.view.buffer,b.view.byteOffset+w|0,k-w|0);try{var x,C;try{x=o.decode_g2l45e$(S,cl(!0))}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(C=t.message)?C:"no cause provided")):t}}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(g=t.message)?g:"no cause provided")):t}var O=x;i.append_gw00v9$(O),a.v=a.v+O.length|0;var N=S.byteLength;if(y.discardExact_za3lpa$(N),a.v===r){try{m=o.decode()}catch(t){m=""}m.length>0&&y.rewind_za3lpa$($),_=0}else _=a.v0)}finally{c&&zo(n,u)}}while(0);if(a.v=D)try{var B=L,H=B.memory,V=B.readPosition,K=B.writePosition,W=ss(new ht(H.view.buffer,H.view.byteOffset+V|0,K-V|0),o,r-a.v|0);i.append_gw00v9$(W.charactersDecoded),a.v=a.v+W.charactersDecoded.length|0;var Y=W.bytesConsumed;B.discardExact_za3lpa$(Y),Y>0?R.v=1:8===R.v?R.v=0:R.v=R.v+1|0,D=R.v}finally{var G=L;q=G.writePosition-G.readPosition|0}else q=U;if(M=!1,0===q)I=jo(n,L);else{var J=q0)}finally{M&&zo(n,L)}}while(0)}return a.v}function Qa(t,n,i){if(0===i)return"";var r=e.isType(n,un);if(r&&(r=(n.headEndExclusive-n.headPosition|0)>=i),r){var o,a,s=sl(Ja(t)._name_8be2vx$,!0),l=n.head,c=n.headMemory.view;try{var u=0===l.readPosition&&i===c.byteLength?c:new DataView(c.buffer,c.byteOffset+l.readPosition|0,i);o=s.decode_c2mund$(u)}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(a=t.message)?a:"no cause provided")):t}var p=o;return n.discardExact_za3lpa$(i),p}return function(t,n,i){var r,o=sl(Ua(Ja(t)),!0),a={v:i},s=L(i);try{t:do{var l,c,u=!0;if(null==(l=No(n,6)))break t;var p=l,h=6;try{do{var f,d=p,_=d.writePosition-d.readPosition|0;if(_>=h)try{var y,m=p,v=m.writePosition-m.readPosition|0,$=a.v,b=g.min(v,$);if(0===m.readPosition&&m.memory.view.byteLength===b){var w,k,S=m.memory.view;try{w=o.decode_g2l45e$(S,cl(!0))}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(k=t.message)?k:"no cause provided")):t}y=w}else{var x,C,O=new Int8Array(m.memory.view.buffer,m.memory.view.byteOffset+m.readPosition|0,b);try{x=o.decode_g2l45e$(O,cl(!0))}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(C=t.message)?C:"no cause provided")):t}y=x}var N=y;s.append_pdl1vj$(N),m.discardExact_za3lpa$(b),a.v=a.v-b|0,h=a.v>0?6:0}finally{var z=p;f=z.writePosition-z.readPosition|0}else f=_;if(u=!1,0===f)c=jo(n,p);else{var j=f0)}finally{u&&zo(n,p)}}while(0);if(a.v>0)t:do{var R,A,I=!0;if(null==(R=No(n,1)))break t;var M=R;try{for(;;){var D,q=M,F=q.writePosition-q.readPosition|0,U=a.v,B=g.min(F,U);if(0===q.readPosition&&q.memory.view.byteLength===B)D=o.decode_c2mund$(q.memory.view);else{var H,V,K=new Int8Array(q.memory.view.buffer,q.memory.view.byteOffset+q.readPosition|0,B);try{H=o.decode_g2l45e$(K,cl(!0))}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(V=t.message)?V:"no cause provided")):t}D=H}var W=D;if(s.append_pdl1vj$(W),q.discardExact_za3lpa$(B),a.v=a.v-B|0,I=!1,null==(A=jo(n,M)))break;M=A,I=!0}}finally{I&&zo(n,M)}}while(0);s.append_pdl1vj$(o.decode())}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(r=t.message)?r:"no cause provided")):t}if(a.v>0)throw new al("Not enough bytes available: had only "+(i-a.v|0)+" instead of "+i);return s.toString()}(t,n,i)}function Xa(){ns=this,this.UTF_8=new rs("UTF-8"),this.ISO_8859_1=new rs("ISO-8859-1")}La.$metadata$={kind:h,simpleName:"Charset",interfaces:[]},Ba.$metadata$={kind:h,simpleName:"CharsetEncoder",interfaces:[]},Ha.$metadata$={kind:h,simpleName:"CharsetEncoderImpl",interfaces:[Ba]},Ha.prototype.component1_0=function(){return this.charset_0},Ha.prototype.copy_6ypavq$=function(t){return new Ha(void 0===t?this.charset_0:t)},Ha.prototype.toString=function(){return"CharsetEncoderImpl(charset="+e.toString(this.charset_0)+")"},Ha.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.charset_0)|0},Ha.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.charset_0,t.charset_0)},Ya.$metadata$={kind:h,simpleName:"CharsetDecoder",interfaces:[]},Ga.$metadata$={kind:h,simpleName:"CharsetDecoderImpl",interfaces:[Ya]},Ga.prototype.component1_0=function(){return this.charset_0},Ga.prototype.copy_6ypavq$=function(t){return new Ga(void 0===t?this.charset_0:t)},Ga.prototype.toString=function(){return"CharsetDecoderImpl(charset="+e.toString(this.charset_0)+")"},Ga.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.charset_0)|0},Ga.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.charset_0,t.charset_0)},Xa.$metadata$={kind:B,simpleName:"Charsets",interfaces:[]};var ts,es,ns=null;function is(){return null===ns&&new Xa,ns}function rs(t){La.call(this,t),this.name=t}function os(t){E.call(this),this.message_dl21pz$_0=t,this.cause_5de4tn$_0=null,e.captureStack(E,this),this.name="MalformedInputException"}function as(t,e){this.charactersDecoded=t,this.bytesConsumed=e}function ss(t,n,i){if(0===i)return new as("",0);try{var r=P(i,t.byteLength),o=n.decode_c2mund$(t.subarray(0,r));if(o.length<=i)return new as(o,r)}catch(t){}return function(t,n,i){for(var r,o=P(i>=268435455?2147483647:8*i|0,t.byteLength);o>8;){try{var a=n.decode_c2mund$(t.subarray(0,o));if(a.length<=i)return new as(a,o)}catch(t){}o=o/2|0}for(o=8;o>0;){try{var s=n.decode_c2mund$(t.subarray(0,o));if(s.length<=i)return new as(s,o)}catch(t){}o=o-1|0}try{n.decode_c2mund$(t)}catch(t){throw e.isType(t,E)?new os("Failed to decode bytes: "+(null!=(r=t.message)?r:"no cause provided")):t}throw new os("Unable to decode buffer")}(t,n,i)}function ls(t,e,n,i){if(e>=n)return 0;for(var r,o=i.memory,a=i.writePosition,s=o.slice_vux9f0$(a,i.limit-a|0).view,l=new Int8Array(s.buffer,s.byteOffset,s.byteLength),c=0,u=e;u255&&cs(p),l[(r=c,c=r+1|0,r)]=_(p)}var h=c;return i.commitWritten_za3lpa$(h),n-e|0}function cs(t){throw new os("The character with unicode point "+t+" couldn't be mapped to ISO-8859-1 character")}function us(t,n){this.head=t,this.headMemory=this.head.memory,this.headPosition=this.head.readPosition,this.headEndExclusive=this.head.writePosition,this.tailRemaining=n.subtract(e.Long.fromInt(this.headEndExclusive-this.headPosition|0))}function ps(){this.head=null,this.tail=null,this.tailMemory=ba().Empty,this.tailPosition=0,this.tailEndExclusive=0,this.tailInitialPosition=0,this.chainedSize=0}function hs(t){this.limit=t,this.readPosition=0,this.writePosition=0,this.startGap=0,this.attachment=null}function fs(t,e){dt.call(this),this.name$=t,this.ordinal$=e}function ds(){ds=function(){},ts=new fs("BIG_ENDIAN",0),es=new fs("LITTLE_ENDIAN",1),$s()}function _s(){return ds(),ts}function ys(){return ds(),es}function ms(){vs=this,this.native_0=null;var t=new ArrayBuffer(4),e=new Int32Array(t),n=new DataView(t);e[0]=287454020,this.native_0=287454020===n.getInt32(0,!0)?ys():_s()}rs.prototype.newEncoder=function(){return new Ha(this)},rs.prototype.newDecoder=function(){return new Ga(this)},rs.$metadata$={kind:h,simpleName:"CharsetImpl",interfaces:[La]},rs.prototype.component1=function(){return this.name},rs.prototype.copy_61zpoe$=function(t){return new rs(void 0===t?this.name:t)},rs.prototype.toString=function(){return"CharsetImpl(name="+e.toString(this.name)+")"},rs.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.name)|0},rs.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.name,t.name)},Object.defineProperty(os.prototype,"message",{get:function(){return this.message_dl21pz$_0}}),Object.defineProperty(os.prototype,"cause",{get:function(){return this.cause_5de4tn$_0}}),os.$metadata$={kind:h,simpleName:"MalformedInputException",interfaces:[E]},as.$metadata$={kind:h,simpleName:"DecodeBufferResult",interfaces:[]},as.prototype.component1=function(){return this.charactersDecoded},as.prototype.component2=function(){return this.bytesConsumed},as.prototype.copy_bm4lxs$=function(t,e){return new as(void 0===t?this.charactersDecoded:t,void 0===e?this.bytesConsumed:e)},as.prototype.toString=function(){return"DecodeBufferResult(charactersDecoded="+e.toString(this.charactersDecoded)+", bytesConsumed="+e.toString(this.bytesConsumed)+")"},as.prototype.hashCode=function(){var t=0;return t=31*(t=31*t+e.hashCode(this.charactersDecoded)|0)+e.hashCode(this.bytesConsumed)|0},as.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.charactersDecoded,t.charactersDecoded)&&e.equals(this.bytesConsumed,t.bytesConsumed)},us.$metadata$={kind:h,simpleName:"AbstractInputSharedState",interfaces:[]},ps.$metadata$={kind:h,simpleName:"AbstractOutputSharedState",interfaces:[]},hs.$metadata$={kind:h,simpleName:"BufferSharedState",interfaces:[]},ms.prototype.nativeOrder=function(){return this.native_0},ms.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var vs=null;function $s(){return ds(),null===vs&&new ms,vs}function gs(){}function bs(t){this.closure$message=t,uo.call(this)}function ws(t,n,i,r){if(void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.isType(t,un))return Os(t,n,i,r);xs(t,n,i,r)!==r&&Kr(r)}function ks(t,n,i,r){if(void 0===i&&(i=0),void 0===r&&(r=n.byteLength-i|0),e.isType(t,un))return Ns(t,n,i,r);Es(t,n,i,r)!==r&&Kr(r)}function Ss(t,n,i,r){if(void 0===i&&(i=0),void 0===r&&(r=n.byteLength-i|0),e.isType(t,un))return zs(t,n,i,r);Cs(t,n,i,r)!==r&&Kr(r)}function xs(t,n,i,r){var o;return void 0===i&&(i=0),void 0===r&&(r=n.length-i|0),e.isType(t,un)?js(t,n,i,r):Cs(t,e.isType(o=n,Object)?o:p(),i,r)}function Es(t,n,i,r){if(void 0===i&&(i=0),void 0===r&&(r=n.byteLength-i|0),e.isType(t,un))return Ts(t,n,i,r);var o={v:0};t:do{var a,s,l=!0;if(null==(a=No(t,1)))break t;var c=a;try{for(;;){var u=c,p=u.writePosition-u.readPosition|0,h=r-o.v|0,f=g.min(p,h);if(Sa(u.memory,n,u.readPosition,f,o.v),o.v=o.v+f|0,!(o.v0&&(r.v=r.v+c|0),!(r.vt.byteLength)throw b("Destination buffer overflow: length = "+i+", buffer capacity "+t.byteLength);n>=0||new As(Ms).doFail(),(n+i|0)<=t.byteLength||new As(Ls).doFail(),Gs(e.isType(this,$n)?this:p(),t.buffer,t.byteOffset+n|0,i)},Is.prototype.readAvailable_p0d4q1$=function(t,n,i){var r=this.writePosition-this.readPosition|0;if(0===r)return-1;var o=g.min(i,r);return Js(e.isType(this,$n)?this:p(),t,n,o),o},Is.prototype.readFully_gsnag5$=function(t,n,i){Js(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readAvailable_gsnag5$=function(t,n,i){return Qs(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readFully_qr0era$=function(t,n){bi(e.isType(this,$n)?this:p(),t,n)},Is.prototype.append_ezbsdh$=function(t,e,n){if(Fn(this,null!=t?t:"null",e,n)!==n)throw R("Not enough free space to append char sequence");return this},Is.prototype.append_gw00v9$=function(t){return null==t?this.append_gw00v9$("null"):this.append_ezbsdh$(t,0,t.length)},Is.prototype.append_8chfmy$=function(t,e,n){if(qn(this,t,e,n)!==n)throw R("Not enough free space to append char sequence");return this},Is.prototype.append_s8itvh$=function(t){return Un(e.isType(this,$n)?this:p(),t),this},Is.prototype.write_mj6st8$=function(t,n,i){oi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.write_gsnag5$=function(t,n,i){Xs(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readShort=function(){return Wn(e.isType(this,$n)?this:p())},Is.prototype.readInt=function(){return Yn(e.isType(this,$n)?this:p())},Is.prototype.readFloat=function(){return Jn(e.isType(this,$n)?this:p())},Is.prototype.readDouble=function(){return Zn(e.isType(this,$n)?this:p())},Is.prototype.readFully_mj6st8$=function(t,n,i){ii(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readFully_359eei$=function(t,n,i){ai(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readFully_nd5v6f$=function(t,n,i){ci(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readFully_rfv6wg$=function(t,n,i){hi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readFully_kgymra$=function(t,n,i){_i(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readFully_6icyh1$=function(t,n,i){vi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readAvailable_mj6st8$=function(t,n,i){return ri(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readAvailable_359eei$=function(t,n,i){return si(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readAvailable_nd5v6f$=function(t,n,i){return ui(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readAvailable_rfv6wg$=function(t,n,i){return fi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readAvailable_kgymra$=function(t,n,i){return yi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.readAvailable_6icyh1$=function(t,n,i){return $i(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.peekTo_99qa0s$=function(t){return ar(e.isType(this,Rs)?this:p(),t)},Is.prototype.readLong=function(){return Gn(e.isType(this,$n)?this:p())},Is.prototype.writeShort_mq22fl$=function(t){Qn(e.isType(this,$n)?this:p(),t)},Is.prototype.writeInt_za3lpa$=function(t){Xn(e.isType(this,$n)?this:p(),t)},Is.prototype.writeFloat_mx4ult$=function(t){ei(e.isType(this,$n)?this:p(),t)},Is.prototype.writeDouble_14dthe$=function(t){ni(e.isType(this,$n)?this:p(),t)},Is.prototype.writeFully_mj6st8$=function(t,n,i){oi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.writeFully_359eei$=function(t,n,i){li(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.writeFully_nd5v6f$=function(t,n,i){pi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.writeFully_rfv6wg$=function(t,n,i){di(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.writeFully_kgymra$=function(t,n,i){mi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.writeFully_6icyh1$=function(t,n,i){gi(e.isType(this,$n)?this:p(),t,n,i)},Is.prototype.writeFully_qr0era$=function(t,n){ki(e.isType(this,$n)?this:p(),t,n)},Is.prototype.fill_3pq026$=function(t,n){Dn(e.isType(this,$n)?this:p(),t,n)},Is.prototype.writeLong_s8cxhz$=function(t){ti(e.isType(this,$n)?this:p(),t)},Is.prototype.writeBuffer_qr0era$=function(t,n){return ki(e.isType(this,$n)?this:p(),t,n),n},Is.prototype.flush=function(){},Is.prototype.readableView=function(){var t=this.readPosition,e=this.writePosition;return t===e?Ys().EmptyDataView_0:0===t&&e===this.content_0.byteLength?this.memory.view:new DataView(this.content_0,t,e-t|0)},Is.prototype.writableView=function(){var t=this.writePosition,e=this.limit;return t===e?Ys().EmptyDataView_0:0===t&&e===this.content_0.byteLength?this.memory.view:new DataView(this.content_0,t,e-t|0)},Is.prototype.readDirect_5b066c$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.IoBuffer.readDirect_5b066c$",k((function(){var t=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e){var n=e(this.readableView());if(!(n>=0))throw t(("The returned value from block function shouldn't be negative: "+n).toString());return this.discard_za3lpa$(n),n}}))),Is.prototype.writeDirect_5b066c$=w("ktor-ktor-io-jsLegacy.io.ktor.utils.io.core.IoBuffer.writeDirect_5b066c$",k((function(){var t=e.kotlin.IllegalStateException_init_pdl1vj$;return function(e){var n=e(this.writableView());if(!(n>=0))throw t(("The returned value from block function shouldn't be negative: "+n).toString());if(!(n<=(this.limit-this.writePosition|0))){var i="The returned value from block function is too big: "+n+" > "+(this.limit-this.writePosition|0);throw t(i.toString())}return this.commitWritten_za3lpa$(n),n}}))),Is.prototype.release_duua06$=function(t){Si(this,t)},Is.prototype.close=function(){throw A("close for buffer view is not supported")},Is.prototype.toString=function(){return"Buffer[readable = "+(this.writePosition-this.readPosition|0)+", writable = "+(this.limit-this.writePosition|0)+", startGap = "+this.startGap+", endGap = "+(this.capacity-this.limit|0)+"]"},Object.defineProperty(Ds.prototype,"ReservedSize",{configurable:!0,get:function(){return 8}}),qs.prototype.produceInstance=function(){return new Is(ya().alloc_za3lpa$(4096),null)},qs.prototype.clearInstance_trkh7z$=function(t){var e=dl.prototype.clearInstance_trkh7z$.call(this,t);return e.unpark_8be2vx$(),e.reset(),e},qs.prototype.validateInstance_trkh7z$=function(t){var e;dl.prototype.validateInstance_trkh7z$.call(this,t),0!==t.referenceCount&&new As((e=t,function(){return"unable to recycle buffer: buffer view is in use (refCount = "+e.referenceCount+")"})).doFail(),null!=t.origin&&new As(Fs).doFail()},qs.prototype.disposeInstance_trkh7z$=function(t){ya().free_vn6nzs$(t.memory),t.unlink_8be2vx$()},qs.$metadata$={kind:h,interfaces:[dl]},Us.prototype.borrow=function(){return new Is(ya().alloc_za3lpa$(4096),null)},Us.prototype.recycle_trkh7z$=function(t){ya().free_vn6nzs$(t.memory)},Us.$metadata$={kind:h,interfaces:[Bo]},Ds.$metadata$={kind:B,simpleName:"Companion",interfaces:[]};var Bs,Hs,Vs,Ks,Ws=null;function Ys(){return null===Ws&&new Ds,Ws}function Gs(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.byteLength-n|0);var r=t.memory,o=t.readPosition;if((t.writePosition-o|0)t.readPosition))return-1;var r=t.writePosition-t.readPosition|0,o=g.min(i,r);return Gs(t,e,n,o),o}function Qs(t,e,n,i){if(void 0===n&&(n=0),void 0===i&&(i=e.byteLength-n|0),!(t.writePosition>t.readPosition))return-1;var r=t.writePosition-t.readPosition|0,o=g.min(i,r);return Js(t,e,n,o),o}function Xs(t,e,n,i){void 0===n&&(n=0),void 0===i&&(i=e.byteLength-n|0);var r=t.memory,o=t.writePosition;if((t.limit-o|0)=0))throw new nt("offset ("+t+") shouldn't be negative");if(!(e>=0))throw new nt("length ("+e+") shouldn't be negative");if(!((t+e|0)<=n.length))throw new nt("offset ("+t+") + length ("+e+") > bytes.size ("+n.length+")");throw yt()}function il(t,e,n){var i,r=t.length;if(!((n+r|0)<=e.length))throw b("Failed requirement.".toString());for(var o=n,a=0;a255&&r.writeByte_s8j3t7$(_(u>>8)),r.writeByte_s8j3t7$(_(255&u))}n=r.build()}catch(t){throw e.isType(t,E)?(r.release(),t):t}return vt(Fr(n))},fl.prototype.decode_g2l45e$=function(t,e){return this.decode_c2mund$(t)},fl.$metadata$={kind:h,simpleName:"TextDecoderFallback",interfaces:[ll]},Object.defineProperty(dl.prototype,"capacity",{get:function(){return this.capacity_7nvyry$_0}}),dl.prototype.disposeInstance_trkh7z$=function(t){},dl.prototype.clearInstance_trkh7z$=function(t){return t},dl.prototype.validateInstance_trkh7z$=function(t){},dl.prototype.borrow=function(){var t;if(0===this.size_p9jgx3$_0)return this.produceInstance();var n=(this.size_p9jgx3$_0=this.size_p9jgx3$_0-1|0,this.size_p9jgx3$_0),i=e.isType(t=this.instances_j5hzgy$_0[n],$)?t:p();return this.instances_j5hzgy$_0[n]=null,this.clearInstance_trkh7z$(i)},dl.prototype.recycle_trkh7z$=function(t){var e;this.validateInstance_trkh7z$(t),this.size_p9jgx3$_0===this.capacity?this.disposeInstance_trkh7z$(t):this.instances_j5hzgy$_0[(e=this.size_p9jgx3$_0,this.size_p9jgx3$_0=e+1|0,e)]=t},dl.prototype.dispose=function(){var t,n;t=this.size_p9jgx3$_0;for(var i=0;i0))break;if(c=!1,null==(l=jo(t,u)))break;u=l,c=!0}}finally{c&&zo(t,u)}}while(0);var g=o.v,b=r.subtract(g);return d(b,f)&&t.endOfInput?G:b},$l.peekTo_6v858t$=ar,$l.readShort_7wsnj1$=sr,$l.readInt_7wsnj1$=cr,$l.readLong_7wsnj1$=pr,$l.readFloat_7wsnj1$=fr,$l.readFloatFallback_7wsnj1$=dr,$l.readDouble_7wsnj1$=_r,$l.readDoubleFallback_7wsnj1$=yr,$l.writeFully_i6snlg$=mr,$l.writeFully_d18giu$=vr,$l.writeFully_yw8055$=$r,$l.writeFully_2v9eo0$=gr,$l.writeFully_ydnkai$=br,$l.writeFully_avy7cl$=wr,$l.writeFully_apj91c$=kr,$l.writeFully_35rta0$=Sr,$l.writeFully_bch96q$=xr,$l.fill_g2e272$=Er,wl.prepareWriteHead_6z8r11$=To,wl.afterHeadWrite_z1cqja$=Po,$l.writeShort_9kfkzl$=Cr,$l.writeInt_qu9kum$=Or,$l.writeLong_kb5mzd$=jr,$l.writeFloat_9rid5t$=Pr,$l.writeDouble_jgp4k2$=Rr,Object.defineProperty(Ar,"Companion",{get:Lr}),$l.ByteReadPacketBase=Ar,$l.get_isNotEmpty_7wsnj1$=Dr,$l.prematureEndOfStream_za3lpa$=Kr,$l.preview_en5wxq$=qr,bl.encodeToByteArray_fj4osb$=function(t,e,n,i){return void 0===n&&(n=0),void 0===i&&(i=e.length),on(t,e,n,i)},$l.readBytes_xc9h3n$=Fr,$l.readText_1lnizf$=function(t,e,n){return void 0===e&&(e=is().UTF_8),void 0===n&&(n=2147483647),nn(e.newDecoder(),t,n)},$l.readTextExactBytes_yqne27$=Ur,$l.writeText_t153jy$=Br,$l.writeText_t7k8z4$=Hr,Object.defineProperty(Gr,"Companion",{get:ao}),wl.ChunkBuffer=Gr,wl.isExclusivelyOwned_kx8gx4$=lo,wl.failLongToIntConversion_a4hdmt$=co,wl.RequireFailureCapture=uo,wl.decodeUTF8LineLoopSuspend_f8x9lf$=fo,wl.malformedByteCount_za3lpa$=go,wl.isBmpCodePoint_za3lpa$=wo,wl.isValidCodePoint_za3lpa$=ko,wl.malformedCodePoint_za3lpa$=bo,wl.highSurrogate_za3lpa$=xo,wl.lowSurrogate_za3lpa$=So,wl.CharArraySequence=yo,wl.EncodeResult_init_2ahd1g$=vo,wl.EncodeResult=mo,wl.encodeUTF8_yjoz4m$=$o,wl.codePoint_fdkhi5$=Eo,wl.MalformedUTF8InputException=Co,wl.unsafeAppend_z83jwh$=Oo;var kl=vl.errors||(vl.errors={});kl.checkPeekTo_swsbrn$=Ao;var Sl=vl.internal||(vl.internal={});Sl.AwaitingSlot=Io,Sl.copyToSequentialImpl_6ii227$=qo;var xl=vl.pool||(vl.pool={});xl.ObjectPool=Uo,xl.NoPoolImpl=Bo,xl.SingleInstancePool=Ho,vl.ByteChannel_6taknv$=Vo,vl.ByteReadChannel_mj6st8$=Ko,vl.copyTo_47ygvz$=Wo,vl.ByteChannelJS=Yo,vl.ByteChannelSequentialBaseSharedState=Qo,Object.defineProperty(Xo,"Companion",{get:ia}),vl.ByteReadChannel=Xo,vl.ByteWriteChannel=ra,vl.preventFreeze_s8jyvk$=function(t){},vl.makeShared_s8jyvk$=oa,gl.Memory=ma,gl.of_2z595v$=pa,gl.of_3qjk6t$=ha,gl.of_d2rc7k$=fa,Object.defineProperty(gl,"DefaultAllocator",{get:ya}),Object.defineProperty(ma,"Companion",{get:ba}),gl.fill_yaef32$=ka,gl.copyTo_1uvjz5$=Sa,gl.copyTo_duys70$=xa,gl.copyTo_3wm8wl$=Ea,gl.copyTo_vnj7g0$=Ca,gl.loadFloatArray_f2kqdl$=ja,gl.loadDoubleArray_itdtda$=Ta,gl.storeFloatArray_f2kqdl$=Ia,gl.storeDoubleArray_itdtda$=Ma,Object.defineProperty(La,"Companion",{get:Fa}),bl.Charset=La,bl.get_name_2sg7fd$=Ua,bl.CharsetEncoder=Ba,bl.get_charset_x4isqx$=Va,bl.encodeImpl_edsj0y$=Ka,bl.encodeComplete_5txte2$=Wa,bl.CharsetDecoder=Ya,bl.get_charset_e9jvmp$=Ja,bl.decode_eyhcpn$=Za,bl.decodeExactBytes_lb8wo3$=Qa,Object.defineProperty(bl,"Charsets",{get:is}),bl.MalformedInputException=os,bl.DecodeBufferResult=as,bl.decodeBufferImpl_g8dwr5$=ss,bl.encodeISO88591_4e1bz1$=ls,(vl.concurrent||(vl.concurrent={})).threadLocal_issdgt$=function(t){return new ft((e=t,function(t,n){return e}));var e},$l.AbstractInputSharedState=us,$l.AbstractOutputSharedState=ps,$l.BufferSharedState=hs,Object.defineProperty(fs,"BIG_ENDIAN",{get:_s}),Object.defineProperty(fs,"LITTLE_ENDIAN",{get:ys}),Object.defineProperty(fs,"Companion",{get:$s}),$l.Closeable=gs,$l.readFully_nu5h60$=ws,$l.readFully_7dohgh$=ks,$l.readFully_hqska$=Ss,$l.readAvailable_nu5h60$=xs,$l.readAvailable_7dohgh$=Es,$l.readAvailable_hqska$=Cs,$l.readFully_56hr53$=Os,$l.readFully_xvjntq$=Ns,$l.readFully_28a27b$=zs,$l.readAvailable_56hr53$=js,$l.readAvailable_xvjntq$=Ts,$l.readAvailable_28a27b$=Ps,$l.Input=Rs,Object.defineProperty(Is,"Companion",{get:Ys}),$l.IoBuffer=Is,$l.readFully_xbe0h9$=Gs,$l.readFully_agdgmg$=Js,$l.readAvailable_xbe0h9$=Zs,$l.readAvailable_agdgmg$=Qs,$l.writeFully_agdgmg$=Xs,$l.Output=tl,$l.String_xge8xe$=function(t,e,n,i){void 0===e&&(e=0),void 0===n&&(n=t.length),void 0===i&&(i=is().UTF_8),(e<0||n<0||(e+n|0)>t.length)&&nl(e,n,t);var r=t,o=r.byteOffset+e|0,a=r.buffer.slice(o,o+n|0),s=new Is(ha(ba(),a),null);s.resetForRead();var l=Ui(s,ao().NoPoolManuallyManaged_8be2vx$);return nn(i.newDecoder(),l,2147483647)},$l.checkIndices_khgzz8$=nl,$l.getCharsInternal_8t7fl6$=il,kl.IOException_init_61zpoe$=ol,kl.IOException=rl,kl.EOFException=al;var El=vl.js||(vl.js={});return El.Decoder_t8jjq2$=sl,El.Decoder=ll,El.decodeOptions_vft4zs$=cl,El.toKtor_y2kull$=pl,El.textDecoderOptions_vft4zs$=hl,El.TextDecoderFallback=fl,xl.DefaultPool=dl,gt.prototype.peekTo_afjyek$=Xo.prototype.peekTo_afjyek$,Fe.prototype.request_za3lpa$=qe.prototype.request_za3lpa$,wt.prototype.await_za3lpa$=Fe.prototype.await_za3lpa$,wt.prototype.request_za3lpa$=Fe.prototype.request_za3lpa$,wt.prototype.peekTo_afjyek$=gt.prototype.peekTo_afjyek$,Pe.prototype.cancel=C.prototype.cancel,Pe.prototype.fold_3cc69b$=C.prototype.fold_3cc69b$,Pe.prototype.get_j3r2sn$=C.prototype.get_j3r2sn$,Pe.prototype.minusKey_yeqjby$=C.prototype.minusKey_yeqjby$,Pe.prototype.plus_dqr1mp$=C.prototype.plus_dqr1mp$,Pe.prototype.plus_1fupul$=C.prototype.plus_1fupul$,Pe.prototype.cancel_dbl4no$=C.prototype.cancel_dbl4no$,Pe.prototype.cancel_m4sck1$=C.prototype.cancel_m4sck1$,Pe.prototype.invokeOnCompletion_ct2b2z$=C.prototype.invokeOnCompletion_ct2b2z$,Re.prototype.cancel=C.prototype.cancel,Re.prototype.fold_3cc69b$=C.prototype.fold_3cc69b$,Re.prototype.get_j3r2sn$=C.prototype.get_j3r2sn$,Re.prototype.minusKey_yeqjby$=C.prototype.minusKey_yeqjby$,Re.prototype.plus_dqr1mp$=C.prototype.plus_dqr1mp$,Re.prototype.plus_1fupul$=C.prototype.plus_1fupul$,Re.prototype.cancel_dbl4no$=C.prototype.cancel_dbl4no$,Re.prototype.cancel_m4sck1$=C.prototype.cancel_m4sck1$,Re.prototype.invokeOnCompletion_ct2b2z$=C.prototype.invokeOnCompletion_ct2b2z$,De.prototype.cancel_m4sck1$=Pe.prototype.cancel_m4sck1$,De.prototype.cancel_dbl4no$=Pe.prototype.cancel_dbl4no$,De.prototype.invokeOnCompletion_ct2b2z$=Pe.prototype.invokeOnCompletion_ct2b2z$,un.prototype.readFully_359eei$=Rs.prototype.readFully_359eei$,un.prototype.readFully_nd5v6f$=Rs.prototype.readFully_nd5v6f$,un.prototype.readFully_rfv6wg$=Rs.prototype.readFully_rfv6wg$,un.prototype.readFully_kgymra$=Rs.prototype.readFully_kgymra$,un.prototype.readFully_6icyh1$=Rs.prototype.readFully_6icyh1$,un.prototype.readFully_qr0era$=Rs.prototype.readFully_qr0era$,un.prototype.readFully_gsnag5$=Rs.prototype.readFully_gsnag5$,un.prototype.readFully_qmgm5g$=Rs.prototype.readFully_qmgm5g$,un.prototype.readFully_p0d4q1$=Rs.prototype.readFully_p0d4q1$,un.prototype.readAvailable_mj6st8$=Rs.prototype.readAvailable_mj6st8$,un.prototype.readAvailable_359eei$=Rs.prototype.readAvailable_359eei$,un.prototype.readAvailable_nd5v6f$=Rs.prototype.readAvailable_nd5v6f$,un.prototype.readAvailable_rfv6wg$=Rs.prototype.readAvailable_rfv6wg$,un.prototype.readAvailable_kgymra$=Rs.prototype.readAvailable_kgymra$,un.prototype.readAvailable_6icyh1$=Rs.prototype.readAvailable_6icyh1$,un.prototype.readAvailable_qr0era$=Rs.prototype.readAvailable_qr0era$,un.prototype.readAvailable_gsnag5$=Rs.prototype.readAvailable_gsnag5$,un.prototype.readAvailable_qmgm5g$=Rs.prototype.readAvailable_qmgm5g$,un.prototype.readAvailable_p0d4q1$=Rs.prototype.readAvailable_p0d4q1$,un.prototype.peekTo_afjyek$=Rs.prototype.peekTo_afjyek$,yn.prototype.writeShort_mq22fl$=tl.prototype.writeShort_mq22fl$,yn.prototype.writeInt_za3lpa$=tl.prototype.writeInt_za3lpa$,yn.prototype.writeLong_s8cxhz$=tl.prototype.writeLong_s8cxhz$,yn.prototype.writeFloat_mx4ult$=tl.prototype.writeFloat_mx4ult$,yn.prototype.writeDouble_14dthe$=tl.prototype.writeDouble_14dthe$,yn.prototype.writeFully_mj6st8$=tl.prototype.writeFully_mj6st8$,yn.prototype.writeFully_359eei$=tl.prototype.writeFully_359eei$,yn.prototype.writeFully_nd5v6f$=tl.prototype.writeFully_nd5v6f$,yn.prototype.writeFully_rfv6wg$=tl.prototype.writeFully_rfv6wg$,yn.prototype.writeFully_kgymra$=tl.prototype.writeFully_kgymra$,yn.prototype.writeFully_6icyh1$=tl.prototype.writeFully_6icyh1$,yn.prototype.writeFully_qr0era$=tl.prototype.writeFully_qr0era$,yn.prototype.fill_3pq026$=tl.prototype.fill_3pq026$,dl.prototype.close=Uo.prototype.close,Bo.prototype.close=Uo.prototype.close,Xr.prototype.close=Uo.prototype.close,to.prototype.close=Uo.prototype.close,Ho.prototype.close=Uo.prototype.close,Is.prototype.peekTo_afjyek$=Rs.prototype.peekTo_afjyek$,i=l,bn=new Bn,ro=new Int8Array(0),$a=$s().nativeOrder()===ys(),Bs=200,Hs=mt(["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"]),Vs=new Int8Array([_(239),_(191),_(189)]),Ks=new Int32Array([8364,-1,8218,402,8222,8230,8224,8225,710,8240,352,8249,338,-1,381,-1,-1,8216,8217,8220,8221,8226,8211,8212,732,8482,353,8250,339,-1,382,376,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255]),t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){var i=n(2).Buffer,r=n(165).Transform,o=n(16).StringDecoder;function a(t){r.call(this),this.hashMode="string"==typeof t,this.hashMode?this[t]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}n(0)(a,r),a.prototype.update=function(t,e,n){"string"==typeof t&&(t=i.from(t,e));var r=this._update(t);return this.hashMode?this:(n&&(r=this._toString(r,n)),r)},a.prototype.setAutoPadding=function(){},a.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},a.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},a.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},a.prototype._transform=function(t,e,n){var i;try{this.hashMode?this._update(t):this.push(this._update(t))}catch(t){i=t}finally{n(i)}},a.prototype._flush=function(t){var e;try{this.push(this.__final())}catch(t){e=t}t(e)},a.prototype._finalOrDigest=function(t){var e=this.__final()||i.alloc(0);return t&&(e=this._toString(e,t,!0)),e},a.prototype._toString=function(t,e,n){if(this._decoder||(this._decoder=new o(e),this._encoding=e),this._encoding!==e)throw new Error("can't switch encodings");var i=this._decoder.write(t);return n&&(i+=this._decoder.end()),i},t.exports=a},function(t,e,n){"use strict";var i,r="object"==typeof Reflect?Reflect:null,o=r&&"function"==typeof r.apply?r.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};i=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var a=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(n,i){function r(n){t.removeListener(e,o),i(n)}function o(){"function"==typeof t.removeListener&&t.removeListener("error",r),n([].slice.call(arguments))}m(t,e,o,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&m(t,"error",e,n)}(t,r,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var l=10;function c(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function u(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function p(t,e,n,i){var r,o,a,s;if(c(n),void 0===(o=t._events)?(o=t._events=Object.create(null),t._eventsCount=0):(void 0!==o.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),o=t._events),a=o[e]),void 0===a)a=o[e]=n,++t._eventsCount;else if("function"==typeof a?a=o[e]=i?[n,a]:[a,n]:i?a.unshift(n):a.push(n),(r=u(t))>0&&a.length>r&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=a.length,s=l,console&&console.warn&&console.warn(s)}return t}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(t,e,n){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},r=h.bind(i);return r.listener=n,i.wrapFn=r,r}function d(t,e,n){var i=t._events;if(void 0===i)return[];var r=i[e];return void 0===r?[]:"function"==typeof r?n?[r.listener||r]:[r]:n?function(t){for(var e=new Array(t.length),n=0;n0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var l=r[t];if(void 0===l)return!1;if("function"==typeof l)o(l,this,e);else{var c=l.length,u=y(l,c);for(n=0;n=0;o--)if(n[o]===e||n[o].listener===e){a=n[o].listener,r=o;break}if(r<0)return this;0===r?n.shift():function(t,e){for(;e+1=0;i--)this.removeListener(t,e[i]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):_.call(t,e)},s.prototype.listenerCount=_,s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},function(t,e,n){"use strict";var i=n(2).Buffer,r=i.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function o(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(i.isEncoding===r||!r(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=l,this.end=c,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=u,this.end=p,e=3;break;default:return this.write=h,void(this.end=f)}this.lastNeed=0,this.lastTotal=0,this.lastChar=i.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function l(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var i=n.charCodeAt(n.length-1);if(i>=55296&&i<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function u(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function p(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function f(t){return t&&t.length?this.write(t):""}e.StringDecoder=o,o.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return r>0&&(t.lastNeed=r-1),r;if(--i=0)return r>0&&(t.lastNeed=r-2),r;if(--i=0)return r>0&&(2===r?r=0:t.lastNeed=r-3),r;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var i=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,i),t.toString("utf8",e,i)},o.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},function(t,e,n){"use strict";var i=n(37),r=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=p;var o=Object.create(n(30));o.inherits=n(0);var a=n(86),s=n(52);o.inherits(p,a);for(var l=r(s.prototype),c=0;c255?l/3|0:l);r>n&&c.append_ezbsdh$(t,n,r);for(var u=r,p=null;u=i){var d,_=u;throw d=t.length,new Me("Incomplete trailing HEX escape: "+e.subSequence(t,_,d).toString()+", in "+t+" at "+u)}var y=De(t.charCodeAt(u+1|0)),m=De(t.charCodeAt(u+2|0));if(-1===y||-1===m)throw new Me("Wrong HEX escape: %"+String.fromCharCode(t.charCodeAt(u+1|0))+String.fromCharCode(t.charCodeAt(u+2|0))+", in "+t+", at "+u);p[(s=f,f=s+1|0,s)]=x((16*y|0)+m|0),u=u+3|0}c.append_pdl1vj$(M(p,0,f,a))}else c.append_s8itvh$(h),u=u+1|0}return c.toString()}function Me(t){L(t,this),this.name="URLDecodeException"}function Le(t){var e=I(3),n=255&t;return e.append_s8itvh$(37),e.append_s8itvh$(qe(n>>4)),e.append_s8itvh$(qe(15&n)),e.toString()}function De(t){return new b(48,57).contains_mef7kx$(t)?t-48:new b(65,70).contains_mef7kx$(t)?t-65+10|0:new b(97,102).contains_mef7kx$(t)?t-97+10|0:-1}function qe(t){return P(t>=0&&t<=9?48+t:P(65+t)-10)}function Fe(t,e){t:do{var n,i,r=!0;if(null==(n=F(t,1)))break t;var o=n;try{for(;;){for(var a=o;a.writePosition>a.readPosition;)e(a.readByte());if(r=!1,null==(i=U(t,o)))break;o=i,r=!0}}finally{r&&B(t,o)}}while(0)}function Ue(t,e){Ve(),void 0===e&&(e=W()),wn.call(this,t,e)}function Be(){He=this,this.File=new Ue("file"),this.Mixed=new Ue("mixed"),this.Attachment=new Ue("attachment"),this.Inline=new Ue("inline")}i.io.ktor.util.encodeBase64_964n91$,Me.prototype=Object.create(D.prototype),Me.prototype.constructor=Me,Ue.prototype=Object.create(wn.prototype),Ue.prototype.constructor=Ue,Je.prototype=Object.create(wn.prototype),Je.prototype.constructor=Je,mn.prototype=Object.create(D.prototype),mn.prototype.constructor=mn,Pn.prototype=Object.create(qt.prototype),Pn.prototype.constructor=Pn,Mn.prototype=Object.create(Ht.prototype),Mn.prototype.constructor=Mn,Xn.prototype=Object.create(Rt.prototype),Xn.prototype.constructor=Xn,ti.prototype=Object.create(Rt.prototype),ti.prototype.constructor=ti,ei.prototype=Object.create(Rt.prototype),ei.prototype.constructor=ei,Ai.prototype=Object.create(qt.prototype),Ai.prototype.constructor=Ai,Di.prototype=Object.create(Ht.prototype),Di.prototype.constructor=Di,sr.prototype=Object.create(Ct.prototype),sr.prototype.constructor=sr,zr.prototype=Object.create(f.prototype),zr.prototype.constructor=zr,Ir.prototype=Object.create(Ar.prototype),Ir.prototype.constructor=Ir,Mr.prototype=Object.create(Ar.prototype),Mr.prototype.constructor=Mr,no.prototype=Object.create(Zr.prototype),no.prototype.constructor=no,Yr.prototype=Object.create(Wr.prototype),Yr.prototype.constructor=Yr,Gr.prototype=Object.create(Wr.prototype),Gr.prototype.constructor=Gr,Jr.prototype=Object.create(Wr.prototype),Jr.prototype.constructor=Jr,Qr.prototype=Object.create(Zr.prototype),Qr.prototype.constructor=Qr,Xr.prototype=Object.create(Zr.prototype),Xr.prototype.constructor=Xr,eo.prototype=Object.create(Zr.prototype),eo.prototype.constructor=eo,io.prototype=Object.create(Zr.prototype),io.prototype.constructor=io,ro.prototype=Object.create(no.prototype),ro.prototype.constructor=ro,oo.prototype=Object.create(Rt.prototype),oo.prototype.constructor=oo,po.prototype=Object.create(lo.prototype),po.prototype.constructor=po,ho.prototype=Object.create(lo.prototype),ho.prototype.constructor=ho,fo.prototype=Object.create(lo.prototype),fo.prototype.constructor=fo,_o.prototype=Object.create(lo.prototype),_o.prototype.constructor=_o,yo.prototype=Object.create(lo.prototype),yo.prototype.constructor=yo,mo.prototype=Object.create(lo.prototype),mo.prototype.constructor=mo,vo.prototype=Object.create(lo.prototype),vo.prototype.constructor=vo,$o.prototype=Object.create(lo.prototype),$o.prototype.constructor=$o,go.prototype=Object.create(lo.prototype),go.prototype.constructor=go,bo.prototype=Object.create(lo.prototype),bo.prototype.constructor=bo,Me.$metadata$={kind:d,simpleName:"URLDecodeException",interfaces:[D]},Object.defineProperty(Ue.prototype,"disposition",{configurable:!0,get:function(){return this.content}}),Object.defineProperty(Ue.prototype,"name",{configurable:!0,get:function(){return this.parameter_61zpoe$(Ye().Name)}}),Ue.prototype.withParameter_puj7f4$=function(t,e){return new Ue(this.disposition,V(this.parameters,new Ln(t,e)))},Ue.prototype.withParameters_1wyvw$=function(t){return new Ue(this.disposition,k(this.parameters,t))},Ue.prototype.equals=function(t){return e.isType(t,Ue)&&y(this.disposition,t.disposition)&&y(this.parameters,t.parameters)},Ue.prototype.hashCode=function(){return(31*g(this.disposition)|0)+g(this.parameters)|0},Be.prototype.parse_61zpoe$=function(t){var e=Y(qn(t));return new Ue(e.value,e.params)},Be.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var He=null;function Ve(){return null===He&&new Be,He}function Ke(){We=this,this.FileName="filename",this.FileNameAsterisk="filename*",this.Name="name",this.CreationDate="creation-date",this.ModificationDate="modification-date",this.ReadDate="read-date",this.Size="size",this.Handling="handling"}Ke.$metadata$={kind:K,simpleName:"Parameters",interfaces:[]};var We=null;function Ye(){return null===We&&new Ke,We}function Ge(){}function Je(t,e,n,i){Xe(),void 0===i&&(i=W()),wn.call(this,n,i),this.contentType=t,this.contentSubtype=e}function Ze(){Qe=this,this.Any=yn("*","*")}Ue.$metadata$={kind:d,simpleName:"ContentDisposition",interfaces:[wn]},Ge.$metadata$={kind:G,simpleName:"ContentTypeMatcher",interfaces:[]},Je.prototype.withParameter_puj7f4$=function(t,e){return this.hasParameter_0(t,e)?this:new Je(this.contentType,this.contentSubtype,this.content,V(this.parameters,new Ln(t,e)))},Je.prototype.hasParameter_0=function(t,n){switch(this.parameters.size){case 0:return!1;case 1:var i=this.parameters.get_za3lpa$(0);return J(i.name,t,!0)&&J(i.value,n,!0);default:var r,o=this.parameters;t:do{var a;if(e.isType(o,nt)&&o.isEmpty()){r=!1;break t}for(a=o.iterator();a.hasNext();){var s=a.next();if(J(s.name,t,!0)&&J(s.value,n,!0)){r=!0;break t}}r=!1}while(0);return r}},Je.prototype.withoutParameters=function(){return this.parameters.isEmpty()?this:yn(this.contentType,this.contentSubtype)},Je.prototype.match_9v5yzd$=function(t){var n,i;if(!y(t.contentType,"*")&&!J(t.contentType,this.contentType,!0))return!1;if(!y(t.contentSubtype,"*")&&!J(t.contentSubtype,this.contentSubtype,!0))return!1;for(n=t.parameters.iterator();n.hasNext();){var r=n.next(),o=r.component1(),a=r.component2();if(y(o,"*"))if(y(a,"*"))i=!0;else{var s,l=this.parameters;t:do{var c;if(e.isType(l,nt)&&l.isEmpty()){s=!1;break t}for(c=l.iterator();c.hasNext();){var u=c.next();if(J(u.value,a,!0)){s=!0;break t}}s=!1}while(0);i=s}else{var p=this.parameter_61zpoe$(o);i=y(a,"*")?null!=p:J(p,a,!0)}if(!i)return!1}return!0},Je.prototype.match_61zpoe$=function(t){return this.match_9v5yzd$(Xe().parse_61zpoe$(t))},Je.prototype.equals=function(t){return e.isType(t,Je)&&J(this.contentType,t.contentType,!0)&&J(this.contentSubtype,t.contentSubtype,!0)&&y(this.parameters,t.parameters)},Je.prototype.hashCode=function(){var t=g(this.contentType.toLowerCase());return t=(t=t+((31*t|0)+g(this.contentSubtype.toLowerCase()))|0)+(31*g(this.parameters)|0)|0},Ze.prototype.parse_61zpoe$=function(t){if(Z(t))return this.Any;var n=Y(qn(t)),i=n.value,r=n.params,o=Q(i,47);if(-1===o){var a;if(y(rt(e.isCharSequence(a=i)?a:it()).toString(),"*"))return this.Any;throw new mn(t)}var s,l=i.substring(0,o),c=rt(e.isCharSequence(s=l)?s:it()).toString();if(0===c.length)throw new mn(t);var u,p=o+1|0,h=i.substring(p),f=rt(e.isCharSequence(u=h)?u:it()).toString();if(0===f.length||X(f,47))throw new mn(t);return yn(c,f,r)},Ze.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var Qe=null;function Xe(){return null===Qe&&new Ze,Qe}function tn(){en=this,this.Any=yn("application","*"),this.Atom=yn("application","atom+xml"),this.Cbor=yn("application","cbor"),this.Json=yn("application","json"),this.HalJson=yn("application","hal+json"),this.JavaScript=yn("application","javascript"),this.OctetStream=yn("application","octet-stream"),this.FontWoff=yn("application","font-woff"),this.Rss=yn("application","rss+xml"),this.Xml=yn("application","xml"),this.Xml_Dtd=yn("application","xml-dtd"),this.Zip=yn("application","zip"),this.GZip=yn("application","gzip"),this.FormUrlEncoded=yn("application","x-www-form-urlencoded"),this.Pdf=yn("application","pdf"),this.ProtoBuf=yn("application","protobuf"),this.Wasm=yn("application","wasm"),this.ProblemJson=yn("application","problem+json"),this.ProblemXml=yn("application","problem+xml")}tn.$metadata$={kind:K,simpleName:"Application",interfaces:[]};var en=null;function nn(){rn=this,this.Any=yn("audio","*"),this.MP4=yn("audio","mp4"),this.MPEG=yn("audio","mpeg"),this.OGG=yn("audio","ogg")}nn.$metadata$={kind:K,simpleName:"Audio",interfaces:[]};var rn=null;function on(){an=this,this.Any=yn("image","*"),this.GIF=yn("image","gif"),this.JPEG=yn("image","jpeg"),this.PNG=yn("image","png"),this.SVG=yn("image","svg+xml"),this.XIcon=yn("image","x-icon")}on.$metadata$={kind:K,simpleName:"Image",interfaces:[]};var an=null;function sn(){ln=this,this.Any=yn("message","*"),this.Http=yn("message","http")}sn.$metadata$={kind:K,simpleName:"Message",interfaces:[]};var ln=null;function cn(){un=this,this.Any=yn("multipart","*"),this.Mixed=yn("multipart","mixed"),this.Alternative=yn("multipart","alternative"),this.Related=yn("multipart","related"),this.FormData=yn("multipart","form-data"),this.Signed=yn("multipart","signed"),this.Encrypted=yn("multipart","encrypted"),this.ByteRanges=yn("multipart","byteranges")}cn.$metadata$={kind:K,simpleName:"MultiPart",interfaces:[]};var un=null;function pn(){hn=this,this.Any=yn("text","*"),this.Plain=yn("text","plain"),this.CSS=yn("text","css"),this.CSV=yn("text","csv"),this.Html=yn("text","html"),this.JavaScript=yn("text","javascript"),this.VCard=yn("text","vcard"),this.Xml=yn("text","xml"),this.EventStream=yn("text","event-stream")}pn.$metadata$={kind:K,simpleName:"Text",interfaces:[]};var hn=null;function fn(){_n=this,this.Any=yn("video","*"),this.MPEG=yn("video","mpeg"),this.MP4=yn("video","mp4"),this.OGG=yn("video","ogg"),this.QuickTime=yn("video","quicktime")}fn.$metadata$={kind:K,simpleName:"Video",interfaces:[]};var dn,_n=null;function yn(t,e,n,i){return void 0===n&&(n=W()),i=i||Object.create(Je.prototype),Je.call(i,t,e,t+"/"+e,n),i}function mn(t){L("Bad Content-Type format: "+t,this),this.name="BadContentTypeFormatException"}function vn(t){var e;return null!=(e=t.parameter_61zpoe$("charset"))?et.Companion.forName_61zpoe$(e):null}function $n(t){var e=t.component1(),n=t.component2();return lt(n,e)}function gn(t){var e,n=mt();for(e=t.iterator();e.hasNext();){var i,r=e.next(),o=r.first,a=n.get_11rb$(o);if(null==a){var s=vt();n.put_xwzc9p$(o,s),i=s}else i=a;i.add_11rb$(r)}var l,c=_t(dt(n.size));for(l=n.entries.iterator();l.hasNext();){var u,p=l.next(),h=c.put_xwzc9p$,f=p.key,d=p.value,_=m(H(d,10));for(u=d.iterator();u.hasNext();){var y=u.next();_.add_11rb$(y.second)}h.call(c,f,_)}return c}function bn(t){try{return Xe().parse_61zpoe$(t)}catch(n){throw e.isType(n,At)?new Rt("Failed to parse "+t,n):n}}function wn(t,e){xn(),void 0===e&&(e=W()),this.content=t,this.parameters=e}function kn(){Sn=this}Je.$metadata$={kind:d,simpleName:"ContentType",interfaces:[wn]},mn.$metadata$={kind:d,simpleName:"BadContentTypeFormatException",interfaces:[D]},wn.prototype.parameter_61zpoe$=function(t){var e,n,i=this.parameters;t:do{var r;for(r=i.iterator();r.hasNext();){var o=r.next();if(J(o.name,t,!0)){n=o;break t}}n=null}while(0);return null!=(e=n)?e.value:null},wn.prototype.toString=function(){if(this.parameters.isEmpty())return this.content;var t,e=this.content.length,n=0;for(t=this.parameters.iterator();t.hasNext();){var i=t.next();n=n+(i.name.length+i.value.length+3|0)|0}var r,o=I(e+n|0);o.append_pdl1vj$(this.content),r=this.parameters.size;for(var a=0;a?@[\\]{}',t)}function ii(){}function ri(){}function oi(t){var e;return null!=(e=t.headers.get_61zpoe$(Qn().ContentType))?Xe().parse_61zpoe$(e):null}function ai(t){ci(),this.value=t}function si(){li=this,this.Get=new ai("GET"),this.Post=new ai("POST"),this.Put=new ai("PUT"),this.Patch=new ai("PATCH"),this.Delete=new ai("DELETE"),this.Head=new ai("HEAD"),this.Options=new ai("OPTIONS"),this.DefaultMethods=C([this.Get,this.Post,this.Put,this.Patch,this.Delete,this.Head,this.Options])}Xn.$metadata$={kind:d,simpleName:"UnsafeHeaderException",interfaces:[Rt]},ti.$metadata$={kind:d,simpleName:"IllegalHeaderNameException",interfaces:[Rt]},ei.$metadata$={kind:d,simpleName:"IllegalHeaderValueException",interfaces:[Rt]},ii.$metadata$={kind:G,simpleName:"HttpMessage",interfaces:[]},ri.$metadata$={kind:G,simpleName:"HttpMessageBuilder",interfaces:[]},si.prototype.parse_61zpoe$=function(t){return y(t,this.Get.value)?this.Get:y(t,this.Post.value)?this.Post:y(t,this.Put.value)?this.Put:y(t,this.Patch.value)?this.Patch:y(t,this.Delete.value)?this.Delete:y(t,this.Head.value)?this.Head:y(t,this.Options.value)?this.Options:new ai(t)},si.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var li=null;function ci(){return null===li&&new si,li}function ui(t,e,n){fi(),this.name=t,this.major=e,this.minor=n}function pi(){hi=this,this.HTTP_2_0=new ui("HTTP",2,0),this.HTTP_1_1=new ui("HTTP",1,1),this.HTTP_1_0=new ui("HTTP",1,0),this.SPDY_3=new ui("SPDY",3,0),this.QUIC=new ui("QUIC",1,0)}ai.$metadata$={kind:d,simpleName:"HttpMethod",interfaces:[]},ai.prototype.component1=function(){return this.value},ai.prototype.copy_61zpoe$=function(t){return new ai(void 0===t?this.value:t)},ai.prototype.toString=function(){return"HttpMethod(value="+e.toString(this.value)+")"},ai.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.value)|0},ai.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.value,t.value)},pi.prototype.fromValue_3m52m6$=function(t,e,n){return y(t,"HTTP")&&1===e&&1===n?this.HTTP_1_1:y(t,"HTTP")&&2===e&&0===n?this.HTTP_2_0:new ui(t,e,n)},pi.prototype.parse_6bul2c$=function(t){var e=Gt(t,["/","."]);if(3!==e.size)throw Et(("Failed to parse HttpProtocolVersion. Expected format: protocol/major.minor, but actual: "+t).toString());var n=e.get_za3lpa$(0),i=e.get_za3lpa$(1),r=e.get_za3lpa$(2);return this.fromValue_3m52m6$(n,St(i),St(r))},pi.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var hi=null;function fi(){return null===hi&&new pi,hi}function di(t,e){gi(),this.value=t,this.description=e}function _i(){$i=this,this.Continue=new di(100,"Continue"),this.SwitchingProtocols=new di(101,"Switching Protocols"),this.Processing=new di(102,"Processing"),this.OK=new di(200,"OK"),this.Created=new di(201,"Created"),this.Accepted=new di(202,"Accepted"),this.NonAuthoritativeInformation=new di(203,"Non-Authoritative Information"),this.NoContent=new di(204,"No Content"),this.ResetContent=new di(205,"Reset Content"),this.PartialContent=new di(206,"Partial Content"),this.MultiStatus=new di(207,"Multi-Status"),this.MultipleChoices=new di(300,"Multiple Choices"),this.MovedPermanently=new di(301,"Moved Permanently"),this.Found=new di(302,"Found"),this.SeeOther=new di(303,"See Other"),this.NotModified=new di(304,"Not Modified"),this.UseProxy=new di(305,"Use Proxy"),this.SwitchProxy=new di(306,"Switch Proxy"),this.TemporaryRedirect=new di(307,"Temporary Redirect"),this.PermanentRedirect=new di(308,"Permanent Redirect"),this.BadRequest=new di(400,"Bad Request"),this.Unauthorized=new di(401,"Unauthorized"),this.PaymentRequired=new di(402,"Payment Required"),this.Forbidden=new di(403,"Forbidden"),this.NotFound=new di(404,"Not Found"),this.MethodNotAllowed=new di(405,"Method Not Allowed"),this.NotAcceptable=new di(406,"Not Acceptable"),this.ProxyAuthenticationRequired=new di(407,"Proxy Authentication Required"),this.RequestTimeout=new di(408,"Request Timeout"),this.Conflict=new di(409,"Conflict"),this.Gone=new di(410,"Gone"),this.LengthRequired=new di(411,"Length Required"),this.PreconditionFailed=new di(412,"Precondition Failed"),this.PayloadTooLarge=new di(413,"Payload Too Large"),this.RequestURITooLong=new di(414,"Request-URI Too Long"),this.UnsupportedMediaType=new di(415,"Unsupported Media Type"),this.RequestedRangeNotSatisfiable=new di(416,"Requested Range Not Satisfiable"),this.ExpectationFailed=new di(417,"Expectation Failed"),this.UnprocessableEntity=new di(422,"Unprocessable Entity"),this.Locked=new di(423,"Locked"),this.FailedDependency=new di(424,"Failed Dependency"),this.UpgradeRequired=new di(426,"Upgrade Required"),this.TooManyRequests=new di(429,"Too Many Requests"),this.RequestHeaderFieldTooLarge=new di(431,"Request Header Fields Too Large"),this.InternalServerError=new di(500,"Internal Server Error"),this.NotImplemented=new di(501,"Not Implemented"),this.BadGateway=new di(502,"Bad Gateway"),this.ServiceUnavailable=new di(503,"Service Unavailable"),this.GatewayTimeout=new di(504,"Gateway Timeout"),this.VersionNotSupported=new di(505,"HTTP Version Not Supported"),this.VariantAlsoNegotiates=new di(506,"Variant Also Negotiates"),this.InsufficientStorage=new di(507,"Insufficient Storage"),this.allStatusCodes=bi();var t,e=Zt(1e3);t=e.length-1|0;for(var n=0;n<=t;n++){var i,r=this.allStatusCodes;t:do{var o;for(o=r.iterator();o.hasNext();){var a=o.next();if(a.value===n){i=a;break t}}i=null}while(0);e[n]=i}this.byValue_0=e}ui.prototype.toString=function(){return this.name+"/"+this.major+"."+this.minor},ui.$metadata$={kind:d,simpleName:"HttpProtocolVersion",interfaces:[]},ui.prototype.component1=function(){return this.name},ui.prototype.component2=function(){return this.major},ui.prototype.component3=function(){return this.minor},ui.prototype.copy_3m52m6$=function(t,e,n){return new ui(void 0===t?this.name:t,void 0===e?this.major:e,void 0===n?this.minor:n)},ui.prototype.hashCode=function(){var t=0;return t=31*(t=31*(t=31*t+e.hashCode(this.name)|0)+e.hashCode(this.major)|0)+e.hashCode(this.minor)|0},ui.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.name,t.name)&&e.equals(this.major,t.major)&&e.equals(this.minor,t.minor)},di.prototype.toString=function(){return this.value.toString()+" "+this.description},di.prototype.equals=function(t){return e.isType(t,di)&&t.value===this.value},di.prototype.hashCode=function(){return g(this.value)},di.prototype.description_61zpoe$=function(t){return this.copy_19mbxw$(void 0,t)},_i.prototype.fromValue_za3lpa$=function(t){var e=1<=t&&t<1e3?this.byValue_0[t]:null;return null!=e?e:new di(t,"Unknown Status Code")},_i.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var yi,mi,vi,$i=null;function gi(){return null===$i&&new _i,$i}function bi(){return C([gi().Continue,gi().SwitchingProtocols,gi().Processing,gi().OK,gi().Created,gi().Accepted,gi().NonAuthoritativeInformation,gi().NoContent,gi().ResetContent,gi().PartialContent,gi().MultiStatus,gi().MultipleChoices,gi().MovedPermanently,gi().Found,gi().SeeOther,gi().NotModified,gi().UseProxy,gi().SwitchProxy,gi().TemporaryRedirect,gi().PermanentRedirect,gi().BadRequest,gi().Unauthorized,gi().PaymentRequired,gi().Forbidden,gi().NotFound,gi().MethodNotAllowed,gi().NotAcceptable,gi().ProxyAuthenticationRequired,gi().RequestTimeout,gi().Conflict,gi().Gone,gi().LengthRequired,gi().PreconditionFailed,gi().PayloadTooLarge,gi().RequestURITooLong,gi().UnsupportedMediaType,gi().RequestedRangeNotSatisfiable,gi().ExpectationFailed,gi().UnprocessableEntity,gi().Locked,gi().FailedDependency,gi().UpgradeRequired,gi().TooManyRequests,gi().RequestHeaderFieldTooLarge,gi().InternalServerError,gi().NotImplemented,gi().BadGateway,gi().ServiceUnavailable,gi().GatewayTimeout,gi().VersionNotSupported,gi().VariantAlsoNegotiates,gi().InsufficientStorage])}function wi(t){var e=q();return Si(t,e),e.toString()}function ki(t){var e=je(t.first,!0);return null==t.second?e:e+"="+Te(v(t.second))}function Si(t,e){Qt(t,e,"&",void 0,void 0,void 0,void 0,ki)}function xi(t,e){Ci(t.entries(),e)}function Ei(t,e){Ci(t.entries(),e)}function Ci(t,e){var n,i=vt();for(n=t.iterator();n.hasNext();){var r,o=n.next(),a=o.key,s=o.value;if(s.isEmpty())r=Ut(lt(a,null));else{var l,c=m(H(s,10));for(l=s.iterator();l.hasNext();){var u=l.next();c.add_11rb$(lt(a,u))}r=c}Jt(i,r)}Si(i,e)}function Oi(t){var n,i=rt(e.isCharSequence(n=t)?n:it()).toString();if(0===i.length)return null;var r=Q(i,44),o=i.substring(0,r),a=r+1|0,s=i.substring(a);return lt(st(Nt(o,".")),bn(s))}function Ni(){return ee(te(Xt("\n.123,application/vnd.lotus-1-2-3\n.3dmf,x-world/x-3dmf\n.3dml,text/vnd.in3d.3dml\n.3dm,x-world/x-3dmf\n.3g2,video/3gpp2\n.3gp,video/3gpp\n.7z,application/x-7z-compressed\n.aab,application/x-authorware-bin\n.aac,audio/aac\n.aam,application/x-authorware-map\n.a,application/octet-stream\n.aas,application/x-authorware-seg\n.abc,text/vnd.abc\n.abw,application/x-abiword\n.ac,application/pkix-attr-cert\n.acc,application/vnd.americandynamics.acc\n.ace,application/x-ace-compressed\n.acgi,text/html\n.acu,application/vnd.acucobol\n.adp,audio/adpcm\n.aep,application/vnd.audiograph\n.afl,video/animaflex\n.afp,application/vnd.ibm.modcap\n.ahead,application/vnd.ahead.space\n.ai,application/postscript\n.aif,audio/aiff\n.aifc,audio/aiff\n.aiff,audio/aiff\n.aim,application/x-aim\n.aip,text/x-audiosoft-intra\n.air,application/vnd.adobe.air-application-installer-package+zip\n.ait,application/vnd.dvb.ait\n.ami,application/vnd.amiga.ami\n.ani,application/x-navi-animation\n.aos,application/x-nokia-9000-communicator-add-on-software\n.apk,application/vnd.android.package-archive\n.application,application/x-ms-application\n,application/pgp-encrypted\n.apr,application/vnd.lotus-approach\n.aps,application/mime\n.arc,application/octet-stream\n.arj,application/arj\n.arj,application/octet-stream\n.art,image/x-jg\n.asf,video/x-ms-asf\n.asm,text/x-asm\n.aso,application/vnd.accpac.simply.aso\n.asp,text/asp\n.asx,application/x-mplayer2\n.asx,video/x-ms-asf\n.asx,video/x-ms-asf-plugin\n.atc,application/vnd.acucorp\n.atomcat,application/atomcat+xml\n.atomsvc,application/atomsvc+xml\n.atom,application/atom+xml\n.atx,application/vnd.antix.game-component\n.au,audio/basic\n.au,audio/x-au\n.avi,video/avi\n.avi,video/msvideo\n.avi,video/x-msvideo\n.avs,video/avs-video\n.aw,application/applixware\n.azf,application/vnd.airzip.filesecure.azf\n.azs,application/vnd.airzip.filesecure.azs\n.azw,application/vnd.amazon.ebook\n.bcpio,application/x-bcpio\n.bdf,application/x-font-bdf\n.bdm,application/vnd.syncml.dm+wbxml\n.bed,application/vnd.realvnc.bed\n.bh2,application/vnd.fujitsu.oasysprs\n.bin,application/macbinary\n.bin,application/mac-binary\n.bin,application/octet-stream\n.bin,application/x-binary\n.bin,application/x-macbinary\n.bmi,application/vnd.bmi\n.bm,image/bmp\n.bmp,image/bmp\n.bmp,image/x-windows-bmp\n.boo,application/book\n.book,application/book\n.box,application/vnd.previewsystems.box\n.boz,application/x-bzip2\n.bsh,application/x-bsh\n.btif,image/prs.btif\n.bz2,application/x-bzip2\n.bz,application/x-bzip\n.c11amc,application/vnd.cluetrust.cartomobile-config\n.c11amz,application/vnd.cluetrust.cartomobile-config-pkg\n.c4g,application/vnd.clonk.c4group\n.cab,application/vnd.ms-cab-compressed\n.car,application/vnd.curl.car\n.cat,application/vnd.ms-pki.seccat\n.ccad,application/clariscad\n.cco,application/x-cocoa\n.cc,text/plain\n.cc,text/x-c\n.ccxml,application/ccxml+xml,\n.cdbcmsg,application/vnd.contact.cmsg\n.cdf,application/cdf\n.cdf,application/x-cdf\n.cdf,application/x-netcdf\n.cdkey,application/vnd.mediastation.cdkey\n.cdmia,application/cdmi-capability\n.cdmic,application/cdmi-container\n.cdmid,application/cdmi-domain\n.cdmio,application/cdmi-object\n.cdmiq,application/cdmi-queue\n.cdx,chemical/x-cdx\n.cdxml,application/vnd.chemdraw+xml\n.cdy,application/vnd.cinderella\n.cer,application/pkix-cert\n.cgm,image/cgm\n.cha,application/x-chat\n.chat,application/x-chat\n.chm,application/vnd.ms-htmlhelp\n.chrt,application/vnd.kde.kchart\n.cif,chemical/x-cif\n.cii,application/vnd.anser-web-certificate-issue-initiation\n.cil,application/vnd.ms-artgalry\n.cla,application/vnd.claymore\n.class,application/java\n.class,application/java-byte-code\n.class,application/java-vm\n.class,application/x-java-class\n.clkk,application/vnd.crick.clicker.keyboard\n.clkp,application/vnd.crick.clicker.palette\n.clkt,application/vnd.crick.clicker.template\n.clkw,application/vnd.crick.clicker.wordbank\n.clkx,application/vnd.crick.clicker\n.clp,application/x-msclip\n.cmc,application/vnd.cosmocaller\n.cmdf,chemical/x-cmdf\n.cml,chemical/x-cml\n.cmp,application/vnd.yellowriver-custom-menu\n.cmx,image/x-cmx\n.cod,application/vnd.rim.cod\n.com,application/octet-stream\n.com,text/plain\n.conf,text/plain\n.cpio,application/x-cpio\n.cpp,text/x-c\n.cpt,application/mac-compactpro\n.cpt,application/x-compactpro\n.cpt,application/x-cpt\n.crd,application/x-mscardfile\n.crl,application/pkcs-crl\n.crl,application/pkix-crl\n.crt,application/pkix-cert\n.crt,application/x-x509-ca-cert\n.crt,application/x-x509-user-cert\n.cryptonote,application/vnd.rig.cryptonote\n.csh,application/x-csh\n.csh,text/x-script.csh\n.csml,chemical/x-csml\n.csp,application/vnd.commonspace\n.css,text/css\n.csv,text/csv\n.c,text/plain\n.c++,text/plain\n.c,text/x-c\n.cu,application/cu-seeme\n.curl,text/vnd.curl\n.cww,application/prs.cww\n.cxx,text/plain\n.dat,binary/octet-stream\n.dae,model/vnd.collada+xml\n.daf,application/vnd.mobius.daf\n.davmount,application/davmount+xml\n.dcr,application/x-director\n.dcurl,text/vnd.curl.dcurl\n.dd2,application/vnd.oma.dd2+xml\n.ddd,application/vnd.fujixerox.ddd\n.deb,application/x-debian-package\n.deepv,application/x-deepv\n.def,text/plain\n.der,application/x-x509-ca-cert\n.dfac,application/vnd.dreamfactory\n.dif,video/x-dv\n.dir,application/x-director\n.dis,application/vnd.mobius.dis\n.djvu,image/vnd.djvu\n.dl,video/dl\n.dl,video/x-dl\n.dna,application/vnd.dna\n.doc,application/msword\n.docm,application/vnd.ms-word.document.macroenabled.12\n.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document\n.dot,application/msword\n.dotm,application/vnd.ms-word.template.macroenabled.12\n.dotx,application/vnd.openxmlformats-officedocument.wordprocessingml.template\n.dp,application/commonground\n.dp,application/vnd.osgi.dp\n.dpg,application/vnd.dpgraph\n.dra,audio/vnd.dra\n.drw,application/drafting\n.dsc,text/prs.lines.tag\n.dssc,application/dssc+der\n.dtb,application/x-dtbook+xml\n.dtd,application/xml-dtd\n.dts,audio/vnd.dts\n.dtshd,audio/vnd.dts.hd\n.dump,application/octet-stream\n.dvi,application/x-dvi\n.dv,video/x-dv\n.dwf,drawing/x-dwf (old)\n.dwf,model/vnd.dwf\n.dwg,application/acad\n.dwg,image/vnd.dwg\n.dwg,image/x-dwg\n.dxf,application/dxf\n.dxf,image/vnd.dwg\n.dxf,image/vnd.dxf\n.dxf,image/x-dwg\n.dxp,application/vnd.spotfire.dxp\n.dxr,application/x-director\n.ecelp4800,audio/vnd.nuera.ecelp4800\n.ecelp7470,audio/vnd.nuera.ecelp7470\n.ecelp9600,audio/vnd.nuera.ecelp9600\n.edm,application/vnd.novadigm.edm\n.edx,application/vnd.novadigm.edx\n.efif,application/vnd.picsel\n.ei6,application/vnd.pg.osasli\n.elc,application/x-bytecode.elisp (compiled elisp)\n.elc,application/x-elc\n.el,text/x-script.elisp\n.eml,message/rfc822\n.emma,application/emma+xml\n.env,application/x-envoy\n.eol,audio/vnd.digital-winds\n.eot,application/vnd.ms-fontobject\n.eps,application/postscript\n.epub,application/epub+zip\n.es3,application/vnd.eszigno3+xml\n.es,application/ecmascript\n.es,application/x-esrehber\n.esf,application/vnd.epson.esf\n.etx,text/x-setext\n.evy,application/envoy\n.evy,application/x-envoy\n.exe,application/octet-stream\n.exe,application/x-msdownload\n.exi,application/exi\n.ext,application/vnd.novadigm.ext\n.ez2,application/vnd.ezpix-album\n.ez3,application/vnd.ezpix-package\n.f4v,video/x-f4v\n.f77,text/x-fortran\n.f90,text/plain\n.f90,text/x-fortran\n.fbs,image/vnd.fastbidsheet\n.fcs,application/vnd.isac.fcs\n.fdf,application/vnd.fdf\n.fe_launch,application/vnd.denovo.fcselayout-link\n.fg5,application/vnd.fujitsu.oasysgp\n.fh,image/x-freehand\n.fif,application/fractals\n.fif,image/fif\n.fig,application/x-xfig\n.fli,video/fli\n.fli,video/x-fli\n.flo,application/vnd.micrografx.flo\n.flo,image/florian\n.flv,video/x-flv\n.flw,application/vnd.kde.kivio\n.flx,text/vnd.fmi.flexstor\n.fly,text/vnd.fly\n.fm,application/vnd.framemaker\n.fmf,video/x-atomic3d-feature\n.fnc,application/vnd.frogans.fnc\n.for,text/plain\n.for,text/x-fortran\n.fpx,image/vnd.fpx\n.fpx,image/vnd.net-fpx\n.frl,application/freeloader\n.fsc,application/vnd.fsc.weblaunch\n.fst,image/vnd.fst\n.ftc,application/vnd.fluxtime.clip\n.f,text/plain\n.f,text/x-fortran\n.fti,application/vnd.anser-web-funds-transfer-initiation\n.funk,audio/make\n.fvt,video/vnd.fvt\n.fxp,application/vnd.adobe.fxp\n.fzs,application/vnd.fuzzysheet\n.g2w,application/vnd.geoplan\n.g3,image/g3fax\n.g3w,application/vnd.geospace\n.gac,application/vnd.groove-account\n.gdl,model/vnd.gdl\n.geo,application/vnd.dynageo\n.gex,application/vnd.geometry-explorer\n.ggb,application/vnd.geogebra.file\n.ggt,application/vnd.geogebra.tool\n.ghf,application/vnd.groove-help\n.gif,image/gif\n.gim,application/vnd.groove-identity-message\n.gl,video/gl\n.gl,video/x-gl\n.gmx,application/vnd.gmx\n.gnumeric,application/x-gnumeric\n.gph,application/vnd.flographit\n.gqf,application/vnd.grafeq\n.gram,application/srgs\n.grv,application/vnd.groove-injector\n.grxml,application/srgs+xml\n.gsd,audio/x-gsm\n.gsf,application/x-font-ghostscript\n.gsm,audio/x-gsm\n.gsp,application/x-gsp\n.gss,application/x-gss\n.gtar,application/x-gtar\n.g,text/plain\n.gtm,application/vnd.groove-tool-message\n.gtw,model/vnd.gtw\n.gv,text/vnd.graphviz\n.gxt,application/vnd.geonext\n.gz,application/x-compressed\n.gz,application/x-gzip\n.gzip,application/x-gzip\n.gzip,multipart/x-gzip\n.h261,video/h261\n.h263,video/h263\n.h264,video/h264\n.hal,application/vnd.hal+xml\n.hbci,application/vnd.hbci\n.hdf,application/x-hdf\n.help,application/x-helpfile\n.hgl,application/vnd.hp-hpgl\n.hh,text/plain\n.hh,text/x-h\n.hlb,text/x-script\n.hlp,application/hlp\n.hlp,application/winhlp\n.hlp,application/x-helpfile\n.hlp,application/x-winhelp\n.hpg,application/vnd.hp-hpgl\n.hpgl,application/vnd.hp-hpgl\n.hpid,application/vnd.hp-hpid\n.hps,application/vnd.hp-hps\n.hqx,application/binhex\n.hqx,application/binhex4\n.hqx,application/mac-binhex\n.hqx,application/mac-binhex40\n.hqx,application/x-binhex40\n.hqx,application/x-mac-binhex40\n.hta,application/hta\n.htc,text/x-component\n.h,text/plain\n.h,text/x-h\n.htke,application/vnd.kenameaapp\n.htmls,text/html\n.html,text/html\n.htm,text/html\n.htt,text/webviewhtml\n.htx,text/html\n.hvd,application/vnd.yamaha.hv-dic\n.hvp,application/vnd.yamaha.hv-voice\n.hvs,application/vnd.yamaha.hv-script\n.i2g,application/vnd.intergeo\n.icc,application/vnd.iccprofile\n.ice,x-conference/x-cooltalk\n.ico,image/x-icon\n.ics,text/calendar\n.idc,text/plain\n.ief,image/ief\n.iefs,image/ief\n.iff,application/iff\n.ifm,application/vnd.shana.informed.formdata\n.iges,application/iges\n.iges,model/iges\n.igl,application/vnd.igloader\n.igm,application/vnd.insors.igm\n.igs,application/iges\n.igs,model/iges\n.igx,application/vnd.micrografx.igx\n.iif,application/vnd.shana.informed.interchange\n.ima,application/x-ima\n.imap,application/x-httpd-imap\n.imp,application/vnd.accpac.simply.imp\n.ims,application/vnd.ms-ims\n.inf,application/inf\n.ins,application/x-internett-signup\n.ip,application/x-ip2\n.ipfix,application/ipfix\n.ipk,application/vnd.shana.informed.package\n.irm,application/vnd.ibm.rights-management\n.irp,application/vnd.irepository.package+xml\n.isu,video/x-isvideo\n.it,audio/it\n.itp,application/vnd.shana.informed.formtemplate\n.iv,application/x-inventor\n.ivp,application/vnd.immervision-ivp\n.ivr,i-world/i-vrml\n.ivu,application/vnd.immervision-ivu\n.ivy,application/x-livescreen\n.jad,text/vnd.sun.j2me.app-descriptor\n.jam,application/vnd.jam\n.jam,audio/x-jam\n.jar,application/java-archive\n.java,text/plain\n.java,text/x-java-source\n.jav,text/plain\n.jav,text/x-java-source\n.jcm,application/x-java-commerce\n.jfif,image/jpeg\n.jfif,image/pjpeg\n.jfif-tbnl,image/jpeg\n.jisp,application/vnd.jisp\n.jlt,application/vnd.hp-jlyt\n.jnlp,application/x-java-jnlp-file\n.joda,application/vnd.joost.joda-archive\n.jpeg,image/jpeg\n.jpe,image/jpeg\n.jpg,image/jpeg\n.jpgv,video/jpeg\n.jpm,video/jpm\n.jps,image/x-jps\n.js,application/javascript\n.json,application/json\n.jut,image/jutvision\n.kar,audio/midi\n.karbon,application/vnd.kde.karbon\n.kar,music/x-karaoke\n.key,application/pgp-keys\n.keychain,application/octet-stream\n.kfo,application/vnd.kde.kformula\n.kia,application/vnd.kidspiration\n.kml,application/vnd.google-earth.kml+xml\n.kmz,application/vnd.google-earth.kmz\n.kne,application/vnd.kinar\n.kon,application/vnd.kde.kontour\n.kpr,application/vnd.kde.kpresenter\n.ksh,application/x-ksh\n.ksh,text/x-script.ksh\n.ksp,application/vnd.kde.kspread\n.ktx,image/ktx\n.ktz,application/vnd.kahootz\n.kwd,application/vnd.kde.kword\n.la,audio/nspaudio\n.la,audio/x-nspaudio\n.lam,audio/x-liveaudio\n.lasxml,application/vnd.las.las+xml\n.latex,application/x-latex\n.lbd,application/vnd.llamagraphics.life-balance.desktop\n.lbe,application/vnd.llamagraphics.life-balance.exchange+xml\n.les,application/vnd.hhe.lesson-player\n.lha,application/lha\n.lha,application/x-lha\n.link66,application/vnd.route66.link66+xml\n.list,text/plain\n.lma,audio/nspaudio\n.lma,audio/x-nspaudio\n.log,text/plain\n.lrm,application/vnd.ms-lrm\n.lsp,application/x-lisp\n.lsp,text/x-script.lisp\n.lst,text/plain\n.lsx,text/x-la-asf\n.ltf,application/vnd.frogans.ltf\n.ltx,application/x-latex\n.lvp,audio/vnd.lucent.voice\n.lwp,application/vnd.lotus-wordpro\n.lzh,application/octet-stream\n.lzh,application/x-lzh\n.lzx,application/lzx\n.lzx,application/octet-stream\n.lzx,application/x-lzx\n.m1v,video/mpeg\n.m21,application/mp21\n.m2a,audio/mpeg\n.m2v,video/mpeg\n.m3u8,application/vnd.apple.mpegurl\n.m3u,audio/x-mpegurl\n.m4a,audio/mp4\n.m4v,video/mp4\n.ma,application/mathematica\n.mads,application/mads+xml\n.mag,application/vnd.ecowin.chart\n.man,application/x-troff-man\n.map,application/x-navimap\n.mar,text/plain\n.mathml,application/mathml+xml\n.mbd,application/mbedlet\n.mbk,application/vnd.mobius.mbk\n.mbox,application/mbox\n.mc1,application/vnd.medcalcdata\n.mc$,application/x-magic-cap-package-1.0\n.mcd,application/mcad\n.mcd,application/vnd.mcd\n.mcd,application/x-mathcad\n.mcf,image/vasa\n.mcf,text/mcf\n.mcp,application/netmc\n.mcurl,text/vnd.curl.mcurl\n.mdb,application/x-msaccess\n.mdi,image/vnd.ms-modi\n.me,application/x-troff-me\n.meta4,application/metalink4+xml\n.mets,application/mets+xml\n.mfm,application/vnd.mfmp\n.mgp,application/vnd.osgeo.mapguide.package\n.mgz,application/vnd.proteus.magazine\n.mht,message/rfc822\n.mhtml,message/rfc822\n.mid,application/x-midi\n.mid,audio/midi\n.mid,audio/x-mid\n.midi,application/x-midi\n.midi,audio/midi\n.midi,audio/x-mid\n.midi,audio/x-midi\n.midi,music/crescendo\n.midi,x-music/x-midi\n.mid,music/crescendo\n.mid,x-music/x-midi\n.mif,application/vnd.mif\n.mif,application/x-frame\n.mif,application/x-mif\n.mime,message/rfc822\n.mime,www/mime\n.mj2,video/mj2\n.mjf,audio/x-vnd.audioexplosion.mjuicemediafile\n.mjpg,video/x-motion-jpeg\n.mkv,video/x-matroska\n.mkv,audio/x-matroska\n.mlp,application/vnd.dolby.mlp\n.mm,application/base64\n.mm,application/x-meme\n.mmd,application/vnd.chipnuts.karaoke-mmd\n.mme,application/base64\n.mmf,application/vnd.smaf\n.mmr,image/vnd.fujixerox.edmics-mmr\n.mny,application/x-msmoney\n.mod,audio/mod\n.mod,audio/x-mod\n.mods,application/mods+xml\n.moov,video/quicktime\n.movie,video/x-sgi-movie\n.mov,video/quicktime\n.mp2,audio/mpeg\n.mp2,audio/x-mpeg\n.mp2,video/mpeg\n.mp2,video/x-mpeg\n.mp2,video/x-mpeq2a\n.mp3,audio/mpeg\n.mp3,audio/mpeg3\n.mp4a,audio/mp4\n.mp4,video/mp4\n.mp4,application/mp4\n.mpa,audio/mpeg\n.mpc,application/vnd.mophun.certificate\n.mpc,application/x-project\n.mpeg,video/mpeg\n.mpe,video/mpeg\n.mpga,audio/mpeg\n.mpg,video/mpeg\n.mpg,audio/mpeg\n.mpkg,application/vnd.apple.installer+xml\n.mpm,application/vnd.blueice.multipass\n.mpn,application/vnd.mophun.application\n.mpp,application/vnd.ms-project\n.mpt,application/x-project\n.mpv,application/x-project\n.mpx,application/x-project\n.mpy,application/vnd.ibm.minipay\n.mqy,application/vnd.mobius.mqy\n.mrc,application/marc\n.mrcx,application/marcxml+xml\n.ms,application/x-troff-ms\n.mscml,application/mediaservercontrol+xml\n.mseq,application/vnd.mseq\n.msf,application/vnd.epson.msf\n.msg,application/vnd.ms-outlook\n.msh,model/mesh\n.msl,application/vnd.mobius.msl\n.msty,application/vnd.muvee.style\n.m,text/plain\n.m,text/x-m\n.mts,model/vnd.mts\n.mus,application/vnd.musician\n.musicxml,application/vnd.recordare.musicxml+xml\n.mvb,application/x-msmediaview\n.mv,video/x-sgi-movie\n.mwf,application/vnd.mfer\n.mxf,application/mxf\n.mxl,application/vnd.recordare.musicxml\n.mxml,application/xv+xml\n.mxs,application/vnd.triscape.mxs\n.mxu,video/vnd.mpegurl\n.my,audio/make\n.mzz,application/x-vnd.audioexplosion.mzz\n.n3,text/n3\nN/A,application/andrew-inset\n.nap,image/naplps\n.naplps,image/naplps\n.nbp,application/vnd.wolfram.player\n.nc,application/x-netcdf\n.ncm,application/vnd.nokia.configuration-message\n.ncx,application/x-dtbncx+xml\n.n-gage,application/vnd.nokia.n-gage.symbian.install\n.ngdat,application/vnd.nokia.n-gage.data\n.niff,image/x-niff\n.nif,image/x-niff\n.nix,application/x-mix-transfer\n.nlu,application/vnd.neurolanguage.nlu\n.nml,application/vnd.enliven\n.nnd,application/vnd.noblenet-directory\n.nns,application/vnd.noblenet-sealer\n.nnw,application/vnd.noblenet-web\n.npx,image/vnd.net-fpx\n.nsc,application/x-conference\n.nsf,application/vnd.lotus-notes\n.nvd,application/x-navidoc\n.oa2,application/vnd.fujitsu.oasys2\n.oa3,application/vnd.fujitsu.oasys3\n.o,application/octet-stream\n.oas,application/vnd.fujitsu.oasys\n.obd,application/x-msbinder\n.oda,application/oda\n.odb,application/vnd.oasis.opendocument.database\n.odc,application/vnd.oasis.opendocument.chart\n.odf,application/vnd.oasis.opendocument.formula\n.odft,application/vnd.oasis.opendocument.formula-template\n.odg,application/vnd.oasis.opendocument.graphics\n.odi,application/vnd.oasis.opendocument.image\n.odm,application/vnd.oasis.opendocument.text-master\n.odp,application/vnd.oasis.opendocument.presentation\n.ods,application/vnd.oasis.opendocument.spreadsheet\n.odt,application/vnd.oasis.opendocument.text\n.oga,audio/ogg\n.ogg,audio/ogg\n.ogv,video/ogg\n.ogx,application/ogg\n.omc,application/x-omc\n.omcd,application/x-omcdatamaker\n.omcr,application/x-omcregerator\n.onetoc,application/onenote\n.opf,application/oebps-package+xml\n.org,application/vnd.lotus-organizer\n.osf,application/vnd.yamaha.openscoreformat\n.osfpvg,application/vnd.yamaha.openscoreformat.osfpvg+xml\n.otc,application/vnd.oasis.opendocument.chart-template\n.otf,application/x-font-otf\n.otg,application/vnd.oasis.opendocument.graphics-template\n.oth,application/vnd.oasis.opendocument.text-web\n.oti,application/vnd.oasis.opendocument.image-template\n.otp,application/vnd.oasis.opendocument.presentation-template\n.ots,application/vnd.oasis.opendocument.spreadsheet-template\n.ott,application/vnd.oasis.opendocument.text-template\n.oxt,application/vnd.openofficeorg.extension\n.p10,application/pkcs10\n.p12,application/pkcs-12\n.p7a,application/x-pkcs7-signature\n.p7b,application/x-pkcs7-certificates\n.p7c,application/pkcs7-mime\n.p7m,application/pkcs7-mime\n.p7r,application/x-pkcs7-certreqresp\n.p7s,application/pkcs7-signature\n.p8,application/pkcs8\n.pages,application/vnd.apple.pages\n.part,application/pro_eng\n.par,text/plain-bas\n.pas,text/pascal\n.paw,application/vnd.pawaafile\n.pbd,application/vnd.powerbuilder6\n.pbm,image/x-portable-bitmap\n.pcf,application/x-font-pcf\n.pcl,application/vnd.hp-pcl\n.pcl,application/x-pcl\n.pclxl,application/vnd.hp-pclxl\n.pct,image/x-pict\n.pcurl,application/vnd.curl.pcurl\n.pcx,image/x-pcx\n.pdb,application/vnd.palm\n.pdb,chemical/x-pdb\n.pdf,application/pdf\n.pem,application/x-pem-file\n.pfa,application/x-font-type1\n.pfr,application/font-tdpfr\n.pfunk,audio/make\n.pfunk,audio/make.my.funk\n.pfx,application/x-pkcs12\n.pgm,image/x-portable-graymap\n.pgn,application/x-chess-pgn\n.pgp,application/pgp-signature\n.pic,image/pict\n.pict,image/pict\n.pkg,application/x-newton-compatible-pkg\n.pki,application/pkixcmp\n.pkipath,application/pkix-pkipath\n.pko,application/vnd.ms-pki.pko\n.plb,application/vnd.3gpp.pic-bw-large\n.plc,application/vnd.mobius.plc\n.plf,application/vnd.pocketlearn\n.pls,application/pls+xml\n.pl,text/plain\n.pl,text/x-script.perl\n.plx,application/x-pixclscript\n.pm4,application/x-pagemaker\n.pm5,application/x-pagemaker\n.pm,image/x-xpixmap\n.pml,application/vnd.ctc-posml\n.pm,text/x-script.perl-module\n.png,image/png\n.pnm,application/x-portable-anymap\n.pnm,image/x-portable-anymap\n.portpkg,application/vnd.macports.portpkg\n.pot,application/mspowerpoint\n.pot,application/vnd.ms-powerpoint\n.potm,application/vnd.ms-powerpoint.template.macroenabled.12\n.potx,application/vnd.openxmlformats-officedocument.presentationml.template\n.pov,model/x-pov\n.ppa,application/vnd.ms-powerpoint\n.ppam,application/vnd.ms-powerpoint.addin.macroenabled.12\n.ppd,application/vnd.cups-ppd\n.ppm,image/x-portable-pixmap\n.pps,application/mspowerpoint\n.pps,application/vnd.ms-powerpoint\n.ppsm,application/vnd.ms-powerpoint.slideshow.macroenabled.12\n.ppsx,application/vnd.openxmlformats-officedocument.presentationml.slideshow\n.ppt,application/mspowerpoint\n.ppt,application/powerpoint\n.ppt,application/vnd.ms-powerpoint\n.ppt,application/x-mspowerpoint\n.pptm,application/vnd.ms-powerpoint.presentation.macroenabled.12\n.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation\n.ppz,application/mspowerpoint\n.prc,application/x-mobipocket-ebook\n.pre,application/vnd.lotus-freelance\n.pre,application/x-freelance\n.prf,application/pics-rules\n.prt,application/pro_eng\n.ps,application/postscript\n.psb,application/vnd.3gpp.pic-bw-small\n.psd,application/octet-stream\n.psd,image/vnd.adobe.photoshop\n.psf,application/x-font-linux-psf\n.pskcxml,application/pskc+xml\n.p,text/x-pascal\n.ptid,application/vnd.pvi.ptid1\n.pub,application/x-mspublisher\n.pvb,application/vnd.3gpp.pic-bw-var\n.pvu,paleovu/x-pv\n.pwn,application/vnd.3m.post-it-notes\n.pwz,application/vnd.ms-powerpoint\n.pya,audio/vnd.ms-playready.media.pya\n.pyc,application/x-bytecode.python\n.py,text/x-script.python\n.pyv,video/vnd.ms-playready.media.pyv\n.qam,application/vnd.epson.quickanime\n.qbo,application/vnd.intu.qbo\n.qcp,audio/vnd.qcelp\n.qd3d,x-world/x-3dmf\n.qd3,x-world/x-3dmf\n.qfx,application/vnd.intu.qfx\n.qif,image/x-quicktime\n.qps,application/vnd.publishare-delta-tree\n.qtc,video/x-qtc\n.qtif,image/x-quicktime\n.qti,image/x-quicktime\n.qt,video/quicktime\n.qxd,application/vnd.quark.quarkxpress\n.ra,audio/x-pn-realaudio\n.ra,audio/x-pn-realaudio-plugin\n.ra,audio/x-realaudio\n.ram,audio/x-pn-realaudio\n.rar,application/x-rar-compressed\n.ras,application/x-cmu-raster\n.ras,image/cmu-raster\n.ras,image/x-cmu-raster\n.rast,image/cmu-raster\n.rcprofile,application/vnd.ipunplugged.rcprofile\n.rdf,application/rdf+xml\n.rdz,application/vnd.data-vision.rdz\n.rep,application/vnd.businessobjects\n.res,application/x-dtbresource+xml\n.rexx,text/x-script.rexx\n.rf,image/vnd.rn-realflash\n.rgb,image/x-rgb\n.rif,application/reginfo+xml\n.rip,audio/vnd.rip\n.rl,application/resource-lists+xml\n.rlc,image/vnd.fujixerox.edmics-rlc\n.rld,application/resource-lists-diff+xml\n.rm,application/vnd.rn-realmedia\n.rm,audio/x-pn-realaudio\n.rmi,audio/mid\n.rmm,audio/x-pn-realaudio\n.rmp,audio/x-pn-realaudio\n.rmp,audio/x-pn-realaudio-plugin\n.rms,application/vnd.jcp.javame.midlet-rms\n.rnc,application/relax-ng-compact-syntax\n.rng,application/ringing-tones\n.rng,application/vnd.nokia.ringing-tone\n.rnx,application/vnd.rn-realplayer\n.roff,application/x-troff\n.rp9,application/vnd.cloanto.rp9\n.rp,image/vnd.rn-realpix\n.rpm,audio/x-pn-realaudio-plugin\n.rpm,application/x-rpm\n.rpss,application/vnd.nokia.radio-presets\n.rpst,application/vnd.nokia.radio-preset\n.rq,application/sparql-query\n.rs,application/rls-services+xml\n.rsd,application/rsd+xml\n.rss,application/rss+xml\n.rtf,application/rtf\n.rtf,text/rtf\n.rt,text/richtext\n.rt,text/vnd.rn-realtext\n.rtx,application/rtf\n.rtx,text/richtext\n.rv,video/vnd.rn-realvideo\n.s3m,audio/s3m\n.saf,application/vnd.yamaha.smaf-audio\n.saveme,application/octet-stream\n.sbk,application/x-tbook\n.sbml,application/sbml+xml\n.sc,application/vnd.ibm.secure-container\n.scd,application/x-msschedule\n.scm,application/vnd.lotus-screencam\n.scm,application/x-lotusscreencam\n.scm,text/x-script.guile\n.scm,text/x-script.scheme\n.scm,video/x-scm\n.scq,application/scvp-cv-request\n.scs,application/scvp-cv-response\n.scurl,text/vnd.curl.scurl\n.sda,application/vnd.stardivision.draw\n.sdc,application/vnd.stardivision.calc\n.sdd,application/vnd.stardivision.impress\n.sdf,application/octet-stream\n.sdkm,application/vnd.solent.sdkm+xml\n.sdml,text/plain\n.sdp,application/sdp\n.sdp,application/x-sdp\n.sdr,application/sounder\n.sdw,application/vnd.stardivision.writer\n.sea,application/sea\n.sea,application/x-sea\n.see,application/vnd.seemail\n.seed,application/vnd.fdsn.seed\n.sema,application/vnd.sema\n.semd,application/vnd.semd\n.semf,application/vnd.semf\n.ser,application/java-serialized-object\n.set,application/set\n.setpay,application/set-payment-initiation\n.setreg,application/set-registration-initiation\n.sfd-hdstx,application/vnd.hydrostatix.sof-data\n.sfs,application/vnd.spotfire.sfs\n.sgl,application/vnd.stardivision.writer-global\n.sgml,text/sgml\n.sgml,text/x-sgml\n.sgm,text/sgml\n.sgm,text/x-sgml\n.sh,application/x-bsh\n.sh,application/x-sh\n.sh,application/x-shar\n.shar,application/x-bsh\n.shar,application/x-shar\n.shf,application/shf+xml\n.sh,text/x-script.sh\n.shtml,text/html\n.shtml,text/x-server-parsed-html\n.sid,audio/x-psid\n.sis,application/vnd.symbian.install\n.sit,application/x-sit\n.sit,application/x-stuffit\n.sitx,application/x-stuffitx\n.skd,application/x-koan\n.skm,application/x-koan\n.skp,application/vnd.koan\n.skp,application/x-koan\n.skt,application/x-koan\n.sl,application/x-seelogo\n.sldm,application/vnd.ms-powerpoint.slide.macroenabled.12\n.sldx,application/vnd.openxmlformats-officedocument.presentationml.slide\n.slt,application/vnd.epson.salt\n.sm,application/vnd.stepmania.stepchart\n.smf,application/vnd.stardivision.math\n.smi,application/smil\n.smi,application/smil+xml\n.smil,application/smil\n.snd,audio/basic\n.snd,audio/x-adpcm\n.snf,application/x-font-snf\n.sol,application/solids\n.spc,application/x-pkcs7-certificates\n.spc,text/x-speech\n.spf,application/vnd.yamaha.smaf-phrase\n.spl,application/futuresplash\n.spl,application/x-futuresplash\n.spot,text/vnd.in3d.spot\n.spp,application/scvp-vp-response\n.spq,application/scvp-vp-request\n.spr,application/x-sprite\n.sprite,application/x-sprite\n.src,application/x-wais-source\n.srt,text/srt\n.sru,application/sru+xml\n.srx,application/sparql-results+xml\n.sse,application/vnd.kodak-descriptor\n.ssf,application/vnd.epson.ssf\n.ssi,text/x-server-parsed-html\n.ssm,application/streamingmedia\n.ssml,application/ssml+xml\n.sst,application/vnd.ms-pki.certstore\n.st,application/vnd.sailingtracker.track\n.stc,application/vnd.sun.xml.calc.template\n.std,application/vnd.sun.xml.draw.template\n.step,application/step\n.s,text/x-asm\n.stf,application/vnd.wt.stf\n.sti,application/vnd.sun.xml.impress.template\n.stk,application/hyperstudio\n.stl,application/sla\n.stl,application/vnd.ms-pki.stl\n.stl,application/x-navistyle\n.stp,application/step\n.str,application/vnd.pg.format\n.stw,application/vnd.sun.xml.writer.template\n.sub,image/vnd.dvb.subtitle\n.sus,application/vnd.sus-calendar\n.sv4cpio,application/x-sv4cpio\n.sv4crc,application/x-sv4crc\n.svc,application/vnd.dvb.service\n.svd,application/vnd.svd\n.svf,image/vnd.dwg\n.svf,image/x-dwg\n.svg,image/svg+xml\n.svr,application/x-world\n.svr,x-world/x-svr\n.swf,application/x-shockwave-flash\n.swi,application/vnd.aristanetworks.swi\n.sxc,application/vnd.sun.xml.calc\n.sxd,application/vnd.sun.xml.draw\n.sxg,application/vnd.sun.xml.writer.global\n.sxi,application/vnd.sun.xml.impress\n.sxm,application/vnd.sun.xml.math\n.sxw,application/vnd.sun.xml.writer\n.talk,text/x-speech\n.tao,application/vnd.tao.intent-module-archive\n.t,application/x-troff\n.tar,application/x-tar\n.tbk,application/toolbook\n.tbk,application/x-tbook\n.tcap,application/vnd.3gpp2.tcap\n.tcl,application/x-tcl\n.tcl,text/x-script.tcl\n.tcsh,text/x-script.tcsh\n.teacher,application/vnd.smart.teacher\n.tei,application/tei+xml\n.tex,application/x-tex\n.texi,application/x-texinfo\n.texinfo,application/x-texinfo\n.text,text/plain\n.tfi,application/thraud+xml\n.tfm,application/x-tex-tfm\n.tgz,application/gnutar\n.tgz,application/x-compressed\n.thmx,application/vnd.ms-officetheme\n.tiff,image/tiff\n.tif,image/tiff\n.tmo,application/vnd.tmobile-livetv\n.torrent,application/x-bittorrent\n.tpl,application/vnd.groove-tool-template\n.tpt,application/vnd.trid.tpt\n.tra,application/vnd.trueapp\n.tr,application/x-troff\n.trm,application/x-msterminal\n.tsd,application/timestamped-data\n.tsi,audio/tsp-audio\n.tsp,application/dsptype\n.tsp,audio/tsplayer\n.tsv,text/tab-separated-values\n.t,text/troff\n.ttf,application/x-font-ttf\n.ttl,text/turtle\n.turbot,image/florian\n.twd,application/vnd.simtech-mindmapper\n.txd,application/vnd.genomatix.tuxedo\n.txf,application/vnd.mobius.txf\n.txt,text/plain\n.ufd,application/vnd.ufdl\n.uil,text/x-uil\n.umj,application/vnd.umajin\n.unis,text/uri-list\n.uni,text/uri-list\n.unityweb,application/vnd.unity\n.unv,application/i-deas\n.uoml,application/vnd.uoml+xml\n.uris,text/uri-list\n.uri,text/uri-list\n.ustar,application/x-ustar\n.ustar,multipart/x-ustar\n.utz,application/vnd.uiq.theme\n.uu,application/octet-stream\n.uue,text/x-uuencode\n.uu,text/x-uuencode\n.uva,audio/vnd.dece.audio\n.uvh,video/vnd.dece.hd\n.uvi,image/vnd.dece.graphic\n.uvm,video/vnd.dece.mobile\n.uvp,video/vnd.dece.pd\n.uvs,video/vnd.dece.sd\n.uvu,video/vnd.uvvu.mp4\n.uvv,video/vnd.dece.video\n.vcd,application/x-cdlink\n.vcf,text/x-vcard\n.vcg,application/vnd.groove-vcard\n.vcs,text/x-vcalendar\n.vcx,application/vnd.vcx\n.vda,application/vda\n.vdo,video/vdo\n.vew,application/groupwise\n.vis,application/vnd.visionary\n.vivo,video/vivo\n.vivo,video/vnd.vivo\n.viv,video/vivo\n.viv,video/vnd.vivo\n.vmd,application/vocaltec-media-desc\n.vmf,application/vocaltec-media-file\n.vob,video/dvd\n.voc,audio/voc\n.voc,audio/x-voc\n.vos,video/vosaic\n.vox,audio/voxware\n.vqe,audio/x-twinvq-plugin\n.vqf,audio/x-twinvq\n.vql,audio/x-twinvq-plugin\n.vrml,application/x-vrml\n.vrml,model/vrml\n.vrml,x-world/x-vrml\n.vrt,x-world/x-vrt\n.vsd,application/vnd.visio\n.vsd,application/x-visio\n.vsf,application/vnd.vsf\n.vst,application/x-visio\n.vsw,application/x-visio\n.vtt,text/vtt\n.vtu,model/vnd.vtu\n.vxml,application/voicexml+xml\n.w60,application/wordperfect6.0\n.w61,application/wordperfect6.1\n.w6w,application/msword\n.wad,application/x-doom\n.war,application/zip\n.wasm,application/wasm\n.wav,audio/wav\n.wax,audio/x-ms-wax\n.wb1,application/x-qpro\n.wbmp,image/vnd.wap.wbmp\n.wbs,application/vnd.criticaltools.wbs+xml\n.wbxml,application/vnd.wap.wbxml\n.weba,audio/webm\n.web,application/vnd.xara\n.webm,video/webm\n.webp,image/webp\n.wg,application/vnd.pmi.widget\n.wgt,application/widget\n.wiz,application/msword\n.wk1,application/x-123\n.wma,audio/x-ms-wma\n.wmd,application/x-ms-wmd\n.wmf,application/x-msmetafile\n.wmf,windows/metafile\n.wmlc,application/vnd.wap.wmlc\n.wmlsc,application/vnd.wap.wmlscriptc\n.wmls,text/vnd.wap.wmlscript\n.wml,text/vnd.wap.wml\n.wm,video/x-ms-wm\n.wmv,video/x-ms-wmv\n.wmx,video/x-ms-wmx\n.wmz,application/x-ms-wmz\n.woff,application/x-font-woff\n.word,application/msword\n.wp5,application/wordperfect\n.wp5,application/wordperfect6.0\n.wp6,application/wordperfect\n.wp,application/wordperfect\n.wpd,application/vnd.wordperfect\n.wpd,application/wordperfect\n.wpd,application/x-wpwin\n.wpl,application/vnd.ms-wpl\n.wps,application/vnd.ms-works\n.wq1,application/x-lotus\n.wqd,application/vnd.wqd\n.wri,application/mswrite\n.wri,application/x-mswrite\n.wri,application/x-wri\n.wrl,application/x-world\n.wrl,model/vrml\n.wrl,x-world/x-vrml\n.wrz,model/vrml\n.wrz,x-world/x-vrml\n.wsc,text/scriplet\n.wsdl,application/wsdl+xml\n.wspolicy,application/wspolicy+xml\n.wsrc,application/x-wais-source\n.wtb,application/vnd.webturbo\n.wtk,application/x-wintalk\n.wvx,video/x-ms-wvx\n.x3d,application/vnd.hzn-3d-crossword\n.xap,application/x-silverlight-app\n.xar,application/vnd.xara\n.xbap,application/x-ms-xbap\n.xbd,application/vnd.fujixerox.docuworks.binder\n.xbm,image/xbm\n.xbm,image/x-xbitmap\n.xbm,image/x-xbm\n.xdf,application/xcap-diff+xml\n.xdm,application/vnd.syncml.dm+xml\n.xdp,application/vnd.adobe.xdp+xml\n.xdr,video/x-amt-demorun\n.xdssc,application/dssc+xml\n.xdw,application/vnd.fujixerox.docuworks\n.xenc,application/xenc+xml\n.xer,application/patch-ops-error+xml\n.xfdf,application/vnd.adobe.xfdf\n.xfdl,application/vnd.xfdl\n.xgz,xgl/drawing\n.xhtml,application/xhtml+xml\n.xif,image/vnd.xiff\n.xla,application/excel\n.xla,application/x-excel\n.xla,application/x-msexcel\n.xlam,application/vnd.ms-excel.addin.macroenabled.12\n.xl,application/excel\n.xlb,application/excel\n.xlb,application/vnd.ms-excel\n.xlb,application/x-excel\n.xlc,application/excel\n.xlc,application/vnd.ms-excel\n.xlc,application/x-excel\n.xld,application/excel\n.xld,application/x-excel\n.xlk,application/excel\n.xlk,application/x-excel\n.xll,application/excel\n.xll,application/vnd.ms-excel\n.xll,application/x-excel\n.xlm,application/excel\n.xlm,application/vnd.ms-excel\n.xlm,application/x-excel\n.xls,application/excel\n.xls,application/vnd.ms-excel\n.xls,application/x-excel\n.xls,application/x-msexcel\n.xlsb,application/vnd.ms-excel.sheet.binary.macroenabled.12\n.xlsm,application/vnd.ms-excel.sheet.macroenabled.12\n.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\n.xlt,application/excel\n.xlt,application/x-excel\n.xltm,application/vnd.ms-excel.template.macroenabled.12\n.xltx,application/vnd.openxmlformats-officedocument.spreadsheetml.template\n.xlv,application/excel\n.xlv,application/x-excel\n.xlw,application/excel\n.xlw,application/vnd.ms-excel\n.xlw,application/x-excel\n.xlw,application/x-msexcel\n.xm,audio/xm\n.xml,application/xml\n.xml,text/xml\n.xmz,xgl/movie\n.xo,application/vnd.olpc-sugar\n.xop,application/xop+xml\n.xpi,application/x-xpinstall\n.xpix,application/x-vnd.ls-xpix\n.xpm,image/xpm\n.xpm,image/x-xpixmap\n.x-png,image/png\n.xpr,application/vnd.is-xpr\n.xps,application/vnd.ms-xpsdocument\n.xpw,application/vnd.intercon.formnet\n.xslt,application/xslt+xml\n.xsm,application/vnd.syncml+xml\n.xspf,application/xspf+xml\n.xsr,video/x-amt-showrun\n.xul,application/vnd.mozilla.xul+xml\n.xwd,image/x-xwd\n.xwd,image/x-xwindowdump\n.xyz,chemical/x-pdb\n.xyz,chemical/x-xyz\n.xz,application/x-xz\n.yaml,text/yaml\n.yang,application/yang\n.yin,application/yin+xml\n.z,application/x-compress\n.z,application/x-compressed\n.zaz,application/vnd.zzazz.deck+xml\n.zip,application/zip\n.zip,application/x-compressed\n.zip,application/x-zip-compressed\n.zip,multipart/x-zip\n.zir,application/vnd.zul\n.zmm,application/vnd.handheld-entertainment+xml\n.zoo,application/octet-stream\n.zsh,text/x-script.zsh\n"),Oi))}function zi(){return vi.value}function ji(){Ri()}function Ti(){Pi=this,this.Empty=Li()}di.$metadata$={kind:d,simpleName:"HttpStatusCode",interfaces:[]},di.prototype.component1=function(){return this.value},di.prototype.component2=function(){return this.description},di.prototype.copy_19mbxw$=function(t,e){return new di(void 0===t?this.value:t,void 0===e?this.description:e)},Ti.prototype.build_itqcaa$=wt("ktor-ktor-http-jsLegacy.io.ktor.http.Parameters.Companion.build_itqcaa$",kt((function(){var e=t.io.ktor.http.ParametersBuilder;return function(t){var n=new e;return t(n),n.build()}}))),Ti.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var Pi=null;function Ri(){return null===Pi&&new Ti,Pi}function Ai(t){void 0===t&&(t=8),qt.call(this,!0,t)}function Ii(){Mi=this}ji.$metadata$={kind:G,simpleName:"Parameters",interfaces:[Dt]},Ai.prototype.build=function(){if(this.built)throw pt("ParametersBuilder can only build a single Parameters instance".toString());return this.built=!0,new Di(this.values)},Ai.$metadata$={kind:d,simpleName:"ParametersBuilder",interfaces:[qt]},Object.defineProperty(Ii.prototype,"caseInsensitiveName",{configurable:!0,get:function(){return!0}}),Ii.prototype.getAll_61zpoe$=function(t){return null},Ii.prototype.names=function(){return Ft()},Ii.prototype.entries=function(){return Ft()},Ii.prototype.isEmpty=function(){return!0},Ii.prototype.toString=function(){return"Parameters "+this.entries()},Ii.prototype.equals=function(t){return e.isType(t,ji)&&t.isEmpty()},Ii.$metadata$={kind:K,simpleName:"EmptyParameters",interfaces:[ji]};var Mi=null;function Li(){return null===Mi&&new Ii,Mi}function Di(t){void 0===t&&(t=ot()),Ht.call(this,!0,t)}function qi(t,e,n){var i;if(void 0===e&&(e=0),void 0===n&&(n=1e3),e>Lt(t))i=Ri().Empty;else{var r=new Ai;!function(t,e,n,i){var r,o=0,a=n,s=-1;r=Lt(e);for(var l=n;l<=r;l++){if(o===i)return;switch(e.charCodeAt(l)){case 38:Fi(t,e,a,s,l),a=l+1|0,s=-1,o=o+1|0;break;case 61:-1===s&&(s=l)}}o!==i&&Fi(t,e,a,s,e.length)}(r,t,e,n),i=r.build()}return i}function Fi(t,e,n,i,r){if(-1===i){var o=Bi(n,r,e),a=Ui(o,r,e);if(a>o){var s=Pe(e,o,a);t.appendAll_poujtz$(s,W())}}else{var l=Bi(n,i,e),c=Ui(l,i,e);if(c>l){var u=Pe(e,l,c),p=Bi(i+1|0,r,e),h=Pe(e,p,Ui(p,r,e),!0);t.append_puj7f4$(u,h)}}}function Ui(t,e,n){for(var i=e;i>t&&ht(n.charCodeAt(i-1|0));)i=i-1|0;return i}function Bi(t,e,n){for(var i=t;i0&&(t.append_s8itvh$(35),t.append_gw00v9$(Oe(this.fragment))),t},Hi.prototype.buildString=function(){return this.appendTo_0(I(256)).toString()},Hi.prototype.build=function(){return new Gi(this.protocol,this.host,this.port,this.encodedPath,this.parameters.build(),this.fragment,this.user,this.password,this.trailingQuery)},Ki.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var Wi=null;function Yi(){return null===Wi&&new Ki,Wi}function Gi(t,e,n,i,r,o,a,s,l){var c;if(Qi(),this.protocol=t,this.host=e,this.specifiedPort=n,this.encodedPath=i,this.parameters=r,this.fragment=o,this.user=a,this.password=s,this.trailingQuery=l,!(1<=(c=this.specifiedPort)&&c<=65536||0===this.specifiedPort))throw pt("port must be between 1 and 65536, or 0 if not set".toString())}function Ji(){Zi=this}Hi.$metadata$={kind:d,simpleName:"URLBuilder",interfaces:[]},Object.defineProperty(Gi.prototype,"port",{configurable:!0,get:function(){var t,e=this.specifiedPort;return null!=(t=0!==e?e:null)?t:this.protocol.defaultPort}}),Gi.prototype.toString=function(){var t=q();t:do{var e;switch(t.append_pdl1vj$(this.protocol.name),this.protocol.name){case"file":tr(t,this.host,this.encodedPath);break t;case"mailto":if(null==(e=this.user))throw Et("User can't be empty.".toString());Xi(t,e,this.host);break t}t.append_pdl1vj$("://"),t.append_pdl1vj$(rr(this)),t.append_pdl1vj$(yr(this)),this.fragment.length>0&&(t.append_s8itvh$(35),t.append_pdl1vj$(this.fragment))}while(0);return t.toString()},Ji.$metadata$={kind:K,simpleName:"Companion",interfaces:[]};var Zi=null;function Qi(){return null===Zi&&new Ji,Zi}function Xi(t,e,n){t.append_gw00v9$(":"),t.append_gw00v9$(je(e)),t.append_s8itvh$(64),t.append_gw00v9$(n)}function tr(t,e,n){t.append_gw00v9$("://"),t.append_gw00v9$(e),t.append_gw00v9$(n)}function er(t){var e=q();return ir(e,t.user,t.password),e.toString()}function nr(t){var e=q();return ir(e,t.user,t.password),e.toString()}function ir(t,e,n){null!=e&&(t.append_pdl1vj$(je(e)),null!=n&&(t.append_s8itvh$(58),t.append_pdl1vj$(je(n))),t.append_pdl1vj$("@"))}function rr(t){var e=q();return e.append_pdl1vj$(er(t)),0===t.specifiedPort?e.append_pdl1vj$(t.host):e.append_pdl1vj$(mr(t)),e.toString()}function or(t){var e=q();return e.append_pdl1vj$(nr(t)),e.append_pdl1vj$(t.host),0!==t.port&&t.port!==t.protocol.defaultPort&&(e.append_pdl1vj$(":"),e.append_pdl1vj$(t.port.toString())),e.toString()}function ar(t,n){var i;try{i=lr(t,n)}catch(t){throw e.isType(t,At)?new sr(n,t):t}return i}function sr(t,e){Ct.call(this,"Fail to parse url: "+t,e),this.name="URLParserException"}function lr(t,e){var n,i,r,o;t:do{var a,s,l,c;s=(a=re(e)).first,l=a.last,c=a.step;for(var u=s;u<=l;u+=c)if(!ht(S(E(e.charCodeAt(u))))){o=u;break t}o=-1}while(0);var p,h=o;t:do{var f;for(f=se(re(e)).iterator();f.hasNext();){var d=f.next();if(!ht(S(E(e.charCodeAt(d))))){p=d;break t}}p=-1}while(0);var _=p+1|0,m=function(t,e,n){var i=e,r=-1,o=t.charCodeAt(i);for(new b(97,122).contains_mef7kx$(o)||new b(65,90).contains_mef7kx$(o)||(r=i);i0){var v=h,$=h+m|0,g=e.substring(v,$);t.protocol=dr().createOrDefault_61zpoe$(g),h=h+(m+1)|0}var w=function(t,e,n,i){for(var r=0;(e+r|0)=2)t:for(;;){var k=oe(e,Ot("@/\\?#"),h),x=null!=(n=k>0?k:null)?n:_;if(!(x<_&&64===e.charCodeAt(x))){cr(t,e,h,x),h=x;break t}var C=ur(e,h,x);if(-1!==C){var O=h;t.user=Re(e.substring(O,C));var N=C+1|0;t.password=Re(e.substring(N,x))}else{var z=h;t.user=Re(e.substring(z,x))}h=x+1|0}if(h>=_)return t.encodedPath=47===e.charCodeAt(_-1|0)?"/":"",t;if(0===w){var j=ae(t.encodedPath,47);if(j!==(t.encodedPath.length-1|0))if(-1!==j){var T=j+1|0;i=t.encodedPath.substring(0,T)}else i="/";else i=t.encodedPath}else i="";t.encodedPath=i;var P=oe(e,Ot("?#"),h),A=null!=(r=P>0?P:null)?r:_,I=h,M=e.substring(I,A);return t.encodedPath+=ze(M),(h=A)<_&&63===e.charCodeAt(h)&&(h=function(t,e,n,i){var r;if((n+1|0)===i)return t.trailingQuery=!0,i;var o,a=Q(e,35,n+1|0),s=null!=(r=a>0?a:null)?r:i,l=n+1|0;return qi(e.substring(l,s)).forEach_ubvtmq$((o=t,function(t,e){return o.parameters.appendAll_poujtz$(t,e),R})),s}(t,e,h,_)),function(t,e,n,i){if(n0?o:null)?r:i;if(t.host=e.substring(n,a),(a+1|0)@;:/\\\\"\\[\\]\\?=\\{\\}\\s]+)\\s*(=\\s*("[^"]*"|[^;]*))?'),z([E(59),E(44),E(34)]),C(["***, dd MMM YYYY hh:mm:ss zzz","****, dd-MMM-YYYY hh:mm:ss zzz","*** MMM d hh:mm:ss YYYY","***, dd-MMM-YYYY hh:mm:ss zzz","***, dd-MMM-YYYY hh-mm-ss zzz","***, dd MMM YYYY hh:mm:ss zzz","*** dd-MMM-YYYY hh:mm:ss zzz","*** dd MMM YYYY hh:mm:ss zzz","*** dd-MMM-YYYY hh-mm-ss zzz","***,dd-MMM-YYYY hh:mm:ss zzz","*** MMM d YYYY hh:mm:ss zzz"]),Tt((function(){var t=zt();return t.putAll_a2k3zr$(gn(jt(zi()))),t})),Tt((function(){return gn(ct(jt(zi()),$n))})),dn=z([E(40),E(41),E(60),E(62),E(64),E(44),E(59),E(58),E(92),E(34),E(47),E(91),E(93),E(63),E(61),E(123),E(125),E(32),E(9),E(10),E(13)]),yi=ko(So(ko(So(ko(So(jo(),"."),jo()),"."),jo()),"."),jo()),mi=So(wo("[",Co(Eo(zo(),":"))),"]"),Po(xo(yi,mi)),vi=Tt((function(){return Ni()})),Sr=bt("[a-zA-Z0-9\\-._~+/]+=*"),xr=bt("\\S+"),Er=bt("\\s*,?\\s*("+Sr+')\\s*=\\s*(("((\\\\.)|[^\\\\"])*")|[^\\s,]*)\\s*,?\\s*'),Cr=bt("\\\\."),new ye("Caching"),t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){"use strict";(function(e,i){var r=n(2).Buffer,o=e.crypto||e.msCrypto;o&&o.getRandomValues?t.exports=function(t,e){if(t>4294967295)throw new RangeError("requested too many random bytes");var n=r.allocUnsafe(t);if(t>0)if(t>65536)for(var a=0;a2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}r("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(t,e,n){var i,r,a,s;if("string"==typeof e&&(r="not ",e.substr(!a||a<0?0:+a,r.length)===r)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(o(e,"type"));else{var l=function(t,e,n){return"number"!=typeof n&&(n=0),!(n+e.length>t.length)&&-1!==t.indexOf(e,n)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(l," ").concat(i," ").concat(o(e,"type"))}return s+=". Received type ".concat(typeof n)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},function(t,e,n){"use strict";(function(e){var i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=c;var r=n(78),o=n(82);n(0)(c,r);for(var a=i(o.prototype),s=0;s=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var i=(4294967295&n)>>>0,r=(n-i)/4294967296;this._block.writeUInt32BE(r,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},r.prototype._update=function(){throw new Error("_update must be implemented by subclass")},t.exports=r},function(t,e,n){"use strict";var i={};function r(t,e,n){n||(n=Error);var r=function(t){var n,i;function r(n,i,r){return t.call(this,function(t,n,i){return"string"==typeof e?e:e(t,n,i)}(n,i,r))||this}return i=t,(n=r).prototype=Object.create(i.prototype),n.prototype.constructor=n,n.__proto__=i,r}(n);r.prototype.name=n.name,r.prototype.code=t,i[t]=r}function o(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}r("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),r("ERR_INVALID_ARG_TYPE",(function(t,e,n){var i,r,a,s;if("string"==typeof e&&(r="not ",e.substr(!a||a<0?0:+a,r.length)===r)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))s="The ".concat(t," ").concat(i," ").concat(o(e,"type"));else{var l=function(t,e,n){return"number"!=typeof n&&(n=0),!(n+e.length>t.length)&&-1!==t.indexOf(e,n)}(t,".")?"property":"argument";s='The "'.concat(t,'" ').concat(l," ").concat(i," ").concat(o(e,"type"))}return s+=". Received type ".concat(typeof n)}),TypeError),r("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),r("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),r("ERR_STREAM_PREMATURE_CLOSE","Premature close"),r("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" after a stream was destroyed"})),r("ERR_MULTIPLE_CALLBACK","Callback called multiple times"),r("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable"),r("ERR_STREAM_WRITE_AFTER_END","write after end"),r("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),r("ERR_UNKNOWN_ENCODING",(function(t){return"Unknown encoding: "+t}),TypeError),r("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.codes=i},function(t,e,n){"use strict";(function(e){var i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=c;var r=n(107),o=n(111);n(0)(c,r);for(var a=i(o.prototype),s=0;s0;){var i=v(t,n);de(n,i);for(var r=(8*(n.length-i|0)|0)/6|0,o=(255&n[0])<<16|(255&n[1])<<8|255&n[2],a=n.length;a>=r;a--){var l=o>>(6*a|0)&63;e.append_s8itvh$(_e(l))}for(var c=0;c>4],r[(i=o,o=i+1|0,i)]=a[15&l]}return rt(r)}function Re(t,e,n){this.delegate_0=t,this.convertTo_0=e,this.convert_0=n,this.size_uukmxx$_0=this.delegate_0.size}function Ae(t){this.this$DelegatingMutableSet=t,this.delegateIterator=t.delegate_0.iterator()}function Ie(){Me=this}e.kotlin.IllegalArgumentException_init,e.kotlin.IllegalArgumentException,cn.prototype=Object.create(qt.prototype),cn.prototype.constructor=cn,qn.prototype=Object.create(Kt.prototype),qn.prototype.constructor=qn,pi.prototype=Object.create(Kt.prototype),pi.prototype.constructor=pi,Qi.prototype=Object.create(w.prototype),Qi.prototype.constructor=Qi,tr.prototype=Object.create(Xi.prototype),tr.prototype.constructor=tr,er.prototype=Object.create(Xi.prototype),er.prototype.constructor=er,nr.prototype=Object.create(Xi.prototype),nr.prototype.constructor=nr,Cr.prototype=Object.create(Gt.prototype),Cr.prototype.constructor=Cr,pe.prototype.toString=function(){return 0===this.name.length?h.prototype.toString.call(this):"AttributeKey: "+this.name},pe.$metadata$={kind:p,simpleName:"AttributeKey",interfaces:[]},he.prototype.get_yzaw86$=function(t){var e;if(null==(e=this.getOrNull_yzaw86$(t)))throw f("No instance for key "+t);return e},he.prototype.take_yzaw86$=function(t){var e=this.get_yzaw86$(t);return this.remove_yzaw86$(t),e},he.prototype.takeOrNull_yzaw86$=function(t){var e=this.getOrNull_yzaw86$(t);return this.remove_yzaw86$(t),e},he.$metadata$={kind:d,simpleName:"Attributes",interfaces:[]},ye.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[j]},ye.prototype=Object.create(j.prototype),ye.prototype.constructor=ye,ye.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$first.writePacket_3uq2w4$(this.local$closure$chunk.copy(),this),this.result_0===z)return z;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ve.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[j]},ve.prototype=Object.create(j.prototype),ve.prototype.constructor=ve,ve.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$second.writePacket_3uq2w4$(this.local$closure$chunk.copy(),this),this.result_0===z)return z;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ge.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[j]},ge.prototype=Object.create(j.prototype),ge.prototype.constructor=ge,ge.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;this.exceptionState_0=10,this.state_0=1;continue;case 1:if(this.local$this$split.isClosedForRead){this.state_0=7;continue}if(this.state_0=2,this.result_0=O(this.local$this$split,l,this),this.result_0===z)return z;continue;case 2:this.local$$receiver=this.result_0,this.exceptionState_0=5;var n=this.local$closure$first,i=this.local$closure$second;if(this.state_0=3,this.result_0=R(P([T(this.local$$receiver_0,void 0,void 0,me(n,this.local$$receiver)),T(this.local$$receiver_0,void 0,void 0,$e(i,this.local$$receiver))]),this),this.result_0===z)return z;continue;case 3:this.result_0,this.exceptionState_0=10,this.finallyPath_0=[4],this.state_0=6;continue;case 4:this.state_0=1;continue;case 5:this.finallyPath_0=[10],this.state_0=6;continue;case 6:this.exceptionState_0=10,this.local$$receiver.close(),this.state_0=this.finallyPath_0.shift();continue;case 7:if(e.isType(this.local$$receiver_0,A)){if(null!=(t=this.local$$receiver_0.closedCause))throw t;this.exceptionState_0=15,this.finallyPath_0=[8],this.state_0=13,this.$returnValue=N;continue}this.state_0=9;continue;case 8:return this.$returnValue;case 9:this.exceptionState_0=15,this.finallyPath_0=[14],this.state_0=13;continue;case 10:this.finallyPath_0=[15],this.exceptionState_0=13;var r=this.exception_0;if(e.isType(r,w)){this.local$this$split.cancel_dbl4no$(r),this.local$closure$first.cancel_dbl4no$(r),this.exceptionState_0=15,this.finallyPath_0=[11],this.state_0=13,this.$returnValue=this.local$closure$second.cancel_dbl4no$(r);continue}throw r;case 11:return this.$returnValue;case 12:this.finallyPath_0=[14],this.state_0=13;continue;case 13:this.exceptionState_0=15,I(this.local$closure$first),I(this.local$closure$second),this.state_0=this.finallyPath_0.shift();continue;case 14:return N;case 15:throw this.exception_0;default:throw this.state_0=15,new Error("State Machine Unreachable execution")}}catch(t){if(15===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},be.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[j]},be.prototype=Object.create(j.prototype),be.prototype.constructor=be,be.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;this.exceptionState_0=16,this.state_0=1;continue;case 1:if(this.local$this$copyToBoth.isClosedForRead||this.local$closure$first.isClosedForWrite&&this.local$closure$second.isClosedForWrite){this.state_0=13;continue}if(this.state_0=2,this.result_0=O(this.local$this$copyToBoth,l,this),this.result_0===z)return z;continue;case 2:this.local$$receiver=this.result_0,this.exceptionState_0=11,this.local$closure$first_0=this.local$closure$first,this.local$closure$second_0=this.local$closure$second,this.local$this$copyToBoth_0=this.local$this$copyToBoth,this.state_0=3;continue;case 3:if(this.exceptionState_0=6,this.state_0=4,this.result_0=this.local$closure$first_0.writePacket_3uq2w4$(this.local$$receiver.copy(),this),this.result_0===z)return z;continue;case 4:if(this.state_0=5,this.result_0=this.local$closure$second_0.writePacket_3uq2w4$(this.local$$receiver.copy(),this),this.result_0===z)return z;continue;case 5:this.local$block$result=this.result_0,this.exceptionState_0=11,this.state_0=8;continue;case 6:this.exceptionState_0=11;var n=this.exception_0;if(e.isType(n,w)){this.local$this$copyToBoth_0.cancel_dbl4no$(n),this.local$closure$first_0.close_dbl4no$(n),this.local$block$result=this.local$closure$second_0.close_dbl4no$(n),this.exceptionState_0=6,this.state_0=9;continue}throw n;case 7:this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:this.local$block$result,this.exceptionState_0=16,this.finallyPath_0=[10],this.state_0=12;continue;case 10:this.state_0=1;continue;case 11:this.finallyPath_0=[16],this.state_0=12;continue;case 12:this.exceptionState_0=16,this.local$$receiver.close(),this.state_0=this.finallyPath_0.shift();continue;case 13:if(e.isType(this.local$$receiver_0,A)){if(null!=(t=this.local$$receiver_0.closedCause))throw t;this.exceptionState_0=21,this.finallyPath_0=[14],this.state_0=19,this.$returnValue=N;continue}this.state_0=15;continue;case 14:return this.$returnValue;case 15:this.exceptionState_0=21,this.finallyPath_0=[20],this.state_0=19;continue;case 16:this.finallyPath_0=[21],this.exceptionState_0=19;var i=this.exception_0;if(e.isType(i,w)){this.local$closure$first.close_dbl4no$(i),this.exceptionState_0=21,this.finallyPath_0=[17],this.state_0=19,this.$returnValue=this.local$closure$second.close_dbl4no$(i);continue}throw i;case 17:return this.$returnValue;case 18:this.finallyPath_0=[20],this.state_0=19;continue;case 19:this.exceptionState_0=21,I(this.local$closure$first),I(this.local$closure$second),this.state_0=this.finallyPath_0.shift();continue;case 20:return N;case 21:throw this.exception_0;default:throw this.state_0=21,new Error("State Machine Unreachable execution")}}catch(t){if(21===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},we.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[j]},we.prototype=Object.create(j.prototype),we.prototype.constructor=we,we.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=q(this.local$$receiver,this),this.result_0===z)return z;continue;case 1:throw this.exception_0;case 2:return F(this.result_0);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(ke.prototype,"size",{configurable:!0,get:function(){return this.delegate_0.size}}),ke.prototype.containsKey_11rb$=function(t){return this.delegate_0.containsKey_11rb$(new We(t))},ke.prototype.containsValue_11rc$=function(t){return this.delegate_0.containsValue_11rc$(t)},ke.prototype.get_11rb$=function(t){return this.delegate_0.get_11rb$(Ke(t))},ke.prototype.isEmpty=function(){return this.delegate_0.isEmpty()},ke.prototype.clear=function(){this.delegate_0.clear()},ke.prototype.put_xwzc9p$=function(t,e){return this.delegate_0.put_xwzc9p$(Ke(t),e)},ke.prototype.putAll_a2k3zr$=function(t){var e;for(e=t.entries.iterator();e.hasNext();){var n=e.next(),i=n.key,r=n.value;this.put_xwzc9p$(i,r)}},ke.prototype.remove_11rb$=function(t){return this.delegate_0.remove_11rb$(Ke(t))},Object.defineProperty(ke.prototype,"keys",{configurable:!0,get:function(){return new Re(this.delegate_0.keys,Se,xe)}}),Object.defineProperty(ke.prototype,"entries",{configurable:!0,get:function(){return new Re(this.delegate_0.entries,Ee,Ce)}}),Object.defineProperty(ke.prototype,"values",{configurable:!0,get:function(){return this.delegate_0.values}}),ke.prototype.equals=function(t){return!(null==t||!e.isType(t,ke))&&U(t.delegate_0,this.delegate_0)},ke.prototype.hashCode=function(){return B(this.delegate_0)},ke.$metadata$={kind:p,simpleName:"CaseInsensitiveMap",interfaces:[H]},Object.defineProperty(Oe.prototype,"key",{get:function(){return this.key_3iz5qv$_0}}),Object.defineProperty(Oe.prototype,"value",{get:function(){return this.value_p1xw47$_0},set:function(t){this.value_p1xw47$_0=t}}),Oe.prototype.setValue_11rc$=function(t){return this.value=t,this.value},Oe.prototype.hashCode=function(){return 527+B(V(this.key))+B(V(this.value))|0},Oe.prototype.equals=function(t){return!(null==t||!e.isType(t,K))&&U(t.key,this.key)&&U(t.value,this.value)},Oe.prototype.toString=function(){return this.key.toString()+"="+this.value},Oe.$metadata$={kind:p,simpleName:"Entry",interfaces:[W]},je.prototype=Object.create(nt.prototype),je.prototype.constructor=je,je.prototype.handleException_1ur55u$=function(t,e){this.closure$handler(t,e)},je.$metadata$={kind:p,interfaces:[it,nt]},Re.prototype.convert_9xhtru$=function(t){var e,n=lt(st(t,10));for(e=t.iterator();e.hasNext();){var i=e.next();n.add_11rb$(this.convert_0(i))}return n},Re.prototype.convertTo_9xhuij$=function(t){var e,n=lt(st(t,10));for(e=t.iterator();e.hasNext();){var i=e.next();n.add_11rb$(this.convertTo_0(i))}return n},Object.defineProperty(Re.prototype,"size",{configurable:!0,get:function(){return this.size_uukmxx$_0}}),Re.prototype.add_11rb$=function(t){return this.delegate_0.add_11rb$(this.convert_0(t))},Re.prototype.addAll_brywnq$=function(t){return this.delegate_0.addAll_brywnq$(this.convert_9xhtru$(t))},Re.prototype.clear=function(){this.delegate_0.clear()},Re.prototype.remove_11rb$=function(t){return this.delegate_0.remove_11rb$(this.convert_0(t))},Re.prototype.removeAll_brywnq$=function(t){return this.delegate_0.removeAll_brywnq$(this.convert_9xhtru$(t))},Re.prototype.retainAll_brywnq$=function(t){return this.delegate_0.retainAll_brywnq$(this.convert_9xhtru$(t))},Re.prototype.contains_11rb$=function(t){return this.delegate_0.contains_11rb$(this.convert_0(t))},Re.prototype.containsAll_brywnq$=function(t){return this.delegate_0.containsAll_brywnq$(this.convert_9xhtru$(t))},Re.prototype.isEmpty=function(){return this.delegate_0.isEmpty()},Ae.prototype.hasNext=function(){return this.delegateIterator.hasNext()},Ae.prototype.next=function(){return this.this$DelegatingMutableSet.convertTo_0(this.delegateIterator.next())},Ae.prototype.remove=function(){this.delegateIterator.remove()},Ae.$metadata$={kind:p,interfaces:[ot]},Re.prototype.iterator=function(){return new Ae(this)},Re.prototype.hashCode=function(){return B(this.delegate_0)},Re.prototype.equals=function(t){if(null==t||!e.isType(t,at))return!1;var n=this.convertTo_9xhuij$(this.delegate_0),i=t.containsAll_brywnq$(n);return i&&(i=n.containsAll_brywnq$(t)),i},Re.prototype.toString=function(){return this.convertTo_9xhuij$(this.delegate_0).toString()},Re.$metadata$={kind:p,simpleName:"DelegatingMutableSet",interfaces:[G]},Ie.prototype.combine_jiburq$=function(t){return B(ut(t))},Ie.$metadata$={kind:ct,simpleName:"Hash",interfaces:[]};var Me=null;function Le(){return null===Me&&new Ie,Me}function De(){Ue()}function qe(){Fe=this,this.Empty=new Be}qe.prototype.build_o7hlrk$=pt("ktor-ktor-utils-jsLegacy.io.ktor.util.StringValues.Companion.build_o7hlrk$",ft((function(){var e=t.io.ktor.util.StringValuesBuilder;return function(t,n){void 0===t&&(t=!1);var i=new e(t);return n(i),i.build()}}))),qe.$metadata$={kind:ct,simpleName:"Companion",interfaces:[]};var Fe=null;function Ue(){return null===Fe&&new qe,Fe}function Be(t,e){var n,i;void 0===t&&(t=!1),void 0===e&&(e=yt()),this.caseInsensitiveName_w2tiaf$_0=t,this.values_x1t64x$_0=vt((n=this,i=e,function(){var t;if(n.caseInsensitiveName){var e=ze();e.putAll_a2k3zr$(i),t=e}else t=mt(i);return t}))}function He(t,e){void 0===t&&(t=!1),void 0===e&&(e=8),this.caseInsensitiveName=t,this.values=this.caseInsensitiveName?ze():wt(e),this.built=!1}function Ve(t){return new Et(65,90).contains_mef7kx$(t)?_(t+32):new Et(0,127).contains_mef7kx$(t)?t:_(String.fromCharCode(t).toLowerCase().charCodeAt(0))}function Ke(t){return new We(t)}function We(t){this.content=t,this.hash_0=B(this.content.toLowerCase())}function Ye(t){if(kr().IS_NATIVE){var e=new Je;return Nt(e,t),e}var n,i=lt(t.length);for(n=0;n!==t.length;++n){var r=t[n];i.add_11rb$(r)}return i}function Ge(t){this.value_0=t}function Je(){this.data_euorsu$_0=new Ge(new Ln(32)),this.size_emamgl$_0=new Ge(0),this.lock_0=new h,It(this)}De.prototype.get_61zpoe$=function(t){var e;return null!=(e=this.getAll_61zpoe$(t))?dt(e):null},De.prototype.contains_61zpoe$=function(t){return null!=this.getAll_61zpoe$(t)},De.prototype.contains_puj7f4$=function(t,e){var n,i;return null!=(i=null!=(n=this.getAll_61zpoe$(t))?n.contains_11rb$(e):null)&&i},De.prototype.forEach_ubvtmq$=function(t){var e;for(e=this.entries().iterator();e.hasNext();){var n=e.next();t(n.key,n.value)}},De.$metadata$={kind:d,simpleName:"StringValues",interfaces:[]},Object.defineProperty(Be.prototype,"caseInsensitiveName",{get:function(){return this.caseInsensitiveName_w2tiaf$_0}}),Object.defineProperty(Be.prototype,"values",{configurable:!0,get:function(){return this.values_x1t64x$_0.value}}),Be.prototype.get_61zpoe$=function(t){var e;return null!=(e=this.listForKey_6rkiov$_0(t))?dt(e):null},Be.prototype.getAll_61zpoe$=function(t){return this.listForKey_6rkiov$_0(t)},Be.prototype.contains_61zpoe$=function(t){return null!=this.listForKey_6rkiov$_0(t)},Be.prototype.contains_puj7f4$=function(t,e){var n,i;return null!=(i=null!=(n=this.listForKey_6rkiov$_0(t))?n.contains_11rb$(e):null)&&i},Be.prototype.names=function(){return this.values.keys},Be.prototype.isEmpty=function(){return this.values.isEmpty()},Be.prototype.entries=function(){return this.values.entries},Be.prototype.forEach_ubvtmq$=function(t){var e;for(e=this.values.entries.iterator();e.hasNext();){var n=e.next();t(n.key,n.value)}},Be.prototype.listForKey_6rkiov$_0=function(t){return this.values.get_11rb$(t)},Be.prototype.toString=function(){return"StringValues(case="+!this.caseInsensitiveName+") "+this.entries()},Be.prototype.equals=function(t){return this===t||!!e.isType(t,De)&&this.caseInsensitiveName===t.caseInsensitiveName&&(n=this.entries(),i=t.entries(),U(n,i));var n,i},Be.prototype.hashCode=function(){return t=this.entries(),(31*(31*B(this.caseInsensitiveName)|0)|0)+B(t)|0;var t},Be.$metadata$={kind:p,simpleName:"StringValuesImpl",interfaces:[De]},He.prototype.getAll_61zpoe$=function(t){return this.values.get_11rb$(t)},He.prototype.contains_61zpoe$=function(t){var n,i=this.values;return(e.isType(n=i,Z)?n:Q()).containsKey_11rb$(t)},He.prototype.contains_puj7f4$=function(t,e){var n,i;return null!=(i=null!=(n=this.values.get_11rb$(t))?n.contains_11rb$(e):null)&&i},He.prototype.names=function(){return this.values.keys},He.prototype.isEmpty=function(){return this.values.isEmpty()},He.prototype.entries=function(){return this.values.entries},He.prototype.set_puj7f4$=function(t,e){this.validateValue_61zpoe$(e);var n=this.ensureListForKey_fsrbb4$_0(t,1);n.clear(),n.add_11rb$(e)},He.prototype.get_61zpoe$=function(t){var e;return null!=(e=this.getAll_61zpoe$(t))?dt(e):null},He.prototype.append_puj7f4$=function(t,e){this.validateValue_61zpoe$(e),this.ensureListForKey_fsrbb4$_0(t,1).add_11rb$(e)},He.prototype.appendAll_hb0ubp$=function(t){var e;t.forEach_ubvtmq$((e=this,function(t,n){return e.appendAll_poujtz$(t,n),N}))},He.prototype.appendMissing_hb0ubp$=function(t){var e;t.forEach_ubvtmq$((e=this,function(t,n){return e.appendMissing_poujtz$(t,n),N}))},He.prototype.appendAll_poujtz$=function(t,n){var i,r,o,a,s=this.ensureListForKey_fsrbb4$_0(t,null!=(o=null!=(r=e.isType(i=n,$t)?i:null)?r.size:null)?o:2);for(a=n.iterator();a.hasNext();){var l=a.next();this.validateValue_61zpoe$(l),s.add_11rb$(l)}},He.prototype.appendMissing_poujtz$=function(t,e){var n,i,r,o=null!=(i=null!=(n=this.values.get_11rb$(t))?gt(n):null)?i:bt(),a=St();for(r=e.iterator();r.hasNext();){var s=r.next();o.contains_11rb$(s)||a.add_11rb$(s)}this.appendAll_poujtz$(t,a)},He.prototype.remove_61zpoe$=function(t){this.values.remove_11rb$(t)},He.prototype.removeKeysWithNoEntries=function(){var t,e,n=this.values,i=Y();for(e=n.entries.iterator();e.hasNext();){var r=e.next();r.value.isEmpty()&&i.put_xwzc9p$(r.key,r.value)}for(t=i.entries.iterator();t.hasNext();){var o=t.next().key;this.remove_61zpoe$(o)}},He.prototype.remove_puj7f4$=function(t,e){var n,i;return null!=(i=null!=(n=this.values.get_11rb$(t))?n.remove_11rb$(e):null)&&i},He.prototype.clear=function(){this.values.clear()},He.prototype.build=function(){if(this.built)throw xt("ValueMapBuilder can only build a single ValueMap".toString());return this.built=!0,new Be(this.caseInsensitiveName,this.values)},He.prototype.validateName_61zpoe$=function(t){},He.prototype.validateValue_61zpoe$=function(t){},He.prototype.ensureListForKey_fsrbb4$_0=function(t,e){var n,i;if(this.built)throw f("Cannot modify a builder when final structure has already been built");if(null!=(n=this.values.get_11rb$(t)))i=n;else{var r=lt(e);this.validateName_61zpoe$(t),this.values.put_xwzc9p$(t,r),i=r}return i},He.$metadata$={kind:p,simpleName:"StringValuesBuilder",interfaces:[]},We.prototype.equals=function(t){var n,i,r;return!0===(null!=(r=null!=(i=e.isType(n=t,We)?n:null)?i.content:null)?_t(r,this.content,!0):null)},We.prototype.hashCode=function(){return this.hash_0},We.prototype.toString=function(){return this.content},We.$metadata$={kind:p,simpleName:"CaseInsensitiveString",interfaces:[]},Ge.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},Ge.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},Ge.$metadata$={kind:p,interfaces:[Lt]};var Ze=new jt("data");Object.defineProperty(Je.prototype,"data_0",{configurable:!0,get:function(){return this.data_euorsu$_0.getValue_lrcp0p$(this,Ze)},set:function(t){this.data_euorsu$_0.setValue_9rddgb$(this,Ze,t)}});var Qe=new jt("size");function Xe(t,e){this.this$ConcurrentList=t,this.current_cc9gdq$_0=new Ge(e)}Object.defineProperty(Je.prototype,"size",{configurable:!0,get:function(){return this.size_emamgl$_0.getValue_lrcp0p$(this,Qe)},set:function(t){this.size_emamgl$_0.setValue_9rddgb$(this,Qe,t)}}),Je.prototype.hashCode=function(){var t,e=7;for(t=this.iterator();t.hasNext();){var n,i=t.next(),r=e;e=Le().combine_jiburq$([r,null!=(n=null!=i?B(i):null)?n:0])}return e},Je.prototype.equals=function(t){var n;t:do{if(null==t||!e.isType(t,Tt)||t.size!==this.size){n=!1;break t}var i,r,o=0;for(i=this.iterator();i.hasNext();){var a=i.next();if(!U(t.get_za3lpa$(Dt((r=o,o=r+1|0,r))),a)){n=!1;break t}}n=!0}while(0);return n},Je.prototype.toString=function(){var t,e,n=k();n.append_s8itvh$(91);var i=0;for(t=this.iterator();t.hasNext();){var r=t.next(),o=Dt((i=(e=i)+1|0,e));n.append_pdl1vj$(r.toString()),(o+1|0)=0},Je.prototype.containsAll_brywnq$=function(t){var n;t:do{var i;if(e.isType(t,$t)&&t.isEmpty()){n=!0;break t}for(i=t.iterator();i.hasNext();){var r=i.next();if(!this.contains_11rb$(r)){n=!1;break t}}n=!0}while(0);return n},Je.prototype.get_za3lpa$=function(t){if(t>=this.size)throw Pt();return V(this.data_0.get_za3lpa$(t))},Je.prototype.indexOf_11rb$=function(t){var e;e=this.size;for(var n=0;n=0;e--)if(U(this.data_0.get_za3lpa$(e),t))return e;return-1},Je.prototype.add_11rb$=function(t){return this.size>=this.data_0.size&&this.increaseCapacity_0(),this.data_0.set_wxm5ur$(this.size,t),this.size=this.size+1|0,!0},Je.prototype.add_wxm5ur$=function(t,e){this.reserve_0(t,1),this.data_0.set_wxm5ur$(t,e)},Je.prototype.addAll_u57x28$=function(t,e){var n;this.reserve_0(t,e.size);var i=t;for(n=e.iterator();n.hasNext();){var r=n.next();this.data_0.set_wxm5ur$(i,r),i=i+1|0}return!e.isEmpty()},Je.prototype.addAll_brywnq$=function(t){t:do{var n;if(e.isType(t,$t)&&t.isEmpty())break t;for(n=t.iterator();n.hasNext();){var i=n.next();if(!this.add_11rb$(i))break t}}while(0);return!t.isEmpty()},Je.prototype.clear=function(){this.data_0=new Ln(32),this.size=0},Je.prototype.iterator=function(){return this.listIterator()},Je.prototype.listIterator=function(){return this.listIterator_za3lpa$(0)};var tn,en=new jt("current");function nn(t){this.value_0=t}function rn(t,e){void 0===t&&(t=new gr),void 0===e&&(e=32),this.lock_0=t,this.table_7ekke8$_0=new nn(new Ln(e)),this.insertionOrder_w7s5d3$_0=new nn(new On),this._size_0=0,It(this)}Object.defineProperty(Xe.prototype,"current",{configurable:!0,get:function(){return this.current_cc9gdq$_0.getValue_lrcp0p$(this,en)},set:function(t){this.current_cc9gdq$_0.setValue_9rddgb$(this,en,t)}}),Xe.prototype.hasNext=function(){return this.current0},Xe.prototype.nextIndex=function(){return this.current+1|0},Xe.prototype.previous=function(){var t;return this.this$ConcurrentList.get_za3lpa$((t=this.current,this.current=t-1|0,t))},Xe.prototype.previousIndex=function(){return this.current-1|0},Xe.prototype.add_11rb$=function(t){this.this$ConcurrentList.add_wxm5ur$(this.current,t)},Xe.prototype.set_11rb$=function(t){this.this$ConcurrentList.set_wxm5ur$(this.current-1|0,t)},Xe.$metadata$={kind:p,interfaces:[Rt]},Je.prototype.listIterator_za3lpa$=function(t){return new Xe(this,t)},Je.prototype.subList_vux9f0$=function(t,e){return new cn(this,t,e)},Je.prototype.remove_11rb$=function(t){var e=this.indexOf_11rb$(t);return!(e<0||(this.removeAt_za3lpa$(e),0))},Je.prototype.removeAll_brywnq$=function(t){var e,n={v:!1};for(e=t.iterator();e.hasNext();){var i=e.next();n.v=this.remove_11rb$(i)||n.v}return n.v},Je.prototype.removeAt_za3lpa$=function(t){this.checkIndex_0(t);var e=this.data_0.get_za3lpa$(t);return this.data_0.set_wxm5ur$(t,null),this.sweep_0(t),V(e)},Je.prototype.retainAll_brywnq$=function(t){var e,n=!1,i=-1;e=this.size;for(var r=0;r=this.size||t<0)throw At()},Je.prototype.increaseCapacity_0=function(t){var e;void 0===t&&(t=2*this.data_0.size|0);var n=new Ln(t);e=this.data_0.size;for(var i=0;i=t;)this.data_0.set_wxm5ur$(r+e|0,this.data_0.get_za3lpa$(r)),r=r-1|0;n=t+e|0;for(var o=t;otn&&n.upsize_0();var t,e=n.findOrCreateBucket_0(i);t:do{var o;for(o=e.iterator();o.hasNext();){var a=o.next(),s=i;if(U(a.key,s)){t=a;break t}}t=null}while(0);var l=t;if(null!=l){var c=l.value;return l.value=r,c}var u=new wn(i,r),p=n.insertionOrder_0.appendLast_trkh7z$(u);return u.backReference_8be2vx$=p,e.appendFirst_trkh7z$(u),++n._size_0,null}));var n,i,r},rn.prototype.putAll_a2k3zr$=function(t){var e;for(e=t.entries.iterator();e.hasNext();){var n=e.next(),i=n.key,r=n.value;this.put_xwzc9p$(i,r)}},rn.prototype.remove_11rb$=function(t){return this.locked_0((e=t,n=this,function(){var t;if(null==(t=n.findBucket_0(e)))return null;for(var i=t.iterator(),r=e,o=n;i.hasNext();){var a=i.next();if(U(a.key,r)){var s=a.value;return--o._size_0,a.remove_8be2vx$(),i.remove(),s}}return null}));var e,n},Object.defineProperty(rn.prototype,"entries",{configurable:!0,get:function(){return new xn(this)}}),Object.defineProperty(rn.prototype,"keys",{configurable:!0,get:function(){return new un(this)}}),Object.defineProperty(rn.prototype,"values",{configurable:!0,get:function(){return new hn(this)}}),rn.prototype.equals=function(t){return this.locked_0((n=t,i=this,function(){var t;if(null==n||!e.isType(n,Z)||n.size!==i.size)return!1;for(t=n.entries.iterator();t.hasNext();){var r,o=t.next(),a=o.key,s=o.value,l=i;if(!U((e.isType(r=l,Z)?r:Q()).get_11rb$(a),s))return!1}return!0}));var n,i},rn.prototype.hashCode=function(){return this.locked_0((t=this,function(){var e,n=7;for(e=t.entries.iterator();e.hasNext();){var i=e.next(),r=i.key,o=i.value;n=Le().combine_jiburq$([B(r),B(o),n])}return n}));var t},rn.prototype.toString=function(){return this.locked_0((t=this,function(){var e,n,i=k(),r=t;i.append_pdl1vj$("{");var o=0;for(e=r.entries.iterator();e.hasNext();){var a=e.next(),s=Dt((o=(n=o)+1|0,n)),l=a.key,c=a.value;i.append_pdl1vj$(l.toString()+"="+c),s!==(r.size-1|0)&&i.append_pdl1vj$(", ")}return i.append_pdl1vj$("}"),i.toString()}));var t};var ln=new jt("current");function cn(t,e,n){qt.call(this),this.origin_0=t,this.fromIndex_0=e,this.toIndex_0=n}function un(t){this.delegate_0=t,It(this)}function pn(t){this.delegateIterator_0=t.delegate_0.iterator_8be2vx$(),It(this)}function hn(t){this.delegate_0=t,It(this)}function fn(t){this.delegateIterator=t.delegate_0.iterator_8be2vx$(),It(this)}function dn(t){this.value_0=t}function _n(t){this.previous_anlnpc$_0=new dn(t)}Object.defineProperty(sn.prototype,"current_0",{configurable:!0,get:function(){return this.current_cx5bh6$_0.getValue_lrcp0p$(this,ln)},set:function(t){this.current_cx5bh6$_0.setValue_9rddgb$(this,ln,t)}}),Object.defineProperty(sn.prototype,"previous_0",{configurable:!0,get:function(){var t;return null!=(t=this.current_0)?t.previous:null}}),sn.prototype.hasNext=function(){return null!=this.current_0},sn.prototype.next=function(){var t,e=V(V(this.current_0).item);return this.current_0=null!=(t=this.current_0)?t.next:null,e},sn.prototype.remove=function(){var t=V(V(this.previous_0).item);this.this$ConcurrentMap.remove_11rb$(t.key)},sn.$metadata$={kind:p,interfaces:[ot]},rn.prototype.iterator_8be2vx$=function(){return new sn(this)},rn.prototype.getOrDefault_c5ybai$=function(t,e){var n,i,r,o,a=this.lock_0;try{a.lock(),n=(i=t,r=e,o=this,function(){return o.computeIfAbsent_c5ybai$(i,r)})()}finally{a.unlock()}return n},rn.prototype.computeIfAbsent_c5ybai$=function(t,e){return this.locked_0((n=t,i=this,r=e,function(){var t=i.get_11rb$(n);if(null!=t)return t;var e=r();return i.put_xwzc9p$(n,e),e}));var n,i,r},rn.prototype.findBucket_0=function(t){var e=B(t)&this.table_0.size-1;return this.table_0.get_za3lpa$(e)},rn.prototype.findOrCreateBucket_0=function(t){var e=B(t)&this.table_0.size-1,n=this.table_0.get_za3lpa$(e);if(null==n){var i=new On;return this.table_0.set_wxm5ur$(e,i),i}return n},rn.prototype.upsize_0=function(){var t=new rn(void 0,2*this.table_0.size|0);t.putAll_a2k3zr$(this),this.table_0=t.table_0},rn.prototype.locked_0=function(t){var e,n,i=this.lock_0;try{i.lock(),e=(n=t,function(){return n()})()}finally{i.unlock()}return e},rn.$metadata$={kind:p,simpleName:"ConcurrentMap",interfaces:[H]},Object.defineProperty(cn.prototype,"size",{configurable:!0,get:function(){var t=this.origin_0.size,e=this.toIndex_0-this.fromIndex_0|0;return Ft.min(t,e)}}),cn.prototype.get_za3lpa$=function(t){return this.origin_0.get_za3lpa$(this.fromIndex_0+t|0)},cn.prototype.add_wxm5ur$=function(t,e){throw f("Unsupported append in ConcurrentList slice".toString())},cn.prototype.removeAt_za3lpa$=function(t){throw f("Unsupported remove in ConcurrentList slice".toString())},cn.prototype.set_wxm5ur$=function(t,e){return this.origin_0.set_wxm5ur$(this.fromIndex_0+t|0,e)},cn.$metadata$={kind:p,simpleName:"ConcurrentListSlice",interfaces:[qt]},un.prototype.add_11rb$=function(t){throw Ut()},un.prototype.addAll_brywnq$=function(t){throw Ut()},un.prototype.clear=function(){this.delegate_0.clear()},pn.prototype.hasNext=function(){return this.delegateIterator_0.hasNext()},pn.prototype.next=function(){return this.delegateIterator_0.next().key},pn.prototype.remove=function(){this.delegateIterator_0.remove()},pn.$metadata$={kind:p,interfaces:[ot]},un.prototype.iterator=function(){return new pn(this)},un.prototype.remove_11rb$=function(t){return null!=this.delegate_0.remove_11rb$(t)},un.prototype.removeAll_brywnq$=function(t){var e,n={v:!1};for(e=t.iterator();e.hasNext();){var i=e.next();n.v=this.remove_11rb$(i)||n.v}return n.v},un.prototype.retainAll_brywnq$=function(t){for(var e={v:!1},n=this.iterator();n.hasNext();)t.contains_11rb$(n.next())||(e.v=!0,n.remove());return e.v},Object.defineProperty(un.prototype,"size",{configurable:!0,get:function(){return this.delegate_0.size}}),un.prototype.contains_11rb$=function(t){var n,i=this.delegate_0;return(e.isType(n=i,Z)?n:Q()).containsKey_11rb$(t)},un.prototype.containsAll_brywnq$=function(t){var n;t:do{var i;if(e.isType(t,$t)&&t.isEmpty()){n=!0;break t}for(i=t.iterator();i.hasNext();){var r=i.next();if(!this.contains_11rb$(r)){n=!1;break t}}n=!0}while(0);return n},un.prototype.isEmpty=function(){return 0===this.size},un.$metadata$={kind:p,simpleName:"ConcurrentMapKeys",interfaces:[G]},Object.defineProperty(hn.prototype,"size",{configurable:!0,get:function(){return this.delegate_0.size}}),hn.prototype.contains_11rb$=function(t){return this.delegate_0.containsValue_11rc$(t)},hn.prototype.containsAll_brywnq$=function(t){var n;t:do{var i;if(e.isType(t,$t)&&t.isEmpty()){n=!0;break t}for(i=t.iterator();i.hasNext();){var r=i.next();if(!this.contains_11rb$(r)){n=!1;break t}}n=!0}while(0);return n},hn.prototype.isEmpty=function(){return 0===this.delegate_0.size},hn.prototype.add_11rb$=function(t){throw Ut()},hn.prototype.addAll_brywnq$=function(t){throw Ut()},hn.prototype.clear=function(){this.delegate_0.clear()},fn.prototype.hasNext=function(){return this.delegateIterator.hasNext()},fn.prototype.next=function(){return this.delegateIterator.next().value},fn.prototype.remove=function(){this.delegateIterator.remove()},fn.$metadata$={kind:p,interfaces:[ot]},hn.prototype.iterator=function(){return new fn(this)},hn.prototype.remove_11rb$=function(t){for(var e={v:!1},n=this.iterator();n.hasNext();)U(n.next(),t)||(e.v=!0,n.remove());return e.v},hn.prototype.removeAll_brywnq$=function(t){for(var e={v:!1},n=this.iterator();n.hasNext();)t.contains_11rb$(n.next())&&(e.v=!0,n.remove());return e.v},hn.prototype.retainAll_brywnq$=function(t){throw f("Common concurrent map doesn't support this operation yet.".toString())},hn.$metadata$={kind:p,simpleName:"ConcurrentMapValues",interfaces:[zt]},dn.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},dn.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},dn.$metadata$={kind:p,interfaces:[Lt]};var yn=new jt("previous");function mn(t){this.value_0=t}function vn(t,e,n,i){this.list_0=t,this.item=n,this.next_lyuus8$_0=new mn(e),this.previous_mhuox8$_0=new mn(i),It(this)}Object.defineProperty(_n.prototype,"previous",{configurable:!0,get:function(){return this.previous_anlnpc$_0.getValue_lrcp0p$(this,yn)},set:function(t){this.previous_anlnpc$_0.setValue_9rddgb$(this,yn,t)}}),Object.defineProperty(_n.prototype,"current",{configurable:!0,get:function(){var t;return null!=(t=this.previous)?t.next:null}}),_n.prototype.hasNext=function(){var t;return null!=(null!=(t=this.current)?t.item:null)},_n.prototype.next=function(){var t,e;if(this.previous=this.current,null==(e=null!=(t=this.previous)?t.item:null))throw Pt();return e},_n.prototype.remove=function(){var t;if(null==(null!=(t=this.previous)?(t.remove(),N):null))throw f("Fail to remove element before iteration".toString())},_n.$metadata$={kind:p,simpleName:"ForwardListIterator",interfaces:[ot]},mn.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},mn.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},mn.$metadata$={kind:p,interfaces:[Lt]};var $n=new jt("next");Object.defineProperty(vn.prototype,"next",{configurable:!0,get:function(){return this.next_lyuus8$_0.getValue_lrcp0p$(this,$n)},set:function(t){this.next_lyuus8$_0.setValue_9rddgb$(this,$n,t)}});var gn=new jt("previous");function bn(t){this.value_0=t}function wn(t,e){this.key_q49qr5$_0=t,this.backReference_8be2vx$_ku6rvk$_0=new bn(null),this.value_v8fgin$_0=new bn(e);var n,i=this.key;this.hash=null!=(n=null!=i?B(i):null)?n:0,It(this)}Object.defineProperty(vn.prototype,"previous",{configurable:!0,get:function(){return this.previous_mhuox8$_0.getValue_lrcp0p$(this,gn)},set:function(t){this.previous_mhuox8$_0.setValue_9rddgb$(this,gn,t)}}),vn.prototype.insertAfter_trkh7z$=function(t){var e=new vn(this.list_0,this.next,t,this);return this.next=e,e},vn.prototype.removeNext=function(){var t,e;U(this.next,this.list_0.tail_8be2vx$)&&(this.list_0.tail_8be2vx$=this),this.next=null!=(t=this.next)?t.next:null,null!=(e=this.next)&&(e.previous=this)},vn.prototype.remove=function(){V(this.previous).removeNext()},vn.$metadata$={kind:p,simpleName:"ForwardListNode",interfaces:[]},bn.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},bn.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},bn.$metadata$={kind:p,interfaces:[Lt]},Object.defineProperty(wn.prototype,"key",{get:function(){return this.key_q49qr5$_0}});var kn=new jt("backReference");Object.defineProperty(wn.prototype,"backReference_8be2vx$",{configurable:!0,get:function(){return this.backReference_8be2vx$_ku6rvk$_0.getValue_lrcp0p$(this,kn)},set:function(t){this.backReference_8be2vx$_ku6rvk$_0.setValue_9rddgb$(this,kn,t)}});var Sn=new jt("value");function xn(t){this.delegate_0=t,It(this)}function En(t){this.origin_0=t.delegate_0.iterator_8be2vx$()}function Cn(t){this.value_0=t}function On(){this.head_8be2vx$_7kv0go$_0=new Cn(null),this.tail_8be2vx$_w7xtpk$_0=new Cn(this.head_8be2vx$),It(this),this.head_8be2vx$=new vn(this,null,null,null),this.tail_8be2vx$=this.head_8be2vx$}Object.defineProperty(wn.prototype,"value",{configurable:!0,get:function(){return this.value_v8fgin$_0.getValue_lrcp0p$(this,Sn)},set:function(t){this.value_v8fgin$_0.setValue_9rddgb$(this,Sn,t)}}),wn.prototype.setValue_11rc$=function(t){var e=this.value;return this.value=t,e},wn.prototype.remove_8be2vx$=function(){V(this.backReference_8be2vx$).remove(),this.backReference_8be2vx$=null},wn.prototype.toString=function(){return"MapItem["+this.key+", "+this.value+"]"},wn.$metadata$={kind:p,simpleName:"MapNode",interfaces:[W]},xn.prototype.add_11rb$=function(t){return!U(this.delegate_0.put_xwzc9p$(t.key,t.value),t.value)},xn.prototype.addAll_brywnq$=function(t){var e,n={v:!1};for(e=t.iterator();e.hasNext();){var i=e.next();n.v=this.add_11rb$(i)||n.v}return n.v},xn.prototype.clear=function(){this.delegate_0.clear()},En.prototype.hasNext=function(){return this.origin_0.hasNext()},En.prototype.next=function(){return this.origin_0.next()},En.prototype.remove=function(){this.origin_0.remove()},En.$metadata$={kind:p,interfaces:[ot]},xn.prototype.iterator=function(){return new En(this)},xn.prototype.remove_11rb$=function(t){return null!=this.delegate_0.remove_11rb$(t.key)},xn.prototype.removeAll_brywnq$=function(t){var e,n={v:!1};for(e=t.iterator();e.hasNext();){var i=e.next();n.v=this.remove_11rb$(i)||n.v}return n.v},xn.prototype.retainAll_brywnq$=function(t){for(var e={v:!1},n=this.iterator();n.hasNext();)t.contains_11rb$(n.next())||(e.v=!0,n.remove());return e.v},Object.defineProperty(xn.prototype,"size",{configurable:!0,get:function(){return this.delegate_0.size}}),xn.prototype.contains_11rb$=function(t){return U(this.delegate_0.get_11rb$(t.key),t.value)},xn.prototype.containsAll_brywnq$=function(t){var n;t:do{var i;if(e.isType(t,$t)&&t.isEmpty()){n=!0;break t}for(i=t.iterator();i.hasNext();){var r=i.next();if(!this.contains_11rb$(r)){n=!1;break t}}n=!0}while(0);return n},xn.prototype.isEmpty=function(){return this.delegate_0.isEmpty()},xn.$metadata$={kind:p,simpleName:"MutableMapEntries",interfaces:[G]},Cn.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},Cn.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},Cn.$metadata$={kind:p,interfaces:[Lt]};var Nn=new jt("head");Object.defineProperty(On.prototype,"head_8be2vx$",{configurable:!0,get:function(){return this.head_8be2vx$_7kv0go$_0.getValue_lrcp0p$(this,Nn)},set:function(t){this.head_8be2vx$_7kv0go$_0.setValue_9rddgb$(this,Nn,t)}});var zn,jn,Tn,Pn,Rn,An,In,Mn=new jt("tail");function Ln(t){this.size_4if4fg$_0=t,this.data_0=Array(this.size),It(this)}function Dn(t,e){this.this$SharedList=t,this.currentIndex_0=e,It(this)}function qn(t,e,n){Kt.call(this),this.value=n,this.name$=t,this.ordinal$=e}function Fn(){Fn=function(){},zn=new qn("MONDAY",0,"Mon"),jn=new qn("TUESDAY",1,"Tue"),Tn=new qn("WEDNESDAY",2,"Wed"),Pn=new qn("THURSDAY",3,"Thu"),Rn=new qn("FRIDAY",4,"Fri"),An=new qn("SATURDAY",5,"Sat"),In=new qn("SUNDAY",6,"Sun"),ci()}function Un(){return Fn(),zn}function Bn(){return Fn(),jn}function Hn(){return Fn(),Tn}function Vn(){return Fn(),Pn}function Kn(){return Fn(),Rn}function Wn(){return Fn(),An}function Yn(){return Fn(),In}function Gn(){li=this}Object.defineProperty(On.prototype,"tail_8be2vx$",{configurable:!0,get:function(){return this.tail_8be2vx$_w7xtpk$_0.getValue_lrcp0p$(this,Mn)},set:function(t){this.tail_8be2vx$_w7xtpk$_0.setValue_9rddgb$(this,Mn,t)}}),On.prototype.first=function(){return V(this.head_8be2vx$).next},On.prototype.last=function(){return U(this.head_8be2vx$,this.tail_8be2vx$)?null:this.tail_8be2vx$},On.prototype.appendFirst_trkh7z$=function(t){var e=V(this.head_8be2vx$).insertAfter_trkh7z$(t);return U(this.head_8be2vx$,this.tail_8be2vx$)&&(this.tail_8be2vx$=e),e},On.prototype.appendLast_trkh7z$=function(t){return this.tail_8be2vx$=V(this.tail_8be2vx$).insertAfter_trkh7z$(t),V(this.tail_8be2vx$)},On.prototype.iterator=function(){return new _n(V(this.head_8be2vx$))},On.$metadata$={kind:p,simpleName:"SharedForwardList",interfaces:[Bt]},Object.defineProperty(Ln.prototype,"size",{get:function(){return this.size_4if4fg$_0}}),Ln.prototype.set_wxm5ur$=function(t,e){this.data_0[t]=e},Ln.prototype.contains_11rb$=function(t){var e;e=this.size;for(var n=0;n0},Dn.prototype.next=function(){if(!this.hasNext())throw f("Check failed.".toString());var t=this.currentIndex_0++;return this.this$SharedList.data_0[t]},Dn.prototype.nextIndex=function(){if(!this.hasNext())throw f("Check failed.".toString());return this.currentIndex_0+1|0},Dn.prototype.previous=function(){if(!this.hasPrevious())throw f("Check failed.".toString());var t=this.currentIndex_0--;return this.this$SharedList.data_0[t]},Dn.prototype.previousIndex=function(){if(!this.hasPrevious())throw f("Check failed.".toString());return this.currentIndex_0-1|0},Dn.$metadata$={kind:p,interfaces:[Vt]},Ln.prototype.listIterator_za3lpa$=function(t){return new Dn(this,t)},Ln.prototype.subList_vux9f0$=function(t,e){for(var n=new Ln(e-t|0),i=t;i=this.interceptors_0.size?(this.finish(),this.subject):this.proceedLoop_0(t)},Pi.prototype.execute_11rb$=function(t,e){return this.index_0=0,this.subject=t,this.proceed(e)},Ri.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[j]},Ri.prototype=Object.create(j.prototype),Ri.prototype.constructor=Ri,Ri.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$index=this.$this.index_0,-1===this.local$index){this.state_0=6;continue}this.state_0=3;continue;case 3:if(this.local$interceptors=this.$this.interceptors_0,this.local$index>=this.local$interceptors.size){this.$this.finish(),this.state_0=6;continue}this.state_0=4;continue;case 4:var t=this.local$interceptors.get_za3lpa$(this.local$index);if(this.$this.index_0=this.local$index+1|0,this.state_0=5,this.result_0=t(this.$this,this.$this.subject,this),this.result_0===z)return z;continue;case 5:this.state_0=2;continue;case 6:return this.$this.subject;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Pi.prototype.proceedLoop_0=function(t,e){var n=new Ri(this,t);return e?n:n.doResume(null)},Pi.$metadata$={kind:p,simpleName:"DebugPipelineContext",interfaces:[Gi,Yi]},Ai.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},Ai.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},Ai.$metadata$={kind:p,interfaces:[Lt]};var Mi=new jt("interceptors");Object.defineProperty(Ii.prototype,"interceptors_0",{configurable:!0,get:function(){return this.interceptors_7b9p4m$_0.getValue_lrcp0p$(this,Mi)},set:function(t){this.interceptors_7b9p4m$_0.setValue_9rddgb$(this,Mi,t)}});var Li=new jt("shared");function Di(){qi=this,this.SharedArrayList=Ye([])}Object.defineProperty(Ii.prototype,"shared",{configurable:!0,get:function(){return this.shared_t2yicf$_0.getValue_lrcp0p$(this,Li)},set:function(t){this.shared_t2yicf$_0.setValue_9rddgb$(this,Li,t)}}),Object.defineProperty(Ii.prototype,"isEmpty",{configurable:!0,get:function(){return this.interceptors_0.isEmpty()}}),Object.defineProperty(Ii.prototype,"size",{configurable:!0,get:function(){return this.interceptors_0.size}}),Ii.prototype.addInterceptor_mx8w25$=function(t){this.shared&&this.copyInterceptors_0(),this.interceptors_0.add_11rb$(t)},Ii.prototype.addTo_m9oilt$=function(t){var n,i=this.interceptors_0;e.isType(t,Jt)&&t.ensureCapacity_za3lpa$(t.size+i.size|0),n=i.size;for(var r=0;r=this._delta8){var n=(t=this.pending).length%this._delta8;this.pending=t.slice(t.length-n,t.length),0===this.pending.length&&(this.pending=null),t=i.join32(t,0,t.length-n,this.endian);for(var r=0;r>>24&255,i[r++]=t>>>16&255,i[r++]=t>>>8&255,i[r++]=255&t}else for(i[r++]=255&t,i[r++]=t>>>8&255,i[r++]=t>>>16&255,i[r++]=t>>>24&255,i[r++]=0,i[r++]=0,i[r++]=0,i[r++]=0,o=8;o=0&&t.onCreate(),e.compareTo_11rb$(_t())>=0&&t.onStart(),e.compareTo_11rb$(yt())>=0&&t.onResume()},Ct.prototype.unsubscribe_cj0qf$=function(t){if(!this.callbacks_0.contains_11rb$(t))throw w("Not subscribed".toString());this.callbacks_0=d(this.callbacks_0,t)},Ct.prototype.onCreate=function(){var t;for(this.checkState_0(ft()),this._state_0=dt(),t=this.callbacks_0.iterator();t.hasNext();)t.next().onCreate()},Ct.prototype.onStart=function(){var t;for(this.checkState_0(dt()),this._state_0=_t(),t=this.callbacks_0.iterator();t.hasNext();)t.next().onStart()},Ct.prototype.onResume=function(){var t;for(this.checkState_0(_t()),this._state_0=yt(),t=this.callbacks_0.iterator();t.hasNext();)t.next().onResume()},Ct.prototype.onPause=function(){var t;for(this.checkState_0(yt()),this._state_0=_t(),t=_(this.callbacks_0).iterator();t.hasNext();)t.next().onPause()},Ct.prototype.onStop=function(){var t;for(this.checkState_0(_t()),this._state_0=dt(),t=_(this.callbacks_0).iterator();t.hasNext();)t.next().onStop()},Ct.prototype.onDestroy=function(){var t;for(this.checkState_0(dt()),this._state_0=ht(),t=_(this.callbacks_0).iterator();t.hasNext();)t.next().onDestroy()},Ct.prototype.checkState_0=function(t){if(this._state_0!==t){var e="Expected state "+t+" but was "+this._state_0;throw w(e.toString())}},Ct.$metadata$={kind:s,simpleName:"LifecycleRegistryImpl",interfaces:[$t]},Nt.prototype.onCreate=function(){this.onUp_0(dt(),c("onCreate",function(t){return t.onCreate(),k}.bind(null,this.$outer.registry_0)))},Nt.prototype.onStart=function(){this.onUp_0(_t(),c("onStart",function(t){return t.onStart(),k}.bind(null,this.$outer.registry_0)))},Nt.prototype.onResume=function(){this.onUp_0(yt(),c("onResume",function(t){return t.onResume(),k}.bind(null,this.$outer.registry_0)))},Nt.prototype.onPause=function(){this.onDown_0(_t(),c("onPause",function(t){return t.onPause(),k}.bind(null,this.$outer.registry_0)))},Nt.prototype.onStop=function(){this.onDown_0(dt(),c("onStop",function(t){return t.onStop(),k}.bind(null,this.$outer.registry_0)))},Nt.prototype.onDestroy=function(){this.onDown_0(ft(),c("onDestroy",function(t){return t.onDestroy(),k}.bind(null,this.$outer.registry_0)))},Nt.prototype.onUp_0=function(t,e){this.onStateChanged_0(t),t.compareTo_11rb$(this.otherState_0())<=0&&e()},Nt.prototype.onDown_0=function(t,e){t.compareTo_11rb$(this.otherState_0())<0&&e(),this.onStateChanged_0(t)},Nt.$metadata$={kind:s,simpleName:"LifecycleObserverImpl",interfaces:[lt]},Object.defineProperty(Ot.prototype,"state",{configurable:!0,get:function(){return this.registry_0.state}}),Ot.prototype.subscribe_cj0qf$=function(t){return this.registry_0.subscribe_cj0qf$(t)},Ot.prototype.unsubscribe_cj0qf$=function(t){return this.registry_0.unsubscribe_cj0qf$(t)},Ot.$metadata$={kind:s,simpleName:"MergedLifecycle",interfaces:[ct]},Object.defineProperty(Tt.prototype,"configuration",{get:function(){return this.configuration_xkcunr$_0}}),Object.defineProperty(Tt.prototype,"savedState",{get:function(){return this.savedState_j09t7n$_0}}),Tt.$metadata$={kind:s,simpleName:"Created",interfaces:[jt]},Tt.prototype.component1=function(){return this.configuration},Tt.prototype.component2=function(){return this.savedState},Tt.prototype.component3=function(){return this.component},Tt.prototype.component4=function(){return this.lifecycleRegistry},Tt.prototype.component5=function(){return this.stateKeeperDispatcher},Tt.prototype.component6=function(){return this.instanceKeeperDispatcher},Tt.prototype.component7=function(){return this.backPressedDispatcher},Tt.prototype.copy_go6qks$=function(t,e,n,i,r,o,a){return new Tt(void 0===t?this.configuration:t,void 0===e?this.savedState:e,void 0===n?this.component:n,void 0===i?this.lifecycleRegistry:i,void 0===r?this.stateKeeperDispatcher:r,void 0===o?this.instanceKeeperDispatcher:o,void 0===a?this.backPressedDispatcher:a)},Tt.prototype.toString=function(){return"Created(configuration="+e.toString(this.configuration)+", savedState="+e.toString(this.savedState)+", component="+e.toString(this.component)+", lifecycleRegistry="+e.toString(this.lifecycleRegistry)+", stateKeeperDispatcher="+e.toString(this.stateKeeperDispatcher)+", instanceKeeperDispatcher="+e.toString(this.instanceKeeperDispatcher)+", backPressedDispatcher="+e.toString(this.backPressedDispatcher)+")"},Tt.prototype.hashCode=function(){var t=0;return t=31*(t=31*(t=31*(t=31*(t=31*(t=31*(t=31*t+e.hashCode(this.configuration)|0)+e.hashCode(this.savedState)|0)+e.hashCode(this.component)|0)+e.hashCode(this.lifecycleRegistry)|0)+e.hashCode(this.stateKeeperDispatcher)|0)+e.hashCode(this.instanceKeeperDispatcher)|0)+e.hashCode(this.backPressedDispatcher)|0},Tt.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.configuration,t.configuration)&&e.equals(this.savedState,t.savedState)&&e.equals(this.component,t.component)&&e.equals(this.lifecycleRegistry,t.lifecycleRegistry)&&e.equals(this.stateKeeperDispatcher,t.stateKeeperDispatcher)&&e.equals(this.instanceKeeperDispatcher,t.instanceKeeperDispatcher)&&e.equals(this.backPressedDispatcher,t.backPressedDispatcher)},Object.defineProperty(Pt.prototype,"configuration",{get:function(){return this.configuration_vufsfa$_0}}),Object.defineProperty(Pt.prototype,"savedState",{get:function(){return this.savedState_lesury$_0}}),Pt.$metadata$={kind:s,simpleName:"Destroyed",interfaces:[jt]},Pt.prototype.component1=function(){return this.configuration},Pt.prototype.component2=function(){return this.savedState},Pt.prototype.copy_1zc6lu$=function(t,e){return new Pt(void 0===t?this.configuration:t,void 0===e?this.savedState:e)},Pt.prototype.toString=function(){return"Destroyed(configuration="+e.toString(this.configuration)+", savedState="+e.toString(this.savedState)+")"},Pt.prototype.hashCode=function(){var t=0;return t=31*(t=31*t+e.hashCode(this.configuration)|0)+e.hashCode(this.savedState)|0},Pt.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.configuration,t.configuration)&&e.equals(this.savedState,t.savedState)},jt.$metadata$={kind:s,simpleName:"RouterEntry",interfaces:[]},At.prototype.invoke_6glczf$=function(t,e,n,i){return void 0===e&&(e=null),void 0===n&&(n=null),i?i(t,e,n):this.invoke_6glczf$$default(t,e,n)},At.$metadata$={kind:l,simpleName:"RouterEntryFactory",interfaces:[]},It.prototype.invoke_6glczf$$default=function(t,e,n){var i=gt(),r=zt(this.lifecycle_0,i),o=pe(e),a=null!=n?n:ot(),s=Z();return new Tt(t,void 0,this.componentFactory_0(t,D(r,o,a,s)),i,o,a,s)},It.$metadata$={kind:s,simpleName:"RouterEntryFactoryImpl",interfaces:[At]},Ut.prototype.onCreate=function(){this.closure$onCreate()},Ut.prototype.onStart=function(){this.closure$onStart()},Ut.prototype.onResume=function(){this.closure$onResume()},Ut.prototype.onPause=function(){this.closure$onPause()},Ut.prototype.onStop=function(){this.closure$onStop()},Ut.prototype.onDestroy=function(){this.closure$onDestroy()},Ut.$metadata$={kind:s,interfaces:[lt]},Object.defineProperty(Bt.prototype,"state",{configurable:!0,get:function(){return this.state_o71ct6$_0}}),Bt.prototype.destroy_0=function(){this.backPressedRegistry_0.unregister_u332lz$(this.onBackPressedHandler_0)},Bt.prototype.navigate_lbeuw8$=function(t){this.queue_0.addLast_11rb$(t),1===this.queue_0.size&&this.drainQueue_0()},Bt.prototype.drainQueue_0=function(){do{var t,e=this.navigator_0.navigate_uutfxm$(this.stackHolder_0.stack,this.queue_0.first());this.stackHolder_0.stack=e,this.state.value=this.toState_0(e),this.queue_0.removeFirst(),t=!this.queue_0.isEmpty()}while(t)},Bt.prototype.onBackPressed_0=function(){if(this.stackHolder_0.stack.active.backPressedDispatcher.onBackPressed())return!0;var t=this.popOnBackPressed_0;return t&&(t=!this.stackHolder_0.stack.backStack.isEmpty()),!!t&&(B(this),!0)},Bt.prototype.toState_0=function(t){var e,n=new Y(t.active.configuration,t.active.component),i=t.backStack,r=O(C(i,10));for(e=i.iterator();e.hasNext();){var o=e.next();r.add_11rb$(this.toRouterStateEntry_0(o))}return new K(n,r)},Bt.prototype.toRouterStateEntry_0=function(t){return e.isType(t,Tt)?new Y(t.configuration,t.component):e.isType(t,Pt)?new G(t.configuration):e.noWhenBranchMatched()},Bt.$metadata$={kind:s,simpleName:"RouterImpl",interfaces:[H]},Ht.$metadata$={kind:s,simpleName:"RouterStack",interfaces:[]},Ht.prototype.component1=function(){return this.active},Ht.prototype.component2=function(){return this.backStack},Ht.prototype.copy_pejrpx$=function(t,e){return new Ht(void 0===t?this.active:t,void 0===e?this.backStack:e)},Ht.prototype.toString=function(){return"RouterStack(active="+e.toString(this.active)+", backStack="+e.toString(this.backStack)+")"},Ht.prototype.hashCode=function(){var t=0;return t=31*(t=31*t+e.hashCode(this.active)|0)+e.hashCode(this.backStack)|0},Ht.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.active,t.active)&&e.equals(this.backStack,t.backStack)},Vt.$metadata$={kind:l,simpleName:"StackHolder",interfaces:[]},Kt.prototype=Object.create(j.prototype),Kt.prototype.constructor=Kt,Kt.prototype.afterChange_jxtfl0$=function(t,e,n){this.closure$onChange(t,e,n)},Kt.$metadata$={kind:s,interfaces:[j]},Qt.prototype.onCreate=function(){this.closure$onCreate()},Qt.prototype.onStart=function(){this.closure$onStart()},Qt.prototype.onResume=function(){this.closure$onResume()},Qt.prototype.onPause=function(){this.closure$onPause()},Qt.prototype.onStop=function(){this.closure$onStop()},Qt.prototype.onDestroy=function(){this.closure$onDestroy()},Qt.$metadata$={kind:s,interfaces:[lt]};var te=new N("stack");function ee(t,e){this.active=t,this.backStack=e}function ne(t,e){this.configuration=t,this.state=e}function ie(){this.activeEntry=null}function re(){}function oe(t){this.routerEntryFactory_0=t}function ae(){}function se(t){void 0===t&&(t=null);var e=new we;return null!=t&&e.set_xb6vv0$(t),e}function le(t,e){var n=t.consume_6kwwkl$(e);if(null==n)throw A("Required value was null.".toString());return n}function ce(){}function ue(){}function pe(t){return void 0===t&&(t=null),new he(t)}function he(t){var e;this.savedState_0=null!=(e=null!=t?t.consume_6kwwkl$(z(fe)):null)?e.map:null,this.suppliers_0=$()}function fe(t){this.map=t}function de(){}function _e(){ge.call(this)}function ye(t,e){this.closure$onChange=t,j.call(this,e)}function me(t){return new ve(t)}function ve(t){var e;_e.call(this),this.observers_0=y(),this.value_ui44qa$_0=new ye((e=this,function(t,n,i){var r;for(r=e.observers_0.iterator();r.hasNext();)r.next()(i);return k}),t)}Object.defineProperty(Xt.prototype,"stack",{configurable:!0,get:function(){return this.stack_hia3lg$_0.getValue_lrcp0p$(this,te)},set:function(t){this.stack_hia3lg$_0.setValue_9rddgb$(this,te,t)}}),Xt.prototype.destroy_0=function(){this.stateKeeper_0.unregister_61zpoe$(this.key_0);var t=this.stack;Et(t.active.lifecycleRegistry),Rt(t.backStack)},Xt.prototype.initialStack_0=function(t,e){var n,i=this.routerEntryFactory_0.invoke_6glczf$(t),r=O(C(e,10));for(n=e.iterator();n.hasNext();){var o=n.next();r.add_11rb$(new Pt(o))}return new Ht(i,r)},Xt.prototype.restoreStack_0=function(){var t,e;if(null==(t=this.stateKeeper_0.consume_xk4jb$(this.key_0,z(ee))))return null;var n,i=t,r=i.active,o=le(r.configuration,this.configurationClass_0),a=r.state,s=null!=(e=this.retainedInstance_0.activeEntry)?e.instanceKeeperDispatcher:null,l=this.routerEntryFactory_0.invoke_6glczf$(o,a,s),c=i.backStack,u=O(C(c,10));for(n=c.iterator();n.hasNext();){var p=n.next();u.add_11rb$(new Pt(le(p.configuration,this.configurationClass_0),p.state))}return new Ht(l,u)},Xt.prototype.save_0=function(t){var e,n=new ne(this.parcelableContainerFactory_0(t.active.configuration),t.active.stateKeeperDispatcher.save()),i=t.backStack,r=O(C(i,10));for(e=i.iterator();e.hasNext();){var o=e.next();r.add_11rb$(new ne(this.parcelableContainerFactory_0(o.configuration),o.savedState))}return new ee(n,r)},ne.$metadata$={kind:s,simpleName:"Entry",interfaces:[be]},ee.$metadata$={kind:s,simpleName:"SavedState",interfaces:[be]},ie.prototype.onDestroy=function(){var t,e;null!=(e=null!=(t=this.activeEntry)?t.instanceKeeperDispatcher:null)&&e.destroy()},ie.$metadata$={kind:s,simpleName:"RetainedInstance",interfaces:[it]},Xt.$metadata$={kind:s,simpleName:"StackHolderImpl",interfaces:[Vt]},re.$metadata$={kind:l,simpleName:"StackNavigator",interfaces:[]},oe.prototype.navigate_uutfxm$=function(t,n){var i,r=u(t.backStack,t.active),o=S("configuration",1,(function(t){return t.configuration})),a=O(C(r,10));for(i=r.iterator();i.hasNext();){var s=i.next();a.add_11rb$(o(s))}var l=n(a);if(l.isEmpty())throw w("Configuration stack can not be empty".toString());var c,h=T(l);if(h===t.active.configuration)c=t.active;else{var f,d=t.backStack;t:do{var _;for(_=d.iterator();_.hasNext();){var y=_.next();if(y.configuration===h){f=y;break t}}f=null}while(0);var v,$=f;c=e.isType($,Tt)?$.copy_go6qks$(void 0,null):e.isType($,Pt)?this.routerEntryFactory_0.invoke_6glczf$($.configuration,$.savedState):null==$?this.routerEntryFactory_0.invoke_6glczf$(h,null):e.noWhenBranchMatched(),St(t.active.lifecycleRegistry),kt(c.lifecycleRegistry),xt(t.active.lifecycleRegistry);t:do{var g;if(e.isType(l,m)&&l.isEmpty()){v=!0;break t}for(g=l.iterator();g.hasNext();)if(g.next()===t.active.configuration){v=!1;break t}v=!0}while(0);v&&(t.active.instanceKeeperDispatcher.destroy(),Et(t.active.lifecycleRegistry))}var b,k=p(l,1),x=O(C(k,10));for(b=k.iterator();b.hasNext();){var E,N,z=b.next(),j=x.add_11rb$;if(t.active.configuration===z)E=t.active.copy_go6qks$(void 0,t.active.stateKeeperDispatcher.save());else{var R,A=t.backStack;t:do{var I;for(I=A.iterator();I.hasNext();){var M=I.next();if(M.configuration===z){R=M;break t}}R=null}while(0);E=null!=(N=R)?N:new Pt(z)}j.call(x,E)}var L,D=x,q=t.backStack,F=P();for(L=q.iterator();L.hasNext();){var U,B=L.next();t:do{var H;if(e.isType(l,m)&&l.isEmpty()){U=!0;break t}for(H=l.iterator();H.hasNext();)if(H.next()===B.configuration){U=!1;break t}U=!0}while(0);U&&F.add_11rb$(B)}return Rt(F),new Ht(c,D)},oe.$metadata$={kind:s,simpleName:"StackNavigatorImpl",interfaces:[re]},ae.$metadata$={kind:l,simpleName:"ParcelableContainer",interfaces:[be]},ce.$metadata$={kind:l,simpleName:"StateKeeper",interfaces:[]},ue.$metadata$={kind:l,simpleName:"StateKeeperDispatcher",interfaces:[ce]},he.prototype.save=function(){try{var t,n=this.suppliers_0,i=$();for(t=n.entries.iterator();t.hasNext();){var r=t.next();i.put_xwzc9p$(r.key,se(r.value()))}return se(new fe(i))}catch(t){if(e.isType(t,I))return null;throw t}},he.prototype.consume_xk4jb$=function(t,e){var n,i;return null!=(i=null!=(n=this.savedState_0)?n.remove_11rb$(t):null)?i.consume_6kwwkl$(e):null},he.prototype.register_kh27gz$=function(t,n){var i,r=this.suppliers_0;if((e.isType(i=r,R)?i:v()).containsKey_11rb$(t))throw w("Check failed.".toString());this.suppliers_0.put_xwzc9p$(t,n)},he.prototype.unregister_61zpoe$=function(t){var n,i=this.suppliers_0;if(!(e.isType(n=i,R)?n:v()).containsKey_11rb$(t))throw w("Check failed.".toString());this.suppliers_0.remove_11rb$(t)},fe.$metadata$={kind:s,simpleName:"SavedState",interfaces:[be]},he.$metadata$={kind:s,simpleName:"StateKeeperDispatcherImpl",interfaces:[ue]},de.$metadata$={kind:l,simpleName:"StateKeeperOwner",interfaces:[]},_e.$metadata$={kind:s,simpleName:"MutableValue",interfaces:[ge]},ye.prototype=Object.create(j.prototype),ye.prototype.constructor=ye,ye.prototype.afterChange_jxtfl0$=function(t,e,n){this.closure$onChange(t,e,n)},ye.$metadata$={kind:s,interfaces:[j]};var $e=new N("value");function ge(){}function be(){}function we(){this.value_0=null}function ke(t){}Object.defineProperty(ve.prototype,"value",{configurable:!0,get:function(){return this.value_ui44qa$_0.getValue_lrcp0p$(this,$e)},set:function(t){this.value_ui44qa$_0.setValue_9rddgb$(this,$e,t)}}),ve.prototype.subscribe_oh3mgy$=function(t){this.observers_0=f(this.observers_0,t),t(this.value)},ve.prototype.unsubscribe_oh3mgy$=function(t){this.observers_0=d(this.observers_0,t)},ve.$metadata$={kind:s,simpleName:"MutableValueImpl",interfaces:[_e]},ge.$metadata$={kind:s,simpleName:"Value",interfaces:[]},be.$metadata$={kind:l,simpleName:"Parcelable",interfaces:[]},we.prototype.consume_6kwwkl$=function(t){var n,i=null==(n=this.value_0)||e.isType(n,be)?n:v();return this.value_0=null,i},we.prototype.set_xb6vv0$=function(t){this.value_0=t},we.$metadata$={kind:s,simpleName:"ParcelableContainerImpl",interfaces:[ae]};var Se=t.com||(t.com={}),xe=Se.arkivanov||(Se.arkivanov={}),Ee=xe.decompose||(xe.decompose={});Ee.ComponentContext=M,Ee.DefaultComponentContext_init_d83sal$=D,Ee.DefaultComponentContext_init_qi2zqv$=function(t,e){return e=e||Object.create(L.prototype),D(t,pe(),ot(),Z(),e),e},Ee.DefaultComponentContext=L,Ee.DefaultRouterFactory=q,Ee.Navigator=F,Ee.push_35ddl4$=function(t,e){var n;t.navigate_lbeuw8$((n=e,function(t){return u(t,n)}))},Ee.pop_er20gs$=B,Ee.Router=H,Ee.RouterFactory=V,W.Created=Y,W.Destroyed=G,K.Entry=W,Ee.RouterState=K;var Ce=Ee.backpressed||(Ee.backpressed={});Ce.BackPressedDispatcher=J,Ce.backPressedDispatcher=Z,Ce.BackPressedDispatcherImpl=Q,Ce.BackPressedDispatcherOwner=X,Ce.BackPressedHandler=tt,Ce.BackPressedRegistry=et;var Oe=Ee.instancekeeper||(Ee.instancekeeper={});nt.Instance=it,Oe.InstanceKeeper=nt,Oe.InstanceKeeperDispatcher=rt,Oe.instanceKeeperDispatcher=ot,Oe.InstanceKeeperDispatcherImpl=at,Oe.InstanceKeeperOwner=st;var Ne=Ee.lifecycle||(Ee.lifecycle={});Ne.DefaultLifecycleCallbacks=lt,Object.defineProperty(ut,"DESTROYED",{get:ht}),Object.defineProperty(ut,"INITIALIZED",{get:ft}),Object.defineProperty(ut,"CREATED",{get:dt}),Object.defineProperty(ut,"STARTED",{get:_t}),Object.defineProperty(ut,"RESUMED",{get:yt}),ct.State=ut,ct.Callbacks=mt,Ne.Lifecycle=ct,Ne.LifecycleOwner=vt,Ne.LifecycleRegistry=$t,Ne.lifecycleRegistry=gt,Ne.create_ozja4p$=bt,Ne.start_ozja4p$=wt,Ne.resume_ozja4p$=kt,Ne.pause_ozja4p$=St,Ne.stop_ozja4p$=xt,Ne.destroy_ozja4p$=Et,Ne.LifecycleRegistryImpl=Ct,Ne.MergedLifecycle_init_9j7eg6$=zt,Ne.MergedLifecycle=Ot,jt.Created=Tt,jt.Destroyed=Pt;var ze=Ee.router||(Ee.router={});ze.RouterEntry=jt,ze.destroy_1g9gks$=Rt,ze.RouterEntryFactory=At,ze.RouterEntryFactoryImpl=It,ze.RouterImpl=Bt,ze.RouterStack=Ht,ze.StackHolder=Vt,ze.StackHolderImpl=Xt,ze.StackNavigator=re,ze.StackNavigatorImpl=oe;var je=Ee.statekeeper||(Ee.statekeeper={});je.ParcelableContainer=ae,je.ParcelableContainer_xb6vv0$=se,je.consumeRequired_9osh7w$=le,je.StateKeeper=ce,je.StateKeeperDispatcher=ue,je.stateKeeperDispatcher=pe,je.StateKeeperDispatcherImpl=he,je.StateKeeperOwner=de;var Te=Ee.value||(Ee.value={});return Te.MutableValue=_e,Te.MutableValue_issdgt$=me,Te.Value=ge,je.Parcelable=be,je.ParcelableContainerImpl=we,Ee.ensureNeverFrozen_s8jyvk$=ke,M.prototype.router_t9b34l$=V.prototype.router_t9b34l$,L.prototype.router_t9b34l$=M.prototype.router_t9b34l$,q.prototype.router_t9b34l$=V.prototype.router_t9b34l$,It.prototype.invoke_6glczf$=At.prototype.invoke_6glczf$,t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){var i,r,o;r=[e,n(1),n(8),n(28),n(13),n(18),n(245),n(246),n(128),n(247),n(128)],void 0===(o="function"==typeof(i=function(t,e,n,i,r,o,a,s,l,c,u){"use strict";var p=t.$$importsForInline$$||(t.$$importsForInline$$={}),h=e.kotlin.Unit,f=n.kotlinx.coroutines.Job,d=e.ensureNotNull,_=e.PropertyMetadata,y=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,m=e.kotlin.coroutines.CoroutineImpl,v=e.throwCCE,$=i.io.ktor.util.AttributeKey,g=r.io.ktor.utils.io.core.Closeable,b=n.kotlinx.coroutines.Job_5dx9e$,w=i.io.ktor.util.AttributesJsFn,k=n.kotlinx.coroutines.cancel_jnvdxk$,S=r.io.ktor.utils.io.makeShared_s8jyvk$,x=e.Kind.CLASS,E=n.kotlinx.coroutines.CoroutineScope,C=e.kotlin.properties.ReadWriteProperty,O=e.kotlin.IllegalStateException_init_pdl1vj$,N=Object,z=i.io.ktor.util,j=(e.kotlin.Annotation,r.io.ktor.utils.io.ByteReadChannel),T=e.throwUPAE,P=n.kotlinx.coroutines.cancel_n4wjt3$,R=Error,A=e.Kind.OBJECT,I=r.io.ktor.utils.io.concurrent.threadLocal_issdgt$,M=e.defineInlineFunction,L=e.wrapFunction,D=e.kotlin.IllegalStateException_init,q=e.kotlin.IllegalStateException,F=e.kotlin.UnsupportedOperationException_init,U=i.io.ktor.util.flattenEntries_vr6bp2$,B=e.kotlin.collections.joinToString_fmv235$,H=e.kotlin.text.trimMargin_rjktp$,V=e.kotlin.UnsupportedOperationException,K=e.getReifiedTypeParameterKType,W=e.getKClass,Y=i.io.ktor.util.toByteArray_3dmw3p$,G=r.io.ktor.utils.io.ByteReadChannel_fqrh44$,J=r.io.ktor.utils.io.readRemaining_3dmw3p$,Z=r.io.ktor.utils.io.core.readBytes_xc9h3n$,Q=e.kotlin.IllegalArgumentException_init_pdl1vj$,X=e.kotlin.IllegalArgumentException,tt=n.kotlinx.coroutines.CoroutineName,et=e.kotlin.collections.emptySet_287e2$,nt=n.kotlinx.coroutines.async_pda6u4$,it=e.Kind.INTERFACE,rt=o.io.ktor.http,ot=o.io.ktor.http.UnsafeHeaderException,at=e.kotlin.collections.ArrayList_init_287e2$,st=n.kotlinx.coroutines.CompletableJob,lt=i.io.ktor.util.SilentSupervisor_5dx9e$,ct=e.kotlin.lazy_klfg04$,ut=e.kotlin.collections.setOf_mh5how$,pt=(e.kotlin.Enum,e.throwISE,e.equals),ht=e.kotlin.coroutines.CoroutineContext.Key,ft=e.kotlin.coroutines.CoroutineContext.Element,dt=n.kotlinx.coroutines.CancellationException_init_pdl1vj$,_t=o.io.ktor.http.ContentType,yt=o.io.ktor.http.content.TextContent,mt=o.io.ktor.http.content.OutgoingContent.ByteArrayContent,vt=o.io.ktor.http.content.OutgoingContent.ReadChannelContent,$t=e.kotlin.text.toLong_pdl1vz$,gt=e.Long.MAX_VALUE,bt=r.io.ktor.utils.io.cancel_3dmw3p$,wt=e.kotlin,kt=e.kotlin.text.toInt_pdl1vz$,St=e.kotlin.reflect.js.internal.PrimitiveClasses.intClass,xt=r.io.ktor.utils.io.core.ByteReadPacket,Et=r.io.ktor.utils.io.core.Input,Ct=r.io.ktor.utils.io.readRemaining_b56lbm$,Ot=e.kotlin.reflect.js.internal.PrimitiveClasses.byteArrayClass,Nt=r.io.ktor.utils.io.copyTo_47ygvz$,zt=n.kotlinx.coroutines.CancellationException,jt=r.io.ktor.utils.io.writer_x9a1ni$,Tt=o.io.ktor.http.HttpStatusCode,Pt=e.kotlin.collections.reversed_7wnvza$,Rt=i.io.ktor.util.pipeline.PipelinePhase,At=e.kotlin.ranges.rangeTo_38ydlf$,It=e.kotlin.ranges.contains_u6rtyw$,Mt=r.io.ktor.utils.io.charsets,Lt=o.io.ktor.http.contentType_jzzg3d$,Dt=o.io.ktor.http.charset_10ldo9$,qt=e.kotlin.reflect.js.internal.PrimitiveClasses.stringClass,Ft=o.io.ktor.http.withCharset_73qf4i$,Ut=o.io.ktor.http.charset_v1wgmc$,Bt=r.io.ktor.utils.io.core.readText_1lnizf$,Ht=e.kotlin.collections.toList_abgq59$,Vt=r.io.ktor.utils.io.charsets.get_name_2sg7fd$,Kt=e.kotlin.collections.firstOrNull_2p1efm$,Wt=e.kotlin.collections.sortedWith_eknfly$,Yt=e.kotlin.Comparator,Gt=e.kotlin.text.StringBuilder_init,Jt=e.kotlin.math.roundToInt_yrwdxr$,Zt=e.kotlin.collections.LinkedHashSet_init_287e2$,Qt=e.kotlin.collections.LinkedHashMap_init_q3lmfv$,Xt=o.io.ktor.http.HttpMethod,te=e.kotlin.collections.setOf_i5x0yv$,ee=o.io.ktor.http.get_authority_5y8s0c$,ne=o.io.ktor.http.takeFrom_jl1sg7$,ie=o.io.ktor.http.isSecure_v5fpbg$,re=o.io.ktor.http.get_authority_3q1sfd$,oe=n.kotlinx.coroutines.cancel_6dgle8$,ae=o.io.ktor.http.content.OutgoingContent,se=e.hashCode,le=e.Long.ZERO,ce=n.kotlinx.coroutines.delay_s8cxhz$,ue=n.kotlinx.coroutines.launch_s496o7$,pe=(o.io.ktor.http.HeaderValue,o.io.ktor.http.content.OutgoingContent.NoContent),he=(o.io.ktor.http.isSuccess_b3he4c$,e.getCallableRef,o.io.ktor.http.Url_pboq08$,e.kotlin.collections.plus_khz7k3$,e.kotlin.collections.emptyList_287e2$),fe=(e.kotlin.collections.emptyMap_q3lmfv$,i.io.ktor.util.date.GMTDate_mts6q2$),de=(e.kotlin.text.startsWith_7epoxm$,e.kotlin.text.split_ip8yn$,e.Long.fromInt(1e3),e.kotlin.text.isBlank_gw00vp$),_e=(o.io.ktor.http.parseHeaderValue_pdl1vj$,o.io.ktor.http.HeadersBuilder),ye=i.io.ktor.util.collections.ConcurrentMap,me=(e.kotlin.collections.removeAll_qafx1e$,n.kotlinx.coroutines.sync.Mutex_6taknv$,o.io.ktor.http.URLBuilder),ve=(e.kotlin.collections.toList_7wnvza$,e.kotlin.collections.ArrayList_init_ww73n8$),$e=(i.io.ktor.util.toLowerCasePreservingASCIIRules_pdl1vz$,e.kotlin.text.trimStart_wqw3xr$,e.kotlin.text.endsWith_sgbm27$,e.toString,e.kotlin.text.endsWith_7epoxm$,n.kotlinx.coroutines),ge=i.io.ktor.util.split_o3z30d$,be=r.io.ktor.utils.io.discard_3dmw3p$,we=a.io.ktor.http.cio.websocket.WebSocketSession,ke=a.io.ktor.http.cio.websocket.DefaultWebSocketSession,Se=(i.io.ktor.util.encodeBase64_964n91$,e.Long.NEG_ONE,e.Long.fromInt(2147483647),e.kotlin.collections.addAll_ipc267$,o.io.ktor.http.URLProtocol),xe=e.createKType,Ee=r.io.ktor.utils.io.copyAndClose_47ygvz$,Ce=r.io.ktor.utils.io.ByteChannel_6taknv$,Oe=o.io.ktor.http.HttpMessage,Ne=o.io.ktor.http.takeFrom_rs9g2p$,ze=i.io.ktor.util.appendAll_k10e8h$,je=n.kotlinx.coroutines.SupervisorJob_5dx9e$,Te=o.io.ktor.http.HttpMessageBuilder,Pe=o.io.ktor.http.takeFrom_wol2ee$,Re=i.io.ktor.util.pipeline.Pipeline,Ae=o.io.ktor.http.formUrlEncode_invt95$,Ie=r.io.ktor.utils.io.writeFully_4scpqu$,Me=r.io.ktor.utils.io.close_x5qia6$,Le=o.io.ktor.http.content.OutgoingContent.WriteChannelContent,De=r.io.ktor.utils.io.core.BytePacketBuilder_za3lpa$,qe=r.io.ktor.utils.io.core.writeText_t153jy$,Fe=r.io.ktor.utils.io.core.writeFully_i6snlg$,Ue=o.io.ktor.http.content.PartData.FileItem,Be=o.io.ktor.http.content.PartData.BinaryItem,He=o.io.ktor.http.content.PartData.FormItem,Ve=e.kotlin.random.Random,Ke=e.kotlin.text.toString_dqglrj$,We=e.kotlin.text.take_6ic1pp$,Ye=r.io.ktor.utils.io.core.readAvailable_czhrh1$,Ge=r.io.ktor.utils.io.charsets.encodeToByteArray_fj4osb$,Je=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,Ze=r.io.ktor.utils.io.requestWriteBuffer_9tm6dw$,Qe=r.io.ktor.utils.io.core.Buffer,Xe=r.io.ktor.utils.io.completeWriting_oczduq$,tn=(o.io.ktor.http.Parameters,o.io.ktor.http.Headers),en=(o.io.ktor.http.escapeIfNeeded_pdl1vz$,e.kotlin.collections.copyToArray,r.io.ktor.utils.io.charsets.decode_lb8wo3$),nn=o.io.ktor.http.content.OutgoingContent.ProtocolUpgrade,rn=i.io.ktor.util.collections.ConcurrentList,on=o.io.ktor.http.HttpProtocolVersion,an=n.kotlinx.coroutines.CoroutineScope_1fupul$,sn=n.kotlinx.coroutines.cancel_x105z1$,ln=e.kotlin.Result,cn=e.kotlin.createFailure_tcv7n7$,un=e.kotlin.coroutines.intrinsics.intercepted_f9mg25$,pn=n.kotlinx.coroutines.CancellableContinuationImpl,hn=l.Headers,fn=e.kotlin.collections.toTypedArray_964n91$,dn=e.kotlin.Error,_n=n.kotlinx.coroutines.channels.Channel_lsve6m$,yn=a.io.ktor.http.cio.websocket.CloseReason.Codes,mn=n.kotlinx.coroutines.CompletableDeferred_xptg6w$,vn=a.io.ktor.http.cio.websocket.Frame.Binary_init_3eyok5$,$n=a.io.ktor.http.cio.websocket.Frame.Text_init_61zpoe$,gn=a.io.ktor.http.cio.websocket.CloseReason,bn=a.io.ktor.http.cio.websocket.Frame.Close_init_p695es$,wn=r.io.ktor.utils.io.core.String_xge8xe$,kn=r.io.ktor.utils.io.core.readShort_7wsnj1$,Sn=n.kotlinx.coroutines.channels.cancelConsumed_v57n85$;function xn(t){this.value_0=t}function En(t){return h}function Cn(t,e){void 0===e&&(e=En);var n=new An;e(n);var i,r=n,o=t.create_dxyxif$(r.engineConfig_8be2vx$),a=Pn(o,r,!0);return d(a.coroutineContext.get_j3r2sn$(f.Key)).invokeOnCompletion_f05bi3$((i=o,function(t){return i.close(),h})),a}function On(t,e){var n,i;void 0===e&&(e=new An),this.engine=t,this.userConfig_0=e,this.manageEngine_ry3wwv$_0=new xn(!1),this.closed_0=!1,this.clientJob_0=b(this.engine.coroutineContext.get_j3r2sn$(f.Key)),this.coroutineContext_94yqr5$_0=this.engine.coroutineContext.plus_1fupul$(this.clientJob_0),this.requestPipeline=new la(this.userConfig_0.developmentMode),this.responsePipeline=new Ca(this.userConfig_0.developmentMode),this.sendPipeline=new ha(this.userConfig_0.developmentMode),this.receivePipeline=new ja(this.userConfig_0.developmentMode),this.attributes=w(!0),this.engineConfig=this.engine.config,this.config_8be2vx$=new An,this.manageEngine_0&&this.clientJob_0.invokeOnCompletion_f05bi3$((n=this,function(t){return null!=t&&k(n.engine),h})),this.engine.install_k5i6f8$(this),this.sendPipeline.intercept_h71y74$(ya().Receive,(i=this,function(t,e,n,r){var o=new jn(i,t,e,this,n);return r?o:o.doResume(null)}));var r=this.userConfig_0;this.config_8be2vx$.install_xlxg29$(Gr()),r.useDefaultTransformers&&(this.config_8be2vx$.install_xlxg29$(Ar()),this.config_8be2vx$.install_q2ual$("DefaultTransformers",Tn)),this.config_8be2vx$.install_xlxg29$(oo()),r.followRedirects&&this.config_8be2vx$.install_xlxg29$(Br()),this.config_8be2vx$.plusAssign_bi476h$(r),Wi(this.config_8be2vx$),this.config_8be2vx$.install_k5i6f8$(this),S(this)}r.io.ktor.utils.io.errors.IOException,ii.prototype=Object.create(q.prototype),ii.prototype.constructor=ii,ri.prototype=Object.create(q.prototype),ri.prototype.constructor=ri,oi.prototype=Object.create(V.prototype),oi.prototype.constructor=oi,si.prototype=Object.create(Vn.prototype),si.prototype.constructor=si,ui.prototype=Object.create(Sa.prototype),ui.prototype.constructor=ui,di.prototype=Object.create(q.prototype),di.prototype.constructor=di,_i.prototype=Object.create(X.prototype),_i.prototype.constructor=_i,zi.prototype=Object.create(q.prototype),zi.prototype.constructor=zi,Yi.prototype=Object.create(q.prototype),Yi.prototype.constructor=Yi,Ji.prototype=Object.create(Yi.prototype),Ji.prototype.constructor=Ji,Zi.prototype=Object.create(Yi.prototype),Zi.prototype.constructor=Zi,Qi.prototype=Object.create(Yi.prototype),Qi.prototype.constructor=Qi,Xi.prototype=Object.create(mt.prototype),Xi.prototype.constructor=Xi,tr.prototype=Object.create(vt.prototype),tr.prototype.constructor=tr,lo.prototype=Object.create(q.prototype),lo.prototype.constructor=lo,Co.prototype=Object.create(zt.prototype),Co.prototype.constructor=Co,No.prototype=Object.create(Vn.prototype),No.prototype.constructor=No,jo.prototype=Object.create(Sa.prototype),jo.prototype.constructor=jo,Yo.prototype=Object.create(pe.prototype),Yo.prototype.constructor=Yo,Wo.prototype=Object.create(q.prototype),Wo.prototype.constructor=Wo,la.prototype=Object.create(Re.prototype),la.prototype.constructor=la,ha.prototype=Object.create(Re.prototype),ha.prototype.constructor=ha,ma.prototype=Object.create(mt.prototype),ma.prototype.constructor=ma,va.prototype=Object.create(Le.prototype),va.prototype.constructor=va,ka.prototype=Object.create(Sa.prototype),ka.prototype.constructor=ka,Ca.prototype=Object.create(Re.prototype),Ca.prototype.constructor=Ca,ja.prototype=Object.create(Re.prototype),ja.prototype.constructor=ja,Ja.prototype=Object.create(pe.prototype),Ja.prototype.constructor=Ja,Xa.prototype=Object.create(pe.prototype),Xa.prototype.constructor=Xa,ts.prototype=Object.create(vt.prototype),ts.prototype.constructor=ts,es.prototype=Object.create(Le.prototype),es.prototype.constructor=es,ns.prototype=Object.create(mt.prototype),ns.prototype.constructor=ns,is.prototype=Object.create(nn.prototype),is.prototype.constructor=is,bs.prototype=Object.create(Oi.prototype),bs.prototype.constructor=bs,Cs.prototype=Object.create(R.prototype),Cs.prototype.constructor=Cs,xn.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},xn.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},xn.$metadata$={kind:x,interfaces:[C]};var Nn=new _("manageEngine");function zn(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$builder=e}function jn(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$this$HttpClient=t,this.local$$receiver=e,this.local$call=n}function Tn(t){return sr(t),h}function Pn(t,e,n,i){return i=i||Object.create(On.prototype),On.call(i,t,e),i.manageEngine_0=n,i}function Rn(t){this.value_0=t}function An(){this.features_0=rs(),this.featureConfigurations_0=rs(),this.customInterceptors_0=rs(),this.engineConfig_8be2vx$_8hwuhy$_0=new Rn(Bn),this.followRedirects_u64lb0$_0=new Rn(!0),this.useDefaultTransformers_4nse22$_0=new Rn(!0),this.expectSuccess_kppdwg$_0=new Rn(!0),this.developmentMode_umcv04$_0=new Rn(z.PlatformUtils.IS_DEVELOPMENT_MODE)}Object.defineProperty(On.prototype,"manageEngine_0",{configurable:!0,get:function(){return this.manageEngine_ry3wwv$_0.getValue_lrcp0p$(this,Nn)},set:function(t){this.manageEngine_ry3wwv$_0.setValue_9rddgb$(this,Nn,t)}}),Object.defineProperty(On.prototype,"coroutineContext",{configurable:!0,get:function(){return this.coroutineContext_94yqr5$_0}}),Object.defineProperty(On.prototype,"dispatcher",{configurable:!0,get:function(){return this.engine.dispatcher}}),zn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},zn.prototype=Object.create(m.prototype),zn.prototype.constructor=zn,zn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.requestPipeline.execute_8pmvt0$(this.local$builder,this.local$builder.body,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return e.isType(t=this.result_0,Vn)?t:v();default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},On.prototype.execute_s9rlw$=function(t,e,n){var i=new zn(this,t,e);return n?i:i.doResume(null)},On.prototype.isSupported_tlxpog$=function(t){return this.engine.supportedCapabilities.contains_11rb$(t)},On.prototype.config_f0veat$=function(t){var e=this.engine,n=new An;return n.plusAssign_bi476h$(this.userConfig_0),t(n),Pn(e,n,this.manageEngine_0)},On.prototype.close=function(){var t;if(!1===(t=this).closed_0&&(t.closed_0=!0,1)){var n;for(n=this.attributes.allKeys.iterator();n.hasNext();){var i,r=n.next(),o=this.attributes.get_yzaw86$(e.isType(i=r,$)?i:v());e.isType(o,g)&&o.close()}this.clientJob_0.complete(),this.manageEngine_0&&this.engine.close()}},On.prototype.toString=function(){return"HttpClient["+this.engine+"]"},jn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},jn.prototype=Object.create(m.prototype),jn.prototype.constructor=jn,jn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(!e.isType(this.local$call,Vn)){var t="Error: HttpClientCall expected, but found "+this.local$call.toString()+"("+e.getKClassFromExpression(this.local$call)+").";throw O(t.toString())}if(this.state_0=2,this.result_0=this.local$this$HttpClient.receivePipeline.execute_8pmvt0$(this.local$call,this.local$call.response,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:var n=this.result_0.call;if(this.state_0=3,this.result_0=this.local$$receiver.proceedWith_trkh7z$(n,this),this.result_0===y)return y;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},On.$metadata$={kind:x,simpleName:"HttpClient",interfaces:[g,E]},Rn.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},Rn.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},Rn.$metadata$={kind:x,interfaces:[C]};var In=new _("engineConfig");Object.defineProperty(An.prototype,"engineConfig_8be2vx$",{configurable:!0,get:function(){return this.engineConfig_8be2vx$_8hwuhy$_0.getValue_lrcp0p$(this,In)},set:function(t){this.engineConfig_8be2vx$_8hwuhy$_0.setValue_9rddgb$(this,In,t)}}),An.prototype.engine_dxyxif$=function(t){var e,n,i=this.engineConfig_8be2vx$;this.engineConfig_8be2vx$=(e=i,n=t,function(t){return e(t),n(t),h})};var Mn=new _("followRedirects");Object.defineProperty(An.prototype,"followRedirects",{configurable:!0,get:function(){return this.followRedirects_u64lb0$_0.getValue_lrcp0p$(this,Mn)},set:function(t){this.followRedirects_u64lb0$_0.setValue_9rddgb$(this,Mn,t)}});var Ln=new _("useDefaultTransformers");Object.defineProperty(An.prototype,"useDefaultTransformers",{configurable:!0,get:function(){return this.useDefaultTransformers_4nse22$_0.getValue_lrcp0p$(this,Ln)},set:function(t){this.useDefaultTransformers_4nse22$_0.setValue_9rddgb$(this,Ln,t)}});var Dn=new _("expectSuccess");Object.defineProperty(An.prototype,"expectSuccess",{configurable:!0,get:function(){return this.expectSuccess_kppdwg$_0.getValue_lrcp0p$(this,Dn)},set:function(t){this.expectSuccess_kppdwg$_0.setValue_9rddgb$(this,Dn,t)}});var qn=new _("developmentMode");function Fn(t){return h}function Un(){return w(!0)}function Bn(t){return h}function Hn(t,n,i){var r=new Vn(t);return r.request=new Zo(r,n),r.response=new ka(r,i),e.isType(i.body,j)||r.attributes.put_uuntuo$(Xn().CustomResponse,i.body),r}function Vn(t){Xn(),this.received_8b75r7$_0=!1,this.client_77eog7$_0=I(t),this.request_vta333$_0=this.request_vta333$_0,this.response_zcvbsz$_0=this.response_zcvbsz$_0,this.allowDoubleReceive_c2ese3$_0=!1}Object.defineProperty(An.prototype,"developmentMode",{configurable:!0,get:function(){return this.developmentMode_umcv04$_0.getValue_lrcp0p$(this,qn)},set:function(t){this.developmentMode_umcv04$_0.setValue_9rddgb$(this,qn,t)}}),An.prototype.install_xlxg29$=function(t,n){void 0===n&&(n=Fn);var i,r,o=this.featureConfigurations_0.get_11rb$(t.key),a=this.featureConfigurations_0,s=t.key;if(a.put_xwzc9p$(s,(i=o,r=n,function(t){var n;return null!=i&&i(t),r(e.isType(n=t,N)?n:v()),h})),!this.features_0.containsKey_11rb$(t.key)){var l,c=this.features_0,u=t.key;c.put_xwzc9p$(u,(l=t,function(t){var e=t.attributes.computeIfAbsent_u4q9l2$(vr,Un),n=d(t.config_8be2vx$.featureConfigurations_0.get_11rb$(l.key)),i=l.prepare_oh3mgy$(n);return l.install_wojrb5$(i,t),e.put_uuntuo$(l.key,i),h}))}},An.prototype.install_q2ual$=function(t,e){this.customInterceptors_0.put_xwzc9p$(t,e)},An.prototype.install_k5i6f8$=function(t){var e,n;for(e=this.features_0.values.iterator();e.hasNext();)e.next()(t);for(n=this.customInterceptors_0.values.iterator();n.hasNext();)n.next()(t)},An.prototype.clone=function(){var t=new An;return t.plusAssign_bi476h$(this),t},An.prototype.plusAssign_bi476h$=function(t){this.followRedirects=t.followRedirects,this.useDefaultTransformers=t.useDefaultTransformers,this.expectSuccess=t.expectSuccess;var e=this.features_0,n=t.features_0;e.putAll_a2k3zr$(n);var i=this.featureConfigurations_0,r=t.featureConfigurations_0;i.putAll_a2k3zr$(r);var o=this.customInterceptors_0,a=t.customInterceptors_0;o.putAll_a2k3zr$(a)},An.$metadata$={kind:x,simpleName:"HttpClientConfig",interfaces:[]};var Kn=new _("client");function Wn(t,e,n){m.call(this,n),this.exceptionState_0=9,this.$this=t,this.local$tmp$=void 0,this.local$info=e}function Yn(){Qn=this,this.CustomResponse=new $("CustomResponse")}Object.defineProperty(Vn.prototype,"client",{configurable:!0,get:function(){return this.client_77eog7$_0.getValue_lrcp0p$(this,Kn)}}),Object.defineProperty(Vn.prototype,"coroutineContext",{configurable:!0,get:function(){return this.response.coroutineContext}}),Object.defineProperty(Vn.prototype,"attributes",{configurable:!0,get:function(){return this.request.attributes}}),Object.defineProperty(Vn.prototype,"request",{configurable:!0,get:function(){return null==this.request_vta333$_0?T("request"):this.request_vta333$_0},set:function(t){this.request_vta333$_0=t}}),Object.defineProperty(Vn.prototype,"response",{configurable:!0,get:function(){return null==this.response_zcvbsz$_0?T("response"):this.response_zcvbsz$_0},set:function(t){this.response_zcvbsz$_0=t}}),Object.defineProperty(Vn.prototype,"allowDoubleReceive",{configurable:!0,get:function(){return this.allowDoubleReceive_c2ese3$_0}}),Vn.prototype.getResponseContent=function(t){return this.response.content},Wn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Wn.prototype=Object.create(m.prototype),Wn.prototype.constructor=Wn,Wn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.exceptionState_0=1,hs(this.$this.response,this.local$info.type)){this.exceptionState_0=9,this.finallyPath_0=[2],this.state_0=8,this.$returnValue=this.$this.response;continue}this.state_0=3;continue;case 1:this.finallyPath_0=[9],this.exceptionState_0=8;var n=this.exception_0;throw e.isType(n,R)?(P(this.$this.response,"Receive failed",n),n):n;case 2:return this.$returnValue;case 3:if(!this.$this.allowDoubleReceive&&(!1!==(c=this).$this.received_8b75r7$_0||(c.$this.received_8b75r7$_0=!0,0)))throw new ii(this.$this);if(this.local$tmp$=this.$this.attributes.getOrNull_yzaw86$(Xn().CustomResponse),null==this.local$tmp$){if(this.state_0=4,this.result_0=this.$this.getResponseContent(this),this.result_0===y)return y;continue}this.state_0=5;continue;case 4:this.local$tmp$=this.result_0,this.state_0=5;continue;case 5:var i=this.local$tmp$,r=new Ma(this.local$info,i);if(null==(t=this.$this.client))throw O(("Failed to receive call("+this.$this+") in different native thread.").toString());var o=t;if(this.state_0=6,this.result_0=o.responsePipeline.execute_8pmvt0$(this.$this,r,this),this.result_0===y)return y;continue;case 6:var a=this.result_0.response;if(!hs(a,this.local$info.type)){var s=e.getKClassFromExpression(a),l=this.local$info.type;throw new oi(this.$this.response,s,l)}this.exceptionState_0=9,this.finallyPath_0=[7],this.state_0=8,this.$returnValue=a;continue;case 7:return this.$returnValue;case 8:this.exceptionState_0=9,Ea(this.$this.response),this.state_0=this.finallyPath_0.shift();continue;case 9:throw this.exception_0;case 10:return;default:throw this.state_0=9,new Error("State Machine Unreachable execution")}}catch(t){if(9===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var c},Vn.prototype.receive_jo9acv$=function(t,e,n){var i=new Wn(this,t,e);return n?i:i.doResume(null)},Vn.prototype.toString=function(){return"HttpClientCall["+this.request.url+", "+this.response.status+"]"},Yn.$metadata$={kind:A,simpleName:"Companion",interfaces:[]};var Gn,Jn,Zn,Qn=null;function Xn(){return null===Qn&&new Yn,Qn}function ti(t,e){this.request=t,this.response=e}function ei(t,e,n){m.call(this,n),this.$controller=e,this.exceptionState_0=1}function ni(t,e,n){var i=new ei(t,this,e);return n?i:i.doResume(null)}function ii(t){D(this),this.name="DoubleReceiveException",this.message_eo7lbx$_0="Response already received: "+t}function ri(t,e,n){O("Fail to run receive pipeline: "+n,this),this.request=t,this.info=e,this.cause_xlcv2q$_0=n,this.name="ReceivePipelineException"}function oi(t,e,n){F(this),this.name="NoTransformationFoundException",this.message_gd84kd$_0=H("No transformation found: "+e+" -> "+n+"\n |with response from "+xa(t).url+":\n |status: "+t.status+"\n |response headers: \n |"+B(U(t.headers),void 0,void 0,void 0,void 0,void 0,ai)+"\n ")}function ai(t){return t.component1()+": "+t.component2()+"\n"}function si(t){Vn.call(this,t),this.responseContent_0=null,this.allowDoubleReceive_je4pft$_0=!0}function li(t,e){m.call(this,e),this.exceptionState_0=1,this.$this=t}function ci(t,e){this.call_k7cxor$_0=t,this.$delegate_k8mkjd$_0=e}function ui(t,e,n){Sa.call(this),this.call_tbj7t5$_0=t,this.context_0=b(),this.status_i2dvkt$_0=n.status,this.version_ol3l9j$_0=n.version,this.requestTime_3msfjx$_0=n.requestTime,this.responseTime_xhbsdj$_0=n.responseTime,this.headers_w25qx3$_0=n.headers,this.coroutineContext_pwmz9e$_0=n.coroutineContext.plus_1fupul$(this.context_0),this.content_mzxkbe$_0=G(e)}function pi(t,e){m.call(this,e),this.exceptionState_0=1,this.local$$receiver_0=void 0,this.local$$receiver=t}function hi(t,e,n){var i=new pi(t,e);return n?i:i.doResume(null)}function fi(t,e,n){void 0===n&&(n=null),this.type=t,this.reifiedType=e,this.kotlinType=n}function di(t){O("Failed to write body: "+e.getKClassFromExpression(t),this),this.name="UnsupportedContentTypeException"}function _i(t){Q("Unsupported upgrade protocol exception: "+t,this),this.name="UnsupportedUpgradeProtocolException"}function yi(t,e,n){m.call(this,n),this.$controller=e,this.exceptionState_0=1}function mi(t,e,n){var i=new yi(t,this,e);return n?i:i.doResume(null)}function vi(t,e,n){m.call(this,n),this.$controller=e,this.exceptionState_0=1}function $i(t,e,n){var i=new vi(t,this,e);return n?i:i.doResume(null)}function gi(){}function bi(t,e,n,i,r,o){m.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$this$HttpClientEngine=t,this.local$closure$client=e,this.local$requestData=void 0,this.local$$receiver=n,this.local$content=i}function wi(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$this$HttpClientEngine=t,this.local$closure$requestData=e}function ki(t,e){return function(n,i,r){var o=new wi(t,e,n,this,i);return r?o:o.doResume(null)}}function Si(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$requestData=e}function xi(){}function Ei(t){return h}function Ci(t){var e,n=t.headers.names(),i=at();for(e=n.iterator();e.hasNext();){var r=e.next();rt.HttpHeaders.UnsafeHeadersList.contains_11rb$(r)&&i.add_11rb$(r)}var o=i;if(!o.isEmpty())throw new ot(o.toString())}function Oi(t){var e;this.engineName_n0bloo$_0=t,this.closed_je8r6f$_0=!1,this.coroutineContext_huxu0y$_0=ct((e=this,function(){return lt().plus_1fupul$(e.dispatcher).plus_1fupul$(new tt(e.engineName_n0bloo$_0+"-context"))}))}function Ni(t){return function(n){return function(t){var n,i;try{null!=(i=e.isType(n=t,g)?n:null)&&i.close()}catch(t){if(e.isType(t,R))return h;throw t}}(t.dispatcher),h}}function zi(t){void 0===t&&(t=null),O("Client already closed",this),this.cause_om4vf0$_0=t,this.name="ClientEngineClosedException"}function ji(){}function Ti(){this.threadsCount=4,this.pipelining=!1,this.proxy=null}function Pi(t,e,n){var i,r,o,a,s,l,c;ss((l=t,c=e,function(t){return t.appendAll_hb0ubp$(l),t.appendAll_hb0ubp$(c.headers),h})).forEach_ubvtmq$((s=n,function(t,e){if(!pt(rt.HttpHeaders.ContentLength,t)&&!pt(rt.HttpHeaders.ContentType,t))return s(t,B(e,",")),h})),null==t.get_61zpoe$(rt.HttpHeaders.UserAgent)&&null==e.headers.get_61zpoe$(rt.HttpHeaders.UserAgent)&&!z.PlatformUtils.IS_BROWSER&&n(rt.HttpHeaders.UserAgent,Zn);var u=null!=(r=null!=(i=e.contentType)?i.toString():null)?r:e.headers.get_61zpoe$(rt.HttpHeaders.ContentType),p=null!=(a=null!=(o=e.contentLength)?o.toString():null)?a:e.headers.get_61zpoe$(rt.HttpHeaders.ContentLength);null!=u&&n(rt.HttpHeaders.ContentType,u),null!=p&&n(rt.HttpHeaders.ContentLength,p)}function Ri(t){return d(t.context.get_j3r2sn$(Li())).callContext}function Ai(t){Li(),this.callContext=t}function Ii(){Mi=this}Vn.$metadata$={kind:x,simpleName:"HttpClientCall",interfaces:[E]},ti.$metadata$={kind:x,simpleName:"HttpEngineCall",interfaces:[]},ti.prototype.component1=function(){return this.request},ti.prototype.component2=function(){return this.response},ti.prototype.copy_ukxvzw$=function(t,e){return new ti(void 0===t?this.request:t,void 0===e?this.response:e)},ti.prototype.toString=function(){return"HttpEngineCall(request="+e.toString(this.request)+", response="+e.toString(this.response)+")"},ti.prototype.hashCode=function(){var t=0;return t=31*(t=31*t+e.hashCode(this.request)|0)+e.hashCode(this.response)|0},ti.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.request,t.request)&&e.equals(this.response,t.response)},ei.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},ei.prototype=Object.create(m.prototype),ei.prototype.constructor=ei,ei.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return h;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},M("ktor-ktor-client-core-jsLegacy.io.ktor.client.call.receive_8ov3cv$",L((function(){var n=e.getReifiedTypeParameterKType,i=e.throwCCE,r=e.getKClass,o=t.io.ktor.client.call,a=t.io.ktor.client.call.TypeInfo;return function(t,s,l,c){var u,p;t:do{try{p=new a(r(t),o.JsType,n(t))}catch(e){p=new a(r(t),o.JsType);break t}}while(0);return e.suspendCall(l.receive_jo9acv$(p,e.coroutineReceiver())),s(u=e.coroutineResult(e.coroutineReceiver()))?u:i()}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.call.receive_5sqbag$",L((function(){var n=e.getReifiedTypeParameterKType,i=e.throwCCE,r=e.getKClass,o=t.io.ktor.client.call,a=t.io.ktor.client.call.TypeInfo;return function(t,s,l,c){var u,p,h=l.call;t:do{try{p=new a(r(t),o.JsType,n(t))}catch(e){p=new a(r(t),o.JsType);break t}}while(0);return e.suspendCall(h.receive_jo9acv$(p,e.coroutineReceiver())),s(u=e.coroutineResult(e.coroutineReceiver()))?u:i()}}))),Object.defineProperty(ii.prototype,"message",{configurable:!0,get:function(){return this.message_eo7lbx$_0}}),ii.$metadata$={kind:x,simpleName:"DoubleReceiveException",interfaces:[q]},Object.defineProperty(ri.prototype,"cause",{get:function(){return this.cause_xlcv2q$_0}}),ri.$metadata$={kind:x,simpleName:"ReceivePipelineException",interfaces:[q]},Object.defineProperty(oi.prototype,"message",{configurable:!0,get:function(){return this.message_gd84kd$_0}}),oi.$metadata$={kind:x,simpleName:"NoTransformationFoundException",interfaces:[V]},li.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},li.prototype=Object.create(m.prototype),li.prototype.constructor=li,li.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(null==this.$this.responseContent_0&&(this.$this.responseContent_0=this.$this.response.content),this.state_0=2,this.result_0=Y(d(this.$this.responseContent_0),this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;return this.$this.responseContent_0=G(t),G(t);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},si.prototype.getResponseContent=function(t,e){var n=new li(this,t);return e?n:n.doResume(null)},Object.defineProperty(si.prototype,"allowDoubleReceive",{configurable:!0,get:function(){return this.allowDoubleReceive_je4pft$_0}}),si.$metadata$={kind:x,simpleName:"SavedHttpCall",interfaces:[Vn]},Object.defineProperty(ci.prototype,"call",{get:function(){return this.call_k7cxor$_0}}),Object.defineProperty(ci.prototype,"attributes",{configurable:!0,get:function(){return this.$delegate_k8mkjd$_0.attributes}}),Object.defineProperty(ci.prototype,"content",{configurable:!0,get:function(){return this.$delegate_k8mkjd$_0.content}}),Object.defineProperty(ci.prototype,"coroutineContext",{configurable:!0,get:function(){return this.$delegate_k8mkjd$_0.coroutineContext}}),Object.defineProperty(ci.prototype,"executionContext",{configurable:!0,get:function(){return this.$delegate_k8mkjd$_0.executionContext}}),Object.defineProperty(ci.prototype,"headers",{configurable:!0,get:function(){return this.$delegate_k8mkjd$_0.headers}}),Object.defineProperty(ci.prototype,"method",{configurable:!0,get:function(){return this.$delegate_k8mkjd$_0.method}}),Object.defineProperty(ci.prototype,"url",{configurable:!0,get:function(){return this.$delegate_k8mkjd$_0.url}}),ci.$metadata$={kind:x,simpleName:"SavedHttpRequest",interfaces:[Qo]},Object.defineProperty(ui.prototype,"call",{get:function(){return this.call_tbj7t5$_0}}),Object.defineProperty(ui.prototype,"status",{configurable:!0,get:function(){return this.status_i2dvkt$_0}}),Object.defineProperty(ui.prototype,"version",{configurable:!0,get:function(){return this.version_ol3l9j$_0}}),Object.defineProperty(ui.prototype,"requestTime",{configurable:!0,get:function(){return this.requestTime_3msfjx$_0}}),Object.defineProperty(ui.prototype,"responseTime",{configurable:!0,get:function(){return this.responseTime_xhbsdj$_0}}),Object.defineProperty(ui.prototype,"headers",{configurable:!0,get:function(){return this.headers_w25qx3$_0}}),Object.defineProperty(ui.prototype,"coroutineContext",{configurable:!0,get:function(){return this.coroutineContext_pwmz9e$_0}}),Object.defineProperty(ui.prototype,"content",{configurable:!0,get:function(){return this.content_mzxkbe$_0}}),ui.$metadata$={kind:x,simpleName:"SavedHttpResponse",interfaces:[Sa]},pi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},pi.prototype=Object.create(m.prototype),pi.prototype.constructor=pi,pi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(null==(t=this.local$$receiver.client))throw O("Failed to save call in different native thread.".toString());var e=t;if(this.local$$receiver_0=new si(e),this.state_0=2,this.result_0=J(this.local$$receiver.response.content,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:var n=this.result_0;return this.local$$receiver_0.request=new ci(this.local$$receiver_0,this.local$$receiver.request),this.local$$receiver_0.response=new ui(this.local$$receiver_0,Z(n),this.local$$receiver.response),this.local$$receiver_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},fi.$metadata$={kind:x,simpleName:"TypeInfo",interfaces:[]},fi.prototype.component1=function(){return this.type},fi.prototype.component2=function(){return this.reifiedType},fi.prototype.component3=function(){return this.kotlinType},fi.prototype.copy_zg9ia4$=function(t,e,n){return new fi(void 0===t?this.type:t,void 0===e?this.reifiedType:e,void 0===n?this.kotlinType:n)},fi.prototype.toString=function(){return"TypeInfo(type="+e.toString(this.type)+", reifiedType="+e.toString(this.reifiedType)+", kotlinType="+e.toString(this.kotlinType)+")"},fi.prototype.hashCode=function(){var t=0;return t=31*(t=31*(t=31*t+e.hashCode(this.type)|0)+e.hashCode(this.reifiedType)|0)+e.hashCode(this.kotlinType)|0},fi.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.type,t.type)&&e.equals(this.reifiedType,t.reifiedType)&&e.equals(this.kotlinType,t.kotlinType)},di.$metadata$={kind:x,simpleName:"UnsupportedContentTypeException",interfaces:[q]},_i.$metadata$={kind:x,simpleName:"UnsupportedUpgradeProtocolException",interfaces:[X]},yi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},yi.prototype=Object.create(m.prototype),yi.prototype.constructor=yi,yi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return h;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},vi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},vi.prototype=Object.create(m.prototype),vi.prototype.constructor=vi,vi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return h;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(gi.prototype,"supportedCapabilities",{configurable:!0,get:function(){return et()}}),Object.defineProperty(gi.prototype,"closed_yj5g8o$_0",{configurable:!0,get:function(){var t,e;return!(null!=(e=null!=(t=this.coroutineContext.get_j3r2sn$(f.Key))?t.isActive:null)&&e)}}),bi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},bi.prototype=Object.create(m.prototype),bi.prototype.constructor=bi,bi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=new Xo;if(t.takeFromWithExecutionContext_s9rlw$(this.local$$receiver.context),t.body=this.local$content,this.local$requestData=t.build(),Ci(this.local$requestData),this.local$this$HttpClientEngine.checkExtensions_1320zn$_0(this.local$requestData),this.state_0=2,this.result_0=this.local$this$HttpClientEngine.executeWithinCallContext_2kaaho$_0(this.local$requestData,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:var e=this.result_0,n=Hn(this.local$closure$client,this.local$requestData,e);if(this.state_0=3,this.result_0=this.local$$receiver.proceedWith_trkh7z$(n,this),this.result_0===y)return y;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},gi.prototype.install_k5i6f8$=function(t){var e,n;t.sendPipeline.intercept_h71y74$(ya().Engine,(e=this,n=t,function(t,i,r,o){var a=new bi(e,n,t,i,this,r);return o?a:a.doResume(null)}))},wi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},wi.prototype=Object.create(m.prototype),wi.prototype.constructor=wi,wi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$this$HttpClientEngine.closed_yj5g8o$_0)throw new zi;if(this.state_0=2,this.result_0=this.local$this$HttpClientEngine.execute_dkgphz$(this.local$closure$requestData,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Si.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Si.prototype=Object.create(m.prototype),Si.prototype.constructor=Si,Si.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=_s(this.$this,this.local$requestData.executionContext,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;S(t);var e=t.plus_1fupul$(new Ai(t));if(this.state_0=3,this.result_0=nt(this.$this,e,void 0,ki(this.$this,this.local$requestData)).await(this),this.result_0===y)return y;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},gi.prototype.executeWithinCallContext_2kaaho$_0=function(t,e,n){var i=new Si(this,t,e);return n?i:i.doResume(null)},gi.prototype.checkExtensions_1320zn$_0=function(t){var e;for(e=t.requiredCapabilities_8be2vx$.iterator();e.hasNext();){var n=e.next();if(!this.supportedCapabilities.contains_11rb$(n))throw Q(("Engine doesn't support "+n).toString())}},gi.$metadata$={kind:it,simpleName:"HttpClientEngine",interfaces:[g,E]},xi.prototype.create_dxyxif$=function(t,e){return void 0===t&&(t=Ei),e?e(t):this.create_dxyxif$$default(t)},xi.$metadata$={kind:it,simpleName:"HttpClientEngineFactory",interfaces:[]},Object.defineProperty(Oi.prototype,"coroutineContext",{configurable:!0,get:function(){return this.coroutineContext_huxu0y$_0.value}}),Oi.prototype.close=function(){var t,n,i;if(!1===(i=this).closed_je8r6f$_0&&(i.closed_je8r6f$_0=!0,1)&&null!=(n=e.isType(t=this.coroutineContext.get_j3r2sn$(f.Key),st)?t:null)){var r=n;r.complete(),r.invokeOnCompletion_f05bi3$(Ni(this))}},Oi.$metadata$={kind:x,simpleName:"HttpClientEngineBase",interfaces:[gi]},Object.defineProperty(zi.prototype,"cause",{get:function(){return this.cause_om4vf0$_0}}),zi.$metadata$={kind:x,simpleName:"ClientEngineClosedException",interfaces:[q]},ji.$metadata$={kind:it,simpleName:"HttpClientEngineCapability",interfaces:[]},Object.defineProperty(Ti.prototype,"response",{configurable:!0,get:function(){throw O("Unbound [HttpClientCall] is deprecated. Consider using [request(block)] instead.".toString())}}),Ti.$metadata$={kind:x,simpleName:"HttpClientEngineConfig",interfaces:[]},Object.defineProperty(Ai.prototype,"key",{configurable:!0,get:function(){return Li()}}),Ii.$metadata$={kind:A,simpleName:"Companion",interfaces:[ht]};var Mi=null;function Li(){return null===Mi&&new Ii,Mi}function Di(t){Hi(),this.builder_0=t}function qi(){Bi=this,this.key_2n0sxh$_0=new $("DefaultRequest")}function Fi(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$feature=t,this.local$$receiver=e}Ai.$metadata$={kind:x,simpleName:"KtorCallContextElement",interfaces:[ft]},M("ktor-ktor-client-core-jsLegacy.io.ktor.client.engine.attachToUserJob_mmkme6$",L((function(){var n=t.$$importsForInline$$["kotlinx-coroutines-core"].kotlinx.coroutines.Job,i=t.$$importsForInline$$["kotlinx-coroutines-core"].kotlinx.coroutines.CancellationException_init_pdl1vj$,r=e.kotlin.Unit;return function(t,o){var a;if(null!=(a=e.coroutineReceiver().context.get_j3r2sn$(n.Key))){var s,l,c=a.invokeOnCompletion_ct2b2z$(!0,void 0,(s=t,function(t){if(null!=t)return s.cancel_m4sck1$(i(t.message)),r}));t.invokeOnCompletion_f05bi3$((l=c,function(t){return l.dispose(),r}))}}}))),Object.defineProperty(qi.prototype,"key",{configurable:!0,get:function(){return this.key_2n0sxh$_0}}),qi.prototype.prepare_oh3mgy$$default=function(t){return new Di(t)},Fi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Fi.prototype=Object.create(m.prototype),Fi.prototype.constructor=Fi,Fi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=this.local$$receiver.context;return this.local$closure$feature.builder_0(t),t;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},qi.prototype.install_wojrb5$=function(t,e){var n;e.requestPipeline.intercept_h71y74$(pa().Before,(n=t,function(t,e,i,r){var o=new Fi(n,t,e,this,i);return r?o:o.doResume(null)}))},qi.$metadata$={kind:A,simpleName:"Feature",interfaces:[wr]};var Ui,Bi=null;function Hi(){return null===Bi&&new qi,Bi}function Vi(t,e){m.call(this,e),this.exceptionState_0=1,this.local$statusCode=void 0,this.local$originCall=void 0,this.local$exceptionResponse=void 0,this.local$response=t}function Ki(t,e,n){var i=new Vi(t,e);return n?i:i.doResume(null)}function Wi(t){var e;br(t,(e=t,function(t){return t.expectSuccess=e.expectSuccess,t.validateResponse_d4bkoy$(Ki),h}))}function Yi(t,e){O("Bad response: "+t+'. Text: "'+e+'"',this),this.name="ResponseException",this._response_kjamci$_h84ynm$_0=I(t)}Di.$metadata$={kind:x,simpleName:"DefaultRequest",interfaces:[]},Vi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Vi.prototype=Object.create(m.prototype),Vi.prototype.constructor=Vi,Vi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$response.call.attributes.get_yzaw86$(mr)){this.state_0=2;continue}return;case 1:throw this.exception_0;case 2:if(this.local$statusCode=this.local$response.status.value,this.local$originCall=this.local$response.call,this.local$statusCode<300||this.local$originCall.attributes.contains_w48dwb$(Ui))return;this.state_0=3;continue;case 3:if(this.state_0=4,this.result_0=hi(this.local$originCall,this),this.result_0===y)return y;continue;case 4:var t=this.result_0;t.attributes.put_uuntuo$(Ui,h);var e=t;if(this.local$exceptionResponse=e.response,this.state_0=5,this.result_0=Wa(this.local$exceptionResponse,void 0,this),this.result_0===y)return y;continue;case 5:var n=this.result_0;throw this.local$statusCode>=300&&this.local$statusCode<=399?new Ji(this.local$exceptionResponse,n):this.local$statusCode>=400&&this.local$statusCode<=499?new Qi(this.local$exceptionResponse,n):this.local$statusCode>=500&&this.local$statusCode<=599?new Zi(this.local$exceptionResponse,n):new Yi(this.local$exceptionResponse,n);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}};var Gi=new _("_response");function Ji(t,e){Yi.call(this,t,e),this.name="RedirectResponseException",this.message_rcd2w9$_0="Unhandled redirect: "+t.call.request.url+". Status: "+t.status+'. Text: "'+e+'"'}function Zi(t,e){Yi.call(this,t,e),this.name="ServerResponseException",this.message_3dyog2$_0="Server error("+t.call.request.url+": "+t.status.toString()+'. Text: "'+e+'"'}function Qi(t,e){Yi.call(this,t,e),this.name="ClientRequestException",this.message_mrabda$_0="Client request("+t.call.request.url+") invalid: "+t.status+'. Text: "'+e+'"'}function Xi(t,n){this.closure$body=t,mt.call(this),this.contentType_4t2c6o$_0=null!=n?n:_t.Application.OctetStream,this.contentLength_ca0n1g$_0=e.Long.fromInt(t.length)}function tr(t,e){this.closure$body=t,vt.call(this),this.contentType_4t2c6o$_0=null!=e?e:_t.Application.OctetStream}function er(t,e,n,i){m.call(this,i),this.$controller=n,this.exceptionState_0=1,this.local$$receiver=t,this.local$body=e}function nr(t,e,n,i){var r=new er(t,e,this,n);return i?r:r.doResume(null)}function ir(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=6,this.local$closure$body=t,this.local$closure$response=e,this.local$$receiver=n}function rr(t,e){return function(n,i,r){var o=new ir(t,e,n,this,i);return r?o:o.doResume(null)}}function or(t){return function(e){return t.complete(),h}}function ar(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$client=t,this.local$info=void 0,this.local$body=void 0,this.local$contentLength=void 0,this.local$$receiver=e,this.local$f=n}function sr(t){var e,n=t;t.requestPipeline.intercept_h71y74$(pa().Render,nr),t.responsePipeline.intercept_h71y74$(za().Parse,(e=n,function(t,n,i,r){var o=new ar(e,t,n,this,i);return r?o:o.doResume(null)}))}function lr(t,e,n){gr(),this.responseValidators_0=t,this.callExceptionHandlers_0=e,this.expectSuccess_0=n}function cr(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$response=e}function ur(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$cause=e}function pr(){this.responseValidators_8be2vx$=at(),this.responseExceptionHandlers_8be2vx$=at(),this.expectSuccess=!0}function hr(){$r=this,this.key_uukd7r$_0=new $("HttpResponseValidator")}function fr(t){return function(){return t.expectSuccess_0}}function dr(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=6,this.local$closure$feature=t,this.local$unwrappedCause=void 0,this.local$$receiver=e,this.local$it=n}function _r(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=6,this.local$closure$feature=t,this.local$unwrappedCause=void 0,this.local$$receiver=e,this.local$container=n}function yr(t,e,n,i,r,o){m.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$feature=t,this.local$call=n}Object.defineProperty(Yi.prototype,"_response_kjamci$_0",{configurable:!0,get:function(){return this._response_kjamci$_h84ynm$_0.getValue_lrcp0p$(this,Gi)}}),Object.defineProperty(Yi.prototype,"response",{configurable:!0,get:function(){var t;if(null==(t=this._response_kjamci$_0))throw O("Failed to access response from a different native thread".toString());return t}}),Yi.$metadata$={kind:x,simpleName:"ResponseException",interfaces:[q]},Object.defineProperty(Ji.prototype,"message",{configurable:!0,get:function(){return this.message_rcd2w9$_0}}),Ji.$metadata$={kind:x,simpleName:"RedirectResponseException",interfaces:[Yi]},Object.defineProperty(Zi.prototype,"message",{configurable:!0,get:function(){return this.message_3dyog2$_0}}),Zi.$metadata$={kind:x,simpleName:"ServerResponseException",interfaces:[Yi]},Object.defineProperty(Qi.prototype,"message",{configurable:!0,get:function(){return this.message_mrabda$_0}}),Qi.$metadata$={kind:x,simpleName:"ClientRequestException",interfaces:[Yi]},Object.defineProperty(Xi.prototype,"contentType",{configurable:!0,get:function(){return this.contentType_4t2c6o$_0}}),Object.defineProperty(Xi.prototype,"contentLength",{configurable:!0,get:function(){return this.contentLength_ca0n1g$_0}}),Xi.prototype.bytes=function(){return this.closure$body},Xi.$metadata$={kind:x,interfaces:[mt]},Object.defineProperty(tr.prototype,"contentType",{configurable:!0,get:function(){return this.contentType_4t2c6o$_0}}),tr.prototype.readFrom=function(){return this.closure$body},tr.$metadata$={kind:x,interfaces:[vt]},er.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},er.prototype=Object.create(m.prototype),er.prototype.constructor=er,er.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;null==this.local$$receiver.context.headers.get_61zpoe$(rt.HttpHeaders.Accept)&&this.local$$receiver.context.headers.append_puj7f4$(rt.HttpHeaders.Accept,"*/*");var n=null!=(t=this.local$$receiver.context.headers.get_61zpoe$(rt.HttpHeaders.ContentType))?_t.Companion.parse_61zpoe$(t):null,i="string"==typeof this.local$body?new yt(this.local$body,null!=n?n:_t.Text.Plain):e.isByteArray(this.local$body)?new Xi(this.local$body,n):e.isType(this.local$body,j)?new tr(this.local$body,n):null;if(null!=i){if(this.local$$receiver.context.headers.remove_61zpoe$(rt.HttpHeaders.ContentType),this.state_0=2,this.result_0=this.local$$receiver.proceedWith_trkh7z$(i,this),this.result_0===y)return y;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:case 3:return h;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ir.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},ir.prototype=Object.create(m.prototype),ir.prototype.constructor=ir,ir.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=3,this.state_0=1,this.result_0=Nt(this.local$closure$body,this.local$$receiver.channel,gt,this),this.result_0===y)return y;continue;case 1:this.exceptionState_0=6,this.finallyPath_0=[2],this.state_0=4,this.$returnValue=this.result_0;continue;case 2:return this.$returnValue;case 3:this.finallyPath_0=[6],this.exceptionState_0=4;var t=this.exception_0;throw e.isType(t,zt)?(k(this.local$closure$response,t),t):e.isType(t,R)?(P(this.local$closure$response,"Receive failed",t),t):t;case 4:this.exceptionState_0=6,Ea(this.local$closure$response),this.state_0=this.finallyPath_0.shift();continue;case 5:return;case 6:throw this.exception_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ar.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},ar.prototype=Object.create(m.prototype),ar.prototype.constructor=ar,ar.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n,i;if(this.local$info=this.local$f.component1(),this.local$body=this.local$f.component2(),e.isType(this.local$body,j)){this.state_0=2;continue}return;case 1:throw this.exception_0;case 2:var r=this.local$$receiver.context.response;if(this.local$contentLength=null!=(n=null!=(t=r.headers.get_61zpoe$(rt.HttpHeaders.ContentLength))?$t(t):null)?n:gt,i=this.local$info.type,pt(i,W(Object.getPrototypeOf(wt.Unit).constructor))){if(bt(this.local$body),this.state_0=16,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ma(this.local$info,h),this),this.result_0===y)return y;continue}if(pt(i,St)){if(this.state_0=13,this.result_0=J(this.local$body,this),this.result_0===y)return y;continue}if(pt(i,W(xt))||pt(i,W(Et))){if(this.state_0=10,this.result_0=J(this.local$body,this),this.result_0===y)return y;continue}if(pt(i,Ot)){if(this.state_0=7,this.result_0=Ct(this.local$body,this.local$contentLength,this),this.result_0===y)return y;continue}if(pt(i,W(j))){var o=b(r.coroutineContext.get_j3r2sn$(f.Key)),a=jt(this.local$$receiver,this.local$closure$client.coroutineContext,void 0,rr(this.local$body,r));a.invokeOnCompletion_f05bi3$(or(o));var s=a.channel;if(this.state_0=5,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ma(this.local$info,s),this),this.result_0===y)return y;continue}if(pt(i,W(Tt))){if(bt(this.local$body),this.state_0=3,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ma(this.local$info,r.status),this),this.result_0===y)return y;continue}this.state_0=4;continue;case 3:return this.result_0;case 4:this.state_0=6;continue;case 5:return this.result_0;case 6:this.state_0=9;continue;case 7:var l=this.result_0;if(this.local$contentLength.compareTo_11rb$(gt)<0&&!pt(l.remaining,this.local$contentLength)){var c="Expected "+this.local$contentLength.toString()+", actual "+l.remaining.toString();throw O(c.toString())}if(this.state_0=8,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ma(this.local$info,Z(l)),this),this.result_0===y)return y;continue;case 8:return this.result_0;case 9:this.state_0=12;continue;case 10:if(this.state_0=11,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ma(this.local$info,this.result_0),this),this.result_0===y)return y;continue;case 11:return this.result_0;case 12:this.state_0=15;continue;case 13:if(this.state_0=14,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ma(this.local$info,kt(this.result_0.readText_vux9f0$())),this),this.result_0===y)return y;continue;case 14:return this.result_0;case 15:this.state_0=17;continue;case 16:return this.result_0;case 17:return h;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},cr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},cr.prototype=Object.create(m.prototype),cr.prototype.constructor=cr,cr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$tmp$=this.$this.responseValidators_0.iterator(),this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(!this.local$tmp$.hasNext()){this.state_0=4;continue}var t=this.local$tmp$.next();if(this.state_0=3,this.result_0=t(this.local$response,this),this.result_0===y)return y;continue;case 3:this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},lr.prototype.validateResponse_0=function(t,e,n){var i=new cr(this,t,e);return n?i:i.doResume(null)},ur.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},ur.prototype=Object.create(m.prototype),ur.prototype.constructor=ur,ur.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$tmp$=this.$this.callExceptionHandlers_0.iterator(),this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(!this.local$tmp$.hasNext()){this.state_0=4;continue}var t=this.local$tmp$.next();if(this.state_0=3,this.result_0=t(this.local$cause,this),this.result_0===y)return y;continue;case 3:this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},lr.prototype.processException_0=function(t,e,n){var i=new ur(this,t,e);return n?i:i.doResume(null)},pr.prototype.handleResponseException_9rdja$=function(t){this.responseExceptionHandlers_8be2vx$.add_11rb$(t)},pr.prototype.validateResponse_d4bkoy$=function(t){this.responseValidators_8be2vx$.add_11rb$(t)},pr.$metadata$={kind:x,simpleName:"Config",interfaces:[]},Object.defineProperty(hr.prototype,"key",{configurable:!0,get:function(){return this.key_uukd7r$_0}}),hr.prototype.prepare_oh3mgy$$default=function(t){var e=new pr;t(e);var n=e;return new lr(Pt(n.responseValidators_8be2vx$),Pt(n.responseExceptionHandlers_8be2vx$),n.expectSuccess)},dr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},dr.prototype=Object.create(m.prototype),dr.prototype.constructor=dr,dr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=2,this.local$$receiver.context.attributes.computeIfAbsent_u4q9l2$(mr,fr(this.local$closure$feature)),this.state_0=1,this.result_0=this.local$$receiver.proceedWith_trkh7z$(this.local$it,this),this.result_0===y)return y;continue;case 1:return this.result_0;case 2:this.exceptionState_0=6;var t=this.exception_0;if(e.isType(t,R)){if(this.local$unwrappedCause=t,this.state_0=3,this.result_0=this.local$closure$feature.processException_0(this.local$unwrappedCause,this),this.result_0===y)return y;continue}throw t;case 3:throw this.local$unwrappedCause;case 4:this.state_0=5;continue;case 5:return;case 6:throw this.exception_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},_r.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},_r.prototype=Object.create(m.prototype),_r.prototype.constructor=_r,_r.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=2,this.state_0=1,this.result_0=this.local$$receiver.proceedWith_trkh7z$(this.local$container,this),this.result_0===y)return y;continue;case 1:return this.result_0;case 2:this.exceptionState_0=6;var t=this.exception_0;if(e.isType(t,R)){if(this.local$unwrappedCause=t,this.state_0=3,this.result_0=this.local$closure$feature.processException_0(this.local$unwrappedCause,this),this.result_0===y)return y;continue}throw t;case 3:throw this.local$unwrappedCause;case 4:this.state_0=5;continue;case 5:return;case 6:throw this.exception_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},yr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},yr.prototype=Object.create(m.prototype),yr.prototype.constructor=yr,yr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$feature.validateResponse_0(this.local$call.response,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.local$call;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},hr.prototype.install_wojrb5$=function(t,e){var n;e.requestPipeline.intercept_h71y74$(pa().Before,(n=t,function(t,e,i,r){var o=new dr(n,t,e,this,i);return r?o:o.doResume(null)}));var i=new Rt("BeforeReceive");e.responsePipeline.insertPhaseBefore_b9zzbm$(za().Receive,i),e.responsePipeline.intercept_h71y74$(i,function(t){return function(e,n,i,r){var o=new _r(t,e,n,this,i);return r?o:o.doResume(null)}}(t)),xr(e,oo()).intercept_vsqnz3$(function(t){return function(e,n,i,r,o){var a=new yr(t,e,n,i,this,r);return o?a:a.doResume(null)}}(t))},hr.$metadata$={kind:A,simpleName:"Companion",interfaces:[wr]};var mr,vr,$r=null;function gr(){return null===$r&&new hr,$r}function br(t,e){t.install_xlxg29$(gr(),e)}function wr(){}function kr(t){return h}function Sr(t,e){var n;return null!=(n=t.attributes.getOrNull_yzaw86$(vr))?n.getOrNull_yzaw86$(e.key):null}function xr(t,e){var n=Sr(t,e);if(null!=n)return n;var i="Feature "+e+" is not installed. Consider using `install("+e.key+")` in client config first.";throw O(i.toString())}lr.$metadata$={kind:x,simpleName:"HttpCallValidator",interfaces:[]},wr.prototype.prepare_oh3mgy$=function(t,e){return void 0===t&&(t=kr),e?e(t):this.prepare_oh3mgy$$default(t)},wr.$metadata$={kind:it,simpleName:"HttpClientFeature",interfaces:[]};var Er=L((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(i),r(n))}}})),Cr=L((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(n),r(i))}}}));function Or(t,e,n,i){var r,o,a;Ar(),this.responseCharsetFallback_0=i,this.requestCharset_0=null,this.acceptCharsetHeader_0=null;var s,l=Wt(Ht(e),new Yt(Er(Ir))),c=at();for(s=t.iterator();s.hasNext();){var u=s.next();e.containsKey_11rb$(u)||c.add_11rb$(u)}var p,h,f=Wt(c,new Yt(Cr(Mr))),d=Gt();for(p=f.iterator();p.hasNext();){var _=p.next();d.length>0&&d.append_pdl1vj$(","),d.append_pdl1vj$(Vt(_))}for(h=l.iterator();h.hasNext();){var y=h.next(),m=y.component1(),v=y.component2();if(d.length>0&&d.append_pdl1vj$(","),!It(At(0,1),v))throw O("Check failed.".toString());var $=Jt(100*v)/100;d.append_pdl1vj$(Vt(m)+";q="+$)}0===d.length&&d.append_pdl1vj$(Vt(this.responseCharsetFallback_0)),this.acceptCharsetHeader_0=d.toString(),this.requestCharset_0=null!=(a=null!=(o=null!=n?n:Kt(f))?o:null!=(r=Kt(l))?r.first:null)?a:Mt.Charsets.UTF_8}function Nr(){this.charsets_8be2vx$=Zt(),this.charsetQuality_8be2vx$=Qt(),this.sendCharset=null,this.responseCharsetFallback=Mt.Charsets.UTF_8,this.defaultCharset=Mt.Charsets.UTF_8}function zr(){Rr=this,this.key_wkh146$_0=new $("HttpPlainText")}function jr(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$feature=t,this.local$contentType=void 0,this.local$$receiver=e,this.local$content=n}function Tr(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$feature=t,this.local$info=void 0,this.local$body=void 0,this.local$$receiver=e,this.local$f=n}Nr.prototype.register_qv516$=function(t,e){if(void 0===e&&(e=null),null!=e&&!It(At(0,1),e))throw O("Check failed.".toString());this.charsets_8be2vx$.add_11rb$(t),null==e?this.charsetQuality_8be2vx$.remove_11rb$(t):this.charsetQuality_8be2vx$.put_xwzc9p$(t,e)},Nr.$metadata$={kind:x,simpleName:"Config",interfaces:[]},Object.defineProperty(zr.prototype,"key",{configurable:!0,get:function(){return this.key_wkh146$_0}}),zr.prototype.prepare_oh3mgy$$default=function(t){var e=new Nr;t(e);var n=e;return new Or(n.charsets_8be2vx$,n.charsetQuality_8be2vx$,n.sendCharset,n.responseCharsetFallback)},jr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},jr.prototype=Object.create(m.prototype),jr.prototype.constructor=jr,jr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$closure$feature.addCharsetHeaders_jc2hdt$(this.local$$receiver.context),"string"!=typeof this.local$content)return;this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.local$contentType=Lt(this.local$$receiver.context),null==this.local$contentType||pt(this.local$contentType.contentType,_t.Text.Plain.contentType)){this.state_0=3;continue}return;case 3:var t=null!=this.local$contentType?Dt(this.local$contentType):null;if(this.state_0=4,this.result_0=this.local$$receiver.proceedWith_trkh7z$(this.local$closure$feature.wrapContent_0(this.local$content,t),this),this.result_0===y)return y;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Tr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Tr.prototype=Object.create(m.prototype),Tr.prototype.constructor=Tr,Tr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.local$info=this.local$f.component1(),this.local$body=this.local$f.component2(),null!=(t=this.local$info.type)&&t.equals(qt)&&e.isType(this.local$body,j)){this.state_0=2;continue}return;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=J(this.local$body,this),this.result_0===y)return y;continue;case 3:var n=this.result_0,i=this.local$closure$feature.read_r18uy3$(this.local$$receiver.context,n);if(this.state_0=4,this.result_0=this.local$$receiver.proceedWith_trkh7z$(new Ma(this.local$info,i),this),this.result_0===y)return y;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},zr.prototype.install_wojrb5$=function(t,e){var n;e.requestPipeline.intercept_h71y74$(pa().Render,(n=t,function(t,e,i,r){var o=new jr(n,t,e,this,i);return r?o:o.doResume(null)})),e.responsePipeline.intercept_h71y74$(za().Parse,function(t){return function(e,n,i,r){var o=new Tr(t,e,n,this,i);return r?o:o.doResume(null)}}(t))},zr.$metadata$={kind:A,simpleName:"Feature",interfaces:[wr]};var Pr,Rr=null;function Ar(){return null===Rr&&new zr,Rr}function Ir(t){return t.second}function Mr(t){return Vt(t)}function Lr(){Br(),this._checkHttpMethod_0=!0,this._allowHttpsDowngrade_0=!1}function Dr(){Ur=this,this.key_oxn36d$_0=new $("HttpRedirect")}function qr(t,e,n,i,r,o,a){m.call(this,a),this.$controller=o,this.exceptionState_0=1,this.local$closure$feature=t,this.local$this$HttpRedirect$=e,this.local$$receiver=n,this.local$origin=i,this.local$context=r}function Fr(t,e,n,i,r,o){m.call(this,o),this.exceptionState_0=1,this.$this=t,this.local$call=void 0,this.local$requestBuilder=void 0,this.local$originProtocol=void 0,this.local$originAuthority=void 0,this.local$$receiver=void 0,this.local$$receiver_0=e,this.local$context=n,this.local$origin=i,this.local$allowHttpsDowngrade=r}Or.prototype.wrapContent_0=function(t,e){var n=null!=e?e:this.requestCharset_0;return new yt(t,Ft(_t.Text.Plain,n))},Or.prototype.read_r18uy3$=function(t,e){var n,i=null!=(n=Ut(t.response))?n:this.responseCharsetFallback_0;return Bt(e,i)},Or.prototype.addCharsetHeaders_jc2hdt$=function(t){null==t.headers.get_61zpoe$(rt.HttpHeaders.AcceptCharset)&&t.headers.set_puj7f4$(rt.HttpHeaders.AcceptCharset,this.acceptCharsetHeader_0)},Object.defineProperty(Or.prototype,"defaultCharset",{configurable:!0,get:function(){throw O("defaultCharset is deprecated".toString())},set:function(t){throw O("defaultCharset is deprecated".toString())}}),Or.$metadata$={kind:x,simpleName:"HttpPlainText",interfaces:[]},Object.defineProperty(Lr.prototype,"checkHttpMethod",{configurable:!0,get:function(){return this._checkHttpMethod_0},set:function(t){this._checkHttpMethod_0=t}}),Object.defineProperty(Lr.prototype,"allowHttpsDowngrade",{configurable:!0,get:function(){return this._allowHttpsDowngrade_0},set:function(t){this._allowHttpsDowngrade_0=t}}),Object.defineProperty(Dr.prototype,"key",{configurable:!0,get:function(){return this.key_oxn36d$_0}}),Dr.prototype.prepare_oh3mgy$$default=function(t){var e=new Lr;return t(e),e},qr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},qr.prototype=Object.create(m.prototype),qr.prototype.constructor=qr,qr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$closure$feature.checkHttpMethod&&!Pr.contains_11rb$(this.local$origin.request.method))return this.local$origin;this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.local$this$HttpRedirect$.handleCall_0(this.local$$receiver,this.local$context,this.local$origin,this.local$closure$feature.allowHttpsDowngrade,this),this.result_0===y)return y;continue;case 3:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Dr.prototype.install_wojrb5$=function(t,e){var n,i;xr(e,oo()).intercept_vsqnz3$((n=t,i=this,function(t,e,r,o,a){var s=new qr(n,i,t,e,r,this,o);return a?s:s.doResume(null)}))},Fr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Fr.prototype=Object.create(m.prototype),Fr.prototype.constructor=Fr,Fr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(Hr(this.local$origin.response.status)){this.state_0=2;continue}return this.local$origin;case 1:throw this.exception_0;case 2:this.local$call={v:this.local$origin},this.local$requestBuilder={v:this.local$context},this.local$originProtocol=this.local$origin.request.url.protocol,this.local$originAuthority=ee(this.local$origin.request.url),this.state_0=3;continue;case 3:var t=this.local$call.v.response.headers.get_61zpoe$(rt.HttpHeaders.Location);if(this.local$$receiver=new Xo,this.local$$receiver.takeFromWithExecutionContext_s9rlw$(this.local$requestBuilder.v),this.local$$receiver.url.parameters.clear(),null!=t&&ne(this.local$$receiver.url,t),this.local$allowHttpsDowngrade||!ie(this.local$originProtocol)||ie(this.local$$receiver.url.protocol)){this.state_0=4;continue}return this.local$call.v;case 4:if(pt(this.local$originAuthority,re(this.local$$receiver.url))||this.local$$receiver.headers.remove_61zpoe$(rt.HttpHeaders.Authorization),this.local$requestBuilder.v=this.local$$receiver,this.state_0=5,this.result_0=this.local$$receiver_0.execute_s9rlw$(this.local$requestBuilder.v,this),this.result_0===y)return y;continue;case 5:if(this.local$call.v=this.result_0,Hr(this.local$call.v.response.status)){this.state_0=6;continue}return this.local$call.v;case 6:this.state_0=3;continue;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Dr.prototype.handleCall_0=function(t,e,n,i,r,o){var a=new Fr(this,t,e,n,i,r);return o?a:a.doResume(null)},Dr.$metadata$={kind:A,simpleName:"Feature",interfaces:[wr]};var Ur=null;function Br(){return null===Ur&&new Dr,Ur}function Hr(t){var e;return(e=t.value)===Tt.Companion.MovedPermanently.value||e===Tt.Companion.Found.value||e===Tt.Companion.TemporaryRedirect.value||e===Tt.Companion.PermanentRedirect.value||e===Tt.Companion.SeeOther.value}function Vr(){Gr()}function Kr(){Yr=this,this.key_livr7a$_0=new $("RequestLifecycle")}function Wr(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=6,this.local$closure$scope=t,this.local$executionContext=void 0,this.local$$receiver=e}Lr.$metadata$={kind:x,simpleName:"HttpRedirect",interfaces:[]},Object.defineProperty(Kr.prototype,"key",{configurable:!0,get:function(){return this.key_livr7a$_0}}),Kr.prototype.prepare_oh3mgy$$default=function(t){return new Vr},Wr.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Wr.prototype=Object.create(m.prototype),Wr.prototype.constructor=Wr,Wr.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=b(this.local$$receiver.context.executionContext);if(S(t),this.local$executionContext=t,Jr(this.local$executionContext,d(this.local$closure$scope.coroutineContext.get_j3r2sn$(f.Key))),this.exceptionState_0=3,this.local$$receiver.context.executionContext=this.local$executionContext,this.state_0=1,this.result_0=this.local$$receiver.proceed(this),this.result_0===y)return y;continue;case 1:this.exceptionState_0=6,this.finallyPath_0=[2],this.state_0=4,this.$returnValue=this.result_0;continue;case 2:return this.$returnValue;case 3:this.finallyPath_0=[6],this.exceptionState_0=4;var n=this.exception_0;throw e.isType(n,R)?(this.local$executionContext.completeExceptionally_tcv7n7$(n),n):n;case 4:this.exceptionState_0=6,this.local$executionContext.complete(),this.state_0=this.finallyPath_0.shift();continue;case 5:return;case 6:throw this.exception_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Kr.prototype.install_wojrb5$=function(t,e){var n;e.requestPipeline.intercept_h71y74$(pa().Before,(n=e,function(t,e,i,r){var o=new Wr(n,t,e,this,i);return r?o:o.doResume(null)}))},Kr.$metadata$={kind:A,simpleName:"Feature",interfaces:[wr]};var Yr=null;function Gr(){return null===Yr&&new Kr,Yr}function Jr(t,e){S(e);var n,i,r=e.invokeOnCompletion_f05bi3$((n=t,function(t){return null!=t?oe(n,"Engine failed",t):n.complete(),h}));t.invokeOnCompletion_f05bi3$((i=r,function(t){return i.dispose(),h}))}function Zr(t){this.value_0=t}function Qr(){}function Xr(t){oo(),void 0===t&&(t=20),this.maxSendCount_scppen$_0=new Zr(t),this.interceptors_0=os(),S(this)}Vr.$metadata$={kind:x,simpleName:"HttpRequestLifecycle",interfaces:[]},Zr.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},Zr.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},Zr.$metadata$={kind:x,interfaces:[C]},Qr.$metadata$={kind:it,simpleName:"Sender",interfaces:[]};var to=new _("maxSendCount");function eo(t,e,n,i,r,o){m.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$block=t,this.local$$receiver=e,this.local$call=n}function no(){ro=this,this.key_x494tl$_0=new $("HttpSend")}function io(t,e,n,i,r,o){m.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$feature=t,this.local$closure$scope=e,this.local$tmp$=void 0,this.local$sender=void 0,this.local$currentCall=void 0,this.local$callChanged=void 0,this.local$transformed=void 0,this.local$$receiver=n,this.local$content=i}Object.defineProperty(Xr.prototype,"maxSendCount",{configurable:!0,get:function(){return this.maxSendCount_scppen$_0.getValue_lrcp0p$(this,to)},set:function(t){this.maxSendCount_scppen$_0.setValue_9rddgb$(this,to,t)}}),Xr.prototype.intercept_vsqnz3$=function(t){this.interceptors_0.add_11rb$(t)},eo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},eo.prototype=Object.create(m.prototype),eo.prototype.constructor=eo,eo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$block(this.local$$receiver,this.local$call,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Xr.prototype.intercept_efqc3v$=function(t){var e;this.interceptors_0.add_11rb$((e=t,function(t,n,i,r,o){var a=new eo(e,t,n,i,this,r);return o?a:a.doResume(null)}))},Object.defineProperty(no.prototype,"key",{configurable:!0,get:function(){return this.key_x494tl$_0}}),no.prototype.prepare_oh3mgy$$default=function(t){var e=new Xr;return t(e),e},io.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},io.prototype=Object.create(m.prototype),io.prototype.constructor=io,io.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(!e.isType(this.local$content,ae)){var t=H("\n|Fail to serialize body. Content has type: "+e.getKClassFromExpression(this.local$content)+", but OutgoingContent expected.\n|If you expect serialized body, please check that you have installed the corresponding feature(like `Json`) and set `Content-Type` header.");throw O(t.toString())}if(this.local$$receiver.context.body=this.local$content,this.local$sender=new ao(this.local$closure$feature.maxSendCount,this.local$closure$scope),this.state_0=2,this.result_0=this.local$sender.execute_s9rlw$(this.local$$receiver.context,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:this.local$currentCall=this.result_0,this.state_0=3;continue;case 3:this.local$callChanged=!1,this.local$tmp$=this.local$closure$feature.interceptors_0.iterator(),this.state_0=4;continue;case 4:if(!this.local$tmp$.hasNext()){this.state_0=7;continue}var n=this.local$tmp$.next();if(this.state_0=5,this.result_0=n(this.local$sender,this.local$currentCall,this.local$$receiver.context,this),this.result_0===y)return y;continue;case 5:if(this.local$transformed=this.result_0,this.local$transformed===this.local$currentCall){this.state_0=4;continue}this.state_0=6;continue;case 6:this.local$currentCall=this.local$transformed,this.local$callChanged=!0,this.state_0=7;continue;case 7:if(!this.local$callChanged){this.state_0=8;continue}this.state_0=3;continue;case 8:if(this.state_0=9,this.result_0=this.local$$receiver.proceedWith_trkh7z$(this.local$currentCall,this),this.result_0===y)return y;continue;case 9:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},no.prototype.install_wojrb5$=function(t,e){var n,i;e.requestPipeline.intercept_h71y74$(pa().Send,(n=t,i=e,function(t,e,r,o){var a=new io(n,i,t,e,this,r);return o?a:a.doResume(null)}))},no.$metadata$={kind:A,simpleName:"Feature",interfaces:[wr]};var ro=null;function oo(){return null===ro&&new no,ro}function ao(t,e){this.maxSendCount_0=t,this.client_0=e,this.sentCount_0=0,this.currentCall_0=null}function so(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$requestBuilder=e}function lo(t){O(t,this),this.name="SendCountExceedException"}function co(t){this.value_0=t}function uo(t,e,n){Eo(),this.requestTimeoutMillis_0=t,this.connectTimeoutMillis_0=e,this.socketTimeoutMillis_0=n}function po(){vo(),this._requestTimeoutMillis_4dr633$_0=new co(le),this._connectTimeoutMillis_yp3bu2$_0=new co(le),this._socketTimeoutMillis_d8nrb$_0=new co(le)}so.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},so.prototype=Object.create(m.prototype),so.prototype.constructor=so,so.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n,i;if(null!=(t=this.$this.currentCall_0)&&k(t),this.$this.sentCount_0>=this.$this.maxSendCount_0)throw new lo("Max send count "+this.$this.maxSendCount_0+" exceeded");if(this.$this.sentCount_0=this.$this.sentCount_0+1|0,this.state_0=2,this.result_0=this.$this.client_0.sendPipeline.execute_8pmvt0$(this.local$requestBuilder,this.local$requestBuilder.body,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:var r=this.result_0;if(null==(i=e.isType(n=r,Vn)?n:null))throw O(("Failed to execute send pipeline. Expected to got [HttpClientCall], but received "+r.toString()).toString());var o=i;return this.$this.currentCall_0=o,o;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ao.prototype.execute_s9rlw$=function(t,e,n){var i=new so(this,t,e);return n?i:i.doResume(null)},ao.$metadata$={kind:x,simpleName:"DefaultSender",interfaces:[Qr]},Xr.$metadata$={kind:x,simpleName:"HttpSend",interfaces:[]},lo.$metadata$={kind:x,simpleName:"SendCountExceedException",interfaces:[q]},co.prototype.getValue_lrcp0p$=function(t,e){return this.value_0},co.prototype.setValue_9rddgb$=function(t,e,n){this.value_0=n},co.$metadata$={kind:x,interfaces:[C]};var ho=new _("_requestTimeoutMillis");Object.defineProperty(po.prototype,"_requestTimeoutMillis_0",{configurable:!0,get:function(){return this._requestTimeoutMillis_4dr633$_0.getValue_lrcp0p$(this,ho)},set:function(t){this._requestTimeoutMillis_4dr633$_0.setValue_9rddgb$(this,ho,t)}});var fo=new _("_connectTimeoutMillis");Object.defineProperty(po.prototype,"_connectTimeoutMillis_0",{configurable:!0,get:function(){return this._connectTimeoutMillis_yp3bu2$_0.getValue_lrcp0p$(this,fo)},set:function(t){this._connectTimeoutMillis_yp3bu2$_0.setValue_9rddgb$(this,fo,t)}});var _o=new _("_socketTimeoutMillis");function yo(){mo=this,this.key=new $("TimeoutConfiguration")}Object.defineProperty(po.prototype,"_socketTimeoutMillis_0",{configurable:!0,get:function(){return this._socketTimeoutMillis_d8nrb$_0.getValue_lrcp0p$(this,_o)},set:function(t){this._socketTimeoutMillis_d8nrb$_0.setValue_9rddgb$(this,_o,t)}}),Object.defineProperty(po.prototype,"requestTimeoutMillis",{configurable:!0,get:function(){return this._requestTimeoutMillis_0},set:function(t){this._requestTimeoutMillis_0=this.checkTimeoutValue_0(t)}}),Object.defineProperty(po.prototype,"connectTimeoutMillis",{configurable:!0,get:function(){return this._connectTimeoutMillis_0},set:function(t){this._connectTimeoutMillis_0=this.checkTimeoutValue_0(t)}}),Object.defineProperty(po.prototype,"socketTimeoutMillis",{configurable:!0,get:function(){return this._socketTimeoutMillis_0},set:function(t){this._socketTimeoutMillis_0=this.checkTimeoutValue_0(t)}}),po.prototype.build_8be2vx$=function(){return new uo(this.requestTimeoutMillis,this.connectTimeoutMillis,this.socketTimeoutMillis)},po.prototype.checkTimeoutValue_0=function(t){if(!(null==t||t.toNumber()>0))throw Q("Only positive timeout values are allowed, for infinite timeout use HttpTimeout.INFINITE_TIMEOUT_MS".toString());return t},po.prototype.equals=function(t){var n;return!!(this===t||null!=t&&null!=(n=e.getKClassFromExpression(this))&&n.equals(e.getKClassFromExpression(t))&&(e.isType(t,po)||v(),pt(this._requestTimeoutMillis_0,t._requestTimeoutMillis_0)&&pt(this._connectTimeoutMillis_0,t._connectTimeoutMillis_0)&&pt(this._socketTimeoutMillis_0,t._socketTimeoutMillis_0)))},po.prototype.hashCode=function(){var t,e,n,i,r,o,a=null!=(e=null!=(t=this._requestTimeoutMillis_0)?se(t):null)?e:0;return a=(31*(a=(31*a|0)+(null!=(i=null!=(n=this._connectTimeoutMillis_0)?se(n):null)?i:0)|0)|0)+(null!=(o=null!=(r=this._socketTimeoutMillis_0)?se(r):null)?o:0)|0},yo.$metadata$={kind:A,simpleName:"Companion",interfaces:[]};var mo=null;function vo(){return null===mo&&new yo,mo}function $o(t,e,n,i){return void 0===t&&(t=null),void 0===e&&(e=null),void 0===n&&(n=null),i=i||Object.create(po.prototype),po.call(i),i.requestTimeoutMillis=t,i.connectTimeoutMillis=e,i.socketTimeoutMillis=n,i}function go(){xo=this,this.key_g1vqj4$_0=new $("TimeoutFeature"),this.INFINITE_TIMEOUT_MS=gt}function bo(t,e,n,i,r,o){m.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$requestTimeout=t,this.local$closure$executionContext=e,this.local$this$=n}function wo(t,e,n){return function(i,r,o){var a=new bo(t,e,n,i,this,r);return o?a:a.doResume(null)}}function ko(t){return function(e){return t.cancel_m4sck1$(),h}}function So(t,e,n,i,r,o,a){m.call(this,a),this.$controller=o,this.exceptionState_0=1,this.local$closure$feature=t,this.local$this$HttpTimeout$=e,this.local$closure$scope=n,this.local$$receiver=i}po.$metadata$={kind:x,simpleName:"HttpTimeoutCapabilityConfiguration",interfaces:[]},uo.prototype.hasNotNullTimeouts_0=function(){return null!=this.requestTimeoutMillis_0||null!=this.connectTimeoutMillis_0||null!=this.socketTimeoutMillis_0},Object.defineProperty(go.prototype,"key",{configurable:!0,get:function(){return this.key_g1vqj4$_0}}),go.prototype.prepare_oh3mgy$$default=function(t){var e=$o();return t(e),e.build_8be2vx$()},bo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},bo.prototype=Object.create(m.prototype),bo.prototype.constructor=bo,bo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=ce(this.local$closure$requestTimeout,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.local$closure$executionContext.cancel_m4sck1$(new Co(this.local$this$.context)),h;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},So.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},So.prototype=Object.create(m.prototype),So.prototype.constructor=So,So.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e=this.local$$receiver.context.getCapabilityOrNull_i25mbv$(Eo());if(null==e&&this.local$closure$feature.hasNotNullTimeouts_0()&&(e=$o(),this.local$$receiver.context.setCapability_wfl2px$(Eo(),e)),null!=e){var n=e,i=this.local$closure$feature,r=this.local$this$HttpTimeout$,o=this.local$closure$scope;t:do{var a,s,l,c;n.connectTimeoutMillis=null!=(a=n.connectTimeoutMillis)?a:i.connectTimeoutMillis_0,n.socketTimeoutMillis=null!=(s=n.socketTimeoutMillis)?s:i.socketTimeoutMillis_0,n.requestTimeoutMillis=null!=(l=n.requestTimeoutMillis)?l:i.requestTimeoutMillis_0;var u=null!=(c=n.requestTimeoutMillis)?c:i.requestTimeoutMillis_0;if(null==u||pt(u,r.INFINITE_TIMEOUT_MS))break t;var p=this.local$$receiver.context.executionContext,h=ue(o,void 0,void 0,wo(u,p,this.local$$receiver));this.local$$receiver.context.executionContext.invokeOnCompletion_f05bi3$(ko(h))}while(0);t=n}else t=null;return t;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},go.prototype.install_wojrb5$=function(t,e){var n,i,r;e.requestPipeline.intercept_h71y74$(pa().Before,(n=t,i=this,r=e,function(t,e,o,a){var s=new So(n,i,r,t,e,this,o);return a?s:s.doResume(null)}))},go.$metadata$={kind:A,simpleName:"Feature",interfaces:[ji,wr]};var xo=null;function Eo(){return null===xo&&new go,xo}function Co(t){var e,n;dt("Request timeout has been expired [url="+t.url.buildString()+", request_timeout="+(null!=(n=null!=(e=t.getCapabilityOrNull_i25mbv$(Eo()))?e.requestTimeoutMillis:null)?n:"unknown").toString()+" ms]",this),this.name="HttpRequestTimeoutException"}function Oo(t,e){var n;if(null==(n=t.client))throw O("Fail to create response observer in different native thread.".toString());return new No(n,e,t)}function No(t,e,n){Vn.call(this,t),this.request=new zo(this,n.request),this.response=new jo(this,e,n.response)}function zo(t,e){this.call_lxy36a$_0=t,this.$delegate_pysw8w$_0=e}function jo(t,e,n){Sa.call(this),this.call_c6mvxe$_0=t,this.content_luf9up$_0=e,this.origin_0=n,this.coroutineContext_62th7f$_0=this.origin_0.coroutineContext}function To(t){Fo(),this.responseHandler_0=t}function Po(){this.responseHandler_8be2vx$=Ao}function Ro(t,e){m.call(this,e),this.exceptionState_0=1}function Ao(t,e,n){var i=new Ro(t,e);return n?i:i.doResume(null)}function Io(){qo=this,this.key_1kjwna$_0=new $("BodyInterceptor")}function Mo(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=6,this.local$closure$feature=t,this.local$closure$sideCall=e}function Lo(t,e){return function(n,i,r){var o=new Mo(t,e,n,this,i);return r?o:o.doResume(null)}}function Do(t,e,n,i,r,o){m.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$scope=t,this.local$closure$feature=e,this.local$$receiver=n,this.local$response=i}uo.$metadata$={kind:x,simpleName:"HttpTimeout",interfaces:[]},Co.$metadata$={kind:x,simpleName:"HttpRequestTimeoutException",interfaces:[zt]},No.$metadata$={kind:x,simpleName:"DelegatedCall",interfaces:[Vn]},Object.defineProperty(zo.prototype,"call",{get:function(){return this.call_lxy36a$_0}}),Object.defineProperty(zo.prototype,"attributes",{configurable:!0,get:function(){return this.$delegate_pysw8w$_0.attributes}}),Object.defineProperty(zo.prototype,"content",{configurable:!0,get:function(){return this.$delegate_pysw8w$_0.content}}),Object.defineProperty(zo.prototype,"coroutineContext",{configurable:!0,get:function(){return this.$delegate_pysw8w$_0.coroutineContext}}),Object.defineProperty(zo.prototype,"executionContext",{configurable:!0,get:function(){return this.$delegate_pysw8w$_0.executionContext}}),Object.defineProperty(zo.prototype,"headers",{configurable:!0,get:function(){return this.$delegate_pysw8w$_0.headers}}),Object.defineProperty(zo.prototype,"method",{configurable:!0,get:function(){return this.$delegate_pysw8w$_0.method}}),Object.defineProperty(zo.prototype,"url",{configurable:!0,get:function(){return this.$delegate_pysw8w$_0.url}}),zo.$metadata$={kind:x,simpleName:"DelegatedRequest",interfaces:[Qo]},Object.defineProperty(jo.prototype,"call",{get:function(){return this.call_c6mvxe$_0}}),Object.defineProperty(jo.prototype,"content",{get:function(){return this.content_luf9up$_0}}),Object.defineProperty(jo.prototype,"coroutineContext",{configurable:!0,get:function(){return this.coroutineContext_62th7f$_0}}),Object.defineProperty(jo.prototype,"status",{configurable:!0,get:function(){return this.origin_0.status}}),Object.defineProperty(jo.prototype,"version",{configurable:!0,get:function(){return this.origin_0.version}}),Object.defineProperty(jo.prototype,"requestTime",{configurable:!0,get:function(){return this.origin_0.requestTime}}),Object.defineProperty(jo.prototype,"responseTime",{configurable:!0,get:function(){return this.origin_0.responseTime}}),Object.defineProperty(jo.prototype,"headers",{configurable:!0,get:function(){return this.origin_0.headers}}),jo.$metadata$={kind:x,simpleName:"DelegatedResponse",interfaces:[Sa]},Po.prototype.onResponse_d4bkoy$=function(t){this.responseHandler_8be2vx$=t},Ro.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Ro.prototype=Object.create(m.prototype),Ro.prototype.constructor=Ro,Ro.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:return h;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Po.$metadata$={kind:x,simpleName:"Config",interfaces:[]},Object.defineProperty(Io.prototype,"key",{configurable:!0,get:function(){return this.key_1kjwna$_0}}),Io.prototype.prepare_oh3mgy$$default=function(t){var e=new Po;return t(e),new To(e.responseHandler_8be2vx$)},Mo.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Mo.prototype=Object.create(m.prototype),Mo.prototype.constructor=Mo,Mo.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.exceptionState_0=2,this.state_0=1,this.result_0=this.local$closure$feature.responseHandler_0(this.local$closure$sideCall.response,this),this.result_0===y)return y;continue;case 1:this.exceptionState_0=6,this.state_0=3;continue;case 2:this.exceptionState_0=6;var t=this.exception_0;if(!e.isType(t,R))throw t;this.state_0=3;continue;case 3:var n=this.local$closure$sideCall.response.content;if(n.isClosedForRead){this.state_0=5;continue}if(this.state_0=4,this.result_0=be(n,this),this.result_0===y)return y;continue;case 4:case 5:return h;case 6:throw this.exception_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Do.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Do.prototype=Object.create(m.prototype),Do.prototype.constructor=Do,Do.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=ge(this.local$response.content,this.local$response),i=n.component1(),r=n.component2(),o=Oo(this.local$$receiver.context,r),a=Oo(o,i);if(ue(this.local$closure$scope,void 0,void 0,Lo(this.local$closure$feature,a)),this.local$$receiver.context.response=o.response,this.local$$receiver.context.request=o.request,(e.isType(t=this.local$response.coroutineContext.get_j3r2sn$(f.Key),st)?t:v()).complete(),this.state_0=2,this.result_0=this.local$$receiver.proceedWith_trkh7z$(this.local$$receiver.context.response,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Io.prototype.install_wojrb5$=function(t,e){var n,i;e.receivePipeline.intercept_h71y74$(Ia().After,(n=e,i=t,function(t,e,r,o){var a=new Do(n,i,t,e,this,r);return o?a:a.doResume(null)}))},Io.$metadata$={kind:A,simpleName:"Feature",interfaces:[wr]};var qo=null;function Fo(){return null===qo&&new Io,qo}function Uo(){}function Bo(t,e){this.call_e1jkgq$_0=t,this.$delegate_wwo9g4$_0=e}function Ho(){Vo=this}To.$metadata$={kind:x,simpleName:"ResponseObserver",interfaces:[]},Ho.prototype.toString=function(){return"WebSocketCapability"},Ho.$metadata$={kind:A,simpleName:"WebSocketCapability",interfaces:[ji]};var Vo=null;function Ko(){return null===Vo&&new Ho,Vo}function Wo(t){O(t,this),this.name="WebSocketException"}function Yo(){pe.call(this),this.content_1mwwgv$_xt2h6t$_0=ct(Jo)}function Go(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$output=e}function Jo(){return Ce()}function Zo(t,e){this.call_bo7spw$_0=t,this.method_c5x7eh$_0=e.method,this.url_9j6cnp$_0=e.url,this.content_jw4yw1$_0=e.body,this.headers_atwsac$_0=e.headers,this.attributes_el41s3$_0=e.attributes}function Qo(){}function Xo(){ia(),this.url=new me,this.method=Xt.Companion.Get,this.headers_nor9ye$_0=new _e,this.body=Qa();var t=je();S(t),this.executionContext_h6ms6p$_0=t,this.attributes=w(!0)}function ta(){return rs()}function ea(){na=this}Wo.$metadata$={kind:x,simpleName:"WebSocketException",interfaces:[q]},Object.defineProperty(Yo.prototype,"content_1mwwgv$_0",{configurable:!0,get:function(){return this.content_1mwwgv$_xt2h6t$_0.value}}),Object.defineProperty(Yo.prototype,"output",{configurable:!0,get:function(){return this.content_1mwwgv$_0}}),Go.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Go.prototype=Object.create(m.prototype),Go.prototype.constructor=Go,Go.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Ee(this.$this.content_1mwwgv$_0,this.local$output,void 0,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Yo.prototype.pipeTo_h3x4ir$=function(t,e,n){var i=new Go(this,t,e);return n?i:i.doResume(null)},Yo.$metadata$={kind:x,simpleName:"ClientUpgradeContent",interfaces:[pe]},Object.defineProperty(Zo.prototype,"call",{get:function(){return this.call_bo7spw$_0}}),Object.defineProperty(Zo.prototype,"coroutineContext",{configurable:!0,get:function(){return this.call.coroutineContext}}),Object.defineProperty(Zo.prototype,"method",{configurable:!0,get:function(){return this.method_c5x7eh$_0}}),Object.defineProperty(Zo.prototype,"url",{configurable:!0,get:function(){return this.url_9j6cnp$_0}}),Object.defineProperty(Zo.prototype,"content",{configurable:!0,get:function(){return this.content_jw4yw1$_0}}),Object.defineProperty(Zo.prototype,"headers",{configurable:!0,get:function(){return this.headers_atwsac$_0}}),Object.defineProperty(Zo.prototype,"attributes",{configurable:!0,get:function(){return this.attributes_el41s3$_0}}),Zo.$metadata$={kind:x,simpleName:"DefaultHttpRequest",interfaces:[Qo]},Object.defineProperty(Qo.prototype,"coroutineContext",{configurable:!0,get:function(){return this.call.coroutineContext}}),Object.defineProperty(Qo.prototype,"executionContext",{configurable:!0,get:function(){return d(this.coroutineContext.get_j3r2sn$(f.Key))}}),Qo.$metadata$={kind:it,simpleName:"HttpRequest",interfaces:[E,Oe]},Object.defineProperty(Xo.prototype,"headers",{configurable:!0,get:function(){return this.headers_nor9ye$_0}}),Object.defineProperty(Xo.prototype,"executionContext",{configurable:!0,get:function(){return this.executionContext_h6ms6p$_0},set:function(t){S(t),this.executionContext_h6ms6p$_0=t}}),Xo.prototype.url_6yzzjr$=function(t){t(this.url,this.url)},Xo.prototype.build=function(){var t,n,i,r,o;if(t=this.url.build(),n=this.method,i=this.headers.build(),null==(o=e.isType(r=this.body,ae)?r:null))throw O(("No request transformation found: "+this.body.toString()).toString());return new ra(t,n,i,o,this.executionContext,this.attributes)},Xo.prototype.setAttributes_yhh5ns$=function(t){t(this.attributes)},Xo.prototype.takeFromWithExecutionContext_s9rlw$=function(t){return this.executionContext=t.executionContext,this.takeFrom_s9rlw$(t)},Xo.prototype.takeFrom_s9rlw$=function(t){var n;for(this.method=t.method,this.body=t.body,Ne(this.url,t.url),this.url.encodedPath=de(this.url.encodedPath)?"/":this.url.encodedPath,ze(this.headers,t.headers),n=t.attributes.allKeys.iterator();n.hasNext();){var i,r=n.next();this.attributes.put_uuntuo$(e.isType(i=r,$)?i:v(),t.attributes.get_yzaw86$(r))}return this},Xo.prototype.setCapability_wfl2px$=function(t,e){this.attributes.computeIfAbsent_u4q9l2$(Jn,ta).put_xwzc9p$(t,e)},Xo.prototype.getCapabilityOrNull_i25mbv$=function(t){var n,i;return null==(i=null!=(n=this.attributes.getOrNull_yzaw86$(Jn))?n.get_11rb$(t):null)||e.isType(i,N)?i:v()},ea.$metadata$={kind:A,simpleName:"Companion",interfaces:[]};var na=null;function ia(){return null===na&&new ea,na}function ra(t,e,n,i,r,o){var a,s;this.url=t,this.method=e,this.headers=n,this.body=i,this.executionContext=r,this.attributes=o,this.requiredCapabilities_8be2vx$=null!=(s=null!=(a=this.attributes.getOrNull_yzaw86$(Jn))?a.keys:null)?s:et()}function oa(t,e,n,i,r,o){this.statusCode=t,this.requestTime=e,this.headers=n,this.version=i,this.body=r,this.callContext=o,this.responseTime=fe()}function aa(t){return h}function sa(t){return e.isType(t.body,Yo)}function la(t){pa(),void 0===t&&(t=!1),Re.call(this,[pa().Before,pa().State,pa().Transform,pa().Render,pa().Send]),this.developmentMode_dglch5$_0=t}function ca(){ua=this,this.Before=new Rt("Before"),this.State=new Rt("State"),this.Transform=new Rt("Transform"),this.Render=new Rt("Render"),this.Send=new Rt("Send")}Xo.$metadata$={kind:x,simpleName:"HttpRequestBuilder",interfaces:[Te]},ra.prototype.getCapabilityOrNull_1sr7de$=function(t){var n,i;return null==(i=null!=(n=this.attributes.getOrNull_yzaw86$(Jn))?n.get_11rb$(t):null)||e.isType(i,N)?i:v()},ra.prototype.toString=function(){return"HttpRequestData(url="+this.url+", method="+this.method+")"},ra.$metadata$={kind:x,simpleName:"HttpRequestData",interfaces:[]},oa.prototype.toString=function(){return"HttpResponseData=(statusCode="+this.statusCode+")"},oa.$metadata$={kind:x,simpleName:"HttpResponseData",interfaces:[]},Object.defineProperty(la.prototype,"developmentMode",{get:function(){return this.developmentMode_dglch5$_0}}),ca.$metadata$={kind:A,simpleName:"Phases",interfaces:[]};var ua=null;function pa(){return null===ua&&new ca,ua}function ha(t){ya(),void 0===t&&(t=!1),Re.call(this,[ya().Before,ya().State,ya().Monitoring,ya().Engine,ya().Receive]),this.developmentMode_7517lc$_0=t}function fa(){_a=this,this.Before=new Rt("Before"),this.State=new Rt("State"),this.Monitoring=new Rt("Monitoring"),this.Engine=new Rt("Engine"),this.Receive=new Rt("Receive")}la.$metadata$={kind:x,simpleName:"HttpRequestPipeline",interfaces:[Re]},Object.defineProperty(ha.prototype,"developmentMode",{get:function(){return this.developmentMode_7517lc$_0}}),fa.$metadata$={kind:A,simpleName:"Phases",interfaces:[]};var da,_a=null;function ya(){return null===_a&&new fa,_a}function ma(t){mt.call(this),this.formData=t;var n=Ae(this.formData);this.content_0=Ge(Mt.Charsets.UTF_8.newEncoder(),n,0,n.length),this.contentLength_f2tvnf$_0=e.Long.fromInt(this.content_0.length),this.contentType_gyve29$_0=Ft(_t.Application.FormUrlEncoded,Mt.Charsets.UTF_8)}function va(t){Le.call(this),this.boundary_0=function(){for(var t=Gt(),e=0;e<32;e++)t.append_pdl1vj$(Ke(Ve.Default.nextInt(),16));return We(t.toString(),70)}();var n="--"+this.boundary_0+"\r\n";this.BOUNDARY_BYTES_0=Ge(Mt.Charsets.UTF_8.newEncoder(),n,0,n.length);var i="--"+this.boundary_0+"--\r\n";this.LAST_BOUNDARY_BYTES_0=Ge(Mt.Charsets.UTF_8.newEncoder(),i,0,i.length),this.BODY_OVERHEAD_SIZE_0=this.LAST_BOUNDARY_BYTES_0.length,this.PART_OVERHEAD_SIZE_0=(2*da.length|0)+this.BOUNDARY_BYTES_0.length|0;var r,o,a=ve(Je(t,10));for(r=t.iterator();r.hasNext();){var s,l,c,u,p,h=r.next(),f=a.add_11rb$,d=De();for(l=h.headers.entries().iterator();l.hasNext();){var _=l.next(),y=_.key,m=_.value;qe(d,y+": "+B(m,"; ")),Fe(d,da)}var v=null!=(c=h.headers.get_61zpoe$(rt.HttpHeaders.ContentLength))?$t(c):null;if(e.isType(h,Ue)){var $=Z(d.build()),g=null!=(u=null!=v?v.add(e.Long.fromInt(this.PART_OVERHEAD_SIZE_0)):null)?u.add(e.Long.fromInt($.length)):null;s=new ba($,h.provider,g)}else if(e.isType(h,Be)){var b=Z(d.build()),w=null!=(p=null!=v?v.add(e.Long.fromInt(this.PART_OVERHEAD_SIZE_0)):null)?p.add(e.Long.fromInt(b.length)):null;s=new ba(b,h.provider,w)}else if(e.isType(h,He)){var k,S=De(0);try{qe(S,h.value),k=S.build()}catch(t){throw e.isType(t,R)?(S.release(),t):t}var x=Z(k),E=ga(x);null==v&&(qe(d,rt.HttpHeaders.ContentLength+": "+x.length),Fe(d,da));var C=Z(d.build()),O=x.length+this.PART_OVERHEAD_SIZE_0+C.length|0;s=new ba(C,E,e.Long.fromInt(O))}else s=e.noWhenBranchMatched();f.call(a,s)}this.rawParts_0=a,this.contentLength_egukxp$_0=null,this.contentType_azd2en$_0=_t.MultiPart.FormData.withParameter_puj7f4$("boundary",this.boundary_0);var N=le;for(o=this.rawParts_0.iterator();o.hasNext();){var z=o.next().size;if(null==z){N=null;break}N=null!=N?N.add(z):null}null!=N&&(N=N.add(e.Long.fromInt(this.BODY_OVERHEAD_SIZE_0))),this.contentLength_egukxp$_0=N}function $a(t,e,n){m.call(this,n),this.exceptionState_0=15,this.$this=t,this.local$tmp$=void 0,this.local$part=void 0,this.local$$receiver=void 0,this.local$channel=e}function ga(t){return function(){var n,i=De(0);try{Fe(i,t),n=i.build()}catch(t){throw e.isType(t,R)?(i.release(),t):t}return n}}function ba(t,e,n){this.headers=t,this.provider=e,this.size=n}function wa(t,e,n){m.call(this,n),this.exceptionState_0=8,this.local$buffer=void 0,this.local$bytesWritten=void 0,this.local$$receiver=t,this.local$channel=e}function ka(t,n){var i,r;Sa.call(this),this.call_9p3cfk$_0=t,this.coroutineContext_5l7f2v$_0=n.callContext,this.status_gsg6kc$_0=n.statusCode,this.version_vctfwy$_0=n.version,this.requestTime_34y64q$_0=n.requestTime,this.responseTime_u9wao0$_0=n.responseTime,this.content_7wqjir$_0=null!=(r=e.isType(i=n.body,j)?i:null)?r:j.Companion.Empty,this.headers_gyyq4g$_0=n.headers}function Sa(){}function xa(t){return t.call.request}function Ea(t){var n;(e.isType(n=d(t.coroutineContext.get_j3r2sn$(f.Key)),st)?n:v()).complete()}function Ca(t){za(),void 0===t&&(t=!1),Re.call(this,[za().Receive,za().Parse,za().Transform,za().State,za().After]),this.developmentMode_368lah$_0=t}function Oa(){Na=this,this.Receive=new Rt("Receive"),this.Parse=new Rt("Parse"),this.Transform=new Rt("Transform"),this.State=new Rt("State"),this.After=new Rt("After")}ha.$metadata$={kind:x,simpleName:"HttpSendPipeline",interfaces:[Re]},M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.request_ixrg4t$",L((function(){var n=t.io.ktor.client.request.HttpRequestBuilder,i=t.io.ktor.client.statement.HttpStatement,r=e.getReifiedTypeParameterKType,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){void 0===d&&(d=new n);var y,m,v,$=new i(d,f);if(y=o(t),s(y,o(i)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,r(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.request_g0tv8i$",L((function(){var n=t.io.ktor.client.request.HttpRequestBuilder,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){var y=new n;d(y);var m,v,$,g=new r(y,f);if(m=o(t),s(m,o(r)))e.setCoroutineResult(h(v=g)?v:a(),e.coroutineReceiver());else if(s(m,o(l)))e.suspendCall(g.execute(e.coroutineReceiver())),e.setCoroutineResult(h($=e.coroutineResult(e.coroutineReceiver()))?$:a(),e.coroutineReceiver());else{e.suspendCall(g.executeUnsafe(e.coroutineReceiver()));var b=e.coroutineResult(e.coroutineReceiver());try{var w,k,S=b.call;t:do{try{k=new p(o(t),u.JsType,i(t))}catch(e){k=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(S.receive_jo9acv$(k,e.coroutineReceiver())),e.setCoroutineResult(h(w=e.coroutineResult(e.coroutineReceiver()))?w:a(),e.coroutineReceiver())}finally{c(b)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.request_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.io.ktor.client.request.HttpRequestBuilder,r=t.io.ktor.client.request.url_g8iu3v$,o=e.getReifiedTypeParameterKType,a=t.io.ktor.client.statement.HttpStatement,s=e.getKClass,l=e.throwCCE,c=e.equals,u=t.io.ktor.client.statement.HttpResponse,p=t.io.ktor.client.statement.complete_abn2de$,h=t.io.ktor.client.call,f=t.io.ktor.client.call.TypeInfo;function d(t){return n}return function(t,n,_,y,m,v){void 0===m&&(m=d);var $=new i;r($,y),m($);var g,b,w,k=new a($,_);if(g=s(t),c(g,s(a)))e.setCoroutineResult(n(b=k)?b:l(),e.coroutineReceiver());else if(c(g,s(u)))e.suspendCall(k.execute(e.coroutineReceiver())),e.setCoroutineResult(n(w=e.coroutineResult(e.coroutineReceiver()))?w:l(),e.coroutineReceiver());else{e.suspendCall(k.executeUnsafe(e.coroutineReceiver()));var S=e.coroutineResult(e.coroutineReceiver());try{var x,E,C=S.call;t:do{try{E=new f(s(t),h.JsType,o(t))}catch(e){E=new f(s(t),h.JsType);break t}}while(0);e.suspendCall(C.receive_jo9acv$(E,e.coroutineReceiver())),e.setCoroutineResult(n(x=e.coroutineResult(e.coroutineReceiver()))?x:l(),e.coroutineReceiver())}finally{p(S)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.request_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.io.ktor.client.request.HttpRequestBuilder,r=t.io.ktor.client.request.url_qpqkqe$,o=e.getReifiedTypeParameterKType,a=t.io.ktor.client.statement.HttpStatement,s=e.getKClass,l=e.throwCCE,c=e.equals,u=t.io.ktor.client.statement.HttpResponse,p=t.io.ktor.client.statement.complete_abn2de$,h=t.io.ktor.client.call,f=t.io.ktor.client.call.TypeInfo;function d(t){return n}return function(t,n,_,y,m,v){void 0===m&&(m=d);var $=new i;r($,y),m($);var g,b,w,k=new a($,_);if(g=s(t),c(g,s(a)))e.setCoroutineResult(n(b=k)?b:l(),e.coroutineReceiver());else if(c(g,s(u)))e.suspendCall(k.execute(e.coroutineReceiver())),e.setCoroutineResult(n(w=e.coroutineResult(e.coroutineReceiver()))?w:l(),e.coroutineReceiver());else{e.suspendCall(k.executeUnsafe(e.coroutineReceiver()));var S=e.coroutineResult(e.coroutineReceiver());try{var x,E,C=S.call;t:do{try{E=new f(s(t),h.JsType,o(t))}catch(e){E=new f(s(t),h.JsType);break t}}while(0);e.suspendCall(C.receive_jo9acv$(E,e.coroutineReceiver())),e.setCoroutineResult(n(x=e.coroutineResult(e.coroutineReceiver()))?x:l(),e.coroutineReceiver())}finally{p(S)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.get_ixrg4t$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){d.method=n.Companion.Get;var y,m,v,$=new r(d,f);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,i(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.post_ixrg4t$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){d.method=n.Companion.Post;var y,m,v,$=new r(d,f);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,i(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.put_ixrg4t$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){d.method=n.Companion.Put;var y,m,v,$=new r(d,f);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,i(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.delete_ixrg4t$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){d.method=n.Companion.Delete;var y,m,v,$=new r(d,f);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,i(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.options_ixrg4t$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){d.method=n.Companion.Options;var y,m,v,$=new r(d,f);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,i(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.patch_ixrg4t$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){d.method=n.Companion.Patch;var y,m,v,$=new r(d,f);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,i(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.head_ixrg4t$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,i=e.getReifiedTypeParameterKType,r=t.io.ktor.client.statement.HttpStatement,o=e.getKClass,a=e.throwCCE,s=e.equals,l=t.io.ktor.client.statement.HttpResponse,c=t.io.ktor.client.statement.complete_abn2de$,u=t.io.ktor.client.call,p=t.io.ktor.client.call.TypeInfo;return function(t,h,f,d,_){d.method=n.Companion.Head;var y,m,v,$=new r(d,f);if(y=o(t),s(y,o(r)))e.setCoroutineResult(h(m=$)?m:a(),e.coroutineReceiver());else if(s(y,o(l)))e.suspendCall($.execute(e.coroutineReceiver())),e.setCoroutineResult(h(v=e.coroutineResult(e.coroutineReceiver()))?v:a(),e.coroutineReceiver());else{e.suspendCall($.executeUnsafe(e.coroutineReceiver()));var g=e.coroutineResult(e.coroutineReceiver());try{var b,w,k=g.call;t:do{try{w=new p(o(t),u.JsType,i(t))}catch(e){w=new p(o(t),u.JsType);break t}}while(0);e.suspendCall(k.receive_jo9acv$(w,e.coroutineReceiver())),e.setCoroutineResult(h(b=e.coroutineResult(e.coroutineReceiver()))?b:a(),e.coroutineReceiver())}finally{c(g)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.get_xwttm9$",L((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b,w,k,S){void 0===v&&(v="http"),void 0===$&&($="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===k&&(k=y);var x=new s;r(x,v,$,g,b),x.method=o.Companion.Get,x.body=w,k(x);var E,C,O,N=new l(x,m);if(E=c(t),p(E,c(l)))e.setCoroutineResult(i(C=N)?C:u(),e.coroutineReceiver());else if(p(E,c(h)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var z=e.coroutineResult(e.coroutineReceiver());try{var j,T,P=z.call;t:do{try{T=new _(c(t),d.JsType,a(t))}catch(e){T=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(T,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:u(),e.coroutineReceiver())}finally{f(z)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.post_xwttm9$",L((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b,w,k,S){void 0===v&&(v="http"),void 0===$&&($="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===k&&(k=y);var x=new s;r(x,v,$,g,b),x.method=o.Companion.Post,x.body=w,k(x);var E,C,O,N=new l(x,m);if(E=c(t),p(E,c(l)))e.setCoroutineResult(i(C=N)?C:u(),e.coroutineReceiver());else if(p(E,c(h)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var z=e.coroutineResult(e.coroutineReceiver());try{var j,T,P=z.call;t:do{try{T=new _(c(t),d.JsType,a(t))}catch(e){T=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(T,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:u(),e.coroutineReceiver())}finally{f(z)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.put_xwttm9$",L((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b,w,k,S){void 0===v&&(v="http"),void 0===$&&($="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===k&&(k=y);var x=new s;r(x,v,$,g,b),x.method=o.Companion.Put,x.body=w,k(x);var E,C,O,N=new l(x,m);if(E=c(t),p(E,c(l)))e.setCoroutineResult(i(C=N)?C:u(),e.coroutineReceiver());else if(p(E,c(h)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var z=e.coroutineResult(e.coroutineReceiver());try{var j,T,P=z.call;t:do{try{T=new _(c(t),d.JsType,a(t))}catch(e){T=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(T,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:u(),e.coroutineReceiver())}finally{f(z)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.delete_xwttm9$",L((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b,w,k,S){void 0===v&&(v="http"),void 0===$&&($="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===k&&(k=y);var x=new s;r(x,v,$,g,b),x.method=o.Companion.Delete,x.body=w,k(x);var E,C,O,N=new l(x,m);if(E=c(t),p(E,c(l)))e.setCoroutineResult(i(C=N)?C:u(),e.coroutineReceiver());else if(p(E,c(h)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var z=e.coroutineResult(e.coroutineReceiver());try{var j,T,P=z.call;t:do{try{T=new _(c(t),d.JsType,a(t))}catch(e){T=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(T,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:u(),e.coroutineReceiver())}finally{f(z)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.patch_xwttm9$",L((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b,w,k,S){void 0===v&&(v="http"),void 0===$&&($="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===k&&(k=y);var x=new s;r(x,v,$,g,b),x.method=o.Companion.Patch,x.body=w,k(x);var E,C,O,N=new l(x,m);if(E=c(t),p(E,c(l)))e.setCoroutineResult(i(C=N)?C:u(),e.coroutineReceiver());else if(p(E,c(h)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var z=e.coroutineResult(e.coroutineReceiver());try{var j,T,P=z.call;t:do{try{T=new _(c(t),d.JsType,a(t))}catch(e){T=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(T,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:u(),e.coroutineReceiver())}finally{f(z)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.head_xwttm9$",L((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b,w,k,S){void 0===v&&(v="http"),void 0===$&&($="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===k&&(k=y);var x=new s;r(x,v,$,g,b),x.method=o.Companion.Head,x.body=w,k(x);var E,C,O,N=new l(x,m);if(E=c(t),p(E,c(l)))e.setCoroutineResult(i(C=N)?C:u(),e.coroutineReceiver());else if(p(E,c(h)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var z=e.coroutineResult(e.coroutineReceiver());try{var j,T,P=z.call;t:do{try{T=new _(c(t),d.JsType,a(t))}catch(e){T=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(T,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:u(),e.coroutineReceiver())}finally{f(z)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.options_xwttm9$",L((function(){var n=t.io.ktor.client.utils,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b,w,k,S){void 0===v&&(v="http"),void 0===$&&($="localhost"),void 0===g&&(g=0),void 0===b&&(b="/"),void 0===w&&(w=n.EmptyContent),void 0===k&&(k=y);var x=new s;r(x,v,$,g,b),x.method=o.Companion.Options,x.body=w,k(x);var E,C,O,N=new l(x,m);if(E=c(t),p(E,c(l)))e.setCoroutineResult(i(C=N)?C:u(),e.coroutineReceiver());else if(p(E,c(h)))e.suspendCall(N.execute(e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver());else{e.suspendCall(N.executeUnsafe(e.coroutineReceiver()));var z=e.coroutineResult(e.coroutineReceiver());try{var j,T,P=z.call;t:do{try{T=new _(c(t),d.JsType,a(t))}catch(e){T=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(P.receive_jo9acv$(T,e.coroutineReceiver())),e.setCoroutineResult(i(j=e.coroutineResult(e.coroutineReceiver()))?j:u(),e.coroutineReceiver())}finally{f(z)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.get_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Get,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.post_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Post,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.put_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Put,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.delete_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Delete,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.options_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Options,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.patch_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Patch,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.head_hf8dw$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Head,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.get_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Get,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.post_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Post,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.put_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Put,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.patch_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Patch,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.options_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Options,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.head_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Head,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.delete_2swosf$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_wol2ee$,r=e.getReifiedTypeParameterKType,o=t.io.ktor.client.utils,a=t.io.ktor.client.request.url_3rzbk2$,s=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return n}return function(t,n,v,$,g,b){var w;void 0===g&&(g=m),w=o.EmptyContent;var k=new l;a(k,"http","localhost",0,"/"),k.method=s.Companion.Delete,k.body=w,i(k.url,$),g(k);var S,x,E,C=new c(k,v);if(S=u(t),h(S,u(c)))e.setCoroutineResult(n(x=C)?x:p(),e.coroutineReceiver());else if(h(S,u(f)))e.suspendCall(C.execute(e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:p(),e.coroutineReceiver());else{e.suspendCall(C.executeUnsafe(e.coroutineReceiver()));var O=e.coroutineResult(e.coroutineReceiver());try{var N,z,j=O.call;t:do{try{z=new y(u(t),_.JsType,r(t))}catch(e){z=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(j.receive_jo9acv$(z,e.coroutineReceiver())),e.setCoroutineResult(n(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver())}finally{d(O)}}return e.coroutineResult(e.coroutineReceiver())}}))),Object.defineProperty(ma.prototype,"contentLength",{configurable:!0,get:function(){return this.contentLength_f2tvnf$_0}}),Object.defineProperty(ma.prototype,"contentType",{configurable:!0,get:function(){return this.contentType_gyve29$_0}}),ma.prototype.bytes=function(){return this.content_0},ma.$metadata$={kind:x,simpleName:"FormDataContent",interfaces:[mt]},Object.defineProperty(va.prototype,"contentLength",{configurable:!0,get:function(){return this.contentLength_egukxp$_0}}),Object.defineProperty(va.prototype,"contentType",{configurable:!0,get:function(){return this.contentType_azd2en$_0}}),$a.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},$a.prototype=Object.create(m.prototype),$a.prototype.constructor=$a,$a.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.exceptionState_0=12,this.local$tmp$=this.$this.rawParts_0.iterator(),this.state_0=1;continue;case 1:if(!this.local$tmp$.hasNext()){this.state_0=10;continue}if(this.local$part=this.local$tmp$.next(),this.state_0=2,this.result_0=Ie(this.local$channel,this.$this.BOUNDARY_BYTES_0,this),this.result_0===y)return y;continue;case 2:if(this.state_0=3,this.result_0=Ie(this.local$channel,this.local$part.headers,this),this.result_0===y)return y;continue;case 3:if(this.state_0=4,this.result_0=Ie(this.local$channel,da,this),this.result_0===y)return y;continue;case 4:if(this.local$$receiver=this.local$part.provider(),this.exceptionState_0=8,this.state_0=5,this.result_0=(n=this.local$$receiver,i=this.local$channel,r=void 0,o=void 0,o=new wa(n,i,this),r?o:o.doResume(null)),this.result_0===y)return y;continue;case 5:this.exceptionState_0=12,this.finallyPath_0=[6],this.state_0=9;continue;case 6:if(this.state_0=7,this.result_0=Ie(this.local$channel,da,this),this.result_0===y)return y;continue;case 7:this.state_0=1;continue;case 8:this.finallyPath_0=[12],this.state_0=9;continue;case 9:this.exceptionState_0=12,this.local$$receiver.close(),this.state_0=this.finallyPath_0.shift();continue;case 10:if(this.state_0=11,this.result_0=Ie(this.local$channel,this.$this.LAST_BOUNDARY_BYTES_0,this),this.result_0===y)return y;continue;case 11:this.exceptionState_0=15,this.finallyPath_0=[14],this.state_0=13;continue;case 12:this.finallyPath_0=[15],this.exceptionState_0=13;var t=this.exception_0;if(!e.isType(t,R))throw t;this.local$channel.close_dbl4no$(t),this.finallyPath_0=[14],this.state_0=13;continue;case 13:this.exceptionState_0=15,Me(this.local$channel),this.state_0=this.finallyPath_0.shift();continue;case 14:return;case 15:throw this.exception_0;default:throw this.state_0=15,new Error("State Machine Unreachable execution")}}catch(t){if(15===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var n,i,r,o},va.prototype.writeTo_h3x4ir$=function(t,e,n){var i=new $a(this,t,e);return n?i:i.doResume(null)},va.$metadata$={kind:x,simpleName:"MultiPartFormDataContent",interfaces:[Le]},ba.$metadata$={kind:x,simpleName:"PreparedPart",interfaces:[]},wa.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},wa.prototype=Object.create(m.prototype),wa.prototype.constructor=wa,wa.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(e.isType(this.local$$receiver,xt)){if(this.state_0=1,this.result_0=this.local$channel.writePacket_3uq2w4$(this.local$$receiver,this),this.result_0===y)return y;continue}this.state_0=2;continue;case 1:return;case 2:this.state_0=3;continue;case 3:if(this.local$$receiver.endOfInput){this.state_0=10;continue}var t;if(this.state_0=4,this.result_0=Ze(this.local$channel,1,this),this.result_0===y)return y;continue;case 4:this.local$buffer=null!=(t=this.result_0)?t:Qe.Companion.Empty,this.local$bytesWritten=0,this.exceptionState_0=5;var n=this.local$buffer.memory,i=e.Long.fromInt(this.local$buffer.writePosition);this.local$bytesWritten=Ye(this.local$$receiver,n,i,e.Long.fromInt(this.local$buffer.limit).subtract(i)).toInt(),this.local$buffer.commitWritten_za3lpa$(this.local$bytesWritten),this.result_0=this.local$bytesWritten,this.exceptionState_0=8,this.finallyPath_0=[9],this.state_0=6;continue;case 5:this.finallyPath_0=[8],this.state_0=6;continue;case 6:if(this.exceptionState_0=8,this.state_0=7,this.result_0=Xe(this.local$channel,this.local$buffer,this.local$bytesWritten,this),this.result_0===y)return y;continue;case 7:this.state_0=this.finallyPath_0.shift();continue;case 8:throw this.exception_0;case 9:this.state_0=3;continue;case 10:return;default:throw this.state_0=8,new Error("State Machine Unreachable execution")}}catch(t){if(8===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.forms.submitForm_k24olv$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.Parameters,i=e.kotlin.Unit,r=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,o=t.io.ktor.client.request.forms.FormDataContent,a=e.getReifiedTypeParameterKType,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return i}return function(t,i,m,v,$,g,b){void 0===v&&(v=n.Companion.Empty),void 0===$&&($=!1),void 0===g&&(g=y);var w=new s;$?(w.method=r.Companion.Get,w.url.parameters.appendAll_hb0ubp$(v)):(w.method=r.Companion.Post,w.body=new o(v)),g(w);var k,S,x,E=new l(w,m);if(k=c(t),p(k,c(l)))e.setCoroutineResult(i(S=E)?S:u(),e.coroutineReceiver());else if(p(k,c(h)))e.suspendCall(E.execute(e.coroutineReceiver())),e.setCoroutineResult(i(x=e.coroutineResult(e.coroutineReceiver()))?x:u(),e.coroutineReceiver());else{e.suspendCall(E.executeUnsafe(e.coroutineReceiver()));var C=e.coroutineResult(e.coroutineReceiver());try{var O,N,z=C.call;t:do{try{N=new _(c(t),d.JsType,a(t))}catch(e){N=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(z.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(i(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver())}finally{f(C)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.forms.submitForm_32veqj$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.Parameters,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_g8iu3v$,o=e.getReifiedTypeParameterKType,a=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,s=t.io.ktor.client.request.forms.FormDataContent,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return i}return function(t,i,v,$,g,b,w,k){void 0===g&&(g=n.Companion.Empty),void 0===b&&(b=!1),void 0===w&&(w=m);var S=new l;b?(S.method=a.Companion.Get,S.url.parameters.appendAll_hb0ubp$(g)):(S.method=a.Companion.Post,S.body=new s(g)),r(S,$),w(S);var x,E,C,O=new c(S,v);if(x=u(t),h(x,u(c)))e.setCoroutineResult(i(E=O)?E:p(),e.coroutineReceiver());else if(h(x,u(f)))e.suspendCall(O.execute(e.coroutineReceiver())),e.setCoroutineResult(i(C=e.coroutineResult(e.coroutineReceiver()))?C:p(),e.coroutineReceiver());else{e.suspendCall(O.executeUnsafe(e.coroutineReceiver()));var N=e.coroutineResult(e.coroutineReceiver());try{var z,j,T=N.call;t:do{try{j=new y(u(t),_.JsType,o(t))}catch(e){j=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(T.receive_jo9acv$(j,e.coroutineReceiver())),e.setCoroutineResult(i(z=e.coroutineResult(e.coroutineReceiver()))?z:p(),e.coroutineReceiver())}finally{d(N)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.forms.submitFormWithBinaryData_k1tmp5$",L((function(){var n=e.kotlin.Unit,i=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,r=t.io.ktor.client.request.forms.MultiPartFormDataContent,o=e.getReifiedTypeParameterKType,a=t.io.ktor.client.request.HttpRequestBuilder,s=t.io.ktor.client.statement.HttpStatement,l=e.getKClass,c=e.throwCCE,u=e.equals,p=t.io.ktor.client.statement.HttpResponse,h=t.io.ktor.client.statement.complete_abn2de$,f=t.io.ktor.client.call,d=t.io.ktor.client.call.TypeInfo;function _(t){return n}return function(t,n,y,m,v,$){void 0===v&&(v=_);var g=new a;g.method=i.Companion.Post,g.body=new r(m),v(g);var b,w,k,S=new s(g,y);if(b=l(t),u(b,l(s)))e.setCoroutineResult(n(w=S)?w:c(),e.coroutineReceiver());else if(u(b,l(p)))e.suspendCall(S.execute(e.coroutineReceiver())),e.setCoroutineResult(n(k=e.coroutineResult(e.coroutineReceiver()))?k:c(),e.coroutineReceiver());else{e.suspendCall(S.executeUnsafe(e.coroutineReceiver()));var x=e.coroutineResult(e.coroutineReceiver());try{var E,C,O=x.call;t:do{try{C=new d(l(t),f.JsType,o(t))}catch(e){C=new d(l(t),f.JsType);break t}}while(0);e.suspendCall(O.receive_jo9acv$(C,e.coroutineReceiver())),e.setCoroutineResult(n(E=e.coroutineResult(e.coroutineReceiver()))?E:c(),e.coroutineReceiver())}finally{h(x)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.forms.submitFormWithBinaryData_i2k1l1$",L((function(){var n=e.kotlin.Unit,i=t.io.ktor.client.request.url_g8iu3v$,r=e.getReifiedTypeParameterKType,o=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,a=t.io.ktor.client.request.forms.MultiPartFormDataContent,s=t.io.ktor.client.request.HttpRequestBuilder,l=t.io.ktor.client.statement.HttpStatement,c=e.getKClass,u=e.throwCCE,p=e.equals,h=t.io.ktor.client.statement.HttpResponse,f=t.io.ktor.client.statement.complete_abn2de$,d=t.io.ktor.client.call,_=t.io.ktor.client.call.TypeInfo;function y(t){return n}return function(t,n,m,v,$,g,b){void 0===g&&(g=y);var w=new s;w.method=o.Companion.Post,w.body=new a($),i(w,v),g(w);var k,S,x,E=new l(w,m);if(k=c(t),p(k,c(l)))e.setCoroutineResult(n(S=E)?S:u(),e.coroutineReceiver());else if(p(k,c(h)))e.suspendCall(E.execute(e.coroutineReceiver())),e.setCoroutineResult(n(x=e.coroutineResult(e.coroutineReceiver()))?x:u(),e.coroutineReceiver());else{e.suspendCall(E.executeUnsafe(e.coroutineReceiver()));var C=e.coroutineResult(e.coroutineReceiver());try{var O,N,z=C.call;t:do{try{N=new _(c(t),d.JsType,r(t))}catch(e){N=new _(c(t),d.JsType);break t}}while(0);e.suspendCall(z.receive_jo9acv$(N,e.coroutineReceiver())),e.setCoroutineResult(n(O=e.coroutineResult(e.coroutineReceiver()))?O:u(),e.coroutineReceiver())}finally{f(C)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.forms.submitForm_ejo4ot$",L((function(){var n=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.Parameters,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=e.getReifiedTypeParameterKType,a=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,s=t.io.ktor.client.request.forms.FormDataContent,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return i}return function(t,i,v,$,g,b,w,k,S,x,E){void 0===$&&($="http"),void 0===g&&(g="localhost"),void 0===b&&(b=80),void 0===w&&(w="/"),void 0===k&&(k=n.Companion.Empty),void 0===S&&(S=!1),void 0===x&&(x=m);var C=new l;S?(C.method=a.Companion.Get,C.url.parameters.appendAll_hb0ubp$(k)):(C.method=a.Companion.Post,C.body=new s(k)),r(C,$,g,b,w),x(C);var O,N,z,j=new c(C,v);if(O=u(t),h(O,u(c)))e.setCoroutineResult(i(N=j)?N:p(),e.coroutineReceiver());else if(h(O,u(f)))e.suspendCall(j.execute(e.coroutineReceiver())),e.setCoroutineResult(i(z=e.coroutineResult(e.coroutineReceiver()))?z:p(),e.coroutineReceiver());else{e.suspendCall(j.executeUnsafe(e.coroutineReceiver()));var T=e.coroutineResult(e.coroutineReceiver());try{var P,R,A=T.call;t:do{try{R=new y(u(t),_.JsType,o(t))}catch(e){R=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(A.receive_jo9acv$(R,e.coroutineReceiver())),e.setCoroutineResult(i(P=e.coroutineResult(e.coroutineReceiver()))?P:p(),e.coroutineReceiver())}finally{d(T)}}return e.coroutineResult(e.coroutineReceiver())}}))),M("ktor-ktor-client-core-jsLegacy.io.ktor.client.request.forms.submitFormWithBinaryData_vcnbbn$",L((function(){var n=e.kotlin.collections.emptyList_287e2$,i=e.kotlin.Unit,r=t.io.ktor.client.request.url_3rzbk2$,o=e.getReifiedTypeParameterKType,a=t.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,s=t.io.ktor.client.request.forms.MultiPartFormDataContent,l=t.io.ktor.client.request.HttpRequestBuilder,c=t.io.ktor.client.statement.HttpStatement,u=e.getKClass,p=e.throwCCE,h=e.equals,f=t.io.ktor.client.statement.HttpResponse,d=t.io.ktor.client.statement.complete_abn2de$,_=t.io.ktor.client.call,y=t.io.ktor.client.call.TypeInfo;function m(t){return i}return function(t,i,v,$,g,b,w,k,S,x){void 0===$&&($="http"),void 0===g&&(g="localhost"),void 0===b&&(b=80),void 0===w&&(w="/"),void 0===k&&(k=n()),void 0===S&&(S=m);var E=new l;E.method=a.Companion.Post,E.body=new s(k),r(E,$,g,b,w),S(E);var C,O,N,z=new c(E,v);if(C=u(t),h(C,u(c)))e.setCoroutineResult(i(O=z)?O:p(),e.coroutineReceiver());else if(h(C,u(f)))e.suspendCall(z.execute(e.coroutineReceiver())),e.setCoroutineResult(i(N=e.coroutineResult(e.coroutineReceiver()))?N:p(),e.coroutineReceiver());else{e.suspendCall(z.executeUnsafe(e.coroutineReceiver()));var j=e.coroutineResult(e.coroutineReceiver());try{var T,P,R=j.call;t:do{try{P=new y(u(t),_.JsType,o(t))}catch(e){P=new y(u(t),_.JsType);break t}}while(0);e.suspendCall(R.receive_jo9acv$(P,e.coroutineReceiver())),e.setCoroutineResult(i(T=e.coroutineResult(e.coroutineReceiver()))?T:p(),e.coroutineReceiver())}finally{d(j)}}return e.coroutineResult(e.coroutineReceiver())}}))),Object.defineProperty(ka.prototype,"call",{get:function(){return this.call_9p3cfk$_0}}),Object.defineProperty(ka.prototype,"coroutineContext",{configurable:!0,get:function(){return this.coroutineContext_5l7f2v$_0}}),Object.defineProperty(ka.prototype,"status",{configurable:!0,get:function(){return this.status_gsg6kc$_0}}),Object.defineProperty(ka.prototype,"version",{configurable:!0,get:function(){return this.version_vctfwy$_0}}),Object.defineProperty(ka.prototype,"requestTime",{configurable:!0,get:function(){return this.requestTime_34y64q$_0}}),Object.defineProperty(ka.prototype,"responseTime",{configurable:!0,get:function(){return this.responseTime_u9wao0$_0}}),Object.defineProperty(ka.prototype,"content",{configurable:!0,get:function(){return this.content_7wqjir$_0}}),Object.defineProperty(ka.prototype,"headers",{configurable:!0,get:function(){return this.headers_gyyq4g$_0}}),ka.$metadata$={kind:x,simpleName:"DefaultHttpResponse",interfaces:[Sa]},Sa.prototype.toString=function(){return"HttpResponse["+xa(this).url+", "+this.status+"]"},Sa.$metadata$={kind:x,simpleName:"HttpResponse",interfaces:[E,Oe]},Object.defineProperty(Ca.prototype,"developmentMode",{get:function(){return this.developmentMode_368lah$_0}}),Oa.$metadata$={kind:A,simpleName:"Phases",interfaces:[]};var Na=null;function za(){return null===Na&&new Oa,Na}function ja(t){Ia(),void 0===t&&(t=!1),Re.call(this,[Ia().Before,Ia().State,Ia().After]),this.developmentMode_wr860l$_0=t}function Ta(){Aa=this,this.Before=new Rt("Before"),this.State=new Rt("State"),this.After=new Rt("After")}Ca.$metadata$={kind:x,simpleName:"HttpResponsePipeline",interfaces:[Re]},Object.defineProperty(ja.prototype,"developmentMode",{get:function(){return this.developmentMode_wr860l$_0}}),Ta.$metadata$={kind:A,simpleName:"Phases",interfaces:[]};var Pa,Ra,Aa=null;function Ia(){return null===Aa&&new Ta,Aa}function Ma(t,e){this.expectedType=t,this.response=e}function La(t,e){this.builder_0=t,this.client_0=e,this.checkCapabilities_0()}function Da(t,e,n){m.call(this,n),this.exceptionState_0=8,this.$this=t,this.local$response=void 0,this.local$block=e}function qa(t,e){m.call(this,e),this.exceptionState_0=1,this.local$it=t}function Fa(t,e,n){var i=new qa(t,e);return n?i:i.doResume(null)}function Ua(t,e,n,i){m.call(this,i),this.exceptionState_0=7,this.$this=t,this.local$response=void 0,this.local$T_0=e,this.local$isT=n}function Ba(t,e,n,i,r){m.call(this,r),this.exceptionState_0=9,this.$this=t,this.local$response=void 0,this.local$T_0=e,this.local$isT=n,this.local$block=i}function Ha(t,e){m.call(this,e),this.exceptionState_0=1,this.$this=t}function Va(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$$receiver=e}function Ka(t,e,n){m.call(this,n),this.exceptionState_0=1,this.local$decoder=void 0,this.local$$receiver=t,this.local$fallbackCharset=e}function Wa(t,e,n,i){var r=new Ka(t,e,n);return i?r:r.doResume(null)}function Ya(){Ga=this,this.MAX_AGE="max-age",this.MIN_FRESH="min-fresh",this.ONLY_IF_CACHED="only-if-cached",this.MAX_STALE="max-stale",this.NO_CACHE="no-cache",this.NO_STORE="no-store",this.NO_TRANSFORM="no-transform",this.MUST_REVALIDATE="must-revalidate",this.PUBLIC="public",this.PRIVATE="private",this.PROXY_REVALIDATE="proxy-revalidate",this.S_MAX_AGE="s-maxage"}ja.$metadata$={kind:x,simpleName:"HttpReceivePipeline",interfaces:[Re]},Ma.$metadata$={kind:x,simpleName:"HttpResponseContainer",interfaces:[]},Ma.prototype.component1=function(){return this.expectedType},Ma.prototype.component2=function(){return this.response},Ma.prototype.copy_ju9ok$=function(t,e){return new Ma(void 0===t?this.expectedType:t,void 0===e?this.response:e)},Ma.prototype.toString=function(){return"HttpResponseContainer(expectedType="+e.toString(this.expectedType)+", response="+e.toString(this.response)+")"},Ma.prototype.hashCode=function(){var t=0;return t=31*(t=31*t+e.hashCode(this.expectedType)|0)+e.hashCode(this.response)|0},Ma.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.expectedType,t.expectedType)&&e.equals(this.response,t.response)},Da.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Da.prototype=Object.create(m.prototype),Da.prototype.constructor=Da,Da.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=1,this.result_0=this.$this.executeUnsafe(this),this.result_0===y)return y;continue;case 1:if(this.local$response=this.result_0,this.exceptionState_0=5,this.state_0=2,this.result_0=this.local$block(this.local$response,this),this.result_0===y)return y;continue;case 2:this.exceptionState_0=8,this.finallyPath_0=[3],this.state_0=6,this.$returnValue=this.result_0;continue;case 3:return this.$returnValue;case 4:return;case 5:this.finallyPath_0=[8],this.state_0=6;continue;case 6:if(this.exceptionState_0=8,this.state_0=7,this.result_0=this.$this.cleanup_abn2de$(this.local$response,this),this.result_0===y)return y;continue;case 7:this.state_0=this.finallyPath_0.shift();continue;case 8:throw this.exception_0;default:throw this.state_0=8,new Error("State Machine Unreachable execution")}}catch(t){if(8===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},La.prototype.execute_2rh6on$=function(t,e,n){var i=new Da(this,t,e);return n?i:i.doResume(null)},qa.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},qa.prototype=Object.create(m.prototype),qa.prototype.constructor=qa,qa.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=hi(this.local$it.call,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0.response;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},La.prototype.execute=function(t){return this.execute_2rh6on$(Fa,t)},Ua.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Ua.prototype=Object.create(m.prototype),Ua.prototype.constructor=Ua,Ua.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e,n;if(t=W(this.local$T_0),pt(t,W(La)))return this.local$isT(e=this.$this)?e:v();if(pt(t,W(Sa))){if(this.state_0=8,this.result_0=this.$this.execute(this),this.result_0===y)return y;continue}if(this.state_0=1,this.result_0=this.$this.executeUnsafe(this),this.result_0===y)return y;continue;case 1:var i;this.local$response=this.result_0,this.exceptionState_0=5;var r,o=this.local$response.call;t:do{try{r=new fi(W(this.local$T_0),ll.JsType,K(this.local$T_0))}catch(t){r=new fi(W(this.local$T_0),ll.JsType);break t}}while(0);if(this.state_0=2,this.result_0=o.receive_jo9acv$(r,this),this.result_0===y)return y;continue;case 2:this.result_0=this.local$isT(i=this.result_0)?i:v(),this.exceptionState_0=7,this.finallyPath_0=[3],this.state_0=6,this.$returnValue=this.result_0;continue;case 3:return this.$returnValue;case 4:this.state_0=9;continue;case 5:this.finallyPath_0=[7],this.state_0=6;continue;case 6:this.exceptionState_0=7,Ea(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 7:throw this.exception_0;case 8:return this.local$isT(n=this.result_0)?n:v();case 9:this.state_0=10;continue;case 10:return;default:throw this.state_0=7,new Error("State Machine Unreachable execution")}}catch(t){if(7===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},La.prototype.receive_287e2$=function(t,e,n,i){var r=new Ua(this,t,e,n);return i?r:r.doResume(null)},M("ktor-ktor-client-core-jsLegacy.io.ktor.client.statement.HttpStatement.receive_287e2$",L((function(){var n=e.getKClass,i=e.throwCCE,r=t.io.ktor.client.statement.HttpStatement,o=e.equals,a=t.io.ktor.client.statement.HttpResponse,s=e.getReifiedTypeParameterKType,l=t.io.ktor.client.statement.complete_abn2de$,c=t.io.ktor.client.call,u=t.io.ktor.client.call.TypeInfo;return function(t,p,h){var f,d;if(f=n(t),o(f,n(r)))return p(this)?this:i();if(o(f,n(a)))return e.suspendCall(this.execute(e.coroutineReceiver())),p(d=e.coroutineResult(e.coroutineReceiver()))?d:i();e.suspendCall(this.executeUnsafe(e.coroutineReceiver()));var _=e.coroutineResult(e.coroutineReceiver());try{var y,m,v=_.call;t:do{try{m=new u(n(t),c.JsType,s(t))}catch(e){m=new u(n(t),c.JsType);break t}}while(0);return e.suspendCall(v.receive_jo9acv$(m,e.coroutineReceiver())),e.setCoroutineResult(p(y=e.coroutineResult(e.coroutineReceiver()))?y:i(),e.coroutineReceiver()),e.coroutineResult(e.coroutineReceiver())}finally{l(_)}}}))),Ba.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Ba.prototype=Object.create(m.prototype),Ba.prototype.constructor=Ba,Ba.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=1,this.result_0=this.$this.executeUnsafe(this),this.result_0===y)return y;continue;case 1:var t;this.local$response=this.result_0,this.exceptionState_0=6;var e,n=this.local$response.call;t:do{try{e=new fi(W(this.local$T_0),ll.JsType,K(this.local$T_0))}catch(t){e=new fi(W(this.local$T_0),ll.JsType);break t}}while(0);if(this.state_0=2,this.result_0=n.receive_jo9acv$(e,this),this.result_0===y)return y;continue;case 2:this.result_0=this.local$isT(t=this.result_0)?t:v();var i=this.result_0;if(this.state_0=3,this.result_0=this.local$block(i,this),this.result_0===y)return y;continue;case 3:this.exceptionState_0=9,this.finallyPath_0=[4],this.state_0=7,this.$returnValue=this.result_0;continue;case 4:return this.$returnValue;case 5:return;case 6:this.finallyPath_0=[9],this.state_0=7;continue;case 7:if(this.exceptionState_0=9,this.state_0=8,this.result_0=this.$this.cleanup_abn2de$(this.local$response,this),this.result_0===y)return y;continue;case 8:this.state_0=this.finallyPath_0.shift();continue;case 9:throw this.exception_0;default:throw this.state_0=9,new Error("State Machine Unreachable execution")}}catch(t){if(9===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},La.prototype.receive_yswr0a$=function(t,e,n,i,r){var o=new Ba(this,t,e,n,i);return r?o:o.doResume(null)},M("ktor-ktor-client-core-jsLegacy.io.ktor.client.statement.HttpStatement.receive_yswr0a$",L((function(){var n=e.getReifiedTypeParameterKType,i=e.throwCCE,r=e.getKClass,o=t.io.ktor.client.call,a=t.io.ktor.client.call.TypeInfo;return function(t,s,l,c){e.suspendCall(this.executeUnsafe(e.coroutineReceiver()));var u=e.coroutineResult(e.coroutineReceiver());try{var p,h,f=u.call;t:do{try{h=new a(r(t),o.JsType,n(t))}catch(e){h=new a(r(t),o.JsType);break t}}while(0);e.suspendCall(f.receive_jo9acv$(h,e.coroutineReceiver())),e.setCoroutineResult(s(p=e.coroutineResult(e.coroutineReceiver()))?p:i(),e.coroutineReceiver());var d=e.coroutineResult(e.coroutineReceiver());return e.suspendCall(l(d,e.coroutineReceiver())),e.coroutineResult(e.coroutineReceiver())}finally{e.suspendCall(this.cleanup_abn2de$(u,e.coroutineReceiver()))}}}))),Ha.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Ha.prototype=Object.create(m.prototype),Ha.prototype.constructor=Ha,Ha.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=(new Xo).takeFromWithExecutionContext_s9rlw$(this.$this.builder_0);if(this.state_0=2,this.result_0=this.$this.client_0.execute_s9rlw$(t,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0.response;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},La.prototype.executeUnsafe=function(t,e){var n=new Ha(this,t);return e?n:n.doResume(null)},Va.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Va.prototype=Object.create(m.prototype),Va.prototype.constructor=Va,Va.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=e.isType(t=d(this.local$$receiver.coroutineContext.get_j3r2sn$(f.Key)),st)?t:v();n.complete();try{bt(this.local$$receiver.content)}catch(t){if(!e.isType(t,R))throw t}if(this.state_0=2,this.result_0=n.join(this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},La.prototype.cleanup_abn2de$=function(t,e,n){var i=new Va(this,t,e);return n?i:i.doResume(null)},La.prototype.checkCapabilities_0=function(){var t,n,i,r,o;if(null!=(n=null!=(t=this.builder_0.attributes.getOrNull_yzaw86$(Jn))?t.keys:null)){var a,s=at();for(a=n.iterator();a.hasNext();){var l=a.next();e.isType(l,wr)&&s.add_11rb$(l)}r=s}else r=null;if(null!=(i=r))for(o=i.iterator();o.hasNext();){var c=o.next();if(null==Sr(this.client_0,c))throw Q(("Consider installing "+c+" feature because the request requires it to be installed").toString())}},La.prototype.toString=function(){return"HttpStatement["+this.builder_0.url.buildString()+"]"},La.$metadata$={kind:x,simpleName:"HttpStatement",interfaces:[]},Ka.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Ka.prototype=Object.create(m.prototype),Ka.prototype.constructor=Ka,Ka.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n;void 0===this.local$fallbackCharset&&(this.local$fallbackCharset=null);var i,r=null!=(n=null!=(t=Ut(this.local$$receiver))?t:this.local$fallbackCharset)?n:Mt.Charsets.UTF_8;this.local$decoder=r.newDecoder();var o,a=this.local$$receiver.call;t:do{try{o=new fi(W(Et),ll.JsType,xe(W(Et),[],!1))}catch(t){o=new fi(W(Et),ll.JsType);break t}}while(0);if(this.state_0=2,this.result_0=a.receive_jo9acv$(o,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:this.result_0=e.isType(i=this.result_0,Et)?i:v();var s=this.result_0;return en(this.local$decoder,s);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ya.prototype.getMAX_AGE=function(){return this.MAX_AGE},Ya.prototype.getMIN_FRESH=function(){return this.MIN_FRESH},Ya.prototype.getONLY_IF_CACHED=function(){return this.ONLY_IF_CACHED},Ya.prototype.getMAX_STALE=function(){return this.MAX_STALE},Ya.prototype.getNO_CACHE=function(){return this.NO_CACHE},Ya.prototype.getNO_STORE=function(){return this.NO_STORE},Ya.prototype.getNO_TRANSFORM=function(){return this.NO_TRANSFORM},Ya.prototype.getMUST_REVALIDATE=function(){return this.MUST_REVALIDATE},Ya.prototype.getPUBLIC=function(){return this.PUBLIC},Ya.prototype.getPRIVATE=function(){return this.PRIVATE},Ya.prototype.getPROXY_REVALIDATE=function(){return this.PROXY_REVALIDATE},Ya.prototype.getS_MAX_AGE=function(){return this.S_MAX_AGE},Ya.$metadata$={kind:A,simpleName:"CacheControl",interfaces:[]};var Ga=null;function Ja(){Za=this,pe.call(this),this.contentLength_89rfwp$_0=le}Object.defineProperty(Ja.prototype,"contentLength",{configurable:!0,get:function(){return this.contentLength_89rfwp$_0}}),Ja.prototype.toString=function(){return"EmptyContent"},Ja.$metadata$={kind:A,simpleName:"EmptyContent",interfaces:[pe]};var Za=null;function Qa(){return null===Za&&new Ja,Za}function Xa(t,e){this.this$wrapHeaders=t,pe.call(this),this.headers_byaa2p$_0=e(t.headers)}function ts(t,e){this.this$wrapHeaders=t,vt.call(this),this.headers_byaa2p$_0=e(t.headers)}function es(t,e){this.this$wrapHeaders=t,Le.call(this),this.headers_byaa2p$_0=e(t.headers)}function ns(t,e){this.this$wrapHeaders=t,mt.call(this),this.headers_byaa2p$_0=e(t.headers)}function is(t,e){this.this$wrapHeaders=t,nn.call(this),this.headers_byaa2p$_0=e(t.headers)}function rs(){return z.PlatformUtils.IS_NATIVE?new ye:Qt()}function os(){return z.PlatformUtils.IS_NATIVE?new rn:at()}function as(t){return h}function ss(t){void 0===t&&(t=as);var e=new _e;return t(e),e.build()}function ls(t){return h}function cs(){}function us(){ps=this}Object.defineProperty(Xa.prototype,"contentLength",{configurable:!0,get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(Xa.prototype,"contentType",{configurable:!0,get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(Xa.prototype,"status",{configurable:!0,get:function(){return this.this$wrapHeaders.status}}),Object.defineProperty(Xa.prototype,"headers",{configurable:!0,get:function(){return this.headers_byaa2p$_0}}),Xa.$metadata$={kind:x,interfaces:[pe]},Object.defineProperty(ts.prototype,"contentLength",{configurable:!0,get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(ts.prototype,"contentType",{configurable:!0,get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(ts.prototype,"status",{configurable:!0,get:function(){return this.this$wrapHeaders.status}}),Object.defineProperty(ts.prototype,"headers",{configurable:!0,get:function(){return this.headers_byaa2p$_0}}),ts.prototype.readFrom=function(){return this.this$wrapHeaders.readFrom()},ts.prototype.readFrom_6z6t3e$=function(t){return this.this$wrapHeaders.readFrom_6z6t3e$(t)},ts.$metadata$={kind:x,interfaces:[vt]},Object.defineProperty(es.prototype,"contentLength",{configurable:!0,get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(es.prototype,"contentType",{configurable:!0,get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(es.prototype,"status",{configurable:!0,get:function(){return this.this$wrapHeaders.status}}),Object.defineProperty(es.prototype,"headers",{configurable:!0,get:function(){return this.headers_byaa2p$_0}}),es.prototype.writeTo_h3x4ir$=function(t,e){return this.this$wrapHeaders.writeTo_h3x4ir$(t,e)},es.$metadata$={kind:x,interfaces:[Le]},Object.defineProperty(ns.prototype,"contentLength",{configurable:!0,get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(ns.prototype,"contentType",{configurable:!0,get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(ns.prototype,"status",{configurable:!0,get:function(){return this.this$wrapHeaders.status}}),Object.defineProperty(ns.prototype,"headers",{configurable:!0,get:function(){return this.headers_byaa2p$_0}}),ns.prototype.bytes=function(){return this.this$wrapHeaders.bytes()},ns.$metadata$={kind:x,interfaces:[mt]},Object.defineProperty(is.prototype,"contentLength",{configurable:!0,get:function(){return this.this$wrapHeaders.contentLength}}),Object.defineProperty(is.prototype,"contentType",{configurable:!0,get:function(){return this.this$wrapHeaders.contentType}}),Object.defineProperty(is.prototype,"headers",{configurable:!0,get:function(){return this.headers_byaa2p$_0}}),is.prototype.upgrade_h1mv0l$=function(t,e,n,i,r){return this.this$wrapHeaders.upgrade_h1mv0l$(t,e,n,i,r)},is.$metadata$={kind:x,interfaces:[nn]},cs.$metadata$={kind:it,simpleName:"Type",interfaces:[]},us.$metadata$={kind:A,simpleName:"JsType",interfaces:[cs]};var ps=null;function hs(t,e){return e.isInstance_s8jyv4$(t)}function fs(t){return function(e){if(null!=e)return t.cancel_m4sck1$(dt(e.message)),h}}function ds(t){return function(e){return t.dispose(),h}}function _s(t,e,n){var i=b(e),r=t.coroutineContext.plus_1fupul$(i).plus_1fupul$(Gn);t:do{var o;if(null==(o=n.context.get_j3r2sn$(f.Key)))break t;var a=o.invokeOnCompletion_ct2b2z$(!0,void 0,fs(i));i.invokeOnCompletion_f05bi3$(ds(a))}while(0);return r}function ys(){ms=this}ys.prototype.create_dxyxif$$default=function(t){var e=new Ti;return t(e),new bs(e)},ys.$metadata$={kind:A,simpleName:"Js",interfaces:[xi]};var ms=null;function vs(){return null===ms&&new ys,ms}function $s(){return vs()}function gs(t){return function(e){var n=new pn(un(e),1);return n.initCancellability(),t(n),n.getResult()}}function bs(t){if(Oi.call(this,"ktor-js"),this.config_2md4la$_0=t,this.dispatcher_j9yf5v$_0=$e.Dispatchers.Default,this.supportedCapabilities_380cpg$_0=te([Eo(),Ko()]),null!=this.config.proxy)throw O("Proxy unsupported in Js engine.".toString())}function ws(t,e,n){m.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$callContext=void 0,this.local$requestTime=void 0,this.local$data=e}function ks(t,e,n,i){m.call(this,i),this.exceptionState_0=4,this.$this=t,this.local$requestTime=void 0,this.local$urlString=void 0,this.local$socket=void 0,this.local$request=e,this.local$callContext=n}function Ss(t){return function(e){if(!e.isCancelled){var n=function(t,e){return function(n){switch(n.type){case"open":var i=e;t.resumeWith_tl1gpc$(new ln(i));break;case"error":var r=t,o=new Wo(JSON.stringify(n));r.resumeWith_tl1gpc$(new ln(cn(o)))}return h}}(e,t);return t.addEventListener("open",n),t.addEventListener("error",n),e.invokeOnCancellation_f05bi3$(function(t,e){return function(n){return e.removeEventListener("open",t),e.removeEventListener("error",t),null!=n&&e.close(),h}}(n,t)),h}}}function xs(t,e){m.call(this,e),this.exceptionState_0=1,this.local$$receiver=t}function Es(t){return function(e){var n;return t.forEach((n=e,function(t,e){return n.append_puj7f4$(e,t),h})),h}}function Cs(t){R.call(this),this.message_9vnttw$_0="Error from javascript["+t.toString()+"].",this.cause_kdow7y$_0=null,this.origin=t,e.captureStack(R,this),this.name="JsError"}function Os(t){return function(e,n){return t.set(e,n),h}}function Ns(t,e,n,i){m.call(this,i),this.$controller=n,this.exceptionState_0=1,this.local$closure$content=t,this.local$$receiver=e}function zs(t){return function(e,n,i){var r=new Ns(t,e,this,n);return i?r:r.doResume(null)}}function js(t,e,n){m.call(this,n),this.exceptionState_0=1,this.local$tmp$_0=void 0,this.local$jsHeaders=void 0,this.local$$receiver=t,this.local$callContext=e}function Ts(t,e,n,i){var r=new js(t,e,n);return i?r:r.doResume(null)}function Ps(t){return function(e){var n=new pn(un(e),1);return n.initCancellability(),t(n),n.getResult()}}function Rs(t){return function(e){var n;return t.read().then((n=e,function(t){var e=t.value,i=t.done||null==e?null:e;return n.resumeWith_tl1gpc$(new ln(i)),h})).catch(function(t){return function(e){return t.resumeWith_tl1gpc$(new ln(cn(e))),h}}(e)),h}}function As(t,e){m.call(this,e),this.exceptionState_0=1,this.local$$receiver=t}function Is(t,e,n){var i=new As(t,e);return n?i:i.doResume(null)}function Ms(t){return new Int8Array(t.buffer,t.byteOffset,t.length)}function Ls(t,n){var i,r;if(null==(r=e.isType(i=n.body,Object)?i:null))throw O(("Fail to obtain native stream: "+n.toString()).toString());return qs(t,r)}function Ds(t,e,n,i){m.call(this,i),this.$controller=n,this.exceptionState_0=8,this.local$closure$stream=t,this.local$tmp$=void 0,this.local$reader=void 0,this.local$$receiver=e}function qs(t,e){return jt(t,void 0,void 0,(n=e,function(t,e,i){var r=new Ds(n,t,this,e);return i?r:r.doResume(null)})).channel;var n}function Fs(t,e){t.signal=e}function Us(t){return function(e){var n=new pn(un(e),1);return n.initCancellability(),t(n),n.getResult()}}function Bs(t,e){return function(n){var i,r,o=z.PlatformUtils.IS_BROWSER?new AbortController:new c;return Fs(t,o.signal),n.invokeOnCancellation_f05bi3$((i=o,function(t){return i.abort(),h})),(z.PlatformUtils.IS_BROWSER?window.fetch(e,t):u(e,t)).then((r=n,function(t){return r.resumeWith_tl1gpc$(new ln(t)),h}),function(t){return function(e){var n=t,i=new dn("Fail to fetch",e);return n.resumeWith_tl1gpc$(new ln(cn(i))),h}}(n)),h}}function Hs(t,e,n){m.call(this,n),this.exceptionState_0=1,this.local$input=t,this.local$init=e}function Vs(t,e,n,i){var r=new Hs(t,e,n);return i?r:r.doResume(null)}function Ks(t,e){return z.PlatformUtils.IS_BROWSER?Ls(t,e):Zs(t,e)}function Ws(t,e){return function(n){return t.offer_11rb$(Ms(new Uint8Array(n))),e.pause()}}function Ys(t,e){return function(n){var i=new Cs(n);return t.close_dbl4no$(i),e.channel.close_dbl4no$(i)}}function Gs(t){return function(){return t.close_dbl4no$()}}function Js(t,e,n,i){m.call(this,i),this.$controller=n,this.exceptionState_0=8,this.local$closure$response=t,this.local$tmp$_0=void 0,this.local$body=void 0,this.local$$receiver=e}function Zs(t,e){return jt(t,void 0,void 0,(n=e,function(t,e,i){var r=new Js(n,t,this,e);return i?r:r.doResume(null)})).channel;var n}function Qs(t){}function Xs(t,e){var n,i,r;this.coroutineContext_x6mio4$_0=t,this.websocket_0=e,this._closeReason_0=mn(),this._incoming_0=_n(2147483647),this._outgoing_0=_n(2147483647),this.incoming_115vn1$_0=this._incoming_0,this.outgoing_ex3pqx$_0=this._outgoing_0,this.closeReason_n5pjc5$_0=this._closeReason_0,this.websocket_0.binaryType="arraybuffer",this.websocket_0.addEventListener("message",(i=this,function(t){var e,n;return ue(i,void 0,void 0,(e=t,n=i,function(t,i,r){var o=new tl(e,n,t,this,i);return r?o:o.doResume(null)})),h})),this.websocket_0.addEventListener("error",function(t){return function(e){var n=new Wo(e.toString());return t._closeReason_0.completeExceptionally_tcv7n7$(n),t._incoming_0.close_dbl4no$(n),t._outgoing_0.cancel_m4sck1$(),h}}(this)),this.websocket_0.addEventListener("close",function(t){return function(e){var n,i;return ue(t,void 0,void 0,(n=e,i=t,function(t,e,r){var o=new el(n,i,t,this,e);return r?o:o.doResume(null)})),h}}(this)),ue(this,void 0,void 0,(r=this,function(t,e,n){var i=new nl(r,t,this,e);return n?i:i.doResume(null)})),null!=(n=this.coroutineContext.get_j3r2sn$(f.Key))&&n.invokeOnCompletion_f05bi3$(function(t){return function(e){return null==e?t.websocket_0.close():t.websocket_0.close(yn.INTERNAL_ERROR.code,"Client failed"),h}}(this))}function tl(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$event=t,this.local$this$JsWebSocketSession=e}function el(t,e,n,i,r){m.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$event=t,this.local$this$JsWebSocketSession=e}function nl(t,e,n,i){m.call(this,i),this.$controller=n,this.exceptionState_0=8,this.local$this$JsWebSocketSession=t,this.local$$receiver=void 0,this.local$cause=void 0,this.local$tmp$=void 0}function il(){}function rl(t){return t}Object.defineProperty(bs.prototype,"config",{get:function(){return this.config_2md4la$_0}}),Object.defineProperty(bs.prototype,"dispatcher",{configurable:!0,get:function(){return this.dispatcher_j9yf5v$_0}}),Object.defineProperty(bs.prototype,"supportedCapabilities",{configurable:!0,get:function(){return this.supportedCapabilities_380cpg$_0}}),ws.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},ws.prototype=Object.create(m.prototype),ws.prototype.constructor=ws,ws.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Ri(this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:if(this.local$callContext=this.result_0,sa(this.local$data)){if(this.state_0=3,this.result_0=this.$this.executeWebSocketRequest_0(this.local$data,this.local$callContext,this),this.result_0===y)return y;continue}this.state_0=4;continue;case 3:return this.result_0;case 4:if(this.local$requestTime=fe(),this.state_0=5,this.result_0=Ts(this.local$data,this.local$callContext,this),this.result_0===y)return y;continue;case 5:var t=this.result_0;if(this.state_0=6,this.result_0=Vs(this.local$data.url.toString(),t,this),this.result_0===y)return y;continue;case 6:var e=this.result_0,n=new Tt(e.status,e.statusText),i=ss(Es(e.headers)),r=on.Companion.HTTP_1_1,o=Ks(an(this.local$callContext),e);return new oa(n,this.local$requestTime,i,r,o,this.local$callContext);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bs.prototype.execute_dkgphz$=function(t,e,n){var i=new ws(this,t,e);return n?i:i.doResume(null)},ks.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},ks.prototype=Object.create(m.prototype),ks.prototype.constructor=ks,ks.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.local$requestTime=fe(),this.local$urlString=this.local$request.url.toString(),t=z.PlatformUtils.IS_NODE?new s(this.local$urlString):new WebSocket(this.local$urlString),this.local$socket=t,this.exceptionState_0=2,this.state_0=1,this.result_0=(r=this.local$socket,o=void 0,a=void 0,a=new xs(r,this),o?a:a.doResume(null)),this.result_0===y)return y;continue;case 1:this.exceptionState_0=4,this.state_0=3;continue;case 2:this.exceptionState_0=4;var n=this.exception_0;throw e.isType(n,R)?(sn(this.local$callContext,new zt("Failed to connect to "+this.local$urlString,n)),n):n;case 3:var i=new Xs(this.local$callContext,this.local$socket);return new oa(Tt.Companion.OK,this.local$requestTime,tn.Companion.Empty,on.Companion.HTTP_1_1,i,this.local$callContext);case 4:throw this.exception_0;default:throw this.state_0=4,new Error("State Machine Unreachable execution")}}catch(t){if(4===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}var r,o,a},bs.prototype.executeWebSocketRequest_0=function(t,e,n,i){var r=new ks(this,t,e,n);return i?r:r.doResume(null)},bs.$metadata$={kind:x,simpleName:"JsClientEngine",interfaces:[Oi]},xs.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},xs.prototype=Object.create(m.prototype),xs.prototype.constructor=xs,xs.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=gs(Ss(this.local$$receiver))(this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0,this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(Cs.prototype,"message",{get:function(){return this.message_9vnttw$_0}}),Object.defineProperty(Cs.prototype,"cause",{get:function(){return this.cause_kdow7y$_0}}),Cs.$metadata$={kind:x,simpleName:"JsError",interfaces:[R]},Ns.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Ns.prototype=Object.create(m.prototype),Ns.prototype.constructor=Ns,Ns.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$closure$content.writeTo_h3x4ir$(this.local$$receiver.channel,this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},js.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},js.prototype=Object.create(m.prototype),js.prototype.constructor=js,js.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;t=z.PlatformUtils.IS_BROWSER?new Headers:new hn,this.local$jsHeaders=t,Pi(this.local$$receiver.headers,this.local$$receiver.body,Os(this.local$jsHeaders));var n=this.local$$receiver.body;if(e.isType(n,mt)){this.local$tmp$_0=n.bytes(),this.state_0=6;continue}if(e.isType(n,vt)){if(this.state_0=4,this.result_0=J(n.readFrom(),this),this.result_0===y)return y;continue}if(e.isType(n,Le)){if(this.state_0=2,this.result_0=J(jt($e.GlobalScope,this.local$callContext,void 0,zs(n)).channel,this),this.result_0===y)return y;continue}this.local$tmp$_0=null,this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.local$tmp$_0=Z(this.result_0),this.state_0=3;continue;case 3:this.state_0=5;continue;case 4:this.local$tmp$_0=Z(this.result_0),this.state_0=5;continue;case 5:this.state_0=6;continue;case 6:var i=null!=this.local$tmp$_0?new Uint8Array(fn(this.local$tmp$_0)):null,r=this.local$$receiver.method.value,o={};return o.method=r,o.headers=this.local$jsHeaders,o.body=i,o.referrer=void 0,o.referrerPolicy=void 0,o.mode=void 0,o.credentials=void 0,o.cache=void 0,o.redirect="follow",o.integrity=void 0,o.keepalive=void 0,o.window=void 0,o;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},As.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},As.prototype=Object.create(m.prototype),As.prototype.constructor=As,As.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Ps(Rs(this.local$$receiver))(this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0,this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ds.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Ds.prototype=Object.create(m.prototype),Ds.prototype.constructor=Ds,Ds.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$reader=this.local$closure$stream.getReader(),this.state_0=1;continue;case 1:if(this.exceptionState_0=6,this.state_0=2,this.result_0=Is(this.local$reader,this),this.result_0===y)return y;continue;case 2:if(this.local$tmp$=this.result_0,null==this.local$tmp$){this.exceptionState_0=6,this.state_0=5;continue}this.state_0=3;continue;case 3:var t=this.local$tmp$;if(this.state_0=4,this.result_0=Ie(this.local$$receiver.channel,Ms(t),this),this.result_0===y)return y;continue;case 4:this.exceptionState_0=8,this.state_0=7;continue;case 5:return h;case 6:this.exceptionState_0=8;var n=this.exception_0;throw e.isType(n,R)?(this.local$reader.cancel(n),n):n;case 7:this.state_0=1;continue;case 8:throw this.exception_0;default:throw this.state_0=8,new Error("State Machine Unreachable execution")}}catch(t){if(8===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Hs.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Hs.prototype=Object.create(m.prototype),Hs.prototype.constructor=Hs,Hs.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=Us(Bs(this.local$init,this.local$input))(this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.result_0,this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Js.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},Js.prototype=Object.create(m.prototype),Js.prototype.constructor=Js,Js.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n;if(null==(t=this.local$closure$response.body))throw O("Fail to get body".toString());n=t,this.local$body=n;var i=_n(1);this.local$body.on("data",Ws(i,this.local$body)),this.local$body.on("error",Ys(i,this.local$$receiver)),this.local$body.on("end",Gs(i)),this.exceptionState_0=6,this.local$tmp$_0=i.iterator(),this.state_0=1;continue;case 1:if(this.state_0=2,this.result_0=this.local$tmp$_0.hasNext(this),this.result_0===y)return y;continue;case 2:if(this.result_0){this.state_0=3;continue}this.state_0=5;continue;case 3:var r=this.local$tmp$_0.next();if(this.state_0=4,this.result_0=Ie(this.local$$receiver.channel,r,this),this.result_0===y)return y;continue;case 4:this.local$body.resume(),this.state_0=1;continue;case 5:this.exceptionState_0=8,this.state_0=7;continue;case 6:this.exceptionState_0=8;var o=this.exception_0;throw e.isType(o,R)?(this.local$body.destroy(o),o):o;case 7:return h;case 8:throw this.exception_0;default:throw this.state_0=8,new Error("State Machine Unreachable execution")}}catch(t){if(8===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(Xs.prototype,"coroutineContext",{get:function(){return this.coroutineContext_x6mio4$_0}}),Object.defineProperty(Xs.prototype,"incoming",{configurable:!0,get:function(){return this.incoming_115vn1$_0}}),Object.defineProperty(Xs.prototype,"outgoing",{configurable:!0,get:function(){return this.outgoing_ex3pqx$_0}}),Object.defineProperty(Xs.prototype,"extensions",{configurable:!0,get:function(){return he()}}),Object.defineProperty(Xs.prototype,"closeReason",{configurable:!0,get:function(){return this.closeReason_n5pjc5$_0}}),Object.defineProperty(Xs.prototype,"maxFrameSize",{configurable:!0,get:function(){return gt},set:function(t){}}),Xs.prototype.start_wohq5n$$default=function(t){if(!t.isEmpty())throw Q("Extensions are not supported.".toString())},Xs.prototype.flush=function(t){},Xs.prototype.terminate=function(){this._incoming_0.cancel_m4sck1$(),this._outgoing_0.cancel_m4sck1$(),oe(this._closeReason_0,"WebSocket terminated"),this.websocket_0.close()},Xs.prototype.isReservedStatusCode_0=function(t){var e=yn.Companion.byCode_mq22fl$(t);return null==e||pt(e,yn.CLOSED_ABNORMALLY)},tl.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},tl.prototype=Object.create(m.prototype),tl.prototype.constructor=tl,tl.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.local$closure$event.data;if(e.isType(n,ArrayBuffer))t=vn(!1,new Int8Array(n));else{if("string"!=typeof n){var i=O("Unknown frame type: "+this.local$closure$event.type);throw this.local$this$JsWebSocketSession._closeReason_0.completeExceptionally_tcv7n7$(i),i}t=$n(n)}var r=t;return this.local$this$JsWebSocketSession._incoming_0.offer_11rb$(r);case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},el.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},el.prototype=Object.create(m.prototype),el.prototype.constructor=el,el.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e,n=new gn("number"==typeof(t=this.local$closure$event.code)?t:v(),"string"==typeof(e=this.local$closure$event.reason)?e:v());if(this.local$this$JsWebSocketSession._closeReason_0.complete_11rb$(n),this.state_0=2,this.result_0=this.local$this$JsWebSocketSession._incoming_0.send_11rb$(bn(n),this),this.result_0===y)return y;continue;case 1:throw this.exception_0;case 2:return this.local$this$JsWebSocketSession._incoming_0.close_dbl4no$(),this.local$this$JsWebSocketSession._outgoing_0.cancel_m4sck1$(),h;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},nl.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[m]},nl.prototype=Object.create(m.prototype),nl.prototype.constructor=nl,nl.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$$receiver=this.local$this$JsWebSocketSession._outgoing_0,this.local$cause=null,this.exceptionState_0=5,this.local$tmp$=this.local$$receiver.iterator(),this.state_0=1;continue;case 1:if(this.state_0=2,this.result_0=this.local$tmp$.hasNext(this),this.result_0===y)return y;continue;case 2:if(this.result_0){this.state_0=3;continue}this.state_0=4;continue;case 3:var t,n=this.local$tmp$.next(),i=this.local$this$JsWebSocketSession;switch(n.frameType.name){case"TEXT":var r=n.data;i.websocket_0.send(wn(r));break;case"BINARY":var o=e.isType(t=n.data,Int8Array)?t:v(),a=o.buffer.slice(o.byteOffset,o.byteOffset+o.byteLength|0);i.websocket_0.send(a);break;case"CLOSE":var s,l=De(0);try{Fe(l,n.data),s=l.build()}catch(t){throw e.isType(t,R)?(l.release(),t):t}var c=s,u=kn(c),p=c.readText_vux9f0$();i._closeReason_0.complete_11rb$(new gn(u,p)),i.isReservedStatusCode_0(u)?i.websocket_0.close():i.websocket_0.close(u,p)}this.state_0=1;continue;case 4:this.exceptionState_0=8,this.finallyPath_0=[7],this.state_0=6;continue;case 5:this.finallyPath_0=[8],this.exceptionState_0=6;var f=this.exception_0;throw e.isType(f,R)?(this.local$cause=f,f):f;case 6:this.exceptionState_0=8,Sn(this.local$$receiver,this.local$cause),this.state_0=this.finallyPath_0.shift();continue;case 7:return this.result_0=h,this.result_0;case 8:throw this.exception_0;default:throw this.state_0=8,new Error("State Machine Unreachable execution")}}catch(t){if(8===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Xs.$metadata$={kind:x,simpleName:"JsWebSocketSession",interfaces:[ke]};var ol=t.io||(t.io={}),al=ol.ktor||(ol.ktor={}),sl=al.client||(al.client={});sl.HttpClient_744i18$=Cn,p["ktor-ktor-io-jsLegacy"]=r,sl.HttpClient_init_qii15z$=Pn,sl.HttpClient=On,sl.HttpClientConfig=An;var ll=sl.call||(sl.call={});ll.HttpClientCall_iofdyz$=Hn,Object.defineProperty(Vn,"Companion",{get:Xn}),ll.HttpClientCall=Vn,ll.HttpEngineCall=ti,ll.call_htnejk$=function(t,e,n){throw void 0===e&&(e=ni),O("Unbound [HttpClientCall] is deprecated. Consider using [request(block)] in instead.".toString())},ll.DoubleReceiveException=ii,ll.ReceivePipelineException=ri,ll.NoTransformationFoundException=oi,ll.SavedHttpCall=si,ll.SavedHttpRequest=ci,ll.SavedHttpResponse=ui,ll.save_iicrl5$=hi,ll.TypeInfo=fi,ll.UnsupportedContentTypeException=di,ll.UnsupportedUpgradeProtocolException=_i,ll.call_30bfl5$=function(t,e,n){throw O("Unbound [HttpClientCall] is deprecated. Consider using [request(builder)] instead.".toString())},ll.call_1t1q32$=function(t,e,n,i){throw void 0===n&&(n=mi),O("Unbound [HttpClientCall] is deprecated. Consider using [request(urlString, block)] instead.".toString())},ll.call_p7i9r1$=function(t,e,n,i){throw void 0===n&&(n=$i),O("Unbound [HttpClientCall] is deprecated. Consider using [request(url, block)] instead.".toString())};var cl=sl.engine||(sl.engine={});cl.HttpClientEngine=gi,cl.HttpClientEngineFactory=xi,cl.HttpClientEngineBase=Oi,cl.ClientEngineClosedException=zi,cl.HttpClientEngineCapability=ji,cl.HttpClientEngineConfig=Ti,cl.mergeHeaders_kqv6tz$=Pi,cl.callContext=Ri,Object.defineProperty(Ai,"Companion",{get:Li}),cl.KtorCallContextElement=Ai,p["kotlinx-coroutines-core"]=n,Object.defineProperty(Di,"Feature",{get:Hi});var ul=sl.features||(sl.features={});ul.DefaultRequest=Di,ul.defaultRequest_fxc3ki$=function(t,e){var n;t.install_xlxg29$(Hi(),(n=e,function(t){return n(t),h}))},ul.addDefaultResponseValidation_bbdm9p$=Wi,ul.ResponseException=Yi,ul.RedirectResponseException=Ji,ul.ServerResponseException=Zi,ul.ClientRequestException=Qi,ul.defaultTransformers_ejcypf$=sr,lr.Config=pr,Object.defineProperty(lr,"Companion",{get:gr}),ul.HttpCallValidator=lr,ul.HttpResponseValidator_jqt3w2$=br,ul.HttpClientFeature=wr,ul.feature_ccg70z$=Sr,ul.get_ccg70z$=xr,Or.Config=Nr,Object.defineProperty(Or,"Feature",{get:Ar}),ul.HttpPlainText=Or,Object.defineProperty(Lr,"Feature",{get:Br}),ul.HttpRedirect=Lr,Object.defineProperty(Vr,"Feature",{get:Gr}),ul.HttpRequestLifecycle=Vr,ul.Sender=Qr,Object.defineProperty(Xr,"Feature",{get:oo}),ul.HttpSend=Xr,ul.SendCountExceedException=lo,Object.defineProperty(po,"Companion",{get:vo}),uo.HttpTimeoutCapabilityConfiguration_init_oq4a4q$=$o,uo.HttpTimeoutCapabilityConfiguration=po,Object.defineProperty(uo,"Feature",{get:Eo}),ul.HttpTimeout=uo,ul.HttpRequestTimeoutException=Co,p["ktor-ktor-http-jsLegacy"]=o;var pl=ul.observer||(ul.observer={});pl.wrapWithContent_e4hb7v$=Oo,pl.DelegatedCall=No,pl.DelegatedRequest=zo,pl.DelegatedResponse=jo,To.Config=Po,Object.defineProperty(To,"Feature",{get:Fo}),pl.ResponseObserver=To;var hl=ul.websocket||(ul.websocket={});hl.ClientWebSocketSession=Uo,hl.DefaultClientWebSocketSession=Bo,Object.defineProperty(hl,"WebSocketCapability",{get:Ko}),hl.WebSocketException=Wo;var fl=sl.request||(sl.request={});fl.ClientUpgradeContent=Yo,fl.DefaultHttpRequest=Zo,fl.HttpRequest=Qo,Object.defineProperty(Xo,"Companion",{get:ia}),fl.HttpRequestBuilder=Xo,fl.HttpRequestData=ra,fl.HttpResponseData=oa,fl.headers_nc42ot$=function(t,e){var n=t.headers;return e(n),n},fl.url_3rzbk2$=function(t,e,n,i,r,o){void 0===e&&(e="http"),void 0===n&&(n="localhost"),void 0===i&&(i=0),void 0===r&&(r="/"),void 0===o&&(o=aa);var a=t.url;a.protocol=Se.Companion.createOrDefault_61zpoe$(e),a.host=n,a.port=i,a.encodedPath=r,o(t.url)},fl.url_g8iu3v$=function(t,e){ne(t.url,e)},fl.isUpgradeRequest_5kadeu$=sa,Object.defineProperty(la,"Phases",{get:pa}),fl.HttpRequestPipeline=la,Object.defineProperty(ha,"Phases",{get:ya}),fl.HttpSendPipeline=ha,fl.url_qpqkqe$=function(t,e){Pe(t.url,e)};var dl=sl.utils||(sl.utils={}),_l=fl.forms||(fl.forms={});_l.FormDataContent=ma,_l.MultiPartFormDataContent=va,fl.header_xadl6p$=function(t,e,n){null!=n&&t.headers.append_puj7f4$(e,n.toString())},fl.accept_fohfhi$=function(t,e){t.headers.append_puj7f4$(rt.HttpHeaders.Accept,e.toString())};var yl=sl.statement||(sl.statement={});yl.DefaultHttpResponse=ka,yl.HttpResponse=Sa,yl.get_request_abn2de$=xa,yl.complete_abn2de$=Ea,Object.defineProperty(Ca,"Phases",{get:za}),yl.HttpResponsePipeline=Ca,Object.defineProperty(ja,"Phases",{get:Ia}),yl.HttpReceivePipeline=ja,yl.HttpResponseContainer=Ma,yl.HttpStatement=La,yl.readText_rjorc7$=Wa,Object.defineProperty(dl,"DEFAULT_HTTP_POOL_SIZE",{get:function(){return Pa}}),Object.defineProperty(dl,"DEFAULT_HTTP_BUFFER_SIZE",{get:function(){return Ra}}),Object.defineProperty(dl,"CacheControl",{get:function(){return null===Ga&&new Ya,Ga}}),Object.defineProperty(dl,"EmptyContent",{get:Qa}),dl.wrapHeaders_j1n6iz$=function(t,n){return e.isType(t,pe)?new Xa(t,n):e.isType(t,vt)?new ts(t,n):e.isType(t,Le)?new es(t,n):e.isType(t,mt)?new ns(t,n):e.isType(t,nn)?new is(t,n):e.noWhenBranchMatched()},dl.sharedMap_aejgjo$=rs,dl.sharedList_tnbmyv$=os,dl.buildHeaders_g6xk4w$=ss,sl.HttpClient_f0veat$=function(t){return void 0===t&&(t=ls),Cn($s(),t)},ll.Type=cs,Object.defineProperty(ll,"JsType",{get:function(){return null===ps&&new us,ps}}),ll.instanceOf_ofcvxk$=hs,cl.createCallContext_antxd1$=_s;var ml=cl.js||(cl.js={});Object.defineProperty(ml,"Js",{get:vs}),ml.JsClient=$s,ml.JsClientEngine=bs,ml.JsError=Cs,ml.toRaw_lu1yd6$=Ts,ml.readChunk_pggmy1$=Is,ml.asByteArray_es0py6$=Ms;var vl=ml.browser||(ml.browser={});vl.readBodyBrowser_qitd22$=Ls,vl.channelFromStream_xaoqny$=qs;var $l=ml.compatibility||(ml.compatibility={});return $l.set_signal_g8fgly$=Fs,$l.commonFetch_70q1td$=Vs,$l.readBody_qitd22$=Ks,(ml.node||(ml.node={})).readBodyNode_qitd22$=Zs,ul.platformDefaultTransformers_h1fxjk$=Qs,hl.JsWebSocketSession=Xs,dl.clientDispatcher_b7msz$=function(t,e,n){return void 0===n&&(n="ktor-client-dispatcher"),t.Unconfined},dl.checkCoroutinesVersion_8be2vx$=il,dl.unwrapCancellationException_dbl4o4$=rl,xi.prototype.create_dxyxif$,Object.defineProperty(Oi.prototype,"supportedCapabilities",Object.getOwnPropertyDescriptor(gi.prototype,"supportedCapabilities")),Oi.prototype.install_k5i6f8$=gi.prototype.install_k5i6f8$,Oi.prototype.executeWithinCallContext_2kaaho$_0=gi.prototype.executeWithinCallContext_2kaaho$_0,Oi.prototype.checkExtensions_1320zn$_0=gi.prototype.checkExtensions_1320zn$_0,Ai.prototype.fold_3cc69b$=ft.prototype.fold_3cc69b$,Ai.prototype.get_j3r2sn$=ft.prototype.get_j3r2sn$,Ai.prototype.minusKey_yeqjby$=ft.prototype.minusKey_yeqjby$,Ai.prototype.plus_1fupul$=ft.prototype.plus_1fupul$,qi.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,wr.prototype.prepare_oh3mgy$,hr.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,zr.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,Dr.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,Kr.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,no.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,go.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,wr.prototype.prepare_oh3mgy$,wr.prototype.prepare_oh3mgy$,wr.prototype.prepare_oh3mgy$,Io.prototype.prepare_oh3mgy$=wr.prototype.prepare_oh3mgy$,Uo.prototype.send_x9o3m3$=we.prototype.send_x9o3m3$,Bo.prototype.start_wohq5n$=ke.prototype.start_wohq5n$,wr.prototype.prepare_oh3mgy$,Object.defineProperty(Zo.prototype,"executionContext",Object.getOwnPropertyDescriptor(Qo.prototype,"executionContext")),ys.prototype.create_dxyxif$=xi.prototype.create_dxyxif$,bs.prototype.executeWithinCallContext_2kaaho$_0=gi.prototype.executeWithinCallContext_2kaaho$_0,bs.prototype.checkExtensions_1320zn$_0=gi.prototype.checkExtensions_1320zn$_0,Xs.prototype.send_x9o3m3$=ke.prototype.send_x9o3m3$,Xs.prototype.start_wohq5n$=ke.prototype.start_wohq5n$,Gn=new tt("call-context"),Jn=new $("EngineCapabilities"),ut(Eo()),Zn="Ktor client",Ui=new $("ValidateMark"),mr=new $("ExpectSuccessAttribyteKey"),vr=new $("ApplicationFeatureRegistry"),Pr=te([Xt.Companion.Get,Xt.Companion.Head]),new $("Websocket extensions"),da=Ge(Mt.Charsets.UTF_8.newEncoder(),"\r\n",0,"\r\n".length),Pa=1e3,Ra=4096,t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){"use strict";(function(e){void 0===e||!e.version||0===e.version.indexOf("v0.")||0===e.version.indexOf("v1.")&&0!==e.version.indexOf("v1.8.")?t.exports={nextTick:function(t,n,i,r){if("function"!=typeof t)throw new TypeError('"callback" argument must be a function');var o,a,s=arguments.length;switch(s){case 0:case 1:return e.nextTick(t);case 2:return e.nextTick((function(){t.call(null,n)}));case 3:return e.nextTick((function(){t.call(null,n,i)}));case 4:return e.nextTick((function(){t.call(null,n,i,r)}));default:for(o=new Array(s-1),a=0;a>>24]^u[d>>>16&255]^p[_>>>8&255]^h[255&y]^e[m++],a=c[d>>>24]^u[_>>>16&255]^p[y>>>8&255]^h[255&f]^e[m++],s=c[_>>>24]^u[y>>>16&255]^p[f>>>8&255]^h[255&d]^e[m++],l=c[y>>>24]^u[f>>>16&255]^p[d>>>8&255]^h[255&_]^e[m++],f=o,d=a,_=s,y=l;return o=(i[f>>>24]<<24|i[d>>>16&255]<<16|i[_>>>8&255]<<8|i[255&y])^e[m++],a=(i[d>>>24]<<24|i[_>>>16&255]<<16|i[y>>>8&255]<<8|i[255&f])^e[m++],s=(i[_>>>24]<<24|i[y>>>16&255]<<16|i[f>>>8&255]<<8|i[255&d])^e[m++],l=(i[y>>>24]<<24|i[f>>>16&255]<<16|i[d>>>8&255]<<8|i[255&_])^e[m++],[o>>>=0,a>>>=0,s>>>=0,l>>>=0]}var s=[0,1,2,4,8,16,32,64,128,27,54],l=function(){for(var t=new Array(256),e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;for(var n=[],i=[],r=[[],[],[],[]],o=[[],[],[],[]],a=0,s=0,l=0;l<256;++l){var c=s^s<<1^s<<2^s<<3^s<<4;c=c>>>8^255&c^99,n[a]=c,i[c]=a;var u=t[a],p=t[u],h=t[p],f=257*t[c]^16843008*c;r[0][a]=f<<24|f>>>8,r[1][a]=f<<16|f>>>16,r[2][a]=f<<8|f>>>24,r[3][a]=f,f=16843009*h^65537*p^257*u^16843008*a,o[0][c]=f<<24|f>>>8,o[1][c]=f<<16|f>>>16,o[2][c]=f<<8|f>>>24,o[3][c]=f,0===a?a=s=1:(a=u^t[t[t[h^u]]],s^=t[t[s]])}return{SBOX:n,INV_SBOX:i,SUB_MIX:r,INV_SUB_MIX:o}}();function c(t){this._key=r(t),this._reset()}c.blockSize=16,c.keySize=32,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var t=this._key,e=t.length,n=e+6,i=4*(n+1),r=[],o=0;o>>24,a=l.SBOX[a>>>24]<<24|l.SBOX[a>>>16&255]<<16|l.SBOX[a>>>8&255]<<8|l.SBOX[255&a],a^=s[o/e|0]<<24):e>6&&o%e==4&&(a=l.SBOX[a>>>24]<<24|l.SBOX[a>>>16&255]<<16|l.SBOX[a>>>8&255]<<8|l.SBOX[255&a]),r[o]=r[o-e]^a}for(var c=[],u=0;u>>24]]^l.INV_SUB_MIX[1][l.SBOX[h>>>16&255]]^l.INV_SUB_MIX[2][l.SBOX[h>>>8&255]]^l.INV_SUB_MIX[3][l.SBOX[255&h]]}this._nRounds=n,this._keySchedule=r,this._invKeySchedule=c},c.prototype.encryptBlockRaw=function(t){return a(t=r(t),this._keySchedule,l.SUB_MIX,l.SBOX,this._nRounds)},c.prototype.encryptBlock=function(t){var e=this.encryptBlockRaw(t),n=i.allocUnsafe(16);return n.writeUInt32BE(e[0],0),n.writeUInt32BE(e[1],4),n.writeUInt32BE(e[2],8),n.writeUInt32BE(e[3],12),n},c.prototype.decryptBlock=function(t){var e=(t=r(t))[1];t[1]=t[3],t[3]=e;var n=a(t,this._invKeySchedule,l.INV_SUB_MIX,l.INV_SBOX,this._nRounds),o=i.allocUnsafe(16);return o.writeUInt32BE(n[0],0),o.writeUInt32BE(n[3],4),o.writeUInt32BE(n[2],8),o.writeUInt32BE(n[1],12),o},c.prototype.scrub=function(){o(this._keySchedule),o(this._invKeySchedule),o(this._key)},t.exports.AES=c},function(t,e,n){var i=n(2).Buffer,r=n(45);t.exports=function(t,e,n,o){if(i.isBuffer(t)||(t=i.from(t,"binary")),e&&(i.isBuffer(e)||(e=i.from(e,"binary")),8!==e.length))throw new RangeError("salt should be Buffer with 8 byte length");for(var a=n/8,s=i.alloc(a),l=i.alloc(o||0),c=i.alloc(0);a>0||o>0;){var u=new r;u.update(c),u.update(t),e&&u.update(e),c=u.digest();var p=0;if(a>0){var h=s.length-a;p=Math.min(a,c.length),c.copy(s,h,0,p),a-=p}if(p0){var f=l.length-o,d=Math.min(o,c.length-p);c.copy(l,f,p,p+d),o-=d}}return c.fill(0),{key:s,iv:l}}},function(t,e,n){"use strict";var i=n(5),r=n(10),o=r.getNAF,a=r.getJSF,s=r.assert;function l(t,e){this.type=t,this.p=new i(e.p,16),this.red=e.prime?i.red(e.prime):i.mont(this.p),this.zero=new i(0).toRed(this.red),this.one=new i(1).toRed(this.red),this.two=new i(2).toRed(this.red),this.n=e.n&&new i(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}function c(t,e){this.curve=t,this.type=e,this.precomputed=null}t.exports=l,l.prototype.point=function(){throw new Error("Not implemented")},l.prototype.validate=function(){throw new Error("Not implemented")},l.prototype._fixedNafMul=function(t,e){s(t.precomputed);var n=t._getDoubles(),i=o(e,1,this._bitLength),r=(1<=a;u--)l=(l<<1)+i[u];c.push(l)}for(var p=this.jpoint(null,null,null),h=this.jpoint(null,null,null),f=r;f>0;f--){for(a=0;a=0;c--){for(var u=0;c>=0&&0===a[c];c--)u++;if(c>=0&&u++,l=l.dblp(u),c<0)break;var p=a[c];s(0!==p),l="affine"===t.type?p>0?l.mixedAdd(r[p-1>>1]):l.mixedAdd(r[-p-1>>1].neg()):p>0?l.add(r[p-1>>1]):l.add(r[-p-1>>1].neg())}return"affine"===t.type?l.toP():l},l.prototype._wnafMulAdd=function(t,e,n,i,r){var s,l,c,u=this._wnafT1,p=this._wnafT2,h=this._wnafT3,f=0;for(s=0;s=1;s-=2){var _=s-1,y=s;if(1===u[_]&&1===u[y]){var m=[e[_],null,null,e[y]];0===e[_].y.cmp(e[y].y)?(m[1]=e[_].add(e[y]),m[2]=e[_].toJ().mixedAdd(e[y].neg())):0===e[_].y.cmp(e[y].y.redNeg())?(m[1]=e[_].toJ().mixedAdd(e[y]),m[2]=e[_].add(e[y].neg())):(m[1]=e[_].toJ().mixedAdd(e[y]),m[2]=e[_].toJ().mixedAdd(e[y].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],$=a(n[_],n[y]);for(f=Math.max($[0].length,f),h[_]=new Array(f),h[y]=new Array(f),l=0;l=0;s--){for(var S=0;s>=0;){var x=!0;for(l=0;l=0&&S++,w=w.dblp(S),s<0)break;for(l=0;l0?c=p[l][E-1>>1]:E<0&&(c=p[l][-E-1>>1].neg()),w="affine"===c.type?w.mixedAdd(c):w.add(c))}}for(s=0;s=Math.ceil((t.bitLength()+1)/e.step)},c.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],i=this,r=0;r=0){this.childList.removeAt_za3lpa$(n);var i={};M(i,e);var r=m(t,i);this.childList.add_wxm5ur$(n,r)}},N.prototype.withKey_pspxar$=function(t,e){this.withKey_s5hl0b$(t,e.toString())},N.$metadata$={kind:s,simpleName:"RBuilder",interfaces:[]},Object.defineProperty(P.prototype,"attrs",{get:function(){return this.attrs_iyt8sk$_0}}),P.prototype.attrs_slhiwc$=function(t){t(this.attrs)},Object.defineProperty(P.prototype,"key",{configurable:!0,get:function(){throw S("".toString())},set:function(t){M(this.attrs,t)}}),Object.defineProperty(P.prototype,"ref",{configurable:!0,get:function(){throw S("".toString())},set:function(t){L(this.attrs,t)}}),P.prototype.ref_5ij4lk$=function(t){D(this.attrs,t)},P.$metadata$={kind:s,simpleName:"RElementBuilder",interfaces:[N]},q.prototype.init_bc6fkx$=function(t){},q.prototype.init_65a95q$=function(t,e){},q.prototype.children_ss14n$=function(t){t.children_yllgzm$(this.props)},q.prototype.children_tgvp6h$=function(t,e){t.children_48djri$(this.props,e)},q.prototype.render=function(){return T((t=this,function(e){return t.render_ss14n$(e),a}));var t},q.$metadata$={kind:s,simpleName:"RComponent",interfaces:[]},F.prototype.component1=function(){return this.state_0},F.prototype.component2=function(){return this.setState_0},F.prototype.getValue_lrcp0p$=function(t,e){return this.state_0},F.prototype.setValue_9rddgb$=function(t,e,n){this.setState_0(n)},F.$metadata$={kind:s,simpleName:"RStateDelegate",interfaces:[C]};var U=t.react||(t.react={});return o["kotlin-wrappers-kotlin-extensions-jsLegacy"]=i,U.RBuilder=N,U.buildElements_zepujl$=T,U.RElementBuilder=P,U.functionalComponent_7g4vsr$=function(t,e){void 0===t&&(t=null);var n,i=(n=e,function(t){return T(function(t,e){return function(n){return t(n,e),a}}(n,t))});return null!=t&&(i.displayName=t),i},U.child_9r8yuv$=function(t,e,n,i){return void 0===n&&(n={}),void 0===i&&(i=R),t.child_4dvv5y$(e,n,i)},o.react=n,U.get_rClass_inwa2g$=A,U.get_children_yllgzm$=I,U.set_key_38rnt0$=M,U.set_ref_jjyqia$=L,U.ref_dpkau5$=D,U.setState_kpl3tw$=function(t,e){var n;t.setState((n=e,function(t){var e=n,i=u(t);return e(i),i}))},U.RComponent_init_8bz2yq$=function(t,e){e=e||Object.create(q.prototype),E.call(e,t),q.call(e);var n={};return e.init_65a95q$(n,t),e.state=n,e},U.RComponent=q,U.RStateDelegate=F,U.useEffect_wrbdb4$=function(t,e){void 0===t&&(t=null);var n,i=(n=e,function(){n()});null!=t?O(i,g(t)):O(i)},t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){var i,r,o;r=[e,n(1)],void 0===(o="function"==typeof(i=function(t,e){"use strict";var n=e.Kind.INTERFACE,i=e.kotlin.Unit,r=e.Kind.CLASS;function o(){}function a(){}function s(){return i}function l(t){return i}function c(t,e){this.onComplete_0=t,this.onNext_0=e}o.$metadata$={kind:n,simpleName:"Disposable",interfaces:[]},a.$metadata$={kind:n,simpleName:"Observer",interfaces:[]},c.prototype.onNext=function(t){this.onNext_0(t)},c.prototype.onComplete=function(){this.onComplete_0()},c.$metadata$={kind:r,simpleName:"ObserverImpl",interfaces:[a]};var u=t.com||(t.com={}),p=u.arkivanov||(u.arkivanov={}),h=p.mvikotlin||(p.mvikotlin={}),f=h.rx||(h.rx={});return f.Disposable=o,f.Observer=a,f.observer_8xtgbe$=function(t,e){return void 0===t&&(t=s),void 0===e&&(e=l),new c(t,e)},t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){var i,r,o;r=[e,n(1),n(75),n(36),n(67),n(129),n(131),n(248),n(132),n(249),n(18),n(34),n(8),n(251),n(253),n(254),n(255),n(13),n(256),n(25),n(257)],void 0===(o="function"==typeof(i=function(t,e,n,i,r,o,a,s,l,c,u,p,h,f,d,_,y,m,v,$,g){"use strict";var b,w,k=t.$$importsForInline$$||(t.$$importsForInline$$={}),S=e.kotlin.Unit,x=n.org.koin.core.context.startKoin_eciske$,E=i.io.ktor.client.HttpClient,C=e.getKClass,O=r.co.touchlab.kermit.Kermit,N=o.com.shabinder.common.database.createDatabase,z=o.com.shabinder.common.database.getLogger,j=r.co.touchlab.kermit.Kermit_init_bigt7k$,T=n.org.koin.dsl.module_7dh9ex$,P=a.kotlinx.serialization.json.Json_x26noe$,R=s.io.ktor.client.features.json.serializer.KotlinxSerializer,A=l.io.ktor.client.features.json.JsonFeature,I=c.io.ktor.client.features.logging.Logging,M=c.io.ktor.client.features.logging.Logger,L=c.io.ktor.client.features.logging.get_DEFAULT_3z44iy$,D=c.io.ktor.client.features.logging.LogLevel,q=i.io.ktor.client.HttpClient_f0veat$,F=n.org.koin.core.module.addDefinition_iz18dn$,U=e.kotlin.collections.emptyList_287e2$,B=n.org.koin.core.definition.Kind,H=n.org.koin.core.definition.BeanDefinition,V=e.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED,K=e.kotlin.coroutines.CoroutineImpl,W=i.io.ktor.client.statement.HttpStatement,Y=e.createKType,G=u.io.ktor.http.contentLength_v1wgmc$,J=e.ensureNotNull,Z=p.com.shabinder.common.models.DownloadResult.Progress,Q=u.io.ktor.http.isSuccess_b3he4c$,X=p.com.shabinder.common.models.DownloadResult.Success,tt=p.com.shabinder.common.models.DownloadResult.Error,et=h.kotlinx.coroutines.flow.flow_sxz0o1$,nt=(e.kotlin.text.lastIndexOf_8eortd$,e.kotlin.text.replace_r2fvfm$),it=i.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.takeFrom_jl1sg7$,rt=i.io.ktor.client.utils,ot=i.io.ktor.client.request.url_3rzbk2$,at=i.$$importsForInline$$["ktor-ktor-http-jsLegacy"].io.ktor.http.HttpMethod,st=i.io.ktor.client.request.HttpRequestBuilder,lt=e.throwCCE,ct=e.equals,ut=i.io.ktor.client.statement.HttpResponse,pt=i.io.ktor.client.statement.complete_abn2de$,ht=i.io.ktor.client.call,ft=i.io.ktor.client.call.TypeInfo,dt=e.kotlin.math.roundToInt_yrwdxr$,_t=e.kotlin.text.contains_li3zpu$,yt=h.kotlinx.coroutines,mt=h.kotlinx.coroutines.withContext_i5cbzn$,vt=e.Kind.CLASS,$t=f.kotlinx.datetime.Clock,gt=p.com.shabinder.common.models.spotify.TokenData,bt=e.toString,wt=e.Long.ZERO,kt=h.kotlinx.coroutines.launch_s496o7$,St=e.kotlin.text.isBlank_gw00vp$,xt=p.com.shabinder.common.models.AllPlatforms,Et=p.com.shabinder.common.models,Ct=p.com.shabinder.common.models.gaana.GaanaPlaylist,Ot=p.com.shabinder.common.models.gaana.GaanaAlbum,Nt=p.com.shabinder.common.models.gaana.GaanaSong,zt=p.com.shabinder.common.models.gaana.GaanaArtistDetails,jt=p.com.shabinder.common.models.gaana.GaanaArtistTracks,Tt=e.Kind.INTERFACE,Pt=e.kotlin.text.substringAfter_j4ogox$,Rt=e.kotlin.text.substringAfterLast_8cymmc$,At=e.kotlin.text.substringBeforeLast_8cymmc$,It=p.com.shabinder.common.models.spotify.Source,Mt=p.com.shabinder.common.models.PlatformQueryResult,Lt=e.kotlin.collections.firstOrNull_2p1efm$,Dt=e.kotlin.collections.listOf_mh5how$,qt=p.com.shabinder.common.models.DownloadStatus,Ft=p.com.shabinder.common.models.TrackDetails,Ut=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,Bt=e.kotlin.collections.ArrayList_init_ww73n8$,Ht=i.io.ktor.client.request.header_xadl6p$,Vt=i.io.ktor.client.features.defaultRequest_fxc3ki$,Kt=e.throwUPAE,Wt=e.kotlin.text.substringAfterLast_j4ogox$,Yt=e.kotlin.text.substringBefore_j4ogox$,Gt=e.kotlin.text.substringBefore_8cymmc$,Jt=p.com.shabinder.common.models.spotify.Image,Zt=p.com.shabinder.common.models.spotify.Album,Qt=e.kotlin.collections.joinToString_fmv235$,Xt=e.kotlin.text.trim_gw00vp$,te=e.kotlin.collections.getOrNull_yzln2o$,ee=e.kotlin.collections.ArrayList_init_287e2$,ne=e.kotlin.text.Regex_init_61zpoe$,ie=e.kotlin.collections.firstOrNull_7wnvza$,re=a.kotlinx.serialization.json.Json,oe=a.kotlinx.serialization.json.get_jsonObject_u3sd3g$,ae=a.kotlinx.serialization.json.get_jsonArray_u3sd3g$,se=a.kotlinx.serialization.json.get_jsonPrimitive_u3sd3g$,le=a.kotlinx.serialization.json.get_contentOrNull_59esu7$,ce=e.kotlin.collections.listOf_i5x0yv$,ue=e.kotlin.text.split_o64adg$,pe=e.kotlin.collections.last_2p1efm$,he=p.com.shabinder.common.models.YoutubeTrack,fe=e.kotlin.text.replace_680rmw$,de=e.kotlin.text.split_ip8yn$,_e=d.com.willowtreeapps.fuzzywuzzy.diffutils,ye=e.kotlin.text.toInt_pdl1vz$,me=e.numberToInt,ve=e.kotlin.collections.toList_abgq59$,$e=e.kotlin.collections.toMap_6hr0sd$,ge=u.io.ktor.http.ContentType,be=u.io.ktor.http.contentType_41kwpe$,we=i.io.ktor.client.request.headers_nc42ot$,ke=a.kotlinx.serialization.json.put_kdidqz$,Se=a.kotlinx.serialization.json.putJsonObject_qdwamy$,xe=e.kotlin.reflect.js.internal.PrimitiveClasses.stringClass,Ee=a.kotlinx.serialization.json.JsonArrayBuilder,Ce=e.kotlin.collections.LinkedHashMap_init_q3lmfv$,Oe=e.kotlin.math.abs_za3lpa$,Ne=e.kotlin.collections.sortedWith_eknfly$,ze=e.wrapFunction,je=e.kotlin.Comparator,Te=a.kotlinx.serialization.json.JsonObjectBuilder,Pe=i.io.ktor.client.request.forms.FormDataContent,Re=_.io.ktor.client.features.auth.Auth,Ae=_.io.ktor.client.features.auth.providers.basic_c7fts0$,Ie=e.kotlin.lazy_klfg04$,Me=u.io.ktor.http.ParametersBuilder,Le=p.com.shabinder.common.models.spotify.Playlist,De=p.com.shabinder.common.models.spotify.PagingObjectPlaylistTrack,qe=p.com.shabinder.common.models.spotify.Track,Fe=(h.kotlinx.coroutines.CancellationException_init_pdl1vj$,h.kotlinx.coroutines.cancel_x105z1$,h.kotlinx.coroutines.CoroutineScope_1fupul$,Error,h.kotlinx.coroutines.CompletableDeferred_xptg6w$,h.kotlinx.coroutines.Job_5dx9e$,h.kotlinx.coroutines.channels.Channel_lsve6m$,m.io.ktor.utils.io.core.Closeable,h.kotlinx.coroutines.selects.SelectBuilderImpl,e.kotlin.IllegalArgumentException_init_pdl1vj$,e.unboxChar),Ue=a.kotlinx.serialization.json.JsonObject,Be=e.kotlin.io.println_s8jyv4$,He=e.kotlin.Exception,Ve=h.kotlinx.coroutines.flow.MutableSharedFlow_ympafm$,Ke=p.com.shabinder.common.models.DownloadStatus.Downloading,We=h.kotlinx.coroutines.flow.FlowCollector,Ye=e.kotlin.collections.HashMap_init_q3lmfv$,Ge=g.saveAs,Je=e.kotlin.collections.copyToArray;function Ze(t){return S}function Qe(t,e){return new Ki(t.get_7a9my5$(C(O),null,null),N())}function Xe(t,e){return j(z())}function tn(t,e){return new gn(t.get_7a9my5$(C(Ki),null,null),t.get_7a9my5$(C(O),null,null))}function en(t,e){return new ri(t.get_7a9my5$(C(O),null,null),t.get_7a9my5$(C(E),null,null))}function nn(t,e){return new Ln(t.get_7a9my5$(C(gn),null,null),t.get_7a9my5$(C(O),null,null),t.get_7a9my5$(C(Ki),null,null))}function rn(t,e){return new An(t.get_7a9my5$(C(E),null,null),t.get_7a9my5$(C(O),null,null),t.get_7a9my5$(C(Ki),null,null))}function on(t,e){return new nr(t.get_7a9my5$(C(E),null,null),t.get_7a9my5$(C(O),null,null),t.get_7a9my5$(C(Ki),null,null))}function an(t,e){return new Gn(t.get_7a9my5$(C(E),null,null),t.get_7a9my5$(C(O),null,null),t.get_7a9my5$(C(Ki),null,null))}function sn(t,e){return new yn(t.get_7a9my5$(C(An),null,null),t.get_7a9my5$(C(Ln),null,null),t.get_7a9my5$(C(nr),null,null),t.get_7a9my5$(C(ri),null,null),t.get_7a9my5$(C(Gn),null,null),t.get_7a9my5$(C(Ki),null,null))}function ln(t){return function(e){var n,i=function(t){return function(e,n){return hn(t)}}(t),r=e.makeOptions_dqye30$(!1,!1),o=e.rootScope;n=U();var a=new H(o,C(E),null,i,B.Single,n,r);F(e.definitions,a);var s,l=e.makeOptions_dqye30$(!1,!1),c=e.rootScope;s=U();var u=new H(c,C(Ki),null,Qe,B.Single,s,l);F(e.definitions,u);var p,h=e.makeOptions_dqye30$(!1,!1),f=e.rootScope;p=U();var d=new H(f,C(O),null,Xe,B.Single,p,h);F(e.definitions,d);var _,y=e.makeOptions_dqye30$(!1,!1),m=e.rootScope;_=U();var v=new H(m,C(gn),null,tn,B.Single,_,y);F(e.definitions,v);var $,g=e.makeOptions_dqye30$(!1,!1),b=e.rootScope;$=U();var w=new H(b,C(ri),null,en,B.Single,$,g);F(e.definitions,w);var k,x=e.makeOptions_dqye30$(!1,!1),N=e.rootScope;k=U();var z=new H(N,C(Ln),null,nn,B.Single,k,x);F(e.definitions,z);var j,T=e.makeOptions_dqye30$(!1,!1),P=e.rootScope;j=U();var R=new H(P,C(An),null,rn,B.Single,j,T);F(e.definitions,R);var A,I=e.makeOptions_dqye30$(!1,!1),M=e.rootScope;A=U();var L=new H(M,C(nr),null,on,B.Single,A,I);F(e.definitions,L);var D,q=e.makeOptions_dqye30$(!1,!1),V=e.rootScope;D=U();var K=new H(V,C(Gn),null,an,B.Single,D,q);F(e.definitions,K);var W,Y=e.makeOptions_dqye30$(!1,!1),G=e.rootScope;W=U();var J=new H(G,C(yn),null,sn,B.Single,W,Y);return F(e.definitions,J),S}}function cn(t){return T(void 0,void 0,ln(t))}function un(t){return t.logger=L(M.Companion),t.level=D.INFO,S}function pn(t,e){return function(n){return n.install_xlxg29$(A.Feature,function(t){return function(e){return e.serializer=t,S}}(t)),e&&n.install_xlxg29$(I.Companion,un),S}}function hn(t,e){return void 0===t&&(t=!1),void 0===e&&(e=b),q(pn(e,t))}function fn(t,e,n,i){K.call(this,i),this.$controller=n,this.exceptionState_0=6,this.local$closure$url=t,this.local$client=void 0,this.local$response=void 0,this.local$response_0=void 0,this.local$data=void 0,this.local$offset=void 0,this.local$currentRead=void 0,this.local$$receiver=e}function dn(t,e){return et((n=t,function(t,e,i){var r=new fn(n,t,this,e);return i?r:r.doResume(null)}));var n}function _n(t,e,n,i,r,o){return void 0===o&&(o=".mp3"),r+Ni(n)+t.fileSeparator()+(0===i.length?"":Ni(i)+t.fileSeparator())+Ni(e)+o}function yn(t,e,n,i,r,o){this.gaanaProvider_0=t,this.spotifyProvider_0=e,this.youtubeProvider=n,this.youtubeMusic=i,this.youtubeMp3=r,this.dir_0=o}function mn(t,e,n,i,r,o){K.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$this$FetchPlatformQueryResult=t,this.local$this$=e,this.local$closure$link=n}function vn(t,e,n){return function(i,r,o){var a=new mn(t,e,n,i,this,r);return o?a:a.doResume(null)}}function $n(t,e,n){K.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$result=void 0,this.local$link=e}function gn(t,e){this.dir_0=t,this.logger_0=e}function bn(t){return function(){var e;return"System Time:"+$t.System.now().epochSeconds.toString()+" , Token Expiry:"+bt(null!=(e=t.v)?e.expiry:null)}}function wn(){return"Requesting New Token"}function kn(t,e,n,i,r){K.call(this,r),this.$controller=i,this.exceptionState_0=1,this.local$closure$token=t,this.local$this$TokenStore=e}function Sn(t,e){return function(n,i,r){var o=new kn(t,e,n,this,i);return r?o:o.doResume(null)}}function xn(t,e){K.call(this,e),this.exceptionState_0=1,this.$this=t,this.local$token=void 0}function En(t){return S}function Cn(){return e.isType(Xn,Object.getPrototypeOf(xt.Js).constructor)?Et.corsProxy.url:""}function On(){return Cn()+"https://api.gaana.com"}function Nn(){}function zn(t,e,n,i,r,o,a){K.call(this,a),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$type=e,this.local$subtype=n,this.local$seokey=i,this.local$format=r,this.local$limit=o}function jn(t,e,n,i,r,o,a){K.call(this,a),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$type=e,this.local$subtype=n,this.local$seokey=i,this.local$format=r,this.local$limit=o}function Tn(t,e,n,i,r,o){K.call(this,o),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$type=e,this.local$subtype=n,this.local$seokey=i,this.local$format=r}function Pn(t,e,n,i,r,o){K.call(this,o),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$type=e,this.local$subtype=n,this.local$seokey=i,this.local$format=r}function Rn(t,e,n,i,r,o,a){K.call(this,a),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$type=e,this.local$subtype=n,this.local$seokey=i,this.local$format=r,this.local$limit=o}function An(t,e,n){this.httpClient_olzm31$_0=t,this.logger_0=e,this.dir_0=n,this.gaanaPlaceholderImageUrl_0="https://a10.gaanacdn.com/images/social/gaana_social.jpg"}function In(t,e){return function(){return"GAANA SEARCH: "+t+" - "+e}}function Mn(t,e,n,i){K.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$result=void 0,this.local$type=e,this.local$link=n}function Ln(t,e,n){var i;this.tokenStore_0=t,this.logger_0=e,this.dir_0=n,this.logger_0.d_h4ejuu$(Wn),kt(yt.GlobalScope,yt.Dispatchers.Default,void 0,(i=this,function(t,e,n){var r=new Yn(i,t,this,e);return n?r:r.doResume(null)})),this.httpClient_y295mb$_0=this.httpClient_y295mb$_0}function Dn(){return"Please Check your Network Connection"}function qn(t){return function(){return"Spotify Provider Created with "+bt(t)}}function Fn(t){return t.serializer=b,S}function Un(t){return function(e){return Vt(e,function(t){return function(e){return Ht(e,"Authorization","Bearer "+bt(t.access_token)),S}}(t)),e.install_xlxg29$(A.Feature,Fn),S}}function Bn(t,e,n){K.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$override=e}function Hn(t,e,n){K.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$spotifyLink=void 0,this.local$link=void 0,this.local$type=void 0,this.local$fullLink=e}function Vn(t,e,n,i){K.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$result=void 0,this.local$playlistObject=void 0,this.local$tempTrackList=void 0,this.local$moreTracksAvailable=void 0,this.local$type=e,this.local$link=n}function Kn(t,e,n){K.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$url=e}function Wn(){return"Creating Spotify Provider"}function Yn(t,e,n,i){K.call(this,i),this.$controller=n,this.exceptionState_0=1,this.local$this$SpotifyProvider=t}function Gn(t,e,n){this.httpClient_zhlaeb$_0=t,this.logger_0=e,this.dir_0=n}function Jn(t,e,n){K.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$videoID=e}fn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},fn.prototype=Object.create(K.prototype),fn.prototype.constructor=fn,fn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$client=hn();var t,n=this.local$closure$url;t=rt.EmptyContent;var i=new st;ot(i,"http","localhost",0,"/"),i.method=at.Companion.Get,i.body=t,it(i.url,n);var r,o,a,s=new W(i,this.local$client);if(r=C(W),ct(r,C(W))){this.result_0=e.isType(o=s,W)?o:lt(),this.state_0=9;continue}if(ct(r,C(ut))){if(this.state_0=7,this.result_0=s.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=s.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var l;this.local$response=this.result_0,this.exceptionState_0=4;var c,u=this.local$response.call;t:do{try{c=new ft(C(W),ht.JsType,Y(C(W),[],!1))}catch(t){c=new ft(C(W),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=u.receive_jo9acv$(c,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(l=this.result_0,W)?l:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(a=this.result_0,W)?a:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:if(this.result_0,this.state_0=10,this.result_0=this.result_0.execute(this),this.result_0===V)return V;continue;case 10:this.local$response_0=this.result_0,this.local$data=new Int8Array(J(G(this.local$response_0)).toInt()),this.local$offset=0,this.state_0=11;continue;case 11:if(this.state_0=12,this.result_0=this.local$response_0.content.readAvailable_mj6st8$(this.local$data,this.local$offset,this.local$data.length,this),this.result_0===V)return V;continue;case 12:this.local$currentRead=this.result_0,this.local$offset=this.local$offset+this.local$currentRead|0;var p=dt(100*this.local$offset/this.local$data.length);if(this.state_0=13,this.result_0=this.local$$receiver.emit_11rb$(new Z(p),this),this.result_0===V)return V;continue;case 13:if(this.local$currentRead<=0){this.state_0=14;continue}this.state_0=11;continue;case 14:if(Q(this.local$response_0.status)){if(this.state_0=16,this.result_0=this.local$$receiver.emit_11rb$(new X(this.local$data),this),this.result_0===V)return V;continue}if(this.state_0=15,this.result_0=this.local$$receiver.emit_11rb$(new tt("File not downloaded"),this),this.result_0===V)return V;continue;case 15:case 16:this.state_0=17;continue;case 17:return this.local$client.close(),S;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Object.defineProperty(yn.prototype,"db_0",{configurable:!0,get:function(){var t;return null!=(t=this.dir_0.db)?t.downloadRecordDatabaseQueries:null}}),mn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},mn.prototype=Object.create(K.prototype),mn.prototype.constructor=mn,mn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;return null!=(t=this.local$this$FetchPlatformQueryResult.db_0)?(t.add_9slmj3$(this.local$this$.folderType,this.local$this$.title,this.local$closure$link,this.local$this$.coverUrl,e.Long.fromInt(this.local$this$.trackList.size)),S):null;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},$n.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},$n.prototype=Object.create(K.prototype),$n.prototype.constructor=$n,$n.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(_t(this.local$link,"spotify",!0)){if(this.state_0=6,this.result_0=this.$this.spotifyProvider_0.query_61zpoe$(this.local$link,this),this.result_0===V)return V;continue}if(_t(this.local$link,"youtube.com",!0)||_t(this.local$link,"youtu.be",!0)){if(this.state_0=4,this.result_0=this.$this.youtubeProvider.query_61zpoe$(this.local$link,this),this.result_0===V)return V;continue}if(_t(this.local$link,"gaana",!0)){if(this.state_0=2,this.result_0=this.$this.gaanaProvider_0.query_61zpoe$(this.local$link,this),this.result_0===V)return V;continue}this.local$tmp$=null,this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.local$tmp$=this.result_0,this.state_0=3;continue;case 3:this.state_0=5;continue;case 4:this.local$tmp$=this.result_0,this.state_0=5;continue;case 5:this.state_0=7;continue;case 6:this.local$tmp$=this.result_0,this.state_0=7;continue;case 7:if(this.local$result=this.local$tmp$,null!=this.local$result){if(this.state_0=8,this.result_0=mt(yt.Dispatchers.Default,vn(this.$this,this.local$result,this.local$link),this),this.result_0===V)return V;continue}this.state_0=9;continue;case 8:this.state_0=9;continue;case 9:return this.local$result;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},yn.prototype.query_61zpoe$=function(t,e,n){var i=new $n(this,t,e);return n?i:i.doResume(null)},yn.$metadata$={kind:vt,simpleName:"FetchPlatformQueryResult",interfaces:[]},Object.defineProperty(gn.prototype,"db_0",{configurable:!0,get:function(){var t;return null!=(t=this.dir_0.db)?t.tokenDBQueries:null}}),gn.prototype.save_0=function(t){var e,n=t.access_token;null==n||St(n)||null==t.expiry||null!=(e=this.db_0)&&e.add_4wgjuj$(J(t.access_token),J(t.expiry).add($t.System.now().epochSeconds))},kn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},kn.prototype=Object.create(K.prototype),kn.prototype.constructor=kn,kn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e;if(null!=(null!=(t=this.local$closure$token.v)?t.access_token:null)){var n=this.local$closure$token;this.local$this$TokenStore.save_0(n.v),e=S}else e=null;return e;case 1:throw this.exception_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},xn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},xn.prototype=Object.create(K.prototype),xn.prototype.constructor=xn,xn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e,n,i,r,o,a=n;if(o=new gt(a.accessToken,null,a.expiry),this.local$token={v:null!=(n=null!=(e=null!=(t=this.$this.db_0)?t.select():null)?e.executeAsOneOrNull():null)?o:null},this.$this.logger_0.d_h4ejuu$(bn(this.local$token)),$t.System.now().epochSeconds.compareTo_11rb$(null!=(r=null!=(i=this.local$token.v)?i.expiry:null)?r:wt)>0||null==this.local$token.v){if(this.$this.logger_0.d_h4ejuu$(wn),this.state_0=2,this.result_0=_i(this),this.result_0===V)return V;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.local$token.v=this.result_0,kt(yt.GlobalScope,void 0,void 0,Sn(this.local$token,this.$this)),this.state_0=3;continue;case 3:return this.local$token.v;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},gn.prototype.getToken=function(t,e){var n=new xn(this,t);return e?n:n.doResume(null)},gn.$metadata$={kind:vt,simpleName:"TokenStore",interfaces:[]},zn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},zn.prototype=Object.create(K.prototype),zn.prototype.constructor=zn,zn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=On()+"/?type="+this.local$type+"&subtype="+this.local$subtype+"&seokey="+this.local$seokey+"&token="+w+"&format="+this.local$format+"&limit="+this.local$limit;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),En();var o,a,s,l=new W(r,n);if(o=C(Ct),ct(o,C(W))){this.result_0=e.isType(a=l,Ct)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(Ct),ht.JsType,Y(C(Ct),[],!1))}catch(t){u=new ft(C(Ct),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,Ct)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,Ct)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Nn.prototype.getGaanaPlaylist_tgym8q$$default=function(t,e,n,i,r,o,a){var s=new zn(this,t,e,n,i,r,o);return a?s:s.doResume(null)},Nn.prototype.getGaanaPlaylist_tgym8q$=function(t,e,n,i,r,o,a){return void 0===t&&(t="playlist"),void 0===e&&(e="playlist_detail"),void 0===i&&(i="JSON"),void 0===r&&(r=2e3),a?a(t,e,n,i,r,o):this.getGaanaPlaylist_tgym8q$$default(t,e,n,i,r,o)},jn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},jn.prototype=Object.create(K.prototype),jn.prototype.constructor=jn,jn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=On()+"/?type="+this.local$type+"&subtype="+this.local$subtype+"&seokey="+this.local$seokey+"&token="+w+"&format="+this.local$format+"&limit="+this.local$limit;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),En();var o,a,s,l=new W(r,n);if(o=C(Ot),ct(o,C(W))){this.result_0=e.isType(a=l,Ot)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(Ot),ht.JsType,Y(C(Ot),[],!1))}catch(t){u=new ft(C(Ot),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,Ot)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,Ot)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Nn.prototype.getGaanaAlbum_tgym8q$$default=function(t,e,n,i,r,o,a){var s=new jn(this,t,e,n,i,r,o);return a?s:s.doResume(null)},Nn.prototype.getGaanaAlbum_tgym8q$=function(t,e,n,i,r,o,a){return void 0===t&&(t="album"),void 0===e&&(e="album_detail"),void 0===i&&(i="JSON"),void 0===r&&(r=2e3),a?a(t,e,n,i,r,o):this.getGaanaAlbum_tgym8q$$default(t,e,n,i,r,o)},Tn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Tn.prototype=Object.create(K.prototype),Tn.prototype.constructor=Tn,Tn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=On()+"/?type="+this.local$type+"&subtype="+this.local$subtype+"&seokey="+this.local$seokey+"&token="+w+"&format="+this.local$format;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),En();var o,a,s,l=new W(r,n);if(o=C(Nt),ct(o,C(W))){this.result_0=e.isType(a=l,Nt)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(Nt),ht.JsType,Y(C(Nt),[],!1))}catch(t){u=new ft(C(Nt),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,Nt)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,Nt)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Nn.prototype.getGaanaSong_w74nik$$default=function(t,e,n,i,r,o){var a=new Tn(this,t,e,n,i,r);return o?a:a.doResume(null)},Nn.prototype.getGaanaSong_w74nik$=function(t,e,n,i,r,o){return void 0===t&&(t="song"),void 0===e&&(e="song_detail"),void 0===i&&(i="JSON"),o?o(t,e,n,i,r):this.getGaanaSong_w74nik$$default(t,e,n,i,r)},Pn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Pn.prototype=Object.create(K.prototype),Pn.prototype.constructor=Pn,Pn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=On()+"/?type="+this.local$type+"&subtype="+this.local$subtype+"&seokey="+this.local$seokey+"&token="+w+"&format="+this.local$format;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),En();var o,a,s,l=new W(r,n);if(o=C(zt),ct(o,C(W))){this.result_0=e.isType(a=l,zt)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(zt),ht.JsType,Y(C(zt),[],!1))}catch(t){u=new ft(C(zt),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,zt)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,zt)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Nn.prototype.getGaanaArtistDetails_w74nik$$default=function(t,e,n,i,r,o){var a=new Pn(this,t,e,n,i,r);return o?a:a.doResume(null)},Nn.prototype.getGaanaArtistDetails_w74nik$=function(t,e,n,i,r,o){return void 0===t&&(t="artist"),void 0===e&&(e="artist_details_info"),void 0===i&&(i="JSON"),o?o(t,e,n,i,r):this.getGaanaArtistDetails_w74nik$$default(t,e,n,i,r)},Rn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Rn.prototype=Object.create(K.prototype),Rn.prototype.constructor=Rn,Rn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=On()+"/?type="+this.local$type+"&subtype="+this.local$subtype+"&seokey="+this.local$seokey+"&token="+w+"&format="+this.local$format+"&limit="+this.local$limit;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),En();var o,a,s,l=new W(r,n);if(o=C(jt),ct(o,C(W))){this.result_0=e.isType(a=l,jt)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(jt),ht.JsType,Y(C(jt),[],!1))}catch(t){u=new ft(C(jt),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,jt)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,jt)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Nn.prototype.getGaanaArtistTracks_tgym8q$$default=function(t,e,n,i,r,o,a){var s=new Rn(this,t,e,n,i,r,o);return a?s:s.doResume(null)},Nn.prototype.getGaanaArtistTracks_tgym8q$=function(t,e,n,i,r,o,a){return void 0===t&&(t="artist"),void 0===e&&(e="artist_track_listing"),void 0===i&&(i="JSON"),void 0===r&&(r=50),a?a(t,e,n,i,r,o):this.getGaanaArtistTracks_tgym8q$$default(t,e,n,i,r,o)},Nn.$metadata$={kind:Tt,simpleName:"GaanaRequests",interfaces:[]},Object.defineProperty(An.prototype,"httpClient",{get:function(){return this.httpClient_olzm31$_0}}),An.prototype.query_61zpoe$=function(t,e){var n=Pt(t,"gaana.com/"),i=Rt(n,47,"error"),r=Rt(At(n,47,"error"),47);return ct(r,"Error")||ct(i,"Error")?null:this.gaanaSearch_0(r,i,e)},Mn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Mn.prototype=Object.create(K.prototype),Mn.prototype.constructor=Mn,Mn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e;switch(this.local$result=new Mt("",this.local$link,this.local$link,this.$this.gaanaPlaceholderImageUrl_0,U(),It.Gaana),this.$this.logger_0.i_h4ejuu$(In(this.local$type,this.local$link)),this.local$type){case"song":if(this.state_0=6,this.result_0=this.$this.getGaanaSong_w74nik$(void 0,void 0,this.local$link,void 0,this),this.result_0===V)return V;continue;case"album":if(this.state_0=5,this.result_0=this.$this.getGaanaAlbum_tgym8q$(void 0,void 0,this.local$link,void 0,void 0,this),this.result_0===V)return V;continue;case"playlist":if(this.state_0=4,this.result_0=this.$this.getGaanaPlaylist_tgym8q$(void 0,void 0,this.local$link,void 0,void 0,this),this.result_0===V)return V;continue;case"artist":if(this.local$result.folderType="Artist",this.local$result.subFolder=this.local$link,this.local$result.coverUrl=this.$this.gaanaPlaceholderImageUrl_0,this.state_0=2,this.result_0=this.$this.getGaanaArtistDetails_w74nik$(void 0,void 0,this.local$link,void 0,this),this.result_0===V)return V;continue;default:this.state_0=7;continue}case 1:throw this.exception_0;case 2:var n;if(null!=(e=Lt(this.result_0.artist))&&(this.local$result.title=e.name,this.local$result.coverUrl=null!=(n=e.artworkLink)?n:this.$this.gaanaPlaceholderImageUrl_0),this.state_0=3,this.result_0=this.$this.getGaanaArtistTracks_tgym8q$(void 0,void 0,this.local$link,void 0,void 0,this),this.result_0===V)return V;continue;case 3:var i,r,o,a,s=this.result_0;if(null!=(i=s.tracks))for(a=i.iterator();a.hasNext();){var l=a.next();this.$this.updateStatusIfPresent_0(l,this.local$result.folderType,this.local$result.subFolder)}this.local$result.trackList=null!=(o=null!=(r=s.tracks)?this.$this.toTrackDetailsList_0(r,this.local$result.folderType,this.local$result.subFolder):null)?o:U(),this.state_0=7;continue;case 4:var c,u=this.result_0;for(this.local$result.folderType="Playlists",this.local$result.subFolder=this.local$link,c=u.tracks.iterator();c.hasNext();){var p=c.next();this.$this.updateStatusIfPresent_0(p,this.local$result.folderType,this.local$result.subFolder)}this.local$result.trackList=this.$this.toTrackDetailsList_0(u.tracks,this.local$result.folderType,this.local$result.subFolder),this.local$result.title=this.local$link,this.local$result.coverUrl=this.$this.gaanaPlaceholderImageUrl_0,this.state_0=7;continue;case 5:var h,f=this.result_0;for(this.local$result.folderType="Albums",this.local$result.subFolder=this.local$link,h=f.tracks.iterator();h.hasNext();){var d=h.next();this.$this.updateStatusIfPresent_0(d,this.local$result.folderType,this.local$result.subFolder)}this.local$result.trackList=this.$this.toTrackDetailsList_0(f.tracks,this.local$result.folderType,this.local$result.subFolder),this.local$result.title=this.local$link,this.local$result.coverUrl=f.custom_artworks.size_480p,this.state_0=7;continue;case 6:null!=(t=Lt(this.result_0.tracks))&&(this.local$result.folderType="Tracks",this.local$result.subFolder="",this.$this.updateStatusIfPresent_0(t,this.local$result.folderType,this.local$result.subFolder),this.local$result.trackList=this.$this.toTrackDetailsList_0(Dt(t),this.local$result.folderType,this.local$result.subFolder),this.local$result.title=t.track_title,this.local$result.coverUrl=t.artworkLink),this.state_0=7;continue;case 7:return this.local$result;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},An.prototype.gaanaSearch_0=function(t,e,n,i){var r=new Mn(this,t,e,n);return i?r:r.doResume(null)},An.prototype.toTrackDetailsList_0=function(t,e,n){var i,r=Bt(Ut(t,10));for(i=t.iterator();i.hasNext();){var o,a,s,l,c,u,p,h,f,d,_,y=i.next(),m=r.add_11rb$;o=y.track_title;var v,$,g,b=y.artist,w=Bt(Ut(b,10));for(v=b.iterator();v.hasNext();){var k=v.next();w.add_11rb$(bt(null!=k?k.name:null))}if(a=y.duration,s=this.dir_0.imageCacheDir()+Rt(At(y.artworkLink,47),47)+".jpeg",l=y.album_title,c=y.release_date,null!=(u=y.genre)){var S,x=Bt(Ut(u,10));for(S=u.iterator();S.hasNext();){var E=S.next();x.add_11rb$(null!=E?E.name:null)}$=x}else $=null;if(null!=(p=$)){var C;t:do{var O=p.iterator();if(!O.hasNext()){C=null;break t}for(var N=O.next();O.hasNext();)N+=bt(O.next());C=N}while(0);g=C}else g=null;h="Genres:"+bt(g),f=y.lyrics_url,_=null!=(d=y.downloaded)?d:qt.NotDownloaded,m.call(r,new Ft(o,w,a,l,c,h,void 0,f,s,y.artworkLink,It.Gaana,void 0,_,_n(this.dir_0,y.track_title,e,n,this.dir_0.defaultDir())))}return r},An.prototype.updateStatusIfPresent_0=function(t,e,n){this.dir_0.isPresent_61zpoe$(_n(this.dir_0,t.track_title,e,n,this.dir_0.defaultDir()))&&(t.downloaded=qt.Downloaded)},An.$metadata$={kind:vt,simpleName:"GaanaProvider",interfaces:[Nn]},Bn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Bn.prototype=Object.create(K.prototype),Bn.prototype.constructor=Bn,Bn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.local$override){if(this.state_0=3,this.result_0=_i(this),this.result_0===V)return V;continue}if(this.state_0=2,this.result_0=this.$this.tokenStore_0.getToken(this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:case 3:this.local$tmp$=this.result_0,this.state_0=4;continue;case 4:var e=this.local$tmp$;return null==e?(this.$this.logger_0.d_h4ejuu$(Dn),t=null):(this.$this.logger_0.d_h4ejuu$(qn(e)),this.$this.httpClient=q(Un(e)),t=this.$this.httpClient),t;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ln.prototype.authenticateSpotifyClient_6taknv$$default=function(t,e,n){var i=new Bn(this,t,e);return n?i:i.doResume(null)},Object.defineProperty(Ln.prototype,"httpClient",{configurable:!0,get:function(){return null==this.httpClient_y295mb$_0?Kt("httpClient"):this.httpClient_y295mb$_0},set:function(t){this.httpClient_y295mb$_0=t}}),Hn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Hn.prototype=Object.create(K.prototype),Hn.prototype.constructor=Hn,Hn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(null==this.$this.httpClient_y295mb$_0){if(this.state_0=2,this.result_0=this.$this.authenticateSpotifyClient_6taknv$(void 0,this),this.result_0===V)return V;continue}this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.state_0=3;continue;case 3:var t,n=Yt(Wt(this.local$fullLink,"https://")," ");if(this.local$spotifyLink="https://"+Xt(e.isCharSequence(t=n)?t:lt()).toString(),_t(this.local$spotifyLink,"open.spotify")){this.state_0=5;continue}if(this.state_0=4,this.result_0=this.$this.resolveLink_0(this.local$spotifyLink,this),this.result_0===V)return V;continue;case 4:this.local$spotifyLink=this.result_0,this.state_0=5;continue;case 5:if(this.local$link=Gt(Rt(this.local$spotifyLink,47,"Error"),63),this.local$type=Rt(At(this.local$spotifyLink,47,"Error"),47),ct(this.local$type,"Error")||ct(this.local$link,"Error"))return null;this.state_0=6;continue;case 6:if(ct(this.local$type,"episode")||ct(this.local$type,"show"))return null;this.state_0=7;continue;case 7:if(this.state_0=8,this.result_0=this.$this.spotifySearch_0(this.local$type,this.local$link,this),this.result_0===V)return V;continue;case 8:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ln.prototype.query_61zpoe$=function(t,e,n){var i=new Hn(this,t,e);return n?i:i.doResume(null)},Vn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Vn.prototype=Object.create(K.prototype),Vn.prototype.constructor=Vn,Vn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$result=new Mt("","","","",U(),It.Spotify),this.state_0=2;continue;case 1:throw this.exception_0;case 2:var t,e,n,i,r,o,a,s,l,c,u,p,h;switch(this.local$type){case"track":if(this.state_0=8,this.result_0=this.$this.getTrack_pdl1vj$(this.local$link,this),this.result_0===V)return V;continue;case"album":if(this.state_0=7,this.result_0=this.$this.getAlbum_61zpoe$(this.local$link,this),this.result_0===V)return V;continue;case"playlist":if(this.state_0=3,this.result_0=this.$this.getPlaylist_61zpoe$(this.local$link,this),this.result_0===V)return V;continue;case"episode":case"show":default:this.state_0=9;continue}case 3:var f;if(this.local$playlistObject=this.result_0,this.local$result.folderType="Playlists",this.local$result.subFolder=bt(this.local$playlistObject.name),this.local$tempTrackList=ee(),null!=(o=null!=(r=this.local$playlistObject.tracks)?r.items:null))for(f=o.iterator();f.hasNext();){var d;null!=(d=f.next().track)&&(this.$this.updateStatusIfPresent_0(d,this.local$result.folderType,this.local$result.subFolder),this.local$tempTrackList.add_11rb$(d))}var _=null!=(a=this.local$playlistObject.tracks)?a.next:null;this.local$moreTracksAvailable=!(null==_||St(_)),this.state_0=4;continue;case 4:if(!this.local$moreTracksAvailable){this.state_0=6;continue}if(this.state_0=5,this.result_0=this.$this.getPlaylistTracks_hs9j5r$(this.local$link,this.local$tempTrackList.size,void 0,this),this.result_0===V)return V;continue;case 5:var y,m=this.result_0;if(null!=(s=m.items))for(y=s.iterator();y.hasNext();){var v;null!=(v=y.next().track)&&this.local$tempTrackList.add_11rb$(v)}var $=m.next;this.local$moreTracksAvailable=!(null==$||St($)),this.state_0=4;continue;case 6:this.local$result.trackList=this.$this.toTrackDetailsList_0(this.local$tempTrackList,this.local$result.folderType,this.local$result.subFolder),this.local$result.title=bt(this.local$playlistObject.name),this.local$result.coverUrl=null!=(h=null!=(c=null!=(l=this.local$playlistObject.images)?te(l,1):null)?c.url:null)?h:bt(null!=(p=null!=(u=this.local$playlistObject.images)?Lt(u):null)?p.url:null),this.state_0=9;continue;case 7:var g,b=this.result_0;if(this.local$result.folderType="Albums",this.local$result.subFolder=bt(b.name),null!=(e=null!=(t=b.tracks)?t.items:null))for(g=e.iterator();g.hasNext();){var w,k,S,x,E,C=g.next();this.$this.updateStatusIfPresent_0(C,this.local$result.folderType,this.local$result.subFolder),C.album=new Zt(void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,Dt(new Jt(void 0,void 0,null!=(E=null!=(k=null!=(w=b.images)?te(w,1):null)?k.url:null)?E:null!=(x=null!=(S=b.images)?te(S,0):null)?x.url:null)))}var O,N,z,j,T,P=null!=(i=null!=(n=b.tracks)?n.items:null)?this.$this.toTrackDetailsList_0(i,this.local$result.folderType,this.local$result.subFolder):null;null==P||P.isEmpty()||(this.local$result.trackList=P,this.local$result.title=bt(b.name),this.local$result.coverUrl=bt(null!=(T=null!=(N=null!=(O=b.images)?te(O,1):null)?N.url:null)?T:null!=(j=null!=(z=b.images)?te(z,0):null)?j.url:null)),this.state_0=9;continue;case 8:var R,A,I,M,L,D,q,F=this.result_0;this.local$result.folderType="Tracks",this.local$result.subFolder="",this.$this.updateStatusIfPresent_0(F,this.local$result.folderType,this.local$result.subFolder),this.local$result.trackList=this.$this.toTrackDetailsList_0(Dt(F),this.local$result.folderType,this.local$result.subFolder),this.local$result.title=bt(F.name),this.local$result.coverUrl=bt(null!=(q=null!=(I=null!=(A=null!=(R=F.album)?R.images:null)?te(A,1):null)?I.url:null)?q:null!=(D=null!=(L=null!=(M=F.album)?M.images:null)?te(L,0):null)?D.url:null),this.state_0=9;continue;case 9:return this.local$result;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ln.prototype.spotifySearch_0=function(t,e,n,i){var r=new Vn(this,t,e,n);return i?r:r.doResume(null)},Kn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Kn.prototype=Object.create(K.prototype),Kn.prototype.constructor=Kn,Kn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.getResponse_61zpoe$(this.local$url,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:var e=this.result_0,n=ne("https://open\\.spotify\\.com.+\\w");return bt(null!=(t=n.find_905azu$(e))?t.value:null);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ln.prototype.resolveLink_0=function(t,e,n){var i=new Kn(this,t,e);return n?i:i.doResume(null)},Ln.prototype.toTrackDetailsList_0=function(t,n,i){var r,o=Bt(Ut(t,10));for(r=t.iterator();r.hasNext();){var a,s,l,c,u,p,h,f,d,_,y,m,v,$,g,b,w,k,S,x,E,C,O,N,z,j,T,P,R,A,I,M,L=r.next(),D=o.add_11rb$;if(a=bt(L.name),null!=(s=L.artists)){var q,F=Bt(Ut(s,10));for(q=s.iterator();q.hasNext();){var B=q.next();F.add_11rb$(bt(null!=B?B.name:null))}M=F}else M=null;c=null!=(l=M)?l:U(),u=L.duration_ms.div(e.Long.fromInt(1e3)).toInt(),$=this.dir_0.imageCacheDir(),v=Rt(null!=(m=null!=(f=null!=(h=null!=(p=L.album)?p.images:null)?te(h,1):null)?f.url:null)?m:bt(null!=(y=null!=(_=null!=(d=L.album)?d.images:null)?Lt(_):null)?y.url:null),47),b=null!=(g=L.album)?g.name:null,k=null!=(w=L.album)?w.release_date:null,E="Genres:"+bt(null!=(x=null!=(S=L.album)?S.genres:null)?Qt(x):null),C=L.href,O=L.downloaded,N=It.Spotify,D.call(o,new Ft(a,c,u,b,k,E,void 0,C,$+v+".jpeg",null!=(I=null!=(T=null!=(j=null!=(z=L.album)?z.images:null)?te(j,1):null)?T.url:null)?I:bt(null!=(A=null!=(R=null!=(P=L.album)?P.images:null)?Lt(R):null)?A.url:null),N,void 0,O,_n(this.dir_0,bt(L.name),n,i,this.dir_0.defaultDir())))}return o},Ln.prototype.updateStatusIfPresent_0=function(t,e,n){this.dir_0.isPresent_61zpoe$(_n(this.dir_0,bt(t.name),e,n,this.dir_0.defaultDir()))&&(t.downloaded=qt.Downloaded)},Yn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Yn.prototype=Object.create(K.prototype),Yn.prototype.constructor=Yn,Yn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(e.isType(Xn,Object.getPrototypeOf(xt.Js).constructor)){if(this.state_0=3,this.result_0=this.local$this$SpotifyProvider.authenticateSpotifyClient_6taknv$(!0,this),this.result_0===V)return V;continue}if(this.state_0=2,this.result_0=this.local$this$SpotifyProvider.authenticateSpotifyClient_6taknv$(void 0,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:case 3:return this.result_0;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ln.$metadata$={kind:vt,simpleName:"SpotifyProvider",interfaces:[bi]},Object.defineProperty(Gn.prototype,"httpClient",{get:function(){return this.httpClient_zhlaeb$_0}}),Jn.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Jn.prototype=Object.create(K.prototype),Jn.prototype.constructor=Jn,Jn.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t;if(this.state_0=2,this.result_0=this.$this.getLinkFromYt1sMp3_61zpoe$(this.local$videoID,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:return null!=(t=this.result_0)?e.isType(Xn,Object.getPrototypeOf(xt.Js).constructor)?"https://kind-grasshopper-73.telebit.io/cors/"+t:t:null;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Gn.prototype.getMp3DownloadLink_61zpoe$=function(t,e,n){var i=new Jn(this,t,e);return n?i:i.doResume(null)},Gn.$metadata$={kind:vt,simpleName:"YoutubeMp3",interfaces:[zi]};var Zn,Qn,Xn,ti,ei,ni,ii=ze((function(){var t=e.kotlin.comparisons.compareValues_s00gnj$;return function(e){return function(n,i){var r=e;return t(r(i),r(n))}}}));function ri(t,e){this.logger_0=t,this.httpClient_0=e,this.tag_0="YT Music"}function oi(t,e,n,i){K.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$query=e,this.local$trackDetails=n}function ai(t,e,n){K.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$tmp$=void 0,this.local$youtubeTracks=void 0,this.local$query=e}function si(t){return t.second}function li(t){return t.append_puj7f4$("referer","https://music.youtube.com/search"),S}function ci(t){return ke(t,"clientName","WEB_REMIX"),ke(t,"clientVersion","0.1"),S}function ui(t){return Se(t,"client",ci),S}function pi(t){return function(e){be(e,ge.Application.Json),we(e,li);var n=new Te,i=t;return Se(n,"context",ui),ke(n,"query",i),e.body=n.build(),S}}function hi(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$query=e}function fi(t){var e=new Me;return e.append_puj7f4$("grant_type","client_credentials"),t.body=new Pe(e.build()),S}function di(t){K.call(this,t),this.exceptionState_0=6,this.local$tmp$=void 0,this.local$response=void 0}function _i(t,e){var n=new di(t);return e?n:n.doResume(null)}function yi(t,e){return function(n){return Ae(n,function(t,e){return function(n){return n.sendWithoutRequest=!0,n.username=t,n.password=e,S}}(t,e)),S}}function mi(t){return t.serializer=b,S}function vi(t){return t.install_xlxg29$(Re.Feature,yi("694d8bf4f6ec420fa66ea7fb4c68f89d","02ca2d4021a7452dae2328b47a6e8fe8")),t.install_xlxg29$(A.Feature,mi),S}function $i(t){return S}function gi(){return Cn()+"https://api.spotify.com/v1"}function bi(){}function wi(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$playlistID=e}function ki(t,e,n,i,r){K.call(this,r),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$playlistID=e,this.local$offset=n,this.local$limit=i}function Si(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$id=e}function xi(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$id=e}function Ei(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$id=e}function Ci(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$id=e}function Oi(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$url=e}function Ni(t){var n,i=e.charArrayOf(47,10,13,9,0,12,96,63,42,92,60,62,124,34,46,45,39),r=t;for(n=0;n!==i.length;++n){var o=Fe(i[n]);r=nt(t,o,95)}var a=r,s=r=ne("\\s").replace_x2uqeu$(a,"_"),l=r=ne("\\)").replace_x2uqeu$(s,""),c=r=ne("\\(").replace_x2uqeu$(l,""),u=r=ne("\\[").replace_x2uqeu$(c,""),p=r=ne("]").replace_x2uqeu$(u,""),h=r=ne("\\.").replace_x2uqeu$(p,""),f=r=ne('"').replace_x2uqeu$(h,""),d=r=ne("'").replace_x2uqeu$(f,""),_=r=ne(":").replace_x2uqeu$(d,"");return r=ne("\\|").replace_x2uqeu$(_,"")}function zi(){}function ji(t,e,n){K.call(this,n),this.exceptionState_0=1,this.$this=t,this.local$videoID=e}function Ti(t){return function(e){var n=new Me;return n.append_puj7f4$("q","https://www.youtube.com/watch?v="+t),n.append_puj7f4$("vt","mp3"),e.body=new Pe(n.build()),S}}function Pi(t,e,n){K.call(this,n),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$videoID=e}function Ri(t,e){return function(n){var i=new Me,r=t,o=e;return i.append_puj7f4$("vid",r),i.append_puj7f4$("k",o),n.body=new Pe(i.build()),S}}function Ai(t,e,n,i){K.call(this,i),this.exceptionState_0=6,this.$this=t,this.local$response=void 0,this.local$videoID=e,this.local$key=n}function Ii(t){this.closure$action=t}function Mi(){return!0}function Li(t,e,n,i,r,o){K.call(this,o),this.$controller=r,this.exceptionState_0=1,this.local$closure$it=t,this.local$closure$fetcher=e,this.local$closure$dir=n}function Di(t,e,n){return function(i,r,o){var a=new Li(t,e,n,i,this,r);return o?a:a.doResume(null)}}function qi(t,e,n,i){K.call(this,i),this.exceptionState_0=1,this.local$tmp$=void 0,this.local$list=t,this.local$fetcher=e,this.local$dir=n}function Fi(t,e,n,i){K.call(this,i),this.exceptionState_0=1,this.local$closure$dir=t,this.local$closure$track=e,this.local$it=n}function Ui(t,e){return function(n,i,r){var o=new Fi(t,e,n,i);return r?o:o.doResume(null)}}function Bi(t,e,n,i,r){K.call(this,r),this.exceptionState_0=1,this.local$videoID=t,this.local$track=e,this.local$fetcher=n,this.local$dir=i}function Hi(t,e,n,i,r,o){var a=new Bi(t,e,n,i,r);return o?a:a.doResume(null)}function Vi(t){this.closure$action=t}function Ki(t,e){void 0===e&&(e=N()),this.logger_0=t,this.database_0=e}function Wi(){return"Album Art Downloaded Success"}function Yi(){return"Album Art Downloading Error"}function Gi(t){return function(){return"Album Art Downloading: "+t.progress}}function Ji(t,e,n,i,r){K.call(this,r),this.exceptionState_0=1,this.local$this$Dir=t,this.local$closure$writer=e,this.local$closure$trackDetails=n,this.local$it=i}function Zi(t,e,n){return function(i,r,o){var a=new Ji(t,e,n,i,r);return o?a:a.doResume(null)}}function Qi(t,e,n,i){K.call(this,i),this.exceptionState_0=1,this.$this=t,this.local$writer=void 0,this.local$mp3ByteArray=e,this.local$trackDetails=n}function Xi(t,e,n,i,r){K.call(this,r),this.exceptionState_0=1,this.$this=t,this.local$writer=e,this.local$albumArt=n,this.local$trackDetails=i}function tr(t){return t.buffer}function er(t){this.imageUrl=t}function nr(t,e,n){}oi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},oi.prototype=Object.create(K.prototype),oi.prototype.constructor=oi,oi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.$this.getYTTracks_0(this.local$query,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:return ie(this.$this.sortByBestMatch_0(this.result_0,this.local$trackDetails.title,this.local$trackDetails.artists,this.local$trackDetails.durationSec).keys);default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ri.prototype.getYTIDBestMatch_8c1lij$=function(t,e,n,i){var r=new oi(this,t,e,n);return i?r:r.doResume(null)},ai.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},ai.prototype=Object.create(K.prototype),ai.prototype.constructor=ai,ai.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n,i,r,o,a,s,l,c,u,p,h,f,d,_,y,m,v,$,g,b,w,k,S,x,E,C,O,N,z,j,T,P,R,A,I,M,L,D,q,F,B,H,K;if(this.local$youtubeTracks=ee(),this.local$tmp$=re.Default,this.state_0=2,this.result_0=this.$this.getYoutubeMusicResponse_0(this.local$query,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:var W=this.local$tmp$.parseToJsonElement_61zpoe$(this.result_0),Y=null!=(o=null!=(r=null!=(i=null!=(n=null!=(t=oe(W).get_11rb$("contents"))?oe(t):null)?n.get_11rb$("sectionListRenderer"):null)?oe(i):null)?r.get_11rb$("contents"):null)?ae(o):null,G=ee();if(null!=Y){for(a=Y.iterator();a.hasNext();){var J=a.next();if(!oe(J).containsKey_11rb$("itemSectionRenderer"))for(p=(null!=(u=null!=(c=null!=(l=null!=(s=oe(J).get_11rb$("musicShelfRenderer"))?oe(s):null)?l.get_11rb$("contents"):null)?ae(c):null)?u:U()).iterator();p.hasNext();){var Z=p.next(),Q=null!=(d=null!=(f=null!=(h=oe(Z).get_11rb$("musicResponsiveListItemRenderer"))?oe(h):null)?f.get_11rb$("flexColumns"):null)?ae(d):null,X=null!=(S=null!=(k=null!=(w=null!=(b=null!=(g=null!=($=null!=(v=null!=(m=null!=(y=null!=(_=oe(Z).get_11rb$("musicResponsiveListItemRenderer"))?oe(_):null)?y.get_11rb$("overlay"):null)?oe(m):null)?v.get_11rb$("musicItemThumbnailOverlayRenderer"):null)?oe($):null)?g.get_11rb$("content"):null)?oe(b):null)?w.get_11rb$("musicPlayButtonRenderer"):null)?oe(k):null)?S.get_11rb$("playNavigationEndpoint"):null,tt=new Ee;null!=Q&&tt.add_qiw0cd$(Q),null!=X&&tt.add_qiw0cd$(X);var et=tt.build();G.add_11rb$(et)}}for(x=G.iterator();x.hasNext();){var nt=x.next(),it=ee();for(E=nt.subList_vux9f0$(0,nt.size-1|0).iterator();E.hasNext();){var rt=E.next();for(C=ae(rt).iterator();C.hasNext();){var ot=C.next();if(!((null!=(z=null!=(N=null!=(O=oe(ot).get_11rb$("musicResponsiveListItemFlexColumnRenderer"))?oe(O):null)?N.size:null)?z:0)<2))for(M=(null!=(I=null!=(A=null!=(R=null!=(P=null!=(T=null!=(j=oe(ot).get_11rb$("musicResponsiveListItemFlexColumnRenderer"))?oe(j):null)?T.get_11rb$("text"):null)?oe(P):null)?R.get_11rb$("runs"):null)?ae(A):null)?I:U()).iterator();M.hasNext();){var at=M.next();null!=(q=null!=(D=null!=(L=oe(at).get_11rb$("text"))?se(L):null)?le(D):null)&&(ct(q," • ")||it.add_11rb$(q))}}}if(5===it.size&&ce(["Song","Video"]).contains_11rb$(it.get_za3lpa$(1))){if(2!==ue(it.get_za3lpa$(4),e.charArrayOf(58)).size)continue;var st=null!=(K=null!=(H=null!=(B=null!=(F=oe(pe(nt)).get_11rb$("watchEndpoint"))?oe(F):null)?B.get_11rb$("videoId"):null)?se(H):null)?K.content:null,lt=new he(it.get_za3lpa$(0),it.get_za3lpa$(1),it.get_za3lpa$(2),it.get_za3lpa$(4),st);this.local$youtubeTracks.add_11rb$(lt)}}}return this.local$youtubeTracks;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ri.prototype.getYTTracks_0=function(t,e,n){var i=new ai(this,t,e);return n?i:i.doResume(null)},ri.prototype.sortByBestMatch_0=function(t,n,i,r){var o,a,s,l,c,u,p,h,f,d,_,y,m,v,$,g,b,w,k,S,x,E,C,O,N,z=Ce();for(o=t.iterator();o.hasNext();){var j=o.next(),T=!1,P=null!=(c=null!=(l=null!=(s=null!=(a=j.name)?a.toLowerCase():null)?fe(s,"-"," "):null)?fe(l,"/"," "):null)?c:"";for(u=de(n.toLowerCase(),[" "]).iterator();u.hasNext();){var R=u.next();!St(R)&&_e.FuzzySearch.partialRatio_puj7f4$(R,P)>85&&(T=!0)}if(T){var A=0;if(ct(j.type,"Song"))for(p=i.iterator();p.hasNext();){var I=p.next();_e.FuzzySearch.ratio_puj7f4$(I.toLowerCase(),null!=(f=null!=(h=j.artist)?h.toLowerCase():null)?f:"")>85&&(A=A+1|0)}else for(d=i.iterator();d.hasNext();){var M=d.next();_e.FuzzySearch.partialRatio_puj7f4$(M.toLowerCase(),null!=(y=null!=(_=j.name)?_.toLowerCase():null)?y:"")>85&&(A=A+1|0)}if(0!==A){var L=100*(A/i.size|0)|0;E=null!=(g=null!=($=null!=(v=null!=(m=j.duration)?de(m,[":"]):null)?v.get_za3lpa$(0):null)?ye($):null)?60*g|0:null,x=null!=(S=null!=(k=null!=(w=null!=(b=j.duration)?de(b,[":"]):null)?w.get_za3lpa$(1):null)?ye(k):null)?S:0;var D=null!=(N=null!=(O=null!=(C=null!=E?E+x|0:null)?C-r|0:null)?Oe(O):null)?N:0,q=(L+(100-e.imul(D,D)/r*100))/2,F=bt(j.videoId),U=me(q);z.put_xwzc9p$(F,U)}}}var B,H,V=$e(Ne(ve(z),new je(ii(si))));return this.logger_0.d_swpfbs$(this.tag_0,(B=n,H=V,function(){return"Match Found for "+B+" - "+!(null==H||H.isEmpty())})),V},hi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},hi.prototype=Object.create(K.prototype),hi.prototype.constructor=hi,hi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e=this.$this.httpClient_0,n=Cn()+"https://music.youtube.com/youtubei/v1/search?alt=json&key="+Zn;t=rt.EmptyContent;var i=new st;ot(i,"http","localhost",0,"/"),i.method=at.Companion.Post,i.body=t,it(i.url,n),pi(this.local$query)(i);var r,o,a,s=new W(i,e);if(ct(r=xe,C(W))){this.result_0="string"==typeof(o=s)?o:lt(),this.state_0=9;continue}if(ct(r,C(ut))){if(this.state_0=7,this.result_0=s.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=s.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var l;this.local$response=this.result_0,this.exceptionState_0=4;var c,u=this.local$response.call;t:do{try{c=new ft(xe,ht.JsType,Y(xe,[],!1))}catch(t){c=new ft(xe,ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=u.receive_jo9acv$(c,this),this.result_0===V)return V;continue;case 2:this.result_0="string"==typeof(l=this.result_0)?l:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0="string"==typeof(a=this.result_0)?a:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},ri.prototype.getYoutubeMusicResponse_0=function(t,e,n){var i=new hi(this,t,e);return n?i:i.doResume(null)},ri.$metadata$={kind:vt,simpleName:"YoutubeMusic",interfaces:[]},di.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},di.prototype=Object.create(K.prototype),di.prototype.constructor=di,di.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=Qn.value;t=rt.EmptyContent;var i=new st;ot(i,"http","localhost",0,"/"),i.method=at.Companion.Post,i.body=t,it(i.url,"https://accounts.spotify.com/api/token"),fi(i);var r,o,a,s=new W(i,n);if(r=C(gt),ct(r,C(W))){this.result_0=null==(o=s)||e.isType(o,gt)?o:lt(),this.state_0=9;continue}if(ct(r,C(ut))){if(this.state_0=7,this.result_0=s.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=s.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var l;this.local$response=this.result_0,this.exceptionState_0=4;var c,u=this.local$response.call;t:do{try{c=new ft(C(gt),ht.JsType,Y(C(gt),[],!0))}catch(t){c=new ft(C(gt),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=u.receive_jo9acv$(c,this),this.result_0===V)return V;continue;case 2:this.result_0=null==(l=this.result_0)||e.isType(l,gt)?l:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=null==(a=this.result_0)||e.isType(a,gt)?a:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:this.result_0,this.local$tmp$=this.result_0,this.state_0=10;continue;case 10:return this.local$tmp$;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.authenticateSpotifyClient_6taknv$=function(t,e,n){return void 0===t&&(t=!1),n?n(t,e):this.authenticateSpotifyClient_6taknv$$default(t,e)},wi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},wi.prototype=Object.create(K.prototype),wi.prototype.constructor=wi,wi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=gi()+"/playlists/"+this.local$playlistID;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),$i();var o,a,s,l=new W(r,n);if(o=C(Le),ct(o,C(W))){this.result_0=e.isType(a=l,Le)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(Le),ht.JsType,Y(C(Le),[],!1))}catch(t){u=new ft(C(Le),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,Le)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,Le)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.getPlaylist_61zpoe$=function(t,e,n){var i=new wi(this,t,e);return n?i:i.doResume(null)},ki.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},ki.prototype=Object.create(K.prototype),ki.prototype.constructor=ki,ki.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=gi()+"/playlists/"+bt(this.local$playlistID)+"/tracks?offset="+this.local$offset+"&limit="+this.local$limit;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),$i();var o,a,s,l=new W(r,n);if(o=C(De),ct(o,C(W))){this.result_0=e.isType(a=l,De)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(De),ht.JsType,Y(C(De),[],!1))}catch(t){u=new ft(C(De),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,De)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,De)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.getPlaylistTracks_hs9j5r$$default=function(t,e,n,i,r){var o=new ki(this,t,e,n,i);return r?o:o.doResume(null)},bi.prototype.getPlaylistTracks_hs9j5r$=function(t,e,n,i,r){return void 0===e&&(e=0),void 0===n&&(n=100),r?r(t,e,n,i):this.getPlaylistTracks_hs9j5r$$default(t,e,n,i)},Si.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Si.prototype=Object.create(K.prototype),Si.prototype.constructor=Si,Si.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=gi()+"/tracks/"+bt(this.local$id);t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),$i();var o,a,s,l=new W(r,n);if(o=C(qe),ct(o,C(W))){this.result_0=e.isType(a=l,qe)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(qe),ht.JsType,Y(C(qe),[],!1))}catch(t){u=new ft(C(qe),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,qe)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,qe)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.getTrack_pdl1vj$=function(t,e,n){var i=new Si(this,t,e);return n?i:i.doResume(null)},xi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},xi.prototype=Object.create(K.prototype),xi.prototype.constructor=xi,xi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=gi()+"/episodes/"+bt(this.local$id);t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),$i();var o,a,s,l=new W(r,n);if(o=C(qe),ct(o,C(W))){this.result_0=e.isType(a=l,qe)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(qe),ht.JsType,Y(C(qe),[],!1))}catch(t){u=new ft(C(qe),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,qe)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,qe)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.getEpisode_pdl1vj$=function(t,e,n){var i=new xi(this,t,e);return n?i:i.doResume(null)},Ei.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Ei.prototype=Object.create(K.prototype),Ei.prototype.constructor=Ei,Ei.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=gi()+"/shows/"+bt(this.local$id);t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),$i();var o,a,s,l=new W(r,n);if(o=C(qe),ct(o,C(W))){this.result_0=e.isType(a=l,qe)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(qe),ht.JsType,Y(C(qe),[],!1))}catch(t){u=new ft(C(qe),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,qe)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,qe)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.getShow_pdl1vj$=function(t,e,n){var i=new Ei(this,t,e);return n?i:i.doResume(null)},Ci.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Ci.prototype=Object.create(K.prototype),Ci.prototype.constructor=Ci,Ci.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=gi()+"/albums/"+this.local$id;t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Get,r.body=t,it(r.url,i),$i();var o,a,s,l=new W(r,n);if(o=C(Zt),ct(o,C(W))){this.result_0=e.isType(a=l,Zt)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(Zt),ht.JsType,Y(C(Zt),[],!1))}catch(t){u=new ft(C(Zt),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=e.isType(c=this.result_0,Zt)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=e.isType(s=this.result_0,Zt)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.getAlbum_61zpoe$=function(t,e,n){var i=new Ci(this,t,e);return n?i:i.doResume(null)},Oi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Oi.prototype=Object.create(K.prototype),Oi.prototype.constructor=Oi,Oi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e=this.$this.httpClient;t=rt.EmptyContent;var n=new st;ot(n,"http","localhost",0,"/"),n.method=at.Companion.Get,n.body=t,it(n.url,this.local$url),$i();var i,r,o,a=new W(n,e);if(ct(i=xe,C(W))){this.result_0="string"==typeof(r=a)?r:lt(),this.state_0=9;continue}if(ct(i,C(ut))){if(this.state_0=7,this.result_0=a.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=a.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var s;this.local$response=this.result_0,this.exceptionState_0=4;var l,c=this.local$response.call;t:do{try{l=new ft(xe,ht.JsType,Y(xe,[],!1))}catch(t){l=new ft(xe,ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=c.receive_jo9acv$(l,this),this.result_0===V)return V;continue;case 2:this.result_0="string"==typeof(s=this.result_0)?s:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0="string"==typeof(o=this.result_0)?o:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},bi.prototype.getResponse_61zpoe$=function(t,e,n){var i=new Oi(this,t,e);return n?i:i.doResume(null)},bi.$metadata$={kind:Tt,simpleName:"SpotifyRequests",interfaces:[]},ji.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},ji.prototype=Object.create(K.prototype),ji.prototype.constructor=ji,ji.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,e,n,i;if(this.state_0=2,this.result_0=this.$this.getKey_z1wm5e$_0(this.local$videoID,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:if(this.state_0=3,this.result_0=this.$this.getConvertedMp3Link_e5s44t$_0(this.local$videoID,this.result_0,this),this.result_0===V)return V;continue;case 3:return null!=(i=null!=(n=null!=(e=null!=(t=this.result_0)?t.get_11rb$("dlink"):null)?se(e):null)?n.toString():null)?fe(i,'"',""):null;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},zi.prototype.getLinkFromYt1sMp3_61zpoe$=function(t,e,n){var i=new ji(this,t,e);return n?i:i.doResume(null)},Pi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Pi.prototype=Object.create(K.prototype),Pi.prototype.constructor=Pi,Pi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n,i=this.$this.httpClient,r=Cn()+"https://yt1s.com/api/ajaxSearch/index";n=rt.EmptyContent;var o=new st;ot(o,"http","localhost",0,"/"),o.method=at.Companion.Post,o.body=n,it(o.url,r),Ti(this.local$videoID)(o);var a,s,l,c=new W(o,i);if(a=C(Ue),ct(a,C(W))){this.result_0=null==(s=c)||e.isType(s,Ue)?s:lt(),this.state_0=9;continue}if(ct(a,C(ut))){if(this.state_0=7,this.result_0=c.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=c.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var u;this.local$response=this.result_0,this.exceptionState_0=4;var p,h=this.local$response.call;t:do{try{p=new ft(C(Ue),ht.JsType,Y(C(Ue),[],!0))}catch(t){p=new ft(C(Ue),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=h.receive_jo9acv$(p,this),this.result_0===V)return V;continue;case 2:this.result_0=null==(u=this.result_0)||e.isType(u,Ue)?u:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=null==(l=this.result_0)||e.isType(l,Ue)?l:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:this.result_0;var f=this.result_0;return bt(null!=(t=null!=f?f.get_11rb$("kc"):null)?se(t):null);default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},zi.prototype.getKey_z1wm5e$_0=function(t,e,n){var i=new Pi(this,t,e);return n?i:i.doResume(null)},Ai.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Ai.prototype=Object.create(K.prototype),Ai.prototype.constructor=Ai,Ai.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n=this.$this.httpClient,i=Cn()+"https://yt1s.com/api/ajaxConvert/convert";t=rt.EmptyContent;var r=new st;ot(r,"http","localhost",0,"/"),r.method=at.Companion.Post,r.body=t,it(r.url,i),Ri(this.local$videoID,this.local$key)(r);var o,a,s,l=new W(r,n);if(o=C(Ue),ct(o,C(W))){this.result_0=null==(a=l)||e.isType(a,Ue)?a:lt(),this.state_0=9;continue}if(ct(o,C(ut))){if(this.state_0=7,this.result_0=l.execute(this),this.result_0===V)return V;continue}if(this.state_0=1,this.result_0=l.executeUnsafe(this),this.result_0===V)return V;continue;case 1:var c;this.local$response=this.result_0,this.exceptionState_0=4;var u,p=this.local$response.call;t:do{try{u=new ft(C(Ue),ht.JsType,Y(C(Ue),[],!0))}catch(t){u=new ft(C(Ue),ht.JsType);break t}}while(0);if(this.state_0=2,this.result_0=p.receive_jo9acv$(u,this),this.result_0===V)return V;continue;case 2:this.result_0=null==(c=this.result_0)||e.isType(c,Ue)?c:lt(),this.exceptionState_0=6,this.finallyPath_0=[3],this.state_0=5;continue;case 3:this.state_0=8;continue;case 4:this.finallyPath_0=[6],this.state_0=5;continue;case 5:this.exceptionState_0=6,pt(this.local$response),this.state_0=this.finallyPath_0.shift();continue;case 6:throw this.exception_0;case 7:this.result_0=null==(s=this.result_0)||e.isType(s,Ue)?s:lt(),this.state_0=8;continue;case 8:this.state_0=9;continue;case 9:return this.result_0,this.result_0;default:throw this.state_0=6,new Error("State Machine Unreachable execution")}}catch(t){if(6===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},zi.prototype.getConvertedMp3Link_e5s44t$_0=function(t,e,n,i){var r=new Ai(this,t,e,n);return i?r:r.doResume(null)},zi.$metadata$={kind:Tt,simpleName:"Yt1sMp3",interfaces:[]},Ii.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},Ii.$metadata$={kind:vt,interfaces:[We]},Li.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Li.prototype=Object.create(K.prototype),Li.prototype.constructor=Li,Li.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t=ni,e=this.local$closure$it.title,n=qt.Queued;t.put_xwzc9p$(e,n);var i=this.local$closure$it.videoID;if(null==i||St(i)){var r=this.local$closure$it.title+" - "+Qt(this.local$closure$it.artists,",");if(this.state_0=2,this.result_0=this.local$closure$fetcher.youtubeMusic.getYTIDBestMatch_8c1lij$(r,this.local$closure$it,this),this.result_0===V)return V;continue}if(this.state_0=6,this.result_0=Hi(J(this.local$closure$it.videoID),this.local$closure$it,this.local$closure$fetcher,this.local$closure$dir,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:var o=this.result_0;if(Be(o+" : "+this.local$closure$it.title),null==o||St(o)){var a=ni,s=this.local$closure$it.title,l=qt.Failed;if(a.put_xwzc9p$(s,l),this.state_0=4,this.result_0=ei.emit_11rb$(ni,this),this.result_0===V)return V;continue}if(this.state_0=3,this.result_0=Hi(o,this.local$closure$it,this.local$closure$fetcher,this.local$closure$dir,this),this.result_0===V)return V;continue;case 3:case 4:this.state_0=5;continue;case 5:case 6:this.state_0=7;continue;case 7:if(this.state_0=8,this.result_0=ei.emit_11rb$(ni,this),this.result_0===V)return V;continue;case 8:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},qi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},qi.prototype=Object.create(K.prototype),qi.prototype.constructor=qi,qi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:this.local$tmp$=this.local$list.iterator(),this.state_0=2;continue;case 1:throw this.exception_0;case 2:if(!this.local$tmp$.hasNext()){this.state_0=4;continue}var t=this.local$tmp$.next();if(this.state_0=3,this.result_0=mt(ti,Di(t,this.local$fetcher,this.local$dir),this),this.result_0===V)return V;continue;case 3:this.state_0=2;continue;case 4:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Fi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Fi.prototype=Object.create(K.prototype),Fi.prototype.constructor=Fi,Fi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(e.isType(this.local$it,X)){if(Be("Download Completed"),this.state_0=2,this.result_0=this.local$closure$dir.saveFileWithMetadata_vmnm85$(this.local$it.byteArray,this.local$closure$track,this),this.result_0===V)return V;continue}if(e.isType(this.local$it,tt)){var t=ni,n=this.local$closure$track.title,i=qt.Failed;t.put_xwzc9p$(n,i),Be("Download Error: "+this.local$closure$track.title)}else if(e.isType(this.local$it,Z)){var r=ni,o=this.local$closure$track.title,a=new Ke(this.local$it.progress);r.put_xwzc9p$(o,a),Be("Download Progress: "+this.local$it.progress+" : "+this.local$closure$track.title)}this.state_0=3;continue;case 1:throw this.exception_0;case 2:this.state_0=3;continue;case 3:if(this.state_0=4,this.result_0=ei.emit_11rb$(ni,this),this.result_0===V)return V;continue;case 4:return this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Bi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Bi.prototype=Object.create(K.prototype),Bi.prototype.constructor=Bi,Bi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.state_0=2,this.result_0=this.local$fetcher.youtubeMp3.getMp3DownloadLink_61zpoe$(this.local$videoID,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;if(null==t){var e=ni,n=this.local$track.title,i=qt.Failed;if(e.put_xwzc9p$(n,i),this.state_0=5,this.result_0=ei.emit_11rb$(ni,this),this.result_0===V)return V;continue}if(this.state_0=3,this.result_0=dn(t),this.result_0===V)return V;continue;case 3:if(this.state_0=4,this.result_0=this.result_0.collect_42ocv1$(new Ii(Ui(this.local$dir,this.local$track)),this),this.result_0===V)return V;continue;case 4:this.result_0,this.state_0=6;continue;case 5:Be("No URL to Download"),this.state_0=6;continue;case 6:return;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Vi.prototype.emit_11rb$=function(t,e){return this.closure$action(t,e)},Vi.$metadata$={kind:vt,interfaces:[We]},Ki.prototype.fileSeparator=function(){return"/"},Ki.prototype.imageCacheDir=function(){return"TODO"+this.fileSeparator()+"SpotiFlyer/.images"+this.fileSeparator()},Ki.prototype.defaultDir=function(){return"TODO"+this.fileSeparator()+"SpotiFlyer"+this.fileSeparator()},Ki.prototype.isPresent_61zpoe$=function(t){return!1},Ki.prototype.createDirectory_61zpoe$=function(t){},Ki.prototype.clearCache=function(t){},Ki.prototype.cacheImage_hwpqgh$=function(t,e,n){},Ji.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Ji.prototype=Object.create(K.prototype),Ji.prototype.constructor=Ji,Ji.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n;if(e.isType(this.local$it,X)){this.local$this$Dir.logger_0.d_h4ejuu$(Wi);var i={type:3};i.data=tr(this.local$it.byteArray),i.description="Cover Art";var r=i;if(n=e.isType(t=r,Object)?t:lt(),this.state_0=5,this.result_0=this.local$this$Dir.writeTagsAndSave_0(this.local$closure$writer,n,this.local$closure$trackDetails,this),this.result_0===V)return V;continue}if(e.isType(this.local$it,tt)){if(this.local$this$Dir.logger_0.d_h4ejuu$(Yi),this.state_0=3,this.result_0=this.local$this$Dir.writeTagsAndSave_0(this.local$closure$writer,null,this.local$closure$trackDetails,this),this.result_0===V)return V;continue}if(e.isType(this.local$it,Z))return this.local$this$Dir.logger_0.d_h4ejuu$(Gi(this.local$it)),S;this.state_0=2;continue;case 1:throw this.exception_0;case 2:this.state_0=4;continue;case 3:return S;case 4:this.state_0=6;continue;case 5:case 6:return S;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Qi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Qi.prototype=Object.create(K.prototype),Qi.prototype.constructor=Qi,Qi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:if(this.local$writer=new v(tr(this.local$mp3ByteArray)),this.state_0=2,this.result_0=dn(Cn()+this.local$trackDetails.albumArtURL),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:var t=this.result_0;if(this.state_0=3,this.result_0=t.collect_42ocv1$(new Vi(Zi(this.$this,this.local$writer,this.local$trackDetails)),this),this.result_0===V)return V;continue;case 3:return void this.result_0;default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ki.prototype.saveFileWithMetadata_vmnm85$=function(t,e,n,i){var r=new Qi(this,t,e,n);return i?r:r.doResume(null)},Xi.$metadata$={kind:e.Kind.CLASS,simpleName:null,interfaces:[K]},Xi.prototype=Object.create(K.prototype),Xi.prototype.constructor=Xi,Xi.prototype.doResume=function(){for(;;)try{switch(this.state_0){case 0:var t,n,i,r;this.local$writer.setFrame("TIT2",this.local$trackDetails.title),this.local$writer.setFrame("TPE1",Je(this.local$trackDetails.artists)),this.local$writer.setFrame("TALB",null!=(t=this.local$trackDetails.albumName)?t:"");try{null!=(r=null!=(i=null!=(n=this.local$trackDetails.year)?n.substring(0,4):null)?ye(i):null)&&this.local$writer.setFrame("TYER",r)}catch(t){if(!e.isType(t,He))throw t}this.local$writer.setFrame("TPE2",Qt(this.local$trackDetails.artists,",")),this.local$writer.setFrame("WOAS",this.local$trackDetails.source.toString()),this.local$writer.setFrame("TLEN",this.local$trackDetails.durationSec),null!=this.local$albumArt&&this.local$writer.setFrame("APIC",this.local$albumArt),this.local$writer.addTag();var o=ni,a=this.local$trackDetails.title,s=qt.Downloaded;if(o.put_xwzc9p$(a,s),this.state_0=2,this.result_0=ei.emit_11rb$(ni,this),this.result_0===V)return V;continue;case 1:throw this.exception_0;case 2:return void Ge(this.local$writer.getBlob(),Ni(this.local$trackDetails.title)+".mp3");default:throw this.state_0=1,new Error("State Machine Unreachable execution")}}catch(t){if(1===this.state_0)throw this.exceptionState_0=this.state_0,t;this.state_0=this.exceptionState_0,this.exception_0=t}},Ki.prototype.writeTagsAndSave_0=function(t,e,n,i,r){var o=new Xi(this,t,e,n,i);return r?o:o.doResume(null)},Ki.prototype.addToLibrary_61zpoe$=function(t){},Ki.prototype.loadImage_61zpoe$=function(t,e){return new er(t)},Ki.prototype.loadCachedImage_0=function(t){return null},Ki.prototype.freshImage_0=function(t,e){return null},Object.defineProperty(Ki.prototype,"db",{configurable:!0,get:function(){return this.database_0}}),Ki.$metadata$={kind:vt,simpleName:"Dir",interfaces:[]},er.$metadata$={kind:vt,simpleName:"Picture",interfaces:[]},er.prototype.component1=function(){return this.imageUrl},er.prototype.copy_61zpoe$=function(t){return new er(void 0===t?this.imageUrl:t)},er.prototype.toString=function(){return"Picture(imageUrl="+e.toString(this.imageUrl)+")"},er.prototype.hashCode=function(){var t=0;return t=31*t+e.hashCode(this.imageUrl)|0},er.prototype.equals=function(t){return this===t||null!==t&&"object"==typeof t&&Object.getPrototypeOf(this)===Object.getPrototypeOf(t)&&e.equals(this.imageUrl,t.imageUrl)},nr.prototype.query_61zpoe$=function(t,e){return null},nr.$metadata$={kind:vt,simpleName:"YoutubeProvider",interfaces:[]};var ir=t.com||(t.com={}),rr=ir.shabinder||(ir.shabinder={}),or=rr.common||(rr.common={}),ar=or.di||(or.di={});ar.initKoin_8xlgbz$=function(t,e){return void 0===t&&(t=!1),void 0===e&&(e=Ze),x((n=e,i=t,function(t){return n(t),t.modules_7zxgee$(cn(i)),S}));var n,i},k["core-koin-core"]=n,ar.commonModule_6taknv$=cn,ar.createHttpClient_i0srga$=hn,k["ktor-ktor-client-core-jsLegacy"]=i,ar.downloadFile_61zpoe$=dn,ar.finalOutputDir_gpfont$=_n,ar.FetchPlatformQueryResult=yn,ar.TokenStore=gn;var sr=ar.gaana||(ar.gaana={});Object.defineProperty(sr,"corsApi",{get:Cn}),sr.GaanaRequests=Nn;var lr=ar.providers||(ar.providers={});lr.GaanaProvider=An,lr.SpotifyProvider=Ln,lr.YoutubeMp3=Gn,k["kotlinx-serialization-kotlinx-serialization-json-jsLegacy"]=a,lr.YoutubeMusic=ri,k["ktor-ktor-http-jsLegacy"]=u;var cr=ar.spotify||(ar.spotify={});return cr.authenticateSpotify=_i,cr.SpotifyRequests=bi,k["kotlinx-coroutines-core"]=h,(ar.utils||(ar.utils={})).removeIllegalChars_61zpoe$=Ni,(ar.youtubeMp3||(ar.youtubeMp3={})).Yt1sMp3=zi,ar.openPlatform_puj7f4$=function(t,e){},ar.shareApp=function(){},ar.giveDonation=function(){},ar.queryActiveTracks=function(){},Object.defineProperty(ar,"isInternetAvailable",{get:Mi}),Object.defineProperty(ar,"DownloadProgressFlow",{get:function(){return ei}}),ar.downloadTracks_fe9u7d$=function(t,e,n,i,r){var o=new qi(t,e,n,i);return r?o:o.doResume(null)},ar.downloadTrack_oyk27a$=Hi,k["kotlin-wrappers-kotlin-extensions-jsLegacy"]=$,ar.Dir=Ki,ar.toArrayBuffer_964n91$=tr,ar.Picture=er,ar.YoutubeProvider=nr,An.prototype.getGaanaPlaylist_tgym8q$$default=Nn.prototype.getGaanaPlaylist_tgym8q$$default,An.prototype.getGaanaAlbum_tgym8q$$default=Nn.prototype.getGaanaAlbum_tgym8q$$default,An.prototype.getGaanaSong_w74nik$$default=Nn.prototype.getGaanaSong_w74nik$$default,An.prototype.getGaanaArtistDetails_w74nik$$default=Nn.prototype.getGaanaArtistDetails_w74nik$$default,An.prototype.getGaanaArtistTracks_tgym8q$$default=Nn.prototype.getGaanaArtistTracks_tgym8q$$default,An.prototype.getGaanaPlaylist_tgym8q$=Nn.prototype.getGaanaPlaylist_tgym8q$,An.prototype.getGaanaAlbum_tgym8q$=Nn.prototype.getGaanaAlbum_tgym8q$,An.prototype.getGaanaSong_w74nik$=Nn.prototype.getGaanaSong_w74nik$,An.prototype.getGaanaArtistDetails_w74nik$=Nn.prototype.getGaanaArtistDetails_w74nik$,An.prototype.getGaanaArtistTracks_tgym8q$=Nn.prototype.getGaanaArtistTracks_tgym8q$,Ln.prototype.getPlaylist_61zpoe$=bi.prototype.getPlaylist_61zpoe$,Ln.prototype.getPlaylistTracks_hs9j5r$$default=bi.prototype.getPlaylistTracks_hs9j5r$$default,Ln.prototype.getTrack_pdl1vj$=bi.prototype.getTrack_pdl1vj$,Ln.prototype.getEpisode_pdl1vj$=bi.prototype.getEpisode_pdl1vj$,Ln.prototype.getShow_pdl1vj$=bi.prototype.getShow_pdl1vj$,Ln.prototype.getAlbum_61zpoe$=bi.prototype.getAlbum_61zpoe$,Ln.prototype.getResponse_61zpoe$=bi.prototype.getResponse_61zpoe$,Ln.prototype.authenticateSpotifyClient_6taknv$=bi.prototype.authenticateSpotifyClient_6taknv$,Ln.prototype.getPlaylistTracks_hs9j5r$=bi.prototype.getPlaylistTracks_hs9j5r$,Gn.prototype.getLinkFromYt1sMp3_61zpoe$=zi.prototype.getLinkFromYt1sMp3_61zpoe$,Gn.prototype.getKey_z1wm5e$_0=zi.prototype.getKey_z1wm5e$_0,Gn.prototype.getConvertedMp3Link_e5s44t$_0=zi.prototype.getConvertedMp3Link_e5s44t$_0,b=new R(P(void 0,(function(t){return t.isLenient=!0,t.ignoreUnknownKeys=!0,S}))),q((function(t){return S})),w="b2e6d7fbc136547a940516e9b77e5990",Zn="AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30",Qn=Ie((function(){return q(vi)})),Xn=xt.Js,ti=yt.Dispatchers.Default,ei=Ve(1),ni=Ye(),t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){"use strict";var i=n(0),r=n(77),o=n(2).Buffer,a=new Array(16);function s(){r.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}function l(t,e){return t<>>32-e}function c(t,e,n,i,r,o,a){return l(t+(e&n|~e&i)+r+o|0,a)+e|0}function u(t,e,n,i,r,o,a){return l(t+(e&i|n&~i)+r+o|0,a)+e|0}function p(t,e,n,i,r,o,a){return l(t+(e^n^i)+r+o|0,a)+e|0}function h(t,e,n,i,r,o,a){return l(t+(n^(e|~i))+r+o|0,a)+e|0}i(s,r),s.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);var n=this._a,i=this._b,r=this._c,o=this._d;n=c(n,i,r,o,t[0],3614090360,7),o=c(o,n,i,r,t[1],3905402710,12),r=c(r,o,n,i,t[2],606105819,17),i=c(i,r,o,n,t[3],3250441966,22),n=c(n,i,r,o,t[4],4118548399,7),o=c(o,n,i,r,t[5],1200080426,12),r=c(r,o,n,i,t[6],2821735955,17),i=c(i,r,o,n,t[7],4249261313,22),n=c(n,i,r,o,t[8],1770035416,7),o=c(o,n,i,r,t[9],2336552879,12),r=c(r,o,n,i,t[10],4294925233,17),i=c(i,r,o,n,t[11],2304563134,22),n=c(n,i,r,o,t[12],1804603682,7),o=c(o,n,i,r,t[13],4254626195,12),r=c(r,o,n,i,t[14],2792965006,17),n=u(n,i=c(i,r,o,n,t[15],1236535329,22),r,o,t[1],4129170786,5),o=u(o,n,i,r,t[6],3225465664,9),r=u(r,o,n,i,t[11],643717713,14),i=u(i,r,o,n,t[0],3921069994,20),n=u(n,i,r,o,t[5],3593408605,5),o=u(o,n,i,r,t[10],38016083,9),r=u(r,o,n,i,t[15],3634488961,14),i=u(i,r,o,n,t[4],3889429448,20),n=u(n,i,r,o,t[9],568446438,5),o=u(o,n,i,r,t[14],3275163606,9),r=u(r,o,n,i,t[3],4107603335,14),i=u(i,r,o,n,t[8],1163531501,20),n=u(n,i,r,o,t[13],2850285829,5),o=u(o,n,i,r,t[2],4243563512,9),r=u(r,o,n,i,t[7],1735328473,14),n=p(n,i=u(i,r,o,n,t[12],2368359562,20),r,o,t[5],4294588738,4),o=p(o,n,i,r,t[8],2272392833,11),r=p(r,o,n,i,t[11],1839030562,16),i=p(i,r,o,n,t[14],4259657740,23),n=p(n,i,r,o,t[1],2763975236,4),o=p(o,n,i,r,t[4],1272893353,11),r=p(r,o,n,i,t[7],4139469664,16),i=p(i,r,o,n,t[10],3200236656,23),n=p(n,i,r,o,t[13],681279174,4),o=p(o,n,i,r,t[0],3936430074,11),r=p(r,o,n,i,t[3],3572445317,16),i=p(i,r,o,n,t[6],76029189,23),n=p(n,i,r,o,t[9],3654602809,4),o=p(o,n,i,r,t[12],3873151461,11),r=p(r,o,n,i,t[15],530742520,16),n=h(n,i=p(i,r,o,n,t[2],3299628645,23),r,o,t[0],4096336452,6),o=h(o,n,i,r,t[7],1126891415,10),r=h(r,o,n,i,t[14],2878612391,15),i=h(i,r,o,n,t[5],4237533241,21),n=h(n,i,r,o,t[12],1700485571,6),o=h(o,n,i,r,t[3],2399980690,10),r=h(r,o,n,i,t[10],4293915773,15),i=h(i,r,o,n,t[1],2240044497,21),n=h(n,i,r,o,t[8],1873313359,6),o=h(o,n,i,r,t[15],4264355552,10),r=h(r,o,n,i,t[6],2734768916,15),i=h(i,r,o,n,t[13],1309151649,21),n=h(n,i,r,o,t[4],4149444226,6),o=h(o,n,i,r,t[11],3174756917,10),r=h(r,o,n,i,t[2],718787259,15),i=h(i,r,o,n,t[9],3951481745,21),this._a=this._a+n|0,this._b=this._b+i|0,this._c=this._c+r|0,this._d=this._d+o|0},s.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=o.allocUnsafe(16);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t},t.exports=s},function(t,e,n){(function(e){function n(t){try{if(!e.localStorage)return!1}catch(t){return!1}var n=e.localStorage[t];return null!=n&&"true"===String(n).toLowerCase()}t.exports=function(t,e){if(n("noDeprecation"))return t;var i=!1;return function(){if(!i){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),i=!0}return t.apply(this,arguments)}}}).call(this,n(7))},function(t,e,n){"use strict";var i=n(20).codes.ERR_STREAM_PREMATURE_CLOSE;function r(){}t.exports=function t(e,n,o){if("function"==typeof n)return t(e,null,n);n||(n={}),o=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,i=new Array(n),r=0;r>>32-e}function _(t,e,n,i,r,o,a,s){return d(t+(e^n^i)+o+a|0,s)+r|0}function y(t,e,n,i,r,o,a,s){return d(t+(e&n|~e&i)+o+a|0,s)+r|0}function m(t,e,n,i,r,o,a,s){return d(t+((e|~n)^i)+o+a|0,s)+r|0}function v(t,e,n,i,r,o,a,s){return d(t+(e&i|n&~i)+o+a|0,s)+r|0}function $(t,e,n,i,r,o,a,s){return d(t+(e^(n|~i))+o+a|0,s)+r|0}r(f,o),f.prototype._update=function(){for(var t=a,e=0;e<16;++e)t[e]=this._block.readInt32LE(4*e);for(var n=0|this._a,i=0|this._b,r=0|this._c,o=0|this._d,f=0|this._e,g=0|this._a,b=0|this._b,w=0|this._c,k=0|this._d,S=0|this._e,x=0;x<80;x+=1){var E,C;x<16?(E=_(n,i,r,o,f,t[s[x]],p[0],c[x]),C=$(g,b,w,k,S,t[l[x]],h[0],u[x])):x<32?(E=y(n,i,r,o,f,t[s[x]],p[1],c[x]),C=v(g,b,w,k,S,t[l[x]],h[1],u[x])):x<48?(E=m(n,i,r,o,f,t[s[x]],p[2],c[x]),C=m(g,b,w,k,S,t[l[x]],h[2],u[x])):x<64?(E=v(n,i,r,o,f,t[s[x]],p[3],c[x]),C=y(g,b,w,k,S,t[l[x]],h[3],u[x])):(E=$(n,i,r,o,f,t[s[x]],p[4],c[x]),C=_(g,b,w,k,S,t[l[x]],h[4],u[x])),n=f,f=o,o=d(r,10),r=i,i=E,g=S,S=k,k=d(w,10),w=b,b=C}var O=this._b+r+k|0;this._b=this._c+o+S|0,this._c=this._d+f+g|0,this._d=this._e+n+b|0,this._e=this._a+i+w|0,this._a=O},f.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var t=i.alloc?i.alloc(20):new i(20);return t.writeInt32LE(this._a,0),t.writeInt32LE(this._b,4),t.writeInt32LE(this._c,8),t.writeInt32LE(this._d,12),t.writeInt32LE(this._e,16),t},t.exports=f},function(t,e,n){(e=t.exports=function(t){t=t.toLowerCase();var n=e[t];if(!n)throw new Error(t+" is not supported (we accept pull requests)");return new n}).sha=n(161),e.sha1=n(162),e.sha224=n(163),e.sha256=n(84),e.sha384=n(164),e.sha512=n(85)},function(t,e,n){(e=t.exports=n(86)).Stream=e,e.Readable=e,e.Writable=n(52),e.Duplex=n(17),e.Transform=n(89),e.PassThrough=n(171)},function(t,e,n){var i=n(6),r=i.Buffer;function o(t,e){for(var n in t)e[n]=t[n]}function a(t,e,n){return r(t,e,n)}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=i:(o(i,e),e.Buffer=a),o(r,a),a.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return r(t,e,n)},a.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var i=r(t);return void 0!==e?"string"==typeof n?i.fill(e,n):i.fill(e):i.fill(0),i},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i.SlowBuffer(t)}},function(t,e,n){"use strict";(function(e,i,r){var o=n(37);function a(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var i=t.entry;t.entry=null;for(;i;){var r=i.callback;e.pendingcb--,r(n),i=i.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}t.exports=v;var s,l=!e.browser&&["v0.10","v0.9."].indexOf(e.version.slice(0,5))>-1?i:o.nextTick;v.WritableState=m;var c=Object.create(n(30));c.inherits=n(0);var u={deprecate:n(46)},p=n(87),h=n(51).Buffer,f=r.Uint8Array||function(){};var d,_=n(88);function y(){}function m(t,e){s=s||n(17),t=t||{};var i=e instanceof s;this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode);var r=t.highWaterMark,c=t.writableHighWaterMark,u=this.objectMode?16:16384;this.highWaterMark=r||0===r?r:i&&(c||0===c)?c:u,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var p=!1===t.decodeStrings;this.decodeStrings=!p,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,i=n.sync,r=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,i,r){--e.pendingcb,n?(o.nextTick(r,i),o.nextTick(S,t,e),t._writableState.errorEmitted=!0,t.emit("error",i)):(r(i),t._writableState.errorEmitted=!0,t.emit("error",i),S(t,e))}(t,n,i,e,r);else{var a=w(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||b(t,n),i?l(g,t,n,a,r):g(t,n,a,r)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function v(t){if(s=s||n(17),!(d.call(v,this)||this instanceof s))return new v(t);this._writableState=new m(t,this),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),p.call(this)}function $(t,e,n,i,r,o,a){e.writelen=i,e.writecb=a,e.writing=!0,e.sync=!0,n?t._writev(r,e.onwrite):t._write(r,o,e.onwrite),e.sync=!1}function g(t,e,n,i){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,i(),S(t,e)}function b(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var i=e.bufferedRequestCount,r=new Array(i),o=e.corkedRequestsFree;o.entry=n;for(var s=0,l=!0;n;)r[s]=n,n.isBuf||(l=!1),n=n.next,s+=1;r.allBuffers=l,$(t,e,!0,e.length,r,"",o.finish),e.pendingcb++,e.lastBufferedRequest=null,o.next?(e.corkedRequestsFree=o.next,o.next=null):e.corkedRequestsFree=new a(e),e.bufferedRequestCount=0}else{for(;n;){var c=n.chunk,u=n.encoding,p=n.callback;if($(t,e,!1,e.objectMode?1:c.length,c,u,p),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function w(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function k(t,e){t._final((function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),S(t,e)}))}function S(t,e){var n=w(e);return n&&(!function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,o.nextTick(k,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}c.inherits(v,p),m.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(m.prototype,"buffer",{get:u.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(d=Function.prototype[Symbol.hasInstance],Object.defineProperty(v,Symbol.hasInstance,{value:function(t){return!!d.call(this,t)||this===v&&(t&&t._writableState instanceof m)}})):d=function(t){return t instanceof this},v.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},v.prototype.write=function(t,e,n){var i,r=this._writableState,a=!1,s=!r.objectMode&&(i=t,h.isBuffer(i)||i instanceof f);return s&&!h.isBuffer(t)&&(t=function(t){return h.from(t)}(t)),"function"==typeof e&&(n=e,e=null),s?e="buffer":e||(e=r.defaultEncoding),"function"!=typeof n&&(n=y),r.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),o.nextTick(e,n)}(this,n):(s||function(t,e,n,i){var r=!0,a=!1;return null===n?a=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(t.emit("error",a),o.nextTick(i,a),r=!1),r}(this,r,t,n))&&(r.pendingcb++,a=function(t,e,n,i,r,o){if(!n){var a=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=h.from(e,n));return e}(e,i,r);i!==a&&(n=!0,r="buffer",i=a)}var s=e.objectMode?1:i.length;e.length+=s;var l=e.length-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(v.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),v.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},v.prototype._writev=null,v.prototype.end=function(t,e,n){var i=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),i.corked&&(i.corked=1,this.uncork()),i.ending||i.finished||function(t,e,n){e.ending=!0,S(t,e),n&&(e.finished?o.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,i,n)},Object.defineProperty(v.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),v.prototype.destroy=_.destroy,v.prototype._undestroy=_.undestroy,v.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,n(4),n(169).setImmediate,n(7))},function(t,e,n){"use strict";var i=n(9);function r(t){this.options=t,this.type=this.options.type,this.blockSize=8,this._init(),this.buffer=new Array(this.blockSize),this.bufferOff=0}t.exports=r,r.prototype._init=function(){},r.prototype.update=function(t){return 0===t.length?[]:"decrypt"===this.type?this._updateDecrypt(t):this._updateEncrypt(t)},r.prototype._buffer=function(t,e){for(var n=Math.min(this.buffer.length-this.bufferOff,t.length-e),i=0;i0;i--)e+=this._buffer(t,e),n+=this._flushBuffer(r,n);return e+=this._buffer(t,e),r},r.prototype.final=function(t){var e,n;return t&&(e=this.update(t)),n="encrypt"===this.type?this._finalEncrypt():this._finalDecrypt(),e?e.concat(n):n},r.prototype._pad=function(t,e){if(0===e)return!1;for(;e=0||!e.umod(t.prime1)||!e.umod(t.prime2));return e}function a(t,n){var r=function(t){var e=o(t);return{blinder:e.toRed(i.mont(t.modulus)).redPow(new i(t.publicExponent)).fromRed(),unblinder:e.invm(t.modulus)}}(n),a=n.modulus.byteLength(),s=new i(t).mul(r.blinder).umod(n.modulus),l=s.toRed(i.mont(n.prime1)),c=s.toRed(i.mont(n.prime2)),u=n.coefficient,p=n.prime1,h=n.prime2,f=l.redPow(n.exponent1).fromRed(),d=c.redPow(n.exponent2).fromRed(),_=f.isub(d).imul(u).umod(p).imul(h);return d.iadd(_).imul(r.unblinder).umod(n.modulus).toArrayLike(e,"be",a)}a.getr=o,t.exports=a}).call(this,n(6).Buffer)},function(t,e,n){"use strict";var i=e;i.version=n(211).version,i.utils=n(10),i.rand=n(57),i.curve=n(114),i.curves=n(61),i.ec=n(222),i.eddsa=n(226)},function(t,e,n){"use strict";var i,r=e,o=n(62),a=n(114),s=n(10).assert;function l(t){"short"===t.type?this.curve=new a.short(t):"edwards"===t.type?this.curve=new a.edwards(t):this.curve=new a.mont(t),this.g=this.curve.g,this.n=this.curve.n,this.hash=t.hash,s(this.g.validate(),"Invalid curve"),s(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function c(t,e){Object.defineProperty(r,t,{configurable:!0,enumerable:!0,get:function(){var n=new l(e);return Object.defineProperty(r,t,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=l,c("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:o.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),c("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:o.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),c("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:o.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),c("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:o.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),c("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:o.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),c("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["9"]}),c("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:o.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{i=n(221)}catch(t){i=void 0}c("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:o.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",i]})},function(t,e,n){var i=e;i.utils=n(11),i.common=n(32),i.sha=n(215),i.ripemd=n(219),i.hmac=n(220),i.sha1=i.sha.sha1,i.sha256=i.sha.sha256,i.sha224=i.sha.sha224,i.sha384=i.sha.sha384,i.sha512=i.sha.sha512,i.ripemd160=i.ripemd.ripemd160},function(t,e,n){"use strict";(function(e){var i,r=n(6),o=r.Buffer,a={};for(i in r)r.hasOwnProperty(i)&&"SlowBuffer"!==i&&"Buffer"!==i&&(a[i]=r[i]);var s=a.Buffer={};for(i in o)o.hasOwnProperty(i)&&"allocUnsafe"!==i&&"allocUnsafeSlow"!==i&&(s[i]=o[i]);if(a.Buffer.prototype=o.prototype,s.from&&s.from!==Uint8Array.from||(s.from=function(t,e,n){if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&void 0===t.length)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return o(t,e,n)}),s.alloc||(s.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var i=o(t);return e&&0!==e.length?"string"==typeof n?i.fill(e,n):i.fill(e):i.fill(0),i}),!a.kStringMaxLength)try{a.kStringMaxLength=e.binding("buffer").kStringMaxLength}catch(t){}a.constants||(a.constants={MAX_LENGTH:a.kMaxLength},a.kStringMaxLength&&(a.constants.MAX_STRING_LENGTH=a.kStringMaxLength)),t.exports=a}).call(this,n(4))},function(t,e,n){"use strict";const i=n(65).Reporter,r=n(33).EncoderBuffer,o=n(33).DecoderBuffer,a=n(9),s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],l=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s);function c(t,e,n){const i={};this._baseState=i,i.name=n,i.enc=t,i.parent=e||null,i.children=null,i.tag=null,i.args=null,i.reverseArgs=null,i.choice=null,i.optional=!1,i.any=!1,i.obj=!1,i.use=null,i.useDecoder=null,i.key=null,i.default=null,i.explicit=null,i.implicit=null,i.contains=null,i.parent||(i.children=[],this._wrap())}t.exports=c;const u=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];c.prototype.clone=function(){const t=this._baseState,e={};u.forEach((function(n){e[n]=t[n]}));const n=new this.constructor(e.parent);return n._baseState=e,n},c.prototype._wrap=function(){const t=this._baseState;l.forEach((function(e){this[e]=function(){const n=new this.constructor(this);return t.children.push(n),n[e].apply(n,arguments)}}),this)},c.prototype._init=function(t){const e=this._baseState;a(null===e.parent),t.call(this),e.children=e.children.filter((function(t){return t._baseState.parent===this}),this),a.equal(e.children.length,1,"Root node can have only one child")},c.prototype._useArgs=function(t){const e=this._baseState,n=t.filter((function(t){return t instanceof this.constructor}),this);t=t.filter((function(t){return!(t instanceof this.constructor)}),this),0!==n.length&&(a(null===e.children),e.children=n,n.forEach((function(t){t._baseState.parent=this}),this)),0!==t.length&&(a(null===e.args),e.args=t,e.reverseArgs=t.map((function(t){if("object"!=typeof t||t.constructor!==Object)return t;const e={};return Object.keys(t).forEach((function(n){n==(0|n)&&(n|=0);const i=t[n];e[i]=n})),e})))},["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"].forEach((function(t){c.prototype[t]=function(){const e=this._baseState;throw new Error(t+" not implemented for encoding: "+e.enc)}})),s.forEach((function(t){c.prototype[t]=function(){const e=this._baseState,n=Array.prototype.slice.call(arguments);return a(null===e.tag),e.tag=t,this._useArgs(n),this}})),c.prototype.use=function(t){a(t);const e=this._baseState;return a(null===e.use),e.use=t,this},c.prototype.optional=function(){return this._baseState.optional=!0,this},c.prototype.def=function(t){const e=this._baseState;return a(null===e.default),e.default=t,e.optional=!0,this},c.prototype.explicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.explicit=t,this},c.prototype.implicit=function(t){const e=this._baseState;return a(null===e.explicit&&null===e.implicit),e.implicit=t,this},c.prototype.obj=function(){const t=this._baseState,e=Array.prototype.slice.call(arguments);return t.obj=!0,0!==e.length&&this._useArgs(e),this},c.prototype.key=function(t){const e=this._baseState;return a(null===e.key),e.key=t,this},c.prototype.any=function(){return this._baseState.any=!0,this},c.prototype.choice=function(t){const e=this._baseState;return a(null===e.choice),e.choice=t,this._useArgs(Object.keys(t).map((function(e){return t[e]}))),this},c.prototype.contains=function(t){const e=this._baseState;return a(null===e.use),e.contains=t,this},c.prototype._decode=function(t,e){const n=this._baseState;if(null===n.parent)return t.wrapResult(n.children[0]._decode(t,e));let i,r=n.default,a=!0,s=null;if(null!==n.key&&(s=t.enterKey(n.key)),n.optional){let i=null;if(null!==n.explicit?i=n.explicit:null!==n.implicit?i=n.implicit:null!==n.tag&&(i=n.tag),null!==i||n.any){if(a=this._peekTag(t,i,n.any),t.isError(a))return a}else{const i=t.save();try{null===n.choice?this._decodeGeneric(n.tag,t,e):this._decodeChoice(t,e),a=!0}catch(t){a=!1}t.restore(i)}}if(n.obj&&a&&(i=t.enterObject()),a){if(null!==n.explicit){const e=this._decodeTag(t,n.explicit);if(t.isError(e))return e;t=e}const i=t.offset;if(null===n.use&&null===n.choice){let e;n.any&&(e=t.save());const i=this._decodeTag(t,null!==n.implicit?n.implicit:n.tag,n.any);if(t.isError(i))return i;n.any?r=t.raw(e):t=i}if(e&&e.track&&null!==n.tag&&e.track(t.path(),i,t.length,"tagged"),e&&e.track&&null!==n.tag&&e.track(t.path(),t.offset,t.length,"content"),n.any||(r=null===n.choice?this._decodeGeneric(n.tag,t,e):this._decodeChoice(t,e)),t.isError(r))return r;if(n.any||null!==n.choice||null===n.children||n.children.forEach((function(n){n._decode(t,e)})),n.contains&&("octstr"===n.tag||"bitstr"===n.tag)){const i=new o(r);r=this._getUse(n.contains,t._reporterState.obj)._decode(i,e)}}return n.obj&&a&&(r=t.leaveObject(i)),null===n.key||null===r&&!0!==a?null!==s&&t.exitKey(s):t.leaveKey(s,n.key,r),r},c.prototype._decodeGeneric=function(t,e,n){const i=this._baseState;return"seq"===t||"set"===t?null:"seqof"===t||"setof"===t?this._decodeList(e,t,i.args[0],n):/str$/.test(t)?this._decodeStr(e,t,n):"objid"===t&&i.args?this._decodeObjid(e,i.args[0],i.args[1],n):"objid"===t?this._decodeObjid(e,null,null,n):"gentime"===t||"utctime"===t?this._decodeTime(e,t,n):"null_"===t?this._decodeNull(e,n):"bool"===t?this._decodeBool(e,n):"objDesc"===t?this._decodeStr(e,t,n):"int"===t||"enum"===t?this._decodeInt(e,i.args&&i.args[0],n):null!==i.use?this._getUse(i.use,e._reporterState.obj)._decode(e,n):e.error("unknown tag: "+t)},c.prototype._getUse=function(t,e){const n=this._baseState;return n.useDecoder=this._use(t,e),a(null===n.useDecoder._baseState.parent),n.useDecoder=n.useDecoder._baseState.children[0],n.implicit!==n.useDecoder._baseState.implicit&&(n.useDecoder=n.useDecoder.clone(),n.useDecoder._baseState.implicit=n.implicit),n.useDecoder},c.prototype._decodeChoice=function(t,e){const n=this._baseState;let i=null,r=!1;return Object.keys(n.choice).some((function(o){const a=t.save(),s=n.choice[o];try{const n=s._decode(t,e);if(t.isError(n))return!1;i={type:o,value:n},r=!0}catch(e){return t.restore(a),!1}return!0}),this),r?i:t.error("Choice not matched")},c.prototype._createEncoderBuffer=function(t){return new r(t,this.reporter)},c.prototype._encode=function(t,e,n){const i=this._baseState;if(null!==i.default&&i.default===t)return;const r=this._encodeValue(t,e,n);return void 0===r||this._skipDefault(r,e,n)?void 0:r},c.prototype._encodeValue=function(t,e,n){const r=this._baseState;if(null===r.parent)return r.children[0]._encode(t,e||new i);let o=null;if(this.reporter=e,r.optional&&void 0===t){if(null===r.default)return;t=r.default}let a=null,s=!1;if(r.any)o=this._createEncoderBuffer(t);else if(r.choice)o=this._encodeChoice(t,e);else if(r.contains)a=this._getUse(r.contains,n)._encode(t,e),s=!0;else if(r.children)a=r.children.map((function(n){if("null_"===n._baseState.tag)return n._encode(null,e,t);if(null===n._baseState.key)return e.error("Child should have a key");const i=e.enterKey(n._baseState.key);if("object"!=typeof t)return e.error("Child expected, but input is not object");const r=n._encode(t[n._baseState.key],e,t);return e.leaveKey(i),r}),this).filter((function(t){return t})),a=this._createEncoderBuffer(a);else if("seqof"===r.tag||"setof"===r.tag){if(!r.args||1!==r.args.length)return e.error("Too many args for : "+r.tag);if(!Array.isArray(t))return e.error("seqof/setof, but data is not Array");const n=this.clone();n._baseState.implicit=null,a=this._createEncoderBuffer(t.map((function(n){const i=this._baseState;return this._getUse(i.args[0],t)._encode(n,e)}),n))}else null!==r.use?o=this._getUse(r.use,n)._encode(t,e):(a=this._encodePrimitive(r.tag,t),s=!0);if(!r.any&&null===r.choice){const t=null!==r.implicit?r.implicit:r.tag,n=null===r.implicit?"universal":"context";null===t?null===r.use&&e.error("Tag could be omitted only for .use()"):null===r.use&&(o=this._encodeComposite(t,s,n,a))}return null!==r.explicit&&(o=this._encodeComposite(r.explicit,!1,"context",o)),o},c.prototype._encodeChoice=function(t,e){const n=this._baseState,i=n.choice[t.type];return i||a(!1,t.type+" not found in "+JSON.stringify(Object.keys(n.choice))),i._encode(t.value,e)},c.prototype._encodePrimitive=function(t,e){const n=this._baseState;if(/str$/.test(t))return this._encodeStr(e,t);if("objid"===t&&n.args)return this._encodeObjid(e,n.reverseArgs[0],n.args[1]);if("objid"===t)return this._encodeObjid(e,null,null);if("gentime"===t||"utctime"===t)return this._encodeTime(e,t);if("null_"===t)return this._encodeNull();if("int"===t||"enum"===t)return this._encodeInt(e,n.args&&n.reverseArgs[0]);if("bool"===t)return this._encodeBool(e);if("objDesc"===t)return this._encodeStr(e,t);throw new Error("Unsupported tag: "+t)},c.prototype._isNumstr=function(t){return/^[0-9 ]*$/.test(t)},c.prototype._isPrintstr=function(t){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(t)}},function(t,e,n){"use strict";const i=n(0);function r(t){this._reporterState={obj:null,path:[],options:t||{},errors:[]}}function o(t,e){this.path=t,this.rethrow(e)}e.Reporter=r,r.prototype.isError=function(t){return t instanceof o},r.prototype.save=function(){const t=this._reporterState;return{obj:t.obj,pathLen:t.path.length}},r.prototype.restore=function(t){const e=this._reporterState;e.obj=t.obj,e.path=e.path.slice(0,t.pathLen)},r.prototype.enterKey=function(t){return this._reporterState.path.push(t)},r.prototype.exitKey=function(t){const e=this._reporterState;e.path=e.path.slice(0,t-1)},r.prototype.leaveKey=function(t,e,n){const i=this._reporterState;this.exitKey(t),null!==i.obj&&(i.obj[e]=n)},r.prototype.path=function(){return this._reporterState.path.join("/")},r.prototype.enterObject=function(){const t=this._reporterState,e=t.obj;return t.obj={},e},r.prototype.leaveObject=function(t){const e=this._reporterState,n=e.obj;return e.obj=t,n},r.prototype.error=function(t){let e;const n=this._reporterState,i=t instanceof o;if(e=i?t:new o(n.path.map((function(t){return"["+JSON.stringify(t)+"]"})).join(""),t.message||t,t.stack),!n.options.partial)throw e;return i||n.errors.push(e),e},r.prototype.wrapResult=function(t){const e=this._reporterState;return e.options.partial?{result:this.isError(t)?null:t,errors:e.errors}:t},i(o,Error),o.prototype.rethrow=function(t){if(this.message=t+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,o),!this.stack)try{throw new Error(this.message)}catch(t){this.stack=t.stack}return this}},function(t,e,n){"use strict";function i(t){const e={};return Object.keys(t).forEach((function(n){(0|n)==n&&(n|=0);const i=t[n];e[i]=n})),e}e.tagClass={0:"universal",1:"application",2:"context",3:"private"},e.tagClassByName=i(e.tagClass),e.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},e.tagByName=i(e.tag)},function(t,e,n){var i,r,o;r=[e,n(1)],void 0===(o="function"==typeof(i=function(t,e){"use strict";var n,i,r,o,a,s,l=e.kotlin.io.println_s8jyv4$,c=e.Kind.CLASS,u=e.kotlin.lazy_klfg04$,p=e.wrapFunction,h=e.kotlin.collections.listOf_mh5how$,f=(e.kotlin.collections.asList_us0mfu$,e.kotlin.Enum),d=e.throwISE,_=(e.kotlin.Unit,e.Kind.INTERFACE),y=e.kotlin.text.StringBuilder_init;function m(t){void 0===t&&(t=new z),g.call(this),this.throwableStringProvider_0=t}function v(t){return function(){return t()}}function $(t,e){void 0===t&&(t=h(new m)),void 0===e&&(e="Kermit"),this.loggerList_0=t,this.defaultTag_0=e}function g(){}function b(t,e){f.call(this),this.name$=t,this.ordinal$=e}function w(){w=function(){},n=new b("Verbose",0),i=new b("Debug",1),r=new b("Info",2),o=new b("Warn",3),a=new b("Error",4),s=new b("Assert",5)}function k(){return w(),n}function S(){return w(),i}function x(){return w(),r}function E(){return w(),o}function C(){return w(),a}function O(){return w(),s}function N(){}function z(){}m.prototype=Object.create(g.prototype),m.prototype.constructor=m,b.prototype=Object.create(f.prototype),b.prototype.constructor=b,m.prototype.log_hbb6rz$$default=function(t,e,n,i){l(t.toString()+": ("+n+") "+e),null!=i&&l(this.throwableStringProvider_0.getThrowableString_tcv7n7$(i))},m.$metadata$={kind:c,simpleName:"CommonLogger",interfaces:[g]},$.prototype.withTag_61zpoe$=function(t){return new $(this.loggerList_0,t)},$.prototype.v_ttfnl4$=function(t,e,n){void 0===t&&(t=this.defaultTag_0),void 0===e&&(e=null);var i,r=k(),o=u(v(n));for(i=this.loggerList_0.iterator();i.hasNext();){var a=i.next();a.isLoggable_7vw6fh$(r)&&a.v_gqh5ww$(o.value,t,e)}},$.prototype.v_h4ejuu$=function(t){this.v_ttfnl4$(void 0,void 0,t)},$.prototype.v_l35kib$=function(t,e){this.v_ttfnl4$(void 0,t,e)},$.prototype.v_swpfbs$=function(t,e){this.v_ttfnl4$(t,void 0,e)},$.prototype.d_ttfnl4$=function(t,e,n){void 0===t&&(t=this.defaultTag_0),void 0===e&&(e=null);var i,r=S(),o=u(v(n));for(i=this.loggerList_0.iterator();i.hasNext();){var a=i.next();a.isLoggable_7vw6fh$(r)&&a.d_gqh5ww$(o.value,t,e)}},$.prototype.d_h4ejuu$=function(t){this.d_ttfnl4$(void 0,void 0,t)},$.prototype.d_sd3n2e$=function(t,e){this.d_ttfnl4$(void 0,t,e)},$.prototype.d_swpfbs$=function(t,e){this.d_ttfnl4$(t,void 0,e)},$.prototype.i_ttfnl4$=function(t,e,n){void 0===t&&(t=this.defaultTag_0),void 0===e&&(e=null);var i,r=x(),o=u(v(n));for(i=this.loggerList_0.iterator();i.hasNext();){var a=i.next();a.isLoggable_7vw6fh$(r)&&a.i_gqh5ww$(o.value,t,e)}},$.prototype.i_h4ejuu$=function(t){this.i_ttfnl4$(void 0,void 0,t)},$.prototype.i_sd3n2e$=function(t,e){this.i_ttfnl4$(void 0,t,e)},$.prototype.i_swpfbs$=function(t,e){this.i_ttfnl4$(t,void 0,e)},$.prototype.w_ttfnl4$=function(t,e,n){void 0===t&&(t=this.defaultTag_0),void 0===e&&(e=null);var i,r=E(),o=u(v(n));for(i=this.loggerList_0.iterator();i.hasNext();){var a=i.next();a.isLoggable_7vw6fh$(r)&&a.w_gqh5ww$(o.value,t,e)}},$.prototype.w_h4ejuu$=function(t){this.w_ttfnl4$(void 0,void 0,t)},$.prototype.w_sd3n2e$=function(t,e){this.w_ttfnl4$(void 0,t,e)},$.prototype.w_swpfbs$=function(t,e){this.w_ttfnl4$(t,void 0,e)},$.prototype.e_ttfnl4$=function(t,e,n){void 0===t&&(t=this.defaultTag_0),void 0===e&&(e=null);var i,r=C(),o=u(v(n));for(i=this.loggerList_0.iterator();i.hasNext();){var a=i.next();a.isLoggable_7vw6fh$(r)&&a.e_gqh5ww$(o.value,t,e)}},$.prototype.e_h4ejuu$=function(t){this.e_ttfnl4$(void 0,void 0,t)},$.prototype.e_sd3n2e$=function(t,e){this.e_ttfnl4$(void 0,t,e)},$.prototype.e_swpfbs$=function(t,e){this.e_ttfnl4$(t,void 0,e)},$.prototype.wtf_ttfnl4$=function(t,e,n){void 0===t&&(t=this.defaultTag_0),void 0===e&&(e=null);var i,r=O(),o=u(v(n));for(i=this.loggerList_0.iterator();i.hasNext();){var a=i.next();a.isLoggable_7vw6fh$(r)&&a.wtf_gqh5ww$(o.value,t,e)}},$.prototype.wtf_h4ejuu$=function(t){this.wtf_ttfnl4$(void 0,void 0,t)},$.prototype.wtf_sd3n2e$=function(t,e){this.wtf_ttfnl4$(void 0,t,e)},$.prototype.wtf_swpfbs$=function(t,e){this.wtf_ttfnl4$(t,void 0,e)},$.prototype.log_lb0tcp$=function(t,e,n,i){void 0===e&&(e=this.defaultTag_0);var r,o=u(v(i));for(r=this.loggerList_0.iterator();r.hasNext();){var a=r.next();a.isLoggable_7vw6fh$(t)&&a.log_hbb6rz$(t,o.value,e,n)}},$.prototype.processLog_0=p((function(){return function(t,e,n,i,r){var o,a,s=u((o=i,function(){return o()}));for(a=this.loggerList_0.iterator();a.hasNext();){var l=a.next();l.isLoggable_7vw6fh$(t)&&r(l,s.value,e,n)}}})),$.$metadata$={kind:c,simpleName:"Kermit",interfaces:[]},g.prototype.isLoggable_7vw6fh$=function(t){return!0},g.prototype.log_hbb6rz$=function(t,e,n,i,r){void 0===i&&(i=null),r?r(t,e,n,i):this.log_hbb6rz$$default(t,e,n,i)},g.prototype.v_gqh5ww$$default=function(t,e,n){this.log_hbb6rz$(k(),t,e,n)},g.prototype.v_gqh5ww$=function(t,e,n,i){void 0===n&&(n=null),i?i(t,e,n):this.v_gqh5ww$$default(t,e,n)},g.prototype.d_gqh5ww$$default=function(t,e,n){this.log_hbb6rz$(S(),t,e,n)},g.prototype.d_gqh5ww$=function(t,e,n,i){void 0===n&&(n=null),i?i(t,e,n):this.d_gqh5ww$$default(t,e,n)},g.prototype.i_gqh5ww$$default=function(t,e,n){this.log_hbb6rz$(x(),t,e,n)},g.prototype.i_gqh5ww$=function(t,e,n,i){void 0===n&&(n=null),i?i(t,e,n):this.i_gqh5ww$$default(t,e,n)},g.prototype.w_gqh5ww$$default=function(t,e,n){this.log_hbb6rz$(E(),t,e,n)},g.prototype.w_gqh5ww$=function(t,e,n,i){void 0===n&&(n=null),i?i(t,e,n):this.w_gqh5ww$$default(t,e,n)},g.prototype.e_gqh5ww$$default=function(t,e,n){this.log_hbb6rz$(C(),t,e,n)},g.prototype.e_gqh5ww$=function(t,e,n,i){void 0===n&&(n=null),i?i(t,e,n):this.e_gqh5ww$$default(t,e,n)},g.prototype.wtf_gqh5ww$$default=function(t,e,n){this.log_hbb6rz$(O(),t,e,n)},g.prototype.wtf_gqh5ww$=function(t,e,n,i){void 0===n&&(n=null),i?i(t,e,n):this.wtf_gqh5ww$$default(t,e,n)},g.$metadata$={kind:c,simpleName:"Logger",interfaces:[]},b.$metadata$={kind:c,simpleName:"Severity",interfaces:[f]},b.values=function(){return[k(),S(),x(),E(),C(),O()]},b.valueOf_61zpoe$=function(t){switch(t){case"Verbose":return k();case"Debug":return S();case"Info":return x();case"Warn":return E();case"Error":return C();case"Assert":return O();default:d("No enum constant co.touchlab.kermit.Severity."+t)}},N.prototype.getThrowableString_tcv7n7$=function(t){var e,n,i=y(),r=(n=i,function t(e,i){var r;void 0===i&&(i=0),n.append_pdl1vj$("Caused by: "+e.toString()+"\n"),null!=(r=e.cause)&&r!==e&&i<2&&t(r,i+1|0)});return i.append_pdl1vj$(t.toString()+"\n"),null!=(e=t.cause)&&r(e),i.toString()},N.$metadata$={kind:_,simpleName:"ThrowableStringProvider",interfaces:[]},z.$metadata$={kind:c,simpleName:"PlatformThrowableStringProvider",interfaces:[N]};var j=t.co||(t.co={}),T=j.touchlab||(j.touchlab={}),P=T.kermit||(T.kermit={});return P.CommonLogger=m,P.Kermit_init_bigt7k$=function(t,e){return e=e||Object.create($.prototype),$.call(e,h(t)),e},P.Kermit=$,P.Logger=g,Object.defineProperty(b,"Verbose",{get:k}),Object.defineProperty(b,"Debug",{get:S}),Object.defineProperty(b,"Info",{get:x}),Object.defineProperty(b,"Warn",{get:E}),Object.defineProperty(b,"Error",{get:C}),Object.defineProperty(b,"Assert",{get:O}),P.Severity=b,P.ThrowableStringProvider=N,P.PlatformThrowableStringProvider=z,z.prototype.getThrowableString_tcv7n7$=N.prototype.getThrowableString_tcv7n7$,t})?i.apply(e,r):i)||(t.exports=o)},function(t,e,n){var i,r,o;r=[e,n(1)],void 0===(o="function"==typeof(i=function(t,e){"use strict";var n=e.getKClass,i=e.Kind.CLASS,r=e.kotlin.Annotation,o=e.Kind.INTERFACE,a=(e.kotlin.js.internal.StringCompanionObject,e.toString),s=e.kotlin.Unit,l=e.kotlin.IllegalArgumentException_init_pdl1vj$,c=e.kotlin.collections.zip_r9t3v7$,u=e.kotlin.collections.toMap_6hr0sd$,p=e.kotlin.collections.Grouping,h=e.kotlin.collections.LinkedHashMap_init_q3lmfv$,f=e.kotlin.IllegalStateException_init_pdl1vj$,d=e.kotlin.collections.mapCapacity_za3lpa$,_=e.kotlin.collections.LinkedHashMap_init_bwtc7$,y=e.kotlin.collections.Map,m=e.throwCCE,v=(e.defineInlineFunction,e.wrapFunction,e.kotlin.IllegalArgumentException),$=(e.kotlin.IllegalArgumentException_init,e.kotlin.IllegalArgumentException_init_dbl4no$,e.getCallableRef),g=e.kotlin.collections.Collection,b=e.equals,w=e.kotlin.collections.List,k=e.kotlin.collections.MutableList,S=e.kotlin.collections.ArrayList,x=e.kotlin.collections.HashSet,E=e.kotlin.collections.Set,C=e.kotlin.collections.MutableSet,O=e.kotlin.collections.LinkedHashSet,N=e.kotlin.collections.HashMap,z=e.kotlin.collections.MutableMap,j=e.kotlin.collections.LinkedHashMap,T=e.kotlin.collections.Map.Entry,P=e.kotlin.Pair,R=e.kotlin.Triple,A=e.kotlin.reflect.KClass,I=e.kotlin.collections.collectionSizeOrDefault_ba2ldo$,M=e.kotlin.collections.ArrayList_init_ww73n8$,L=e.kotlin.collections.copyToArray,D=(e.kotlin.text.toLong_pdl1vz$,e.Kind.OBJECT),q=e.kotlin.collections.emptyList_287e2$,F=e.hashCode,U=e.kotlin.collections.Iterator,B=e.kotlin.collections.Iterable,H=e.kotlin.collections.toList_us0mfu$,V=e.kotlin.collections.ArrayList_init_287e2$,K=e.kotlin.collections.HashSet_init_287e2$,W=e.arrayEquals,Y=e.kotlin.ranges.until_dqglrj$,G=e.kotlin.collections.joinToString_fmv235$,J=e.kotlin.collections.toHashSet_7wnvza$,Z=e.kotlin.collections.toBooleanArray_xmyvgf$,Q=e.kotlin.collections.withIndex_us0mfu$,X=e.kotlin.to_ujzrz7$,tt=e.kotlin.lazy_klfg04$,et=e.kotlin.text.isBlank_gw00vp$,nt=e.ensureNotNull,it=e.toBoxedChar,rt=Object,ot=Error,at=e.kotlin.text.toIntOrNull_pdl1vz$,st=e.kotlin.collections.getValue_t9ocha$,lt=e.kotlin.collections.asList_us0mfu$,ct=e.kotlin.collections.ArrayList_init_mqih57$,ut=e.kotlin.collections.LinkedHashSet_init_mqih57$,pt=e.kotlin.collections.HashSet_init_mqih57$,ht=e.kotlin.collections.LinkedHashMap_init_73mtqc$,ft=e.kotlin.collections.HashMap_init_q3lmfv$,dt=e.kotlin.collections.HashMap_init_73mtqc$,_t=e.kotlin.collections.LinkedHashSet_init_287e2$,yt=e.kotlin.collections.indexOf_mjy6jw$,mt=e.arrayToString,vt=e.kotlin.collections.get_indices_m7z4lg$,$t=Array,gt=(e.kotlin.js.internal.IntCompanionObject,e.kotlin.js.internal.LongCompanionObject,e.kotlin.js.internal.ByteCompanionObject,e.kotlin.js.internal.ShortCompanionObject,e.kotlin.UInt),bt=e.kotlin.ULong,wt=e.kotlin.UByte,kt=e.kotlin.UShort,St=(e.toByte,e.kotlin.ranges.CharRange,e.kotlin.text.StringBuilder_init_za3lpa$,e.kotlin.text.trimStart_wqw3xr$,e.kotlin.collections.HashSet_init_ww73n8$),xt=e.arrayHashCode,Et=e.kotlin.ranges.coerceAtLeast_dqglrj$,Ct=e.kotlin.collections.copyOf_mrm5p$,Ot=e.kotlin.collections.copyOf_m2jy6x$,Nt=e.kotlin.collections.copyOf_c03ot6$,zt=e.kotlin.collections.copyOf_3aefkx$,jt=(e.kotlin.js.internal.FloatCompanionObject,e.kotlin.collections.copyOf_rblqex$),Tt=(e.kotlin.js.internal.DoubleCompanionObject,e.kotlin.collections.copyOf_xgrzbe$),Pt=e.unboxChar,Rt=(e.kotlin.js.internal.CharCompanionObject,e.kotlin.collections.copyOf_gtcw5h$),At=(e.kotlin.js.internal.BooleanCompanionObject,e.kotlin.collections.copyOf_1qu12l$),It=e.kotlin.reflect.js.internal.PrimitiveClasses.stringClass,Mt=e.BoxedChar,Lt=e.kotlin.reflect.js.internal.PrimitiveClasses.charArrayClass,Dt=e.kotlin.reflect.js.internal.PrimitiveClasses.doubleClass,qt=e.kotlin.reflect.js.internal.PrimitiveClasses.doubleArrayClass,Ft=e.kotlin.reflect.js.internal.PrimitiveClasses.floatClass,Ut=e.kotlin.reflect.js.internal.PrimitiveClasses.floatArrayClass,Bt=e.Long,Ht=e.kotlin.reflect.js.internal.PrimitiveClasses.longArrayClass,Vt=e.kotlin.reflect.js.internal.PrimitiveClasses.intClass,Kt=e.kotlin.reflect.js.internal.PrimitiveClasses.intArrayClass,Wt=e.kotlin.reflect.js.internal.PrimitiveClasses.shortClass,Yt=e.kotlin.reflect.js.internal.PrimitiveClasses.shortArrayClass,Gt=e.kotlin.reflect.js.internal.PrimitiveClasses.byteClass,Jt=e.kotlin.reflect.js.internal.PrimitiveClasses.byteArrayClass,Zt=e.kotlin.reflect.js.internal.PrimitiveClasses.booleanClass,Qt=e.kotlin.reflect.js.internal.PrimitiveClasses.booleanArrayClass,Xt=e.kotlin,te=e.kotlin.collections.mapOf_qfcya0$,ee=e.kotlin.text.capitalize_pdl1vz$,ne=e.kotlin.text.equals_igcy3c$,ie=e.kotlin.text.trimIndent_pdl1vz$,re=e.kotlin.collections.last_2p1efm$,oe=e.kotlin.collections.lastOrNull_2p1efm$,ae=e.kotlin.collections.get_lastIndex_55thoc$,se=e.kotlin.collections.emptyMap_q3lmfv$,le=e.kotlin.IndexOutOfBoundsException,ce=e.kotlin.collections.get_indices_l1lu5t$,ue=e.kotlin.js.get_js_1yb8b7$,pe=e.kotlin.reflect.js.internal.PrimitiveClasses.arrayClass,he=e.findAssociatedObject_yjf3nl$;function fe(){}function de(){}function _e(){}function ye(t,e,n){var i;return null!=(i=t.findPolymorphicSerializerOrNull_ca6uye$(e,n))?i:Oi(n,t.baseClass)}function me(t,n,i){var r;return null!=(r=t.findPolymorphicSerializerOrNull_kjsxpj$(n,i))?r:Ni(e.getKClassFromExpression(i),t.baseClass)}function ve(t,e){this.this$groupingBy=t,this.closure$keySelector=e}function $e(t,e,n,i){var r,o;if(Ci.call(this),this.baseClass_a0a98o$_0=e,this.descriptor_gganzq$_0=cn(t,ci(),[],(r=this,o=i,function(t){t.element_vxrguq$("type",Xe().descriptor);var e=cn("kotlinx.serialization.Sealed<"+a(r.baseClass.simpleName)+">",vn(),[],function(t){return function(e){var n,i=t;for(n=0;n!==i.length;++n){var r=i[n].descriptor;e.element_vxrguq$(r.serialName,r)}return s}}(o));return t.element_vxrguq$("value",e),s})),this.class2Serializer_0=null,this.serialName2Serializer_0=null,n.length!==i.length)throw l("All subclasses of sealed class "+a(this.baseClass.simpleName)+" should be marked @Serializable");this.class2Serializer_0=u(c(n,i));var p,y=new ve(this.class2Serializer_0.entries,ge),m=h();for(p=y.sourceIterator();p.hasNext();){var v=p.next(),$=y.keyOf_11rb$(v),g=m.get_11rb$($),b=m.put_xwzc9p$;if(null==g&&m.containsKey_11rb$($),null!=g)throw f(("Multiple sealed subclasses of '"+this.baseClass+"' have the same serial name '"+$+"': '"+g.key+"', '"+v.key+"'").toString());b.call(m,$,v)}var w,k=_(d(m.size));for(w=m.entries.iterator();w.hasNext();){var S=w.next();k.put_xwzc9p$(S.key,S.value.value)}this.serialName2Serializer_0=k}function ge(t){return t.value.descriptor.serialName}function be(){}function we(){}function ke(){this.name="SerializationException"}function Se(t,e){return e=e||Object.create(ke.prototype),l(t,e),ke.call(e),e}function xe(t,e,n){return n=n||Object.create(ke.prototype),v.call(n,t,e),ke.call(n),n}function Ee(t,e){xe(t,e,this),this.name="MissingFieldException"}function Ce(t){Se(t,this),this.name="UnknownFieldException"}function Oe(t,e){var n;return null!=(n=ze(t,e,!0))?n:la(Sr(e))}function Ne(t,e){return ze(t,e,!1)}function ze(t,i,r){var o,a,s,c=Sr(i),u=i.isMarkedNullable,p=i.arguments,h=M(I(p,10));for(s=p.iterator();s.hasNext();){var f,d=s.next(),_=h.add_11rb$,v=d.type;if(null==v)throw l(("Star projections in type arguments are not allowed, but had "+i).toString());f=v,_.call(h,f)}var D,q,F=h;return null!=(D=null!=(a=F.isEmpty()?null!=(o=je(c))?o:t.getContextual_lmshww$(c):function(t,i,r,o){var a,s,l;if(o){var c,u=$("serializer",function(t,e){return Oe(t,e)}.bind(null,t)),p=M(I(i,10));for(c=i.iterator();c.hasNext();){var h=c.next();p.add_11rb$(u(h))}a=p}else{var f,d=M(I(i,10));for(f=i.iterator();f.hasNext();){var _,v=f.next(),D=d.add_11rb$;if(null==(_=Ne(t,v)))return null;D.call(d,_)}a=d}var q=a;if(b(r,n(g))||b(r,n(w))||b(r,n(k))||b(r,n(S)))l=new Ki(q.get_za3lpa$(0));else if(b(r,n(x)))l=new Yi(q.get_za3lpa$(0));else if(b(r,n(E))||b(r,n(C))||b(r,n(O)))l=new Wi(q.get_za3lpa$(0));else if(b(r,n(N)))l=new Ji(q.get_za3lpa$(0),q.get_za3lpa$(1));else if(b(r,n(y))||b(r,n(z))||b(r,n(j)))l=new Gi(q.get_za3lpa$(0),q.get_za3lpa$(1));else if(b(r,n(T)))l=Re(q.get_za3lpa$(0),q.get_za3lpa$(1));else if(b(r,n(P)))l=Pe(q.get_za3lpa$(0),q.get_za3lpa$(1));else if(b(r,n(R)))l=Ae(q.get_za3lpa$(0),q.get_za3lpa$(1),q.get_za3lpa$(2));else{var F;if(ua(r))return e.isType(F=tn(e.isType(s=i.get_za3lpa$(0).classifier,A)?s:m(),q.get_za3lpa$(0)),fe)?F:m();l=ca(r,L(q).slice())}return l}(t,F,c,r))?e.isType(q=a,fe)?q:m():null)?function(t,n){var i;return n?Te(t):e.isType(i=t,fe)?i:m()}(D,u):null}function je(t){var e;return null!=(e=oa(t))?e:uo(t)}function Te(t){var n;return t.descriptor.isNullable?e.isType(n=t,fe)?n:m():new vr(t)}function Pe(t,e){return new Zo(t,e)}function Re(t,e){return new Go(t,e)}function Ae(t,e,n){return new Qo(t,e,n)}function Ie(t){return Lo()}function Me(){return eo()}function Le(t){return go()}function De(){return jr()}function qe(t){return ko()}function Fe(){return Ar()}function Ue(t){return Eo()}function Be(){return Dr()}function He(t){return No()}function Ve(){return Br()}function Ke(t){return To()}function We(){return Wr()}function Ye(t){return Ao()}function Ge(){return Zr()}function Je(t){return mo()}function Ze(){return ao()}function Qe(t){return fo()}function Xe(t){return Bo()}function tn(t,e){return new Vi(t,e)}function en(t){this.closure$iterator=t}function nn(){}function rn(t){this.this$elementDescriptors=t,this.elementsLeft_0=t.elementsCount}function on(t){return new en((e=t,function(){return new rn(e)}));var e}function an(t){return s}function sn(t,e,n){if(void 0===n&&(n=an),et(t))throw l("Blank serial names are prohibited".toString());var i=new un(t);return n(i),new pn(t,Jn(),i.elementNames_8be2vx$.size,H(e),i)}function ln(t){return s}function cn(t,e,n,i){if(void 0===i&&(i=ln),et(t))throw l("Blank serial names are prohibited".toString());if(b(e,Jn()))throw l("For StructureKind.CLASS please use 'buildClassSerialDescriptor' instead".toString());var r=new un(t);return i(r),new pn(t,e,r.elementNames_8be2vx$.size,H(n),r)}function un(t){this.serialName=t,this.isNullable=!1,this.annotations=q(),this.elementNames_8be2vx$=V(),this.uniqueNames_0=K(),this.elementDescriptors_8be2vx$=V(),this.elementAnnotations_8be2vx$=V(),this.elementOptionality_8be2vx$=V()}function pn(t,e,n,i,r){this.serialName_btmdyn$_0=t,this.kind_589tly$_0=e,this.elementsCount_wewqc2$_0=n,this.annotations_efqcf6$_0=r.annotations,this.serialNames_bcpscy$_0=J(r.elementNames_8be2vx$),this.elementNames_0=L(r.elementNames_8be2vx$),this.elementDescriptors_0=wr(r.elementDescriptors_8be2vx$),this.elementAnnotations_0=L(r.elementAnnotations_8be2vx$),this.elementOptionality_0=Z(r.elementOptionality_8be2vx$);var o,a,s=Q(this.elementNames_0),l=M(I(s,10));for(o=s.iterator();o.hasNext();){var c=o.next();l.add_11rb$(X(c.value,c.index))}this.name2Index_0=u(l),this.typeParametersDescriptors_0=wr(i),this._hashCode_6e2cwc$_0=tt((a=this,function(){return Er(a,a.typeParametersDescriptors_0)}))}function hn(){}function fn(){dn=this,hn.call(this)}$e.prototype=Object.create(Ci.prototype),$e.prototype.constructor=$e,ke.prototype=Object.create(v.prototype),ke.prototype.constructor=ke,Ee.prototype=Object.create(ke.prototype),Ee.prototype.constructor=Ee,Ce.prototype=Object.create(ke.prototype),Ce.prototype.constructor=Ce,fn.prototype=Object.create(hn.prototype),fn.prototype.constructor=fn,yn.prototype=Object.create(hn.prototype),yn.prototype.constructor=yn,$n.prototype=Object.create(hn.prototype),$n.prototype.constructor=$n,gn.prototype=Object.create($n.prototype),gn.prototype.constructor=gn,kn.prototype=Object.create($n.prototype),kn.prototype.constructor=kn,En.prototype=Object.create($n.prototype),En.prototype.constructor=En,Nn.prototype=Object.create($n.prototype),Nn.prototype.constructor=Nn,Tn.prototype=Object.create($n.prototype),Tn.prototype.constructor=Tn,An.prototype=Object.create($n.prototype),An.prototype.constructor=An,Ln.prototype=Object.create($n.prototype),Ln.prototype.constructor=Ln,Fn.prototype=Object.create($n.prototype),Fn.prototype.constructor=Fn,Hn.prototype=Object.create($n.prototype),Hn.prototype.constructor=Hn,Wn.prototype=Object.create(hn.prototype),Wn.prototype.constructor=Wn,Yn.prototype=Object.create(Wn.prototype),Yn.prototype.constructor=Yn,Zn.prototype=Object.create(Wn.prototype),Zn.prototype.constructor=Zn,ti.prototype=Object.create(Wn.prototype),ti.prototype.constructor=ti,ii.prototype=Object.create(Wn.prototype),ii.prototype.constructor=ii,ai.prototype=Object.create(hn.prototype),ai.prototype.constructor=ai,si.prototype=Object.create(ai.prototype),si.prototype.constructor=si,ui.prototype=Object.create(ai.prototype),ui.prototype.constructor=ui,Pi.prototype=Object.create(ji.prototype),Pi.prototype.constructor=Pi,Ri.prototype=Object.create(ji.prototype),Ri.prototype.constructor=Ri,Ai.prototype=Object.create(ji.prototype),Ai.prototype.constructor=Ai,Ii.prototype=Object.create(ji.prototype),Ii.prototype.constructor=Ii,Mi.prototype=Object.create(ji.prototype),Mi.prototype.constructor=Mi,Li.prototype=Object.create(Ti.prototype),Li.prototype.constructor=Li,Di.prototype=Object.create(Ti.prototype),Di.prototype.constructor=Di,Fi.prototype=Object.create(qi.prototype),Fi.prototype.constructor=Fi,Ui.prototype=Object.create(qi.prototype),Ui.prototype.constructor=Ui,Hi.prototype=Object.create(Fi.prototype),Hi.prototype.constructor=Hi,Vi.prototype=Object.create(Fi.prototype),Vi.prototype.constructor=Vi,Ki.prototype=Object.create(Fi.prototype),Ki.prototype.constructor=Ki,Wi.prototype=Object.create(Fi.prototype),Wi.prototype.constructor=Wi,Yi.prototype=Object.create(Fi.prototype),Yi.prototype.constructor=Yi,Gi.prototype=Object.create(Ui.prototype),Gi.prototype.constructor=Gi,Ji.prototype=Object.create(Ui.prototype),Ji.prototype.constructor=Ji,Qi.prototype=Object.create(xr.prototype),Qi.prototype.constructor=Qi,fr.prototype=Object.create(fi.prototype),fr.prototype.constructor=fr,Nr.prototype=Object.create(Hi.prototype),Nr.prototype.constructor=Nr,Tr.prototype=Object.create(Bi.prototype),Tr.prototype.constructor=Tr,Pr.prototype=Object.create(Hi.prototype),Pr.prototype.constructor=Pr,Ir.prototype=Object.create(Bi.prototype),Ir.prototype.constructor=Ir,Mr.prototype=Object.create(Hi.prototype),Mr.prototype.constructor=Mr,qr.prototype=Object.create(Bi.prototype),qr.prototype.constructor=qr,Fr.prototype=Object.create(Hi.prototype),Fr.prototype.constructor=Fr,Hr.prototype=Object.create(Bi.prototype),Hr.prototype.constructor=Hr,Vr.prototype=Object.create(Hi.prototype),Vr.prototype.constructor=Vr,Yr.prototype=Object.create(Bi.prototype),Yr.prototype.constructor=Yr,Gr.prototype=Object.create(Hi.prototype),Gr.prototype.constructor=Gr,Qr.prototype=Object.create(Bi.prototype),Qr.prototype.constructor=Qr,Xr.prototype=Object.create(Hi.prototype),Xr.prototype.constructor=Xr,no.prototype=Object.create(Bi.prototype),no.prototype.constructor=no,io.prototype=Object.create(Hi.prototype),io.prototype.constructor=io,so.prototype=Object.create(Bi.prototype),so.prototype.constructor=so,Vo.prototype=Object.create(Ho.prototype),Vo.prototype.constructor=Vo,Wo.prototype=Object.create(Ko.prototype),Wo.prototype.constructor=Wo,Go.prototype=Object.create(Yo.prototype),Go.prototype.constructor=Go,Zo.prototype=Object.create(Yo.prototype),Zo.prototype.constructor=Zo,ta.prototype=Object.create(Xo.prototype),ta.prototype.constructor=ta,fe.$metadata$={kind:o,simpleName:"KSerializer",interfaces:[_e,de]},de.$metadata$={kind:o,simpleName:"SerializationStrategy",interfaces:[]},_e.$metadata$={kind:o,simpleName:"DeserializationStrategy",interfaces:[]},ve.prototype.sourceIterator=function(){return this.this$groupingBy.iterator()},ve.prototype.keyOf_11rb$=function(t){return this.closure$keySelector(t)},ve.$metadata$={kind:i,interfaces:[p]},Object.defineProperty($e.prototype,"baseClass",{get:function(){return this.baseClass_a0a98o$_0}}),Object.defineProperty($e.prototype,"descriptor",{configurable:!0,get:function(){return this.descriptor_gganzq$_0}}),$e.prototype.findPolymorphicSerializerOrNull_ca6uye$=function(t,n){var i,r,o=this.serialName2Serializer_0;return null!=(i=(e.isType(r=o,y)?r:m()).get_11rb$(n))?i:Ci.prototype.findPolymorphicSerializerOrNull_ca6uye$.call(this,t,n)},$e.prototype.findPolymorphicSerializerOrNull_kjsxpj$=function(t,n){var i,r,o;return null!=(r=null!=(i=this.class2Serializer_0.get_11rb$(e.getKClassFromExpression(n)))?i:Ci.prototype.findPolymorphicSerializerOrNull_kjsxpj$.call(this,t,n))?e.isType(o=r,de)?o:m():null},$e.$metadata$={kind:i,simpleName:"SealedClassSerializer",interfaces:[Ci]},be.$metadata$={kind:o,simpleName:"SerialFormat",interfaces:[]},we.$metadata$={kind:o,simpleName:"StringFormat",interfaces:[be]},ke.$metadata$={kind:i,simpleName:"SerializationException",interfaces:[v]},Ee.$metadata$={kind:i,simpleName:"MissingFieldException",interfaces:[ke]},Ce.$metadata$={kind:i,simpleName:"UnknownFieldException",interfaces:[ke]},en.prototype.iterator=function(){return this.closure$iterator()},en.$metadata$={kind:i,interfaces:[B]},Object.defineProperty(nn.prototype,"isNullable",{configurable:!0,get:function(){return!1}}),Object.defineProperty(nn.prototype,"isInline",{configurable:!0,get:function(){return!1}}),Object.defineProperty(nn.prototype,"annotations",{configurable:!0,get:function(){return q()}}),nn.$metadata$={kind:o,simpleName:"SerialDescriptor",interfaces:[]},rn.prototype.hasNext=function(){return this.elementsLeft_0>0},rn.prototype.next=function(){var t,e,n;return n=this.this$elementDescriptors.elementsCount,t=this.elementsLeft_0,this.elementsLeft_0=t-1|0,e=t,this.this$elementDescriptors.getElementDescriptor_za3lpa$(n-e|0)},rn.$metadata$={kind:i,interfaces:[U]},un.prototype.element_vxrguq$=function(t,e,n,i){if(void 0===n&&(n=q()),void 0===i&&(i=!1),!this.uniqueNames_0.add_11rb$(t))throw l(("Element with name '"+t+"' is already registered").toString());this.elementNames_8be2vx$.add_11rb$(t),this.elementDescriptors_8be2vx$.add_11rb$(e),this.elementAnnotations_8be2vx$.add_11rb$(n),this.elementOptionality_8be2vx$.add_11rb$(i)},un.$metadata$={kind:i,simpleName:"ClassSerialDescriptorBuilder",interfaces:[]},Object.defineProperty(pn.prototype,"serialName",{get:function(){return this.serialName_btmdyn$_0}}),Object.defineProperty(pn.prototype,"kind",{get:function(){return this.kind_589tly$_0}}),Object.defineProperty(pn.prototype,"elementsCount",{get:function(){return this.elementsCount_wewqc2$_0}}),Object.defineProperty(pn.prototype,"annotations",{configurable:!0,get:function(){return this.annotations_efqcf6$_0}}),Object.defineProperty(pn.prototype,"serialNames",{configurable:!0,get:function(){return this.serialNames_bcpscy$_0}}),Object.defineProperty(pn.prototype,"_hashCode_0",{configurable:!0,get:function(){return this._hashCode_6e2cwc$_0.value}}),pn.prototype.getElementName_za3lpa$=function(t){return ia(this.elementNames_0,t)},pn.prototype.getElementIndex_61zpoe$=function(t){var e;return null!=(e=this.name2Index_0.get_11rb$(t))?e:-3},pn.prototype.getElementAnnotations_za3lpa$=function(t){return ia(this.elementAnnotations_0,t)},pn.prototype.getElementDescriptor_za3lpa$=function(t){return ia(this.elementDescriptors_0,t)},pn.prototype.isElementOptional_za3lpa$=function(t){return ra(this.elementOptionality_0,t)},pn.prototype.equals=function(t){var n;t:do{var i;if(this===t){n=!0;break t}if(!e.isType(t,pn)){n=!1;break t}if(!b(this.serialName,t.serialName)){n=!1;break t}if(!W(this.typeParametersDescriptors_0,t.typeParametersDescriptors_0)){n=!1;break t}if(this.elementsCount!==t.elementsCount){n=!1;break t}i=this.elementsCount;for(var r=0;r=0)){var e="Illegal index "+t+", "+this.serialName+" expects only non-negative indices";throw l(e.toString())}return!1},ji.prototype.getElementAnnotations_za3lpa$=function(t){if(!(t>=0)){var e="Illegal index "+t+", "+this.serialName+" expects only non-negative indices";throw l(e.toString())}return q()},ji.prototype.getElementDescriptor_za3lpa$=function(t){if(!(t>=0)){var e="Illegal index "+t+", "+this.serialName+" expects only non-negative indices";throw l(e.toString())}return this.elementDescriptor},ji.prototype.equals=function(t){return this===t||!!e.isType(t,ji)&&!(!b(this.elementDescriptor,t.elementDescriptor)||!b(this.serialName,t.serialName))},ji.prototype.hashCode=function(){return(31*F(this.elementDescriptor)|0)+F(this.serialName)|0},ji.prototype.toString=function(){return this.serialName+"("+this.elementDescriptor+")"},ji.$metadata$={kind:i,simpleName:"ListLikeDescriptor",interfaces:[nn]},Object.defineProperty(Ti.prototype,"serialName",{get:function(){return this.serialName_ra35nx$_0}}),Object.defineProperty(Ti.prototype,"kind",{configurable:!0,get:function(){return ni()}}),Object.defineProperty(Ti.prototype,"elementsCount",{configurable:!0,get:function(){return this.elementsCount_qp2ocq$_0}}),Ti.prototype.getElementName_za3lpa$=function(t){return t.toString()},Ti.prototype.getElementIndex_61zpoe$=function(t){var e;if(null==(e=at(t)))throw l(t+" is not a valid map index");return e},Ti.prototype.isElementOptional_za3lpa$=function(t){if(!(t>=0)){var e="Illegal index "+t+", "+this.serialName+" expects only non-negative indices";throw l(e.toString())}return!1},Ti.prototype.getElementAnnotations_za3lpa$=function(t){if(!(t>=0)){var e="Illegal index "+t+", "+this.serialName+" expects only non-negative indices";throw l(e.toString())}return q()},Ti.prototype.getElementDescriptor_za3lpa$=function(t){var e;if(!(t>=0)){var n="Illegal index "+t+", "+this.serialName+" expects only non-negative indices";throw l(n.toString())}switch(t%2){case 0:e=this.keyDescriptor;break;case 1:e=this.valueDescriptor;break;default:throw f("Unreached".toString())}return e},Ti.prototype.equals=function(t){return this===t||!!e.isType(t,Ti)&&!!b(this.serialName,t.serialName)&&!!b(this.keyDescriptor,t.keyDescriptor)&&!!b(this.valueDescriptor,t.valueDescriptor)},Ti.prototype.hashCode=function(){var t=F(this.serialName);return t=(31*(t=(31*t|0)+F(this.keyDescriptor)|0)|0)+F(this.valueDescriptor)|0},Ti.prototype.toString=function(){return this.serialName+"("+this.keyDescriptor+", "+this.valueDescriptor+")"},Ti.$metadata$={kind:i,simpleName:"MapLikeDescriptor",interfaces:[nn]},Object.defineProperty(Pi.prototype,"serialName",{configurable:!0,get:function(){return this.serialName_reprdi$_0}}),Pi.$metadata$={kind:i,simpleName:"PrimitiveArrayDescriptor",interfaces:[ji]},Object.defineProperty(Ri.prototype,"serialName",{configurable:!0,get:function(){return mi}}),Ri.$metadata$={kind:i,simpleName:"ArrayClassDesc",interfaces:[ji]},Object.defineProperty(Ai.prototype,"serialName",{configurable:!0,get:function(){return vi}}),Ai.$metadata$={kind:i,simpleName:"ArrayListClassDesc",interfaces:[ji]},Object.defineProperty(Ii.prototype,"serialName",{configurable:!0,get:function(){return $i}}),Ii.$metadata$={kind:i,simpleName:"LinkedHashSetClassDesc",interfaces:[ji]},Object.defineProperty(Mi.prototype,"serialName",{configurable:!0,get:function(){return gi}}),Mi.$metadata$={kind:i,simpleName:"HashSetClassDesc",interfaces:[ji]},Li.$metadata$={kind:i,simpleName:"LinkedHashMapClassDesc",interfaces:[Ti]},Di.$metadata$={kind:i,simpleName:"HashMapClassDesc",interfaces:[Ti]},qi.prototype.merge_h7kg3q$=function(t,e){var n,i=null!=(n=null!=e?this.toBuilder_wikn$(e):null)?n:this.builder(),r=this.builderSize_wili$(i),o=t.beginStructure_24f42q$(this.descriptor);if(o.decodeSequentially())this.readAll_8oyp34$(o,i,r,this.readSize_bl0yv7$_0(o,i));else for(;;){var a=o.decodeElementIndex_24f42q$(this.descriptor);if(-1===a)break;this.readElement_8pvye7$(o,r+a|0,i)}return o.endStructure_24f42q$(this.descriptor),this.toResult_wili$(i)},qi.prototype.deserialize_bq71mq$=function(t){return this.merge_h7kg3q$(t,null)},qi.prototype.readSize_bl0yv7$_0=function(t,e){var n=t.decodeCollectionSize_24f42q$(this.descriptor);return this.checkCapacity_rk7bw8$(e,n),n},qi.prototype.readElement_8pvye7$=function(t,e,n,i,r){void 0===i&&(i=!0),r?r(t,e,n,i):this.readElement_8pvye7$$default(t,e,n,i)},qi.$metadata$={kind:i,simpleName:"AbstractCollectionSerializer",interfaces:[fe]},Fi.prototype.serialize_55azsf$=function(t,e){for(var n=this.collectionSize_wikn$(e),i=t.beginCollection_szpzho$(this.descriptor,n),r=this.collectionIterator_wikn$(e),o=0;o=0))throw l("Size must be known in advance when using READ_ALL".toString());for(var r=0;r=0))throw l("Size must be known in advance when using READ_ALL".toString());r=2*i|0;for(var o=0;o"},Zi.$metadata$={kind:i,simpleName:"EnumSerializer",interfaces:[fe]},Object.defineProperty(Qi.prototype,"isInline",{configurable:!0,get:function(){return this.isInline_4xqniz$_0}}),Qi.prototype.hashCode=function(){return 31*xr.prototype.hashCode.call(this)|0},Qi.prototype.equals=function(t){var n;t:do{var i;if(this===t){n=!0;break t}if(!e.isType(t,Qi)){n=!1;break t}if(!b(this.serialName,t.serialName)){n=!1;break t}if(!t.isInline||!W(this.typeParameterDescriptors_8be2vx$,t.typeParameterDescriptors_8be2vx$)){n=!1;break t}if(this.elementsCount!==t.elementsCount){n=!1;break t}i=this.elementsCount;for(var r=0;r])/g,v=/([[}=:>])\s+/g,$=/(\{[^{]+?);(?=\})/g,g=/\s{2,}/g,b=/([^\(])(:+) */g,w=/[svh]\w+-[tblr]{2}/,k=/\(\s*(.*)\s*\)/g,S=/([\s\S]*?);/g,x=/-self|flex-/g,E=/[^]*?(:[rp][el]a[\w-]+)[^]*/,C=/stretch|:\s*\w+\-(?:conte|avail)/,O=/([^-])(image-set\()/,N="-webkit-",z="-moz-",j="-ms-",T=59,P=125,R=123,A=40,I=41,M=10,L=13,D=32,q=45,F=42,U=44,B=58,H=47,V=1,K=1,W=0,Y=1,G=1,J=1,Z=0,Q=0,X=0,tt=[],et=[],nt=0,it=null,rt=0,ot=1,at="",st="",lt="";function ct(t,e,r,o,a){for(var s,l,u=0,p=0,h=0,f=0,m=0,v=0,$=0,g=0,w=0,S=0,x=0,E=0,C=0,O=0,z=0,j=0,Z=0,et=0,it=0,pt=r.length,mt=pt-1,vt="",$t="",gt="",bt="",wt="",kt="";z0&&($t=$t.replace(i,"")),$t.trim().length>0)){switch($){case D:case 9:case T:case L:case M:break;default:$t+=r.charAt(z)}$=T}if(1===Z)switch($){case R:case P:case T:case 34:case 39:case A:case I:case U:Z=0;case 9:case L:case M:case D:break;default:for(Z=0,it=z,m=$,z--,$=T;it0&&(++z,$=m);case R:it=pt}}switch($){case R:for(m=($t=$t.trim()).charCodeAt(0),x=1,it=++z;z0&&($t=$t.replace(i,"")),v=$t.charCodeAt(1)){case 100:case 109:case 115:case q:s=e;break;default:s=tt}if(it=(gt=ct(e,s,gt,v,a+1)).length,X>0&&0===it&&(it=$t.length),nt>0&&(l=_t(3,gt,s=ut(tt,$t,et),e,K,V,it,v,a,o),$t=s.join(""),void 0!==l&&0===(it=(gt=l.trim()).length)&&(v=0,gt="")),it>0)switch(v){case 115:$t=$t.replace(k,dt);case 100:case 109:case q:gt=$t+"{"+gt+"}";break;case 107:gt=($t=$t.replace(d,"$1 $2"+(ot>0?at:"")))+"{"+gt+"}",gt=1===G||2===G&&ft("@"+gt,3)?"@"+N+gt+"@"+gt:"@"+gt;break;default:gt=$t+gt,112===o&&(bt+=gt,gt="")}else gt="";break;default:gt=ct(e,ut(e,$t,et),gt,o,a+1)}wt+=gt,E=0,Z=0,O=0,j=0,et=0,C=0,$t="",gt="",$=r.charCodeAt(++z);break;case P:case T:if((it=($t=(j>0?$t.replace(i,""):$t).trim()).length)>1)switch(0===O&&((m=$t.charCodeAt(0))===q||m>96&&m<123)&&(it=($t=$t.replace(" ",":")).length),nt>0&&void 0!==(l=_t(1,$t,e,t,K,V,bt.length,o,a,o))&&0===(it=($t=l.trim()).length)&&($t="\0\0"),m=$t.charCodeAt(0),v=$t.charCodeAt(1),m){case 0:break;case 64:if(105===v||99===v){kt+=$t+r.charAt(z);break}default:if($t.charCodeAt(it-1)===B)break;bt+=ht($t,m,v,$t.charCodeAt(2))}E=0,Z=0,O=0,j=0,et=0,$t="",$=r.charCodeAt(++z)}}switch($){case L:case M:if(p+f+h+u+Q===0)switch(S){case I:case 39:case 34:case 64:case 126:case 62:case F:case 43:case H:case q:case B:case U:case T:case R:case P:break;default:O>0&&(Z=1)}p===H?p=0:Y+E===0&&107!==o&&$t.length>0&&(j=1,$t+="\0"),nt*rt>0&&_t(0,$t,e,t,K,V,bt.length,o,a,o),V=1,K++;break;case T:case P:if(p+f+h+u===0){V++;break}default:switch(V++,vt=r.charAt(z),$){case 9:case D:if(f+u+p===0)switch(g){case U:case B:case 9:case D:vt="";break;default:$!==D&&(vt=" ")}break;case 0:vt="\\0";break;case 12:vt="\\f";break;case 11:vt="\\v";break;case 38:f+p+u===0&&Y>0&&(et=1,j=1,vt="\f"+vt);break;case 108:if(f+p+u+W===0&&O>0)switch(z-O){case 2:112===g&&r.charCodeAt(z-3)===B&&(W=g);case 8:111===w&&(W=w)}break;case B:f+p+u===0&&(O=z);break;case U:p+h+f+u===0&&(j=1,vt+="\r");break;case 34:case 39:0===p&&(f=f===$?0:0===f?$:f);break;case 91:f+p+h===0&&u++;break;case 93:f+p+h===0&&u--;break;case I:f+p+u===0&&h--;break;case A:if(f+p+u===0){if(0===E)switch(2*g+3*w){case 533:break;default:x=0,E=1}h++}break;case 64:p+h+f+u+O+C===0&&(C=1);break;case F:case H:if(f+u+h>0)break;switch(p){case 0:switch(2*$+3*r.charCodeAt(z+1)){case 235:p=H;break;case 220:it=z,p=F}break;case F:$===H&&g===F&&it+2!==z&&(33===r.charCodeAt(it+2)&&(bt+=r.substring(it,z+1)),vt="",p=0)}}if(0===p){if(Y+f+u+C===0&&107!==o&&$!==T)switch($){case U:case 126:case 62:case 43:case I:case A:if(0===E){switch(g){case 9:case D:case M:case L:vt+="\0";break;default:vt="\0"+vt+($===U?"":"\0")}j=1}else switch($){case A:O+7===z&&108===g&&(O=0),E=++x;break;case I:0==(E=--x)&&(j=1,vt+="\0")}break;case 9:case D:switch(g){case 0:case R:case P:case T:case U:case 12:case 9:case D:case M:case L:break;default:0===E&&(j=1,vt+="\0")}}$t+=vt,$!==D&&9!==$&&(S=$)}}w=g,g=$,z++}if(it=bt.length,X>0&&0===it&&0===wt.length&&0===e[0].length==0&&(109!==o||1===e.length&&(Y>0?st:lt)===e[0])&&(it=e.join(",").length+2),it>0){if(s=0===Y&&107!==o?function(t){for(var e,n,r=0,o=t.length,a=Array(o);r1)){if(h=l.charCodeAt(l.length-1),f=n.charCodeAt(0),e="",0!==u)switch(h){case F:case 126:case 62:case 43:case D:case A:break;default:e=" "}switch(f){case 38:n=e+st;case 126:case 62:case 43:case D:case I:case A:break;case 91:n=e+n+st;break;case B:switch(2*n.charCodeAt(1)+3*n.charCodeAt(2)){case 530:if(J>0){n=e+n.substring(8,p-1);break}default:(u<1||s[u-1].length<1)&&(n=e+st+n)}break;case U:e="";default:n=p>1&&n.indexOf(":")>0?e+n.replace(b,"$1"+st+"$2"):e+n+st}l+=n}a[r]=l.replace(i,"").trim()}return a}(e):e,nt>0&&void 0!==(l=_t(2,bt,s,t,K,V,it,o,a,o))&&0===(bt=l).length)return kt+bt+wt;if(bt=s.join(",")+"{"+bt+"}",G*W!=0){switch(2!==G||ft(bt,2)||(W=0),W){case 111:bt=bt.replace(y,":-moz-$1")+bt;break;case 112:bt=bt.replace(_,"::"+N+"input-$1")+bt.replace(_,"::-moz-$1")+bt.replace(_,":-ms-input-$1")+bt}W=0}}return kt+bt+wt}function ut(t,e,n){var i=e.trim().split(u),r=i,o=i.length,a=t.length;switch(a){case 0:case 1:for(var s=0,l=0===a?"":t[0]+" ";s0&&Y>0)return r.replace(h,"$1").replace(p,"$1"+lt);break;default:return t.trim()+r.replace(p,"$1"+t.trim())}default:if(n*Y>0&&r.indexOf("\f")>0)return r.replace(p,(t.charCodeAt(0)===B?"":"$1")+t.trim())}return t+r}function ht(t,e,n,i){var c,u=0,p=t+";",h=2*e+3*n+4*i;if(944===h)return function(t){var e=t.length,n=t.indexOf(":",9)+1,i=t.substring(0,n).trim(),r=t.substring(n,e-1).trim();switch(t.charCodeAt(9)*ot){case 0:break;case q:if(110!==t.charCodeAt(10))break;default:var o=r.split((r="",s)),a=0;for(n=0,e=o.length;a64&&p<90||p>96&&p<123||95===p||p===q&&c.charCodeAt(1)!==q))switch(isNaN(parseFloat(c))+(-1!==c.indexOf("("))){case 1:switch(c){case"infinite":case"alternate":case"backwards":case"running":case"normal":case"forwards":case"both":case"none":case"linear":case"ease":case"ease-in":case"ease-out":case"ease-in-out":case"paused":case"reverse":case"alternate-reverse":case"inherit":case"initial":case"unset":case"step-start":case"step-end":break;default:c+=at}}u[n++]=c}r+=(0===a?"":",")+u.join(" ")}}return r=i+r+";",1===G||2===G&&ft(r,1)?N+r+r:r}(p);if(0===G||2===G&&!ft(p,1))return p;switch(h){case 1015:return 97===p.charCodeAt(10)?N+p+p:p;case 951:return 116===p.charCodeAt(3)?N+p+p:p;case 963:return 110===p.charCodeAt(5)?N+p+p:p;case 1009:if(100!==p.charCodeAt(4))break;case 969:case 942:return N+p+p;case 978:return N+p+z+p+p;case 1019:case 983:return N+p+z+p+j+p+p;case 883:return p.charCodeAt(8)===q?N+p+p:p.indexOf("image-set(",11)>0?p.replace(O,"$1"+N+"$2")+p:p;case 932:if(p.charCodeAt(4)===q)switch(p.charCodeAt(5)){case 103:return N+"box-"+p.replace("-grow","")+N+p+j+p.replace("grow","positive")+p;case 115:return N+p+j+p.replace("shrink","negative")+p;case 98:return N+p+j+p.replace("basis","preferred-size")+p}return N+p+j+p+p;case 964:return N+p+j+"flex-"+p+p;case 1023:if(99!==p.charCodeAt(8))break;return c=p.substring(p.indexOf(":",15)).replace("flex-","").replace("space-between","justify"),N+"box-pack"+c+N+p+j+"flex-pack"+c+p;case 1005:return o.test(p)?p.replace(r,":"+N)+p.replace(r,":"+z)+p:p;case 1e3:switch(u=(c=p.substring(13).trim()).indexOf("-")+1,c.charCodeAt(0)+c.charCodeAt(u)){case 226:c=p.replace(w,"tb");break;case 232:c=p.replace(w,"tb-rl");break;case 220:c=p.replace(w,"lr");break;default:return p}return N+p+j+c+p;case 1017:if(-1===p.indexOf("sticky",9))return p;case 975:switch(u=(p=t).length-10,h=(c=(33===p.charCodeAt(u)?p.substring(0,u):p).substring(t.indexOf(":",7)+1).trim()).charCodeAt(0)+(0|c.charCodeAt(7))){case 203:if(c.charCodeAt(8)<111)break;case 115:p=p.replace(c,N+c)+";"+p;break;case 207:case 102:p=p.replace(c,N+(h>102?"inline-":"")+"box")+";"+p.replace(c,N+c)+";"+p.replace(c,j+c+"box")+";"+p}return p+";";case 938:if(p.charCodeAt(5)===q)switch(p.charCodeAt(6)){case 105:return c=p.replace("-items",""),N+p+N+"box-"+c+j+"flex-"+c+p;case 115:return N+p+j+"flex-item-"+p.replace(x,"")+p;default:return N+p+j+"flex-line-pack"+p.replace("align-content","").replace(x,"")+p}break;case 973:case 989:if(p.charCodeAt(3)!==q||122===p.charCodeAt(4))break;case 931:case 953:if(!0===C.test(t))return 115===(c=t.substring(t.indexOf(":")+1)).charCodeAt(0)?ht(t.replace("stretch","fill-available"),e,n,i).replace(":fill-available",":stretch"):p.replace(c,N+c)+p.replace(c,z+c.replace("fill-",""))+p;break;case 962:if(p=N+p+(102===p.charCodeAt(5)?j+p:"")+p,n+i===211&&105===p.charCodeAt(13)&&p.indexOf("transform",10)>0)return p.substring(0,p.indexOf(";",27)+1).replace(a,"$1"+N+"$2")+p}return p}function ft(t,e){var n=t.indexOf(1===e?":":"{"),i=t.substring(0,3!==e?n:10),r=t.substring(n+1,t.length-1);return it(2!==e?i:i.replace(E,"$1"),r,e)}function dt(t,e){var n=ht(e,e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2));return n!==e+";"?n.replace(S," or ($1)").substring(4):"("+e+")"}function _t(t,e,n,i,r,o,a,s,l,c){for(var u,p=0,h=e;p0&&(at=r.replace(f,91===o?"":"-")),o=1,1===Y?lt=r:st=r;var a,s=[lt];nt>0&&void 0!==(a=_t(-1,n,s,s,K,V,0,0,0,0))&&"string"==typeof a&&(n=a);var l=ct(tt,s,n,0,0);return nt>0&&void 0!==(a=_t(-2,l,s,s,K,V,l.length,0,0,0))&&"string"!=typeof(l=a)&&(o=0),at="",lt="",st="",W=0,K=1,V=1,Z*o==0?l:l.replace(i,"").replace(m,"").replace(v,"$1").replace($,"$1").replace(g," ")}return vt.use=function t(e){switch(e){case void 0:case null:nt=et.length=0;break;default:if("function"==typeof e)et[nt++]=e;else if("object"==typeof e)for(var n=0,i=e.length;n b ? 1 : 0;\n};\n\nKotlin.doubleCompareTo = function (a, b) {\n if (a < b) return -1;\n if (a > b) return 1;\n\n if (a === b) {\n if (a !== 0) return 0;\n\n var ia = 1 / a;\n return ia === 1 / b ? 0 : (ia < 0 ? -1 : 1);\n }\n\n return a !== a ? (b !== b ? 0 : 1) : -1\n};\n\nKotlin.charInc = function (value) {\n return Kotlin.toChar(value+1);\n};\n\nKotlin.charDec = function (value) {\n return Kotlin.toChar(value-1);\n};\n\nKotlin.imul = Math.imul || imul;\n\nKotlin.imulEmulated = imul;\n\nfunction imul(a, b) {\n return ((a & 0xffff0000) * (b & 0xffff) + (a & 0xffff) * (b | 0)) | 0;\n}\n\n(function() {\n var buf = new ArrayBuffer(8);\n var bufFloat64 = new Float64Array(buf);\n var bufFloat32 = new Float32Array(buf);\n var bufInt32 = new Int32Array(buf);\n var lowIndex = 0;\n var highIndex = 1;\n\n bufFloat64[0] = -1; // bff00000_00000000\n if (bufInt32[lowIndex] !== 0) {\n lowIndex = 1;\n highIndex = 0;\n }\n\n Kotlin.doubleToBits = function(value) {\n return Kotlin.doubleToRawBits(isNaN(value) ? NaN : value);\n };\n\n Kotlin.doubleToRawBits = function(value) {\n bufFloat64[0] = value;\n return Kotlin.Long.fromBits(bufInt32[lowIndex], bufInt32[highIndex]);\n };\n\n Kotlin.doubleFromBits = function(value) {\n bufInt32[lowIndex] = value.low_;\n bufInt32[highIndex] = value.high_;\n return bufFloat64[0];\n };\n\n Kotlin.floatToBits = function(value) {\n return Kotlin.floatToRawBits(isNaN(value) ? NaN : value);\n };\n\n Kotlin.floatToRawBits = function(value) {\n bufFloat32[0] = value;\n return bufInt32[0];\n };\n\n Kotlin.floatFromBits = function(value) {\n bufInt32[0] = value;\n return bufFloat32[0];\n };\n\n // returns zero value for number with positive sign bit and non-zero value for number with negative sign bit.\n Kotlin.doubleSignBit = function(value) {\n bufFloat64[0] = value;\n return bufInt32[highIndex] & 0x80000000;\n };\n\n Kotlin.numberHashCode = function(obj) {\n if ((obj | 0) === obj) {\n return obj | 0;\n }\n else {\n bufFloat64[0] = obj;\n return (bufInt32[highIndex] * 31 | 0) + bufInt32[lowIndex] | 0;\n }\n }\n})();\n\nKotlin.ensureNotNull = function(x) {\n return x != null ? x : Kotlin.throwNPE();\n};\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\nif (typeof String.prototype.startsWith === \"undefined\") {\n Object.defineProperty(String.prototype, \"startsWith\", {\n value: function (searchString, position) {\n position = position || 0;\n return this.lastIndexOf(searchString, position) === position;\n }\n });\n}\nif (typeof String.prototype.endsWith === \"undefined\") {\n Object.defineProperty(String.prototype, \"endsWith\", {\n value: function (searchString, position) {\n var subjectString = this.toString();\n if (position === undefined || position > subjectString.length) {\n position = subjectString.length;\n }\n position -= searchString.length;\n var lastIndex = subjectString.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n }\n });\n}\n// ES6 Math polyfills\nif (typeof Math.sign === \"undefined\") {\n Math.sign = function(x) {\n x = +x; // convert to a number\n if (x === 0 || isNaN(x)) {\n return Number(x);\n }\n return x > 0 ? 1 : -1;\n };\n}\nif (typeof Math.trunc === \"undefined\") {\n Math.trunc = function(x) {\n if (isNaN(x)) {\n return NaN;\n }\n if (x > 0) {\n return Math.floor(x);\n }\n return Math.ceil(x);\n };\n}\n\n(function() {\n var epsilon = 2.220446049250313E-16;\n var taylor_2_bound = Math.sqrt(epsilon);\n var taylor_n_bound = Math.sqrt(taylor_2_bound);\n var upper_taylor_2_bound = 1/taylor_2_bound;\n var upper_taylor_n_bound = 1/taylor_n_bound;\n\n if (typeof Math.sinh === \"undefined\") {\n Math.sinh = function(x) {\n if (Math.abs(x) < taylor_n_bound) {\n var result = x;\n if (Math.abs(x) > taylor_2_bound) {\n result += (x * x * x) / 6;\n }\n return result;\n } else {\n var y = Math.exp(x);\n var y1 = 1 / y;\n if (!isFinite(y)) return Math.exp(x - Math.LN2);\n if (!isFinite(y1)) return -Math.exp(-x - Math.LN2);\n return (y - y1) / 2;\n }\n };\n }\n if (typeof Math.cosh === \"undefined\") {\n Math.cosh = function(x) {\n var y = Math.exp(x);\n var y1 = 1 / y;\n if (!isFinite(y) || !isFinite(y1)) return Math.exp(Math.abs(x) - Math.LN2);\n return (y + y1) / 2;\n };\n }\n\n if (typeof Math.tanh === \"undefined\") {\n Math.tanh = function(x){\n if (Math.abs(x) < taylor_n_bound) {\n var result = x;\n if (Math.abs(x) > taylor_2_bound) {\n result -= (x * x * x) / 3;\n }\n return result;\n }\n else {\n var a = Math.exp(+x), b = Math.exp(-x);\n return a === Infinity ? 1 : b === Infinity ? -1 : (a - b) / (a + b);\n }\n };\n }\n\n // Inverse hyperbolic function implementations derived from boost special math functions,\n // Copyright Eric Ford & Hubert Holin 2001.\n\n if (typeof Math.asinh === \"undefined\") {\n var asinh = function(x) {\n if (x >= +taylor_n_bound)\n {\n if (x > upper_taylor_n_bound)\n {\n if (x > upper_taylor_2_bound)\n {\n // approximation by laurent series in 1/x at 0+ order from -1 to 0\n return Math.log(x) + Math.LN2;\n }\n else\n {\n // approximation by laurent series in 1/x at 0+ order from -1 to 1\n return Math.log(x * 2 + (1 / (x * 2)));\n }\n }\n else\n {\n return Math.log(x + Math.sqrt(x * x + 1));\n }\n }\n else if (x <= -taylor_n_bound)\n {\n return -asinh(-x);\n }\n else\n {\n // approximation by taylor series in x at 0 up to order 2\n var result = x;\n if (Math.abs(x) >= taylor_2_bound)\n {\n var x3 = x * x * x;\n // approximation by taylor series in x at 0 up to order 4\n result -= x3 / 6;\n }\n return result;\n }\n };\n Math.asinh = asinh;\n }\n if (typeof Math.acosh === \"undefined\") {\n Math.acosh = function(x) {\n if (x < 1)\n {\n return NaN;\n }\n else if (x - 1 >= taylor_n_bound)\n {\n if (x > upper_taylor_2_bound)\n {\n // approximation by laurent series in 1/x at 0+ order from -1 to 0\n return Math.log(x) + Math.LN2;\n }\n else\n {\n return Math.log(x + Math.sqrt(x * x - 1));\n }\n }\n else\n {\n var y = Math.sqrt(x - 1);\n // approximation by taylor series in y at 0 up to order 2\n var result = y;\n if (y >= taylor_2_bound)\n {\n var y3 = y * y * y;\n // approximation by taylor series in y at 0 up to order 4\n result -= y3 / 12;\n }\n\n return Math.sqrt(2) * result;\n }\n };\n }\n if (typeof Math.atanh === \"undefined\") {\n Math.atanh = function(x) {\n if (Math.abs(x) < taylor_n_bound) {\n var result = x;\n if (Math.abs(x) > taylor_2_bound) {\n result += (x * x * x) / 3;\n }\n return result;\n }\n return Math.log((1 + x) / (1 - x)) / 2;\n };\n }\n if (typeof Math.log1p === \"undefined\") {\n Math.log1p = function(x) {\n if (Math.abs(x) < taylor_n_bound) {\n var x2 = x * x;\n var x3 = x2 * x;\n var x4 = x3 * x;\n // approximation by taylor series in x at 0 up to order 4\n return (-x4 / 4 + x3 / 3 - x2 / 2 + x);\n }\n return Math.log(x + 1);\n };\n }\n if (typeof Math.expm1 === \"undefined\") {\n Math.expm1 = function(x) {\n if (Math.abs(x) < taylor_n_bound) {\n var x2 = x * x;\n var x3 = x2 * x;\n var x4 = x3 * x;\n // approximation by taylor series in x at 0 up to order 4\n return (x4 / 24 + x3 / 6 + x2 / 2 + x);\n }\n return Math.exp(x) - 1;\n };\n }\n})();\nif (typeof Math.hypot === \"undefined\") {\n Math.hypot = function() {\n var y = 0;\n var length = arguments.length;\n\n for (var i = 0; i < length; i++) {\n if (arguments[i] === Infinity || arguments[i] === -Infinity) {\n return Infinity;\n }\n y += arguments[i] * arguments[i];\n }\n return Math.sqrt(y);\n };\n}\nif (typeof Math.log10 === \"undefined\") {\n Math.log10 = function(x) {\n return Math.log(x) * Math.LOG10E;\n };\n}\nif (typeof Math.log2 === \"undefined\") {\n Math.log2 = function(x) {\n return Math.log(x) * Math.LOG2E;\n };\n}\nif (typeof Math.clz32 === \"undefined\") {\n Math.clz32 = (function(log, LN2) {\n return function(x) {\n var asUint = x >>> 0;\n if (asUint === 0) {\n return 32;\n }\n return 31 - (log(asUint) / LN2 | 0) | 0; // the \"| 0\" acts like math.floor\n };\n })(Math.log, Math.LN2);\n}\n\n// For HtmlUnit and PhantomJs\nif (typeof ArrayBuffer.isView === \"undefined\") {\n ArrayBuffer.isView = function(a) {\n return a != null && a.__proto__ != null && a.__proto__.__proto__ === Int8Array.prototype.__proto__;\n };\n}\n\nif (typeof Array.prototype.fill === \"undefined\") {\n // Polyfill from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/fill#Polyfill\n Object.defineProperty(Array.prototype, 'fill', {\n value: function (value) {\n\n // Steps 1-2.\n if (this == null) {\n throw new TypeError('this is null or not defined');\n }\n\n var O = Object(this);\n\n // Steps 3-5.\n var len = O.length >>> 0;\n\n // Steps 6-7.\n var start = arguments[1];\n var relativeStart = start >> 0;\n\n // Step 8.\n var k = relativeStart < 0 ?\n Math.max(len + relativeStart, 0) :\n Math.min(relativeStart, len);\n\n // Steps 9-10.\n var end = arguments[2];\n var relativeEnd = end === undefined ?\n len : end >> 0;\n\n // Step 11.\n var finalValue = relativeEnd < 0 ?\n Math.max(len + relativeEnd, 0) :\n Math.min(relativeEnd, len);\n\n // Step 12.\n while (k < finalValue) {\n O[k] = value;\n k++;\n }\n\n // Step 13.\n return O;\n }\n });\n}\n\n(function() {\n function normalizeOffset(offset, length) {\n if (offset < 0) return Math.max(0, offset + length);\n return Math.min(offset, length);\n }\n function typedArraySlice(begin, end) {\n if (typeof end === \"undefined\") {\n end = this.length;\n }\n begin = normalizeOffset(begin || 0, this.length);\n end = Math.max(begin, normalizeOffset(end, this.length));\n return new this.constructor(this.subarray(begin, end));\n }\n\n var arrays = [Int8Array, Int16Array, Uint16Array, Int32Array, Float32Array, Float64Array];\n for (var i = 0; i < arrays.length; ++i) {\n var TypedArray = arrays[i];\n if (typeof TypedArray.prototype.fill === \"undefined\") {\n Object.defineProperty(TypedArray.prototype, 'fill', {\n value: Array.prototype.fill\n });\n }\n if (typeof TypedArray.prototype.slice === \"undefined\") {\n Object.defineProperty(TypedArray.prototype, 'slice', {\n value: typedArraySlice\n });\n }\n }\n\n // Patch apply to work with TypedArrays if needed.\n try {\n (function() {}).apply(null, new Int32Array(0))\n } catch (e) {\n var apply = Function.prototype.apply;\n Object.defineProperty(Function.prototype, 'apply', {\n value: function(self, array) {\n return apply.call(this, self, [].slice.call(array));\n }\n });\n }\n\n\n // Patch map to work with TypedArrays if needed.\n for (var i = 0; i < arrays.length; ++i) {\n var TypedArray = arrays[i];\n if (typeof TypedArray.prototype.map === \"undefined\") {\n Object.defineProperty(TypedArray.prototype, 'map', {\n value: function(callback, self) {\n return [].slice.call(this).map(callback, self);\n }\n });\n }\n }\n\n // Patch sort to work with TypedArrays if needed.\n // TODO: consider to remove following function and replace it with `Kotlin.doubleCompareTo` (see misc.js)\n var totalOrderComparator = function (a, b) {\n if (a < b) return -1;\n if (a > b) return 1;\n\n if (a === b) {\n if (a !== 0) return 0;\n\n var ia = 1 / a;\n return ia === 1 / b ? 0 : (ia < 0 ? -1 : 1);\n }\n\n return a !== a ? (b !== b ? 0 : 1) : -1\n };\n\n for (var i = 0; i < arrays.length; ++i) {\n var TypedArray = arrays[i];\n if (typeof TypedArray.prototype.sort === \"undefined\") {\n Object.defineProperty(TypedArray.prototype, 'sort', {\n value: function(compareFunction) {\n return Array.prototype.sort.call(this, compareFunction || totalOrderComparator);\n }\n });\n }\n }\n})();\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. \n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\nKotlin.equals = function (obj1, obj2) {\n if (obj1 == null) {\n return obj2 == null;\n }\n\n if (obj2 == null) {\n return false;\n }\n\n if (obj1 !== obj1) {\n return obj2 !== obj2;\n }\n\n if (typeof obj1 === \"object\" && typeof obj1.equals === \"function\") {\n return obj1.equals(obj2);\n }\n\n if (typeof obj1 === \"number\" && typeof obj2 === \"number\") {\n return obj1 === obj2 && (obj1 !== 0 || 1 / obj1 === 1 / obj2)\n }\n\n return obj1 === obj2;\n};\n\nKotlin.hashCode = function (obj) {\n if (obj == null) {\n return 0;\n }\n var objType = typeof obj;\n if (\"object\" === objType) {\n return \"function\" === typeof obj.hashCode ? obj.hashCode() : getObjectHashCode(obj);\n }\n if (\"function\" === objType) {\n return getObjectHashCode(obj);\n }\n if (\"number\" === objType) {\n return Kotlin.numberHashCode(obj);\n }\n if (\"boolean\" === objType) {\n return Number(obj)\n }\n\n var str = String(obj);\n return getStringHashCode(str);\n};\n\n\nKotlin.toString = function (o) {\n if (o == null) {\n return \"null\";\n }\n else if (Kotlin.isArrayish(o)) {\n return \"[...]\";\n }\n else {\n return o.toString();\n }\n};\n\n/** @const */\nvar POW_2_32 = 4294967296;\n// TODO: consider switching to Symbol type once we are on ES6.\n/** @const */\nvar OBJECT_HASH_CODE_PROPERTY_NAME = \"kotlinHashCodeValue$\";\n\nfunction getObjectHashCode(obj) {\n if (!(OBJECT_HASH_CODE_PROPERTY_NAME in obj)) {\n var hash = (Math.random() * POW_2_32) | 0; // Make 32-bit singed integer.\n Object.defineProperty(obj, OBJECT_HASH_CODE_PROPERTY_NAME, { value: hash, enumerable: false });\n }\n return obj[OBJECT_HASH_CODE_PROPERTY_NAME];\n}\n\nfunction getStringHashCode(str) {\n var hash = 0;\n for (var i = 0; i < str.length; i++) {\n var code = str.charCodeAt(i);\n hash = (hash * 31 + code) | 0; // Keep it 32-bit.\n }\n return hash;\n}\n\nKotlin.identityHashCode = getObjectHashCode;\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. \n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n/**\n * @param {string} id\n * @param {Object} declaration\n */\nKotlin.defineModule = function (id, declaration) {\n};\n\nKotlin.defineInlineFunction = function(tag, fun) {\n return fun;\n};\n\nKotlin.wrapFunction = function(fun) {\n var f = function() {\n f = fun();\n return f.apply(this, arguments);\n };\n return function() {\n return f.apply(this, arguments);\n };\n};\n\nKotlin.isTypeOf = function(type) {\n return function (object) {\n return typeof object === type;\n }\n};\n\nKotlin.isInstanceOf = function (klass) {\n return function (object) {\n return Kotlin.isType(object, klass);\n }\n};\n\nKotlin.orNull = function (fn) {\n return function (object) {\n return object == null || fn(object);\n }\n};\n\nKotlin.andPredicate = function (a, b) {\n return function (object) {\n return a(object) && b(object);\n }\n};\n\nKotlin.kotlinModuleMetadata = function (abiVersion, moduleName, data) {\n};\n\nKotlin.suspendCall = function(value) {\n return value;\n};\n\nKotlin.coroutineResult = function(qualifier) {\n throwMarkerError();\n};\n\nKotlin.coroutineController = function(qualifier) {\n throwMarkerError();\n};\n\nKotlin.coroutineReceiver = function(qualifier) {\n throwMarkerError();\n};\n\nKotlin.setCoroutineResult = function(value, qualifier) {\n throwMarkerError();\n};\n\nKotlin.getReifiedTypeParameterKType = function(typeParameter) {\n throwMarkerError();\n};\n\nfunction throwMarkerError() {\n throw new Error(\n \"This marker function should never been called. \" +\n \"Looks like compiler did not eliminate it properly. \" +\n \"Please, report an issue if you caught this exception.\");\n}\n\nKotlin.getFunctionById = function(id, defaultValue) {\n return function() {\n return defaultValue;\n }\n};","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. \n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\nKotlin.toShort = function (a) {\n return (a & 0xFFFF) << 16 >> 16;\n};\n\nKotlin.toByte = function (a) {\n return (a & 0xFF) << 24 >> 24;\n};\n\nKotlin.toChar = function (a) {\n return a & 0xFFFF;\n};\n\nKotlin.numberToLong = function (a) {\n return a instanceof Kotlin.Long ? a : Kotlin.Long.fromNumber(a);\n};\n\nKotlin.numberToInt = function (a) {\n return a instanceof Kotlin.Long ? a.toInt() : Kotlin.doubleToInt(a);\n};\n\nKotlin.numberToShort = function (a) {\n return Kotlin.toShort(Kotlin.numberToInt(a));\n};\n\nKotlin.numberToByte = function (a) {\n return Kotlin.toByte(Kotlin.numberToInt(a));\n};\n\nKotlin.numberToDouble = function (a) {\n return +a;\n};\n\nKotlin.numberToChar = function (a) {\n return Kotlin.toChar(Kotlin.numberToInt(a));\n};\n\nKotlin.doubleToInt = function(a) {\n if (a > 2147483647) return 2147483647;\n if (a < -2147483648) return -2147483648;\n return a | 0;\n};\n\nKotlin.toBoxedChar = function (a) {\n if (a == null) return a;\n if (a instanceof Kotlin.BoxedChar) return a;\n return new Kotlin.BoxedChar(a);\n};\n\nKotlin.unboxChar = function(a) {\n if (a == null) return a;\n return Kotlin.toChar(a);\n};\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. \n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// Copyright 2009 The Closure Library Authors. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS-IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n\n/**\n * Constructs a 64-bit two's-complement integer, given its low and high 32-bit\n * values as *signed* integers. See the from* functions below for more\n * convenient ways of constructing Longs.\n *\n * The internal representation of a long is the two given signed, 32-bit values.\n * We use 32-bit pieces because these are the size of integers on which\n * Javascript performs bit-operations. For operations like addition and\n * multiplication, we split each number into 16-bit pieces, which can easily be\n * multiplied within Javascript's floating-point representation without overflow\n * or change in sign.\n *\n * In the algorithms below, we frequently reduce the negative case to the\n * positive case by negating the input(s) and then post-processing the result.\n * Note that we must ALWAYS check specially whether those values are MIN_VALUE\n * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as\n * a positive number, it overflows back into a negative). Not handling this\n * case would often result in infinite recursion.\n *\n * @param {number} low The low (signed) 32 bits of the long.\n * @param {number} high The high (signed) 32 bits of the long.\n * @constructor\n * @final\n */\nKotlin.Long = function(low, high) {\n /**\n * @type {number}\n * @private\n */\n this.low_ = low | 0; // force into 32 signed bits.\n\n /**\n * @type {number}\n * @private\n */\n this.high_ = high | 0; // force into 32 signed bits.\n};\n\nKotlin.Long.$metadata$ = {\n kind: \"class\",\n simpleName: \"Long\",\n interfaces:[]\n};\n\n\n// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the\n// from* methods on which they depend.\n\n\n/**\n * A cache of the Long representations of small integer values.\n * @type {!Object}\n * @private\n */\nKotlin.Long.IntCache_ = {};\n\n\n/**\n * Returns a Long representing the given (32-bit) integer value.\n * @param {number} value The 32-bit integer in question.\n * @return {!Kotlin.Long} The corresponding Long value.\n */\nKotlin.Long.fromInt = function(value) {\n if (-128 <= value && value < 128) {\n var cachedObj = Kotlin.Long.IntCache_[value];\n if (cachedObj) {\n return cachedObj;\n }\n }\n\n var obj = new Kotlin.Long(value | 0, value < 0 ? -1 : 0);\n if (-128 <= value && value < 128) {\n Kotlin.Long.IntCache_[value] = obj;\n }\n return obj;\n};\n\n\n/**\n * Converts this number value to `Long`.\n * The fractional part, if any, is rounded down towards zero.\n * Returns zero if this `Double` value is `NaN`, `Long.MIN_VALUE` if it's less than `Long.MIN_VALUE`,\n * `Long.MAX_VALUE` if it's bigger than `Long.MAX_VALUE`.\n * @param {number} value The number in question.\n * @return {!Kotlin.Long} The corresponding Long value.\n */\nKotlin.Long.fromNumber = function(value) {\n if (isNaN(value)) {\n return Kotlin.Long.ZERO;\n } else if (value <= -Kotlin.Long.TWO_PWR_63_DBL_) {\n return Kotlin.Long.MIN_VALUE;\n } else if (value + 1 >= Kotlin.Long.TWO_PWR_63_DBL_) {\n return Kotlin.Long.MAX_VALUE;\n } else if (value < 0) {\n return Kotlin.Long.fromNumber(-value).negate();\n } else {\n return new Kotlin.Long(\n (value % Kotlin.Long.TWO_PWR_32_DBL_) | 0,\n (value / Kotlin.Long.TWO_PWR_32_DBL_) | 0);\n }\n};\n\n\n/**\n * Returns a Long representing the 64-bit integer that comes by concatenating\n * the given high and low bits. Each is assumed to use 32 bits.\n * @param {number} lowBits The low 32-bits.\n * @param {number} highBits The high 32-bits.\n * @return {!Kotlin.Long} The corresponding Long value.\n */\nKotlin.Long.fromBits = function(lowBits, highBits) {\n return new Kotlin.Long(lowBits, highBits);\n};\n\n\n/**\n * Returns a Long representation of the given string, written using the given\n * radix.\n * @param {string} str The textual representation of the Long.\n * @param {number=} opt_radix The radix in which the text is written.\n * @return {!Kotlin.Long} The corresponding Long value.\n */\nKotlin.Long.fromString = function(str, opt_radix) {\n if (str.length == 0) {\n throw Error('number format error: empty string');\n }\n\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (str.charAt(0) == '-') {\n return Kotlin.Long.fromString(str.substring(1), radix).negate();\n } else if (str.indexOf('-') >= 0) {\n throw Error('number format error: interior \"-\" character: ' + str);\n }\n\n // Do several (8) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Kotlin.Long.fromNumber(Math.pow(radix, 8));\n\n var result = Kotlin.Long.ZERO;\n for (var i = 0; i < str.length; i += 8) {\n var size = Math.min(8, str.length - i);\n var value = parseInt(str.substring(i, i + size), radix);\n if (size < 8) {\n var power = Kotlin.Long.fromNumber(Math.pow(radix, size));\n result = result.multiply(power).add(Kotlin.Long.fromNumber(value));\n } else {\n result = result.multiply(radixToPower);\n result = result.add(Kotlin.Long.fromNumber(value));\n }\n }\n return result;\n};\n\n\n// NOTE: the compiler should inline these constant values below and then remove\n// these variables, so there should be no runtime penalty for these.\n\n\n/**\n * Number used repeated below in calculations. This must appear before the\n * first call to any from* function below.\n * @type {number}\n * @private\n */\nKotlin.Long.TWO_PWR_16_DBL_ = 1 << 16;\n\n\n/**\n * @type {number}\n * @private\n */\nKotlin.Long.TWO_PWR_24_DBL_ = 1 << 24;\n\n\n/**\n * @type {number}\n * @private\n */\nKotlin.Long.TWO_PWR_32_DBL_ =\n Kotlin.Long.TWO_PWR_16_DBL_ * Kotlin.Long.TWO_PWR_16_DBL_;\n\n\n/**\n * @type {number}\n * @private\n */\nKotlin.Long.TWO_PWR_31_DBL_ =\n Kotlin.Long.TWO_PWR_32_DBL_ / 2;\n\n\n/**\n * @type {number}\n * @private\n */\nKotlin.Long.TWO_PWR_48_DBL_ =\n Kotlin.Long.TWO_PWR_32_DBL_ * Kotlin.Long.TWO_PWR_16_DBL_;\n\n\n/**\n * @type {number}\n * @private\n */\nKotlin.Long.TWO_PWR_64_DBL_ =\n Kotlin.Long.TWO_PWR_32_DBL_ * Kotlin.Long.TWO_PWR_32_DBL_;\n\n\n/**\n * @type {number}\n * @private\n */\nKotlin.Long.TWO_PWR_63_DBL_ =\n Kotlin.Long.TWO_PWR_64_DBL_ / 2;\n\n\n/** @type {!Kotlin.Long} */\nKotlin.Long.ZERO = Kotlin.Long.fromInt(0);\n\n\n/** @type {!Kotlin.Long} */\nKotlin.Long.ONE = Kotlin.Long.fromInt(1);\n\n\n/** @type {!Kotlin.Long} */\nKotlin.Long.NEG_ONE = Kotlin.Long.fromInt(-1);\n\n\n/** @type {!Kotlin.Long} */\nKotlin.Long.MAX_VALUE =\n Kotlin.Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0);\n\n\n/** @type {!Kotlin.Long} */\nKotlin.Long.MIN_VALUE = Kotlin.Long.fromBits(0, 0x80000000 | 0);\n\n\n/**\n * @type {!Kotlin.Long}\n * @private\n */\nKotlin.Long.TWO_PWR_24_ = Kotlin.Long.fromInt(1 << 24);\n\n\n/** @return {number} The value, assuming it is a 32-bit integer. */\nKotlin.Long.prototype.toInt = function() {\n return this.low_;\n};\n\n\n/** @return {number} The closest floating-point representation to this value. */\nKotlin.Long.prototype.toNumber = function() {\n return this.high_ * Kotlin.Long.TWO_PWR_32_DBL_ +\n this.getLowBitsUnsigned();\n};\n\n/** @return {number} The 32-bit hashCode of this value. */\nKotlin.Long.prototype.hashCode = function() {\n return this.high_ ^ this.low_;\n};\n\n/**\n * @param {number=} opt_radix The radix in which the text should be written.\n * @return {string} The textual representation of this value.\n * @override\n */\nKotlin.Long.prototype.toString = function(opt_radix) {\n var radix = opt_radix || 10;\n if (radix < 2 || 36 < radix) {\n throw Error('radix out of range: ' + radix);\n }\n\n if (this.isZero()) {\n return '0';\n }\n\n if (this.isNegative()) {\n if (this.equalsLong(Kotlin.Long.MIN_VALUE)) {\n // We need to change the Long value before it can be negated, so we remove\n // the bottom-most digit in this base and then recurse to do the rest.\n var radixLong = Kotlin.Long.fromNumber(radix);\n var div = this.div(radixLong);\n var rem = div.multiply(radixLong).subtract(this);\n return div.toString(radix) + rem.toInt().toString(radix);\n } else {\n return '-' + this.negate().toString(radix);\n }\n }\n\n // Do several (6) digits each time through the loop, so as to\n // minimize the calls to the very expensive emulated div.\n var radixToPower = Kotlin.Long.fromNumber(Math.pow(radix, 6));\n\n var rem = this;\n var result = '';\n while (true) {\n var remDiv = rem.div(radixToPower);\n var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt();\n var digits = intval.toString(radix);\n\n rem = remDiv;\n if (rem.isZero()) {\n return digits + result;\n } else {\n while (digits.length < 6) {\n digits = '0' + digits;\n }\n result = '' + digits + result;\n }\n }\n};\n\n\n/** @return {number} The high 32-bits as a signed value. */\nKotlin.Long.prototype.getHighBits = function() {\n return this.high_;\n};\n\n\n/** @return {number} The low 32-bits as a signed value. */\nKotlin.Long.prototype.getLowBits = function() {\n return this.low_;\n};\n\n\n/** @return {number} The low 32-bits as an unsigned value. */\nKotlin.Long.prototype.getLowBitsUnsigned = function() {\n return (this.low_ >= 0) ?\n this.low_ : Kotlin.Long.TWO_PWR_32_DBL_ + this.low_;\n};\n\n\n/**\n * @return {number} Returns the number of bits needed to represent the absolute\n * value of this Long.\n */\nKotlin.Long.prototype.getNumBitsAbs = function() {\n if (this.isNegative()) {\n if (this.equalsLong(Kotlin.Long.MIN_VALUE)) {\n return 64;\n } else {\n return this.negate().getNumBitsAbs();\n }\n } else {\n var val = this.high_ != 0 ? this.high_ : this.low_;\n for (var bit = 31; bit > 0; bit--) {\n if ((val & (1 << bit)) != 0) {\n break;\n }\n }\n return this.high_ != 0 ? bit + 33 : bit + 1;\n }\n};\n\n\n/** @return {boolean} Whether this value is zero. */\nKotlin.Long.prototype.isZero = function() {\n return this.high_ == 0 && this.low_ == 0;\n};\n\n\n/** @return {boolean} Whether this value is negative. */\nKotlin.Long.prototype.isNegative = function() {\n return this.high_ < 0;\n};\n\n\n/** @return {boolean} Whether this value is odd. */\nKotlin.Long.prototype.isOdd = function() {\n return (this.low_ & 1) == 1;\n};\n\n\n/**\n * @param {Kotlin.Long} other Long to compare against.\n * @return {boolean} Whether this Long equals the other.\n */\nKotlin.Long.prototype.equalsLong = function(other) {\n return (this.high_ == other.high_) && (this.low_ == other.low_);\n};\n\n\n/**\n * @param {Kotlin.Long} other Long to compare against.\n * @return {boolean} Whether this Long does not equal the other.\n */\nKotlin.Long.prototype.notEqualsLong = function(other) {\n return (this.high_ != other.high_) || (this.low_ != other.low_);\n};\n\n\n/**\n * @param {Kotlin.Long} other Long to compare against.\n * @return {boolean} Whether this Long is less than the other.\n */\nKotlin.Long.prototype.lessThan = function(other) {\n return this.compare(other) < 0;\n};\n\n\n/**\n * @param {Kotlin.Long} other Long to compare against.\n * @return {boolean} Whether this Long is less than or equal to the other.\n */\nKotlin.Long.prototype.lessThanOrEqual = function(other) {\n return this.compare(other) <= 0;\n};\n\n\n/**\n * @param {Kotlin.Long} other Long to compare against.\n * @return {boolean} Whether this Long is greater than the other.\n */\nKotlin.Long.prototype.greaterThan = function(other) {\n return this.compare(other) > 0;\n};\n\n\n/**\n * @param {Kotlin.Long} other Long to compare against.\n * @return {boolean} Whether this Long is greater than or equal to the other.\n */\nKotlin.Long.prototype.greaterThanOrEqual = function(other) {\n return this.compare(other) >= 0;\n};\n\n\n/**\n * Compares this Long with the given one.\n * @param {Kotlin.Long} other Long to compare against.\n * @return {number} 0 if they are the same, 1 if the this is greater, and -1\n * if the given one is greater.\n */\nKotlin.Long.prototype.compare = function(other) {\n if (this.equalsLong(other)) {\n return 0;\n }\n\n var thisNeg = this.isNegative();\n var otherNeg = other.isNegative();\n if (thisNeg && !otherNeg) {\n return -1;\n }\n if (!thisNeg && otherNeg) {\n return 1;\n }\n\n // at this point, the signs are the same, so subtraction will not overflow\n if (this.subtract(other).isNegative()) {\n return -1;\n } else {\n return 1;\n }\n};\n\n\n/** @return {!Kotlin.Long} The negation of this value. */\nKotlin.Long.prototype.negate = function() {\n if (this.equalsLong(Kotlin.Long.MIN_VALUE)) {\n return Kotlin.Long.MIN_VALUE;\n } else {\n return this.not().add(Kotlin.Long.ONE);\n }\n};\n\n\n/**\n * Returns the sum of this and the given Long.\n * @param {Kotlin.Long} other Long to add to this one.\n * @return {!Kotlin.Long} The sum of this and the given Long.\n */\nKotlin.Long.prototype.add = function(other) {\n // Divide each number into 4 chunks of 16 bits, and then sum the chunks.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 + b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 + b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 + b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 + b48;\n c48 &= 0xFFFF;\n return Kotlin.Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n\n/**\n * Returns the difference of this and the given Long.\n * @param {Kotlin.Long} other Long to subtract from this.\n * @return {!Kotlin.Long} The difference of this and the given Long.\n */\nKotlin.Long.prototype.subtract = function(other) {\n return this.add(other.negate());\n};\n\n\n/**\n * Returns the product of this and the given long.\n * @param {Kotlin.Long} other Long to multiply with this.\n * @return {!Kotlin.Long} The product of this and the other.\n */\nKotlin.Long.prototype.multiply = function(other) {\n if (this.isZero()) {\n return Kotlin.Long.ZERO;\n } else if (other.isZero()) {\n return Kotlin.Long.ZERO;\n }\n\n if (this.equalsLong(Kotlin.Long.MIN_VALUE)) {\n return other.isOdd() ? Kotlin.Long.MIN_VALUE : Kotlin.Long.ZERO;\n } else if (other.equalsLong(Kotlin.Long.MIN_VALUE)) {\n return this.isOdd() ? Kotlin.Long.MIN_VALUE : Kotlin.Long.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().multiply(other.negate());\n } else {\n return this.negate().multiply(other).negate();\n }\n } else if (other.isNegative()) {\n return this.multiply(other.negate()).negate();\n }\n\n // If both longs are small, use float multiplication\n if (this.lessThan(Kotlin.Long.TWO_PWR_24_) &&\n other.lessThan(Kotlin.Long.TWO_PWR_24_)) {\n return Kotlin.Long.fromNumber(this.toNumber() * other.toNumber());\n }\n\n // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products.\n // We can skip products that would overflow.\n\n var a48 = this.high_ >>> 16;\n var a32 = this.high_ & 0xFFFF;\n var a16 = this.low_ >>> 16;\n var a00 = this.low_ & 0xFFFF;\n\n var b48 = other.high_ >>> 16;\n var b32 = other.high_ & 0xFFFF;\n var b16 = other.low_ >>> 16;\n var b00 = other.low_ & 0xFFFF;\n\n var c48 = 0, c32 = 0, c16 = 0, c00 = 0;\n c00 += a00 * b00;\n c16 += c00 >>> 16;\n c00 &= 0xFFFF;\n c16 += a16 * b00;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c16 += a00 * b16;\n c32 += c16 >>> 16;\n c16 &= 0xFFFF;\n c32 += a32 * b00;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a16 * b16;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c32 += a00 * b32;\n c48 += c32 >>> 16;\n c32 &= 0xFFFF;\n c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;\n c48 &= 0xFFFF;\n return Kotlin.Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32);\n};\n\n\n/**\n * Returns this Long divided by the given one.\n * @param {Kotlin.Long} other Long by which to divide.\n * @return {!Kotlin.Long} This Long divided by the given one.\n */\nKotlin.Long.prototype.div = function(other) {\n if (other.isZero()) {\n throw Error('division by zero');\n } else if (this.isZero()) {\n return Kotlin.Long.ZERO;\n }\n\n if (this.equalsLong(Kotlin.Long.MIN_VALUE)) {\n if (other.equalsLong(Kotlin.Long.ONE) ||\n other.equalsLong(Kotlin.Long.NEG_ONE)) {\n return Kotlin.Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE\n } else if (other.equalsLong(Kotlin.Long.MIN_VALUE)) {\n return Kotlin.Long.ONE;\n } else {\n // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|.\n var halfThis = this.shiftRight(1);\n var approx = halfThis.div(other).shiftLeft(1);\n if (approx.equalsLong(Kotlin.Long.ZERO)) {\n return other.isNegative() ? Kotlin.Long.ONE : Kotlin.Long.NEG_ONE;\n } else {\n var rem = this.subtract(other.multiply(approx));\n var result = approx.add(rem.div(other));\n return result;\n }\n }\n } else if (other.equalsLong(Kotlin.Long.MIN_VALUE)) {\n return Kotlin.Long.ZERO;\n }\n\n if (this.isNegative()) {\n if (other.isNegative()) {\n return this.negate().div(other.negate());\n } else {\n return this.negate().div(other).negate();\n }\n } else if (other.isNegative()) {\n return this.div(other.negate()).negate();\n }\n\n // Repeat the following until the remainder is less than other: find a\n // floating-point that approximates remainder / other *from below*, add this\n // into the result, and subtract it from the remainder. It is critical that\n // the approximate value is less than or equal to the real value so that the\n // remainder never becomes negative.\n var res = Kotlin.Long.ZERO;\n var rem = this;\n while (rem.greaterThanOrEqual(other)) {\n // Approximate the result of division. This may be a little greater or\n // smaller than the actual value.\n var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber()));\n\n // We will tweak the approximate result by changing it in the 48-th digit or\n // the smallest non-fractional digit, whichever is larger.\n var log2 = Math.ceil(Math.log(approx) / Math.LN2);\n var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48);\n\n // Decrease the approximation until it is smaller than the remainder. Note\n // that if it is too large, the product overflows and is negative.\n var approxRes = Kotlin.Long.fromNumber(approx);\n var approxRem = approxRes.multiply(other);\n while (approxRem.isNegative() || approxRem.greaterThan(rem)) {\n approx -= delta;\n approxRes = Kotlin.Long.fromNumber(approx);\n approxRem = approxRes.multiply(other);\n }\n\n // We know the answer can't be zero... and actually, zero would cause\n // infinite recursion since we would make no progress.\n if (approxRes.isZero()) {\n approxRes = Kotlin.Long.ONE;\n }\n\n res = res.add(approxRes);\n rem = rem.subtract(approxRem);\n }\n return res;\n};\n\n\n/**\n * Returns this Long modulo the given one.\n * @param {Kotlin.Long} other Long by which to mod.\n * @return {!Kotlin.Long} This Long modulo the given one.\n */\nKotlin.Long.prototype.modulo = function(other) {\n return this.subtract(this.div(other).multiply(other));\n};\n\n\n/** @return {!Kotlin.Long} The bitwise-NOT of this value. */\nKotlin.Long.prototype.not = function() {\n return Kotlin.Long.fromBits(~this.low_, ~this.high_);\n};\n\n\n/**\n * Returns the bitwise-AND of this Long and the given one.\n * @param {Kotlin.Long} other The Long with which to AND.\n * @return {!Kotlin.Long} The bitwise-AND of this and the other.\n */\nKotlin.Long.prototype.and = function(other) {\n return Kotlin.Long.fromBits(this.low_ & other.low_,\n this.high_ & other.high_);\n};\n\n\n/**\n * Returns the bitwise-OR of this Long and the given one.\n * @param {Kotlin.Long} other The Long with which to OR.\n * @return {!Kotlin.Long} The bitwise-OR of this and the other.\n */\nKotlin.Long.prototype.or = function(other) {\n return Kotlin.Long.fromBits(this.low_ | other.low_,\n this.high_ | other.high_);\n};\n\n\n/**\n * Returns the bitwise-XOR of this Long and the given one.\n * @param {Kotlin.Long} other The Long with which to XOR.\n * @return {!Kotlin.Long} The bitwise-XOR of this and the other.\n */\nKotlin.Long.prototype.xor = function(other) {\n return Kotlin.Long.fromBits(this.low_ ^ other.low_,\n this.high_ ^ other.high_);\n};\n\n\n/**\n * Returns this Long with bits shifted to the left by the given amount.\n * @param {number} numBits The number of bits by which to shift.\n * @return {!Kotlin.Long} This shifted to the left by the given amount.\n */\nKotlin.Long.prototype.shiftLeft = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var low = this.low_;\n if (numBits < 32) {\n var high = this.high_;\n return Kotlin.Long.fromBits(\n low << numBits,\n (high << numBits) | (low >>> (32 - numBits)));\n } else {\n return Kotlin.Long.fromBits(0, low << (numBits - 32));\n }\n }\n};\n\n\n/**\n * Returns this Long with bits shifted to the right by the given amount.\n * @param {number} numBits The number of bits by which to shift.\n * @return {!Kotlin.Long} This shifted to the right by the given amount.\n */\nKotlin.Long.prototype.shiftRight = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Kotlin.Long.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >> numBits);\n } else {\n return Kotlin.Long.fromBits(\n high >> (numBits - 32),\n high >= 0 ? 0 : -1);\n }\n }\n};\n\n\n/**\n * Returns this Long with bits shifted to the right by the given amount, with\n * zeros placed into the new leading bits.\n * @param {number} numBits The number of bits by which to shift.\n * @return {!Kotlin.Long} This shifted to the right by the given amount, with\n * zeros placed into the new leading bits.\n */\nKotlin.Long.prototype.shiftRightUnsigned = function(numBits) {\n numBits &= 63;\n if (numBits == 0) {\n return this;\n } else {\n var high = this.high_;\n if (numBits < 32) {\n var low = this.low_;\n return Kotlin.Long.fromBits(\n (low >>> numBits) | (high << (32 - numBits)),\n high >>> numBits);\n } else if (numBits == 32) {\n return Kotlin.Long.fromBits(high, 0);\n } else {\n return Kotlin.Long.fromBits(high >>> (numBits - 32), 0);\n }\n }\n};\n\n// Support for Kotlin\nKotlin.Long.prototype.equals = function (other) {\n return other instanceof Kotlin.Long && this.equalsLong(other);\n};\n\nKotlin.Long.prototype.compareTo_11rb$ = Kotlin.Long.prototype.compare;\n\nKotlin.Long.prototype.inc = function() {\n return this.add(Kotlin.Long.ONE);\n};\n\nKotlin.Long.prototype.dec = function() {\n return this.add(Kotlin.Long.NEG_ONE);\n};\n\nKotlin.Long.prototype.valueOf = function() {\n return this.toNumber();\n};\n\nKotlin.Long.prototype.unaryPlus = function() {\n return this;\n};\n\nKotlin.Long.prototype.unaryMinus = Kotlin.Long.prototype.negate;\nKotlin.Long.prototype.inv = Kotlin.Long.prototype.not;\n\nKotlin.Long.prototype.rangeTo = function (other) {\n return new Kotlin.kotlin.ranges.LongRange(this, other);\n};","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. \n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\nKotlin.Kind = {\n CLASS: \"class\",\n INTERFACE: \"interface\",\n OBJECT: \"object\"\n};\n\nKotlin.callGetter = function (thisObject, klass, propertyName) {\n var propertyDescriptor = Object.getOwnPropertyDescriptor(klass, propertyName);\n if (propertyDescriptor != null && propertyDescriptor.get != null) {\n return propertyDescriptor.get.call(thisObject);\n }\n\n propertyDescriptor = Object.getOwnPropertyDescriptor(thisObject, propertyName);\n if (propertyDescriptor != null && \"value\" in propertyDescriptor) {\n return thisObject[propertyName];\n }\n\n return Kotlin.callGetter(thisObject, Object.getPrototypeOf(klass), propertyName);\n};\n\nKotlin.callSetter = function (thisObject, klass, propertyName, value) {\n var propertyDescriptor = Object.getOwnPropertyDescriptor(klass, propertyName);\n if (propertyDescriptor != null && propertyDescriptor.set != null) {\n propertyDescriptor.set.call(thisObject, value);\n return;\n }\n\n propertyDescriptor = Object.getOwnPropertyDescriptor(thisObject, propertyName);\n if (propertyDescriptor != null && \"value\" in propertyDescriptor) {\n thisObject[propertyName] = value;\n return\n }\n\n Kotlin.callSetter(thisObject, Object.getPrototypeOf(klass), propertyName, value);\n};\n\nfunction isInheritanceFromInterface(ctor, iface) {\n if (ctor === iface) return true;\n\n var metadata = ctor.$metadata$;\n if (metadata != null) {\n var interfaces = metadata.interfaces;\n for (var i = 0; i < interfaces.length; i++) {\n if (isInheritanceFromInterface(interfaces[i], iface)) {\n return true;\n }\n }\n }\n\n var superPrototype = ctor.prototype != null ? Object.getPrototypeOf(ctor.prototype) : null;\n var superConstructor = superPrototype != null ? superPrototype.constructor : null;\n return superConstructor != null && isInheritanceFromInterface(superConstructor, iface);\n}\n\n/**\n *\n * @param {*} object\n * @param {Function|Object} klass\n * @returns {Boolean}\n */\nKotlin.isType = function (object, klass) {\n if (klass === Object) {\n switch (typeof object) {\n case \"string\":\n case \"number\":\n case \"boolean\":\n case \"function\":\n return true;\n default:\n return object instanceof Object;\n }\n }\n\n if (object == null || klass == null || (typeof object !== 'object' && typeof object !== 'function')) {\n return false;\n }\n\n if (typeof klass === \"function\" && object instanceof klass) {\n return true;\n }\n\n var proto = Object.getPrototypeOf(klass);\n var constructor = proto != null ? proto.constructor : null;\n if (constructor != null && \"$metadata$\" in constructor) {\n var metadata = constructor.$metadata$;\n if (metadata.kind === Kotlin.Kind.OBJECT) {\n return object === klass;\n }\n }\n\n var klassMetadata = klass.$metadata$;\n\n // In WebKit (JavaScriptCore) for some interfaces from DOM typeof returns \"object\", nevertheless they can be used in RHS of instanceof\n if (klassMetadata == null) {\n return object instanceof klass;\n }\n\n if (klassMetadata.kind === Kotlin.Kind.INTERFACE && object.constructor != null) {\n return isInheritanceFromInterface(object.constructor, klass);\n }\n\n return false;\n};\n\nKotlin.isNumber = function (a) {\n return typeof a == \"number\" || a instanceof Kotlin.Long;\n};\n\nKotlin.isChar = function (value) {\n return value instanceof Kotlin.BoxedChar\n};\n\nKotlin.isComparable = function (value) {\n var type = typeof value;\n\n return type === \"string\" ||\n type === \"boolean\" ||\n Kotlin.isNumber(value) ||\n Kotlin.isType(value, Kotlin.kotlin.Comparable);\n};\n\nKotlin.isCharSequence = function (value) {\n return typeof value === \"string\" || Kotlin.isType(value, Kotlin.kotlin.CharSequence);\n};","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// a package is omitted to get declarations directly under the module\n\n@PublishedApi\nexternal internal fun Array(size: Int): Array\n\n@JsName(\"newArray\")\nfun newArray(size: Int, initValue: T) = fillArrayVal(Array(size), initValue)\n\n@JsName(\"newArrayF\")\ninline fun arrayWithFun(size: Int, init: (Int) -> T) = fillArrayFun(Array(size), init)\n\n@JsName(\"fillArray\")\ninline fun fillArrayFun(array: Array, init: (Int) -> T): Array {\n for (i in 0..array.size - 1) {\n array[i] = init(i)\n }\n return array\n}\n\n@JsName(\"booleanArray\")\nfun booleanArray(size: Int, init: dynamic): Array {\n val result: dynamic = Array(size)\n result.`$type$` = \"BooleanArray\"\n return when (init) {\n null, true -> fillArrayVal(result, false)\n false -> result\n else -> fillArrayFun(result, init)\n }\n}\n\n@JsName(\"booleanArrayF\")\ninline fun booleanArrayWithFun(size: Int, init: (Int) -> Boolean): Array = fillArrayFun(booleanArray(size, false), init)\n\n@JsName(\"charArray\")\n@Suppress(\"UNUSED_PARAMETER\")\nfun charArray(size: Int, init: dynamic): Array {\n val result = js(\"new Uint16Array(size)\")\n result.`$type$` = \"CharArray\"\n return when (init) {\n null, true, false -> result // For consistency\n else -> fillArrayFun(result, init)\n }\n}\n\n@JsName(\"charArrayF\")\ninline fun charArrayWithFun(size: Int, init: (Int) -> Char): Array {\n val array = charArray(size, null)\n for (i in 0..array.size - 1) {\n @Suppress(\"UNUSED_VARIABLE\") // used in js block\n val value = init(i)\n js(\"array[i] = value;\")\n }\n return array\n}\n\n@JsName(\"untypedCharArrayF\")\ninline fun untypedCharArrayWithFun(size: Int, init: (Int) -> Char): Array {\n val array = Array(size)\n for (i in 0..array.size - 1) {\n @Suppress(\"UNUSED_VARIABLE\") // used in js block\n val value = init(i)\n js(\"array[i] = value;\")\n }\n return array\n}\n\n@JsName(\"longArray\")\nfun longArray(size: Int, init: dynamic): Array {\n val result: dynamic = Array(size)\n result.`$type$` = \"LongArray\"\n return when (init) {\n null, true -> fillArrayVal(result, 0L)\n false -> result\n else -> fillArrayFun(result, init)\n }\n}\n\n@JsName(\"longArrayF\")\ninline fun longArrayWithFun(size: Int, init: (Int) -> Long): Array = fillArrayFun(longArray(size, false), init)\n\nprivate fun fillArrayVal(array: Array, initValue: T): Array {\n for (i in 0..array.size - 1) {\n array[i] = initValue\n }\n return array\n}","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin\n\npublic class Enum> : Comparable> {\n @JsName(\"name$\") private var _name: String = \"\"\n @JsName(\"ordinal$\") private var _ordinal: Int = 0\n\n val name: String\n get() = _name\n\n val ordinal: Int\n get() = _ordinal\n\n override fun compareTo(other: Enum) = ordinal.compareTo(other.ordinal)\n\n override fun equals(other: Any?) = this === other\n\n override fun hashCode(): Int = js(\"Kotlin.identityHashCode\")(this)\n\n override fun toString() = name\n\n companion object\n}",null,"/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"ArraysKt\")\n\npackage kotlin.collections\n\n//\n// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt\n// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib\n//\n\nimport kotlin.random.*\nimport kotlin.ranges.contains\nimport kotlin.ranges.reversed\n\n/**\n * Returns 1st *element* from the array.\n * \n * If the size of this array is less than 1, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun Array.component1(): T {\n return get(0)\n}\n\n/**\n * Returns 1st *element* from the array.\n * \n * If the size of this array is less than 1, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun ByteArray.component1(): Byte {\n return get(0)\n}\n\n/**\n * Returns 1st *element* from the array.\n * \n * If the size of this array is less than 1, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun ShortArray.component1(): Short {\n return get(0)\n}\n\n/**\n * Returns 1st *element* from the array.\n * \n * If the size of this array is less than 1, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun IntArray.component1(): Int {\n return get(0)\n}\n\n/**\n * Returns 1st *element* from the array.\n * \n * If the size of this array is less than 1, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun LongArray.component1(): Long {\n return get(0)\n}\n\n/**\n * Returns 1st *element* from the array.\n * \n * If the size of this array is less than 1, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun FloatArray.component1(): Float {\n return get(0)\n}\n\n/**\n * Returns 1st *element* from the array.\n * \n * If the size of this array is less than 1, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun DoubleArray.component1(): Double {\n return get(0)\n}\n\n/**\n * Returns 1st *element* from the array.\n * \n * If the size of this array is less than 1, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun BooleanArray.component1(): Boolean {\n return get(0)\n}\n\n/**\n * Returns 1st *element* from the array.\n * \n * If the size of this array is less than 1, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun CharArray.component1(): Char {\n return get(0)\n}\n\n/**\n * Returns 2nd *element* from the array.\n * \n * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun Array.component2(): T {\n return get(1)\n}\n\n/**\n * Returns 2nd *element* from the array.\n * \n * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun ByteArray.component2(): Byte {\n return get(1)\n}\n\n/**\n * Returns 2nd *element* from the array.\n * \n * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun ShortArray.component2(): Short {\n return get(1)\n}\n\n/**\n * Returns 2nd *element* from the array.\n * \n * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun IntArray.component2(): Int {\n return get(1)\n}\n\n/**\n * Returns 2nd *element* from the array.\n * \n * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun LongArray.component2(): Long {\n return get(1)\n}\n\n/**\n * Returns 2nd *element* from the array.\n * \n * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun FloatArray.component2(): Float {\n return get(1)\n}\n\n/**\n * Returns 2nd *element* from the array.\n * \n * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun DoubleArray.component2(): Double {\n return get(1)\n}\n\n/**\n * Returns 2nd *element* from the array.\n * \n * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun BooleanArray.component2(): Boolean {\n return get(1)\n}\n\n/**\n * Returns 2nd *element* from the array.\n * \n * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun CharArray.component2(): Char {\n return get(1)\n}\n\n/**\n * Returns 3rd *element* from the array.\n * \n * If the size of this array is less than 3, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun Array.component3(): T {\n return get(2)\n}\n\n/**\n * Returns 3rd *element* from the array.\n * \n * If the size of this array is less than 3, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun ByteArray.component3(): Byte {\n return get(2)\n}\n\n/**\n * Returns 3rd *element* from the array.\n * \n * If the size of this array is less than 3, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun ShortArray.component3(): Short {\n return get(2)\n}\n\n/**\n * Returns 3rd *element* from the array.\n * \n * If the size of this array is less than 3, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun IntArray.component3(): Int {\n return get(2)\n}\n\n/**\n * Returns 3rd *element* from the array.\n * \n * If the size of this array is less than 3, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun LongArray.component3(): Long {\n return get(2)\n}\n\n/**\n * Returns 3rd *element* from the array.\n * \n * If the size of this array is less than 3, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun FloatArray.component3(): Float {\n return get(2)\n}\n\n/**\n * Returns 3rd *element* from the array.\n * \n * If the size of this array is less than 3, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun DoubleArray.component3(): Double {\n return get(2)\n}\n\n/**\n * Returns 3rd *element* from the array.\n * \n * If the size of this array is less than 3, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun BooleanArray.component3(): Boolean {\n return get(2)\n}\n\n/**\n * Returns 3rd *element* from the array.\n * \n * If the size of this array is less than 3, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun CharArray.component3(): Char {\n return get(2)\n}\n\n/**\n * Returns 4th *element* from the array.\n * \n * If the size of this array is less than 4, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun Array.component4(): T {\n return get(3)\n}\n\n/**\n * Returns 4th *element* from the array.\n * \n * If the size of this array is less than 4, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun ByteArray.component4(): Byte {\n return get(3)\n}\n\n/**\n * Returns 4th *element* from the array.\n * \n * If the size of this array is less than 4, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun ShortArray.component4(): Short {\n return get(3)\n}\n\n/**\n * Returns 4th *element* from the array.\n * \n * If the size of this array is less than 4, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun IntArray.component4(): Int {\n return get(3)\n}\n\n/**\n * Returns 4th *element* from the array.\n * \n * If the size of this array is less than 4, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun LongArray.component4(): Long {\n return get(3)\n}\n\n/**\n * Returns 4th *element* from the array.\n * \n * If the size of this array is less than 4, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun FloatArray.component4(): Float {\n return get(3)\n}\n\n/**\n * Returns 4th *element* from the array.\n * \n * If the size of this array is less than 4, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun DoubleArray.component4(): Double {\n return get(3)\n}\n\n/**\n * Returns 4th *element* from the array.\n * \n * If the size of this array is less than 4, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun BooleanArray.component4(): Boolean {\n return get(3)\n}\n\n/**\n * Returns 4th *element* from the array.\n * \n * If the size of this array is less than 4, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun CharArray.component4(): Char {\n return get(3)\n}\n\n/**\n * Returns 5th *element* from the array.\n * \n * If the size of this array is less than 5, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun Array.component5(): T {\n return get(4)\n}\n\n/**\n * Returns 5th *element* from the array.\n * \n * If the size of this array is less than 5, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun ByteArray.component5(): Byte {\n return get(4)\n}\n\n/**\n * Returns 5th *element* from the array.\n * \n * If the size of this array is less than 5, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun ShortArray.component5(): Short {\n return get(4)\n}\n\n/**\n * Returns 5th *element* from the array.\n * \n * If the size of this array is less than 5, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun IntArray.component5(): Int {\n return get(4)\n}\n\n/**\n * Returns 5th *element* from the array.\n * \n * If the size of this array is less than 5, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun LongArray.component5(): Long {\n return get(4)\n}\n\n/**\n * Returns 5th *element* from the array.\n * \n * If the size of this array is less than 5, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun FloatArray.component5(): Float {\n return get(4)\n}\n\n/**\n * Returns 5th *element* from the array.\n * \n * If the size of this array is less than 5, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun DoubleArray.component5(): Double {\n return get(4)\n}\n\n/**\n * Returns 5th *element* from the array.\n * \n * If the size of this array is less than 5, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun BooleanArray.component5(): Boolean {\n return get(4)\n}\n\n/**\n * Returns 5th *element* from the array.\n * \n * If the size of this array is less than 5, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun CharArray.component5(): Char {\n return get(4)\n}\n\n/**\n * Returns `true` if [element] is found in the array.\n */\npublic operator fun <@kotlin.internal.OnlyInputTypes T> Array.contains(element: T): Boolean {\n return indexOf(element) >= 0\n}\n\n/**\n * Returns `true` if [element] is found in the array.\n */\npublic operator fun ByteArray.contains(element: Byte): Boolean {\n return indexOf(element) >= 0\n}\n\n/**\n * Returns `true` if [element] is found in the array.\n */\npublic operator fun ShortArray.contains(element: Short): Boolean {\n return indexOf(element) >= 0\n}\n\n/**\n * Returns `true` if [element] is found in the array.\n */\npublic operator fun IntArray.contains(element: Int): Boolean {\n return indexOf(element) >= 0\n}\n\n/**\n * Returns `true` if [element] is found in the array.\n */\npublic operator fun LongArray.contains(element: Long): Boolean {\n return indexOf(element) >= 0\n}\n\n/**\n * Returns `true` if [element] is found in the array.\n */\n@Deprecated(\"The function has unclear behavior when searching for NaN or zero values and will be removed soon. Use 'any { it == element }' instead to continue using this behavior, or '.asList().contains(element: T)' to get the same search behavior as in a list.\", ReplaceWith(\"any { it == element }\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@Suppress(\"DEPRECATION\")\npublic operator fun FloatArray.contains(element: Float): Boolean {\n return indexOf(element) >= 0\n}\n\n/**\n * Returns `true` if [element] is found in the array.\n */\n@Deprecated(\"The function has unclear behavior when searching for NaN or zero values and will be removed soon. Use 'any { it == element }' instead to continue using this behavior, or '.asList().contains(element: T)' to get the same search behavior as in a list.\", ReplaceWith(\"any { it == element }\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@Suppress(\"DEPRECATION\")\npublic operator fun DoubleArray.contains(element: Double): Boolean {\n return indexOf(element) >= 0\n}\n\n/**\n * Returns `true` if [element] is found in the array.\n */\npublic operator fun BooleanArray.contains(element: Boolean): Boolean {\n return indexOf(element) >= 0\n}\n\n/**\n * Returns `true` if [element] is found in the array.\n */\npublic operator fun CharArray.contains(element: Char): Boolean {\n return indexOf(element) >= 0\n}\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic expect fun Array.elementAt(index: Int): T\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic expect fun ByteArray.elementAt(index: Int): Byte\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic expect fun ShortArray.elementAt(index: Int): Short\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic expect fun IntArray.elementAt(index: Int): Int\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic expect fun LongArray.elementAt(index: Int): Long\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic expect fun FloatArray.elementAt(index: Int): Float\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic expect fun DoubleArray.elementAt(index: Int): Double\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic expect fun BooleanArray.elementAt(index: Int): Boolean\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic expect fun CharArray.elementAt(index: Int): Char\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@kotlin.internal.InlineOnly\npublic inline fun Array.elementAtOrElse(index: Int, defaultValue: (Int) -> T): T {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Byte): Byte {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Short): Short {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Int): Int {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Long): Long {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Float): Float {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Double): Double {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Boolean): Boolean {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.elementAtOrElse(index: Int, defaultValue: (Int) -> Char): Char {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@kotlin.internal.InlineOnly\npublic inline fun Array.elementAtOrNull(index: Int): T? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.elementAtOrNull(index: Int): Byte? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.elementAtOrNull(index: Int): Short? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.elementAtOrNull(index: Int): Int? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.elementAtOrNull(index: Int): Long? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.elementAtOrNull(index: Int): Float? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.elementAtOrNull(index: Int): Double? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.elementAtOrNull(index: Int): Boolean? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.elementAtOrNull(index: Int): Char? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun Array.find(predicate: (T) -> Boolean): T? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.find(predicate: (Byte) -> Boolean): Byte? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.find(predicate: (Short) -> Boolean): Short? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.find(predicate: (Int) -> Boolean): Int? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.find(predicate: (Long) -> Boolean): Long? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.find(predicate: (Float) -> Boolean): Float? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.find(predicate: (Double) -> Boolean): Double? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.find(predicate: (Boolean) -> Boolean): Boolean? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.find(predicate: (Char) -> Boolean): Char? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun Array.findLast(predicate: (T) -> Boolean): T? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.findLast(predicate: (Byte) -> Boolean): Byte? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.findLast(predicate: (Short) -> Boolean): Short? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.findLast(predicate: (Int) -> Boolean): Int? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.findLast(predicate: (Long) -> Boolean): Long? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.findLast(predicate: (Float) -> Boolean): Float? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.findLast(predicate: (Double) -> Boolean): Double? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.findLast(predicate: (Boolean) -> Boolean): Boolean? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.findLast(predicate: (Char) -> Boolean): Char? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the array is empty.\n */\npublic fun Array.first(): T {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[0]\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the array is empty.\n */\npublic fun ByteArray.first(): Byte {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[0]\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the array is empty.\n */\npublic fun ShortArray.first(): Short {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[0]\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the array is empty.\n */\npublic fun IntArray.first(): Int {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[0]\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the array is empty.\n */\npublic fun LongArray.first(): Long {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[0]\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the array is empty.\n */\npublic fun FloatArray.first(): Float {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[0]\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the array is empty.\n */\npublic fun DoubleArray.first(): Double {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[0]\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the array is empty.\n */\npublic fun BooleanArray.first(): Boolean {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[0]\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the array is empty.\n */\npublic fun CharArray.first(): Char {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[0]\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n */\npublic inline fun Array.first(predicate: (T) -> Boolean): T {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n */\npublic inline fun ByteArray.first(predicate: (Byte) -> Boolean): Byte {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n */\npublic inline fun ShortArray.first(predicate: (Short) -> Boolean): Short {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n */\npublic inline fun IntArray.first(predicate: (Int) -> Boolean): Int {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n */\npublic inline fun LongArray.first(predicate: (Long) -> Boolean): Long {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n */\npublic inline fun FloatArray.first(predicate: (Float) -> Boolean): Float {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n */\npublic inline fun DoubleArray.first(predicate: (Double) -> Boolean): Double {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n */\npublic inline fun BooleanArray.first(predicate: (Boolean) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n */\npublic inline fun CharArray.first(predicate: (Char) -> Boolean): Char {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element, or `null` if the array is empty.\n */\npublic fun Array.firstOrNull(): T? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first element, or `null` if the array is empty.\n */\npublic fun ByteArray.firstOrNull(): Byte? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first element, or `null` if the array is empty.\n */\npublic fun ShortArray.firstOrNull(): Short? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first element, or `null` if the array is empty.\n */\npublic fun IntArray.firstOrNull(): Int? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first element, or `null` if the array is empty.\n */\npublic fun LongArray.firstOrNull(): Long? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first element, or `null` if the array is empty.\n */\npublic fun FloatArray.firstOrNull(): Float? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first element, or `null` if the array is empty.\n */\npublic fun DoubleArray.firstOrNull(): Double? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first element, or `null` if the array is empty.\n */\npublic fun BooleanArray.firstOrNull(): Boolean? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first element, or `null` if the array is empty.\n */\npublic fun CharArray.firstOrNull(): Char? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n */\npublic inline fun Array.firstOrNull(predicate: (T) -> Boolean): T? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n */\npublic inline fun ByteArray.firstOrNull(predicate: (Byte) -> Boolean): Byte? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n */\npublic inline fun ShortArray.firstOrNull(predicate: (Short) -> Boolean): Short? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n */\npublic inline fun IntArray.firstOrNull(predicate: (Int) -> Boolean): Int? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n */\npublic inline fun LongArray.firstOrNull(predicate: (Long) -> Boolean): Long? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n */\npublic inline fun FloatArray.firstOrNull(predicate: (Float) -> Boolean): Float? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n */\npublic inline fun DoubleArray.firstOrNull(predicate: (Double) -> Boolean): Double? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n */\npublic inline fun BooleanArray.firstOrNull(predicate: (Boolean) -> Boolean): Boolean? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n */\npublic inline fun CharArray.firstOrNull(predicate: (Char) -> Boolean): Char? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun Array.getOrElse(index: Int, defaultValue: (Int) -> T): T {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.getOrElse(index: Int, defaultValue: (Int) -> Byte): Byte {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.getOrElse(index: Int, defaultValue: (Int) -> Short): Short {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.getOrElse(index: Int, defaultValue: (Int) -> Int): Int {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.getOrElse(index: Int, defaultValue: (Int) -> Long): Long {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.getOrElse(index: Int, defaultValue: (Int) -> Float): Float {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.getOrElse(index: Int, defaultValue: (Int) -> Double): Double {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.getOrElse(index: Int, defaultValue: (Int) -> Boolean): Boolean {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.getOrElse(index: Int, defaultValue: (Int) -> Char): Char {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\npublic fun Array.getOrNull(index: Int): T? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\npublic fun ByteArray.getOrNull(index: Int): Byte? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\npublic fun ShortArray.getOrNull(index: Int): Short? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\npublic fun IntArray.getOrNull(index: Int): Int? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\npublic fun LongArray.getOrNull(index: Int): Long? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\npublic fun FloatArray.getOrNull(index: Int): Float? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\npublic fun DoubleArray.getOrNull(index: Int): Double? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\npublic fun BooleanArray.getOrNull(index: Int): Boolean? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\npublic fun CharArray.getOrNull(index: Int): Char? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns first index of [element], or -1 if the array does not contain element.\n */\npublic fun <@kotlin.internal.OnlyInputTypes T> Array.indexOf(element: T): Int {\n if (element == null) {\n for (index in indices) {\n if (this[index] == null) {\n return index\n }\n }\n } else {\n for (index in indices) {\n if (element == this[index]) {\n return index\n }\n }\n }\n return -1\n}\n\n/**\n * Returns first index of [element], or -1 if the array does not contain element.\n */\npublic fun ByteArray.indexOf(element: Byte): Int {\n for (index in indices) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns first index of [element], or -1 if the array does not contain element.\n */\npublic fun ShortArray.indexOf(element: Short): Int {\n for (index in indices) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns first index of [element], or -1 if the array does not contain element.\n */\npublic fun IntArray.indexOf(element: Int): Int {\n for (index in indices) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns first index of [element], or -1 if the array does not contain element.\n */\npublic fun LongArray.indexOf(element: Long): Int {\n for (index in indices) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns first index of [element], or -1 if the array does not contain element.\n */\n@Deprecated(\"The function has unclear behavior when searching for NaN or zero values and will be removed soon. Use 'indexOfFirst { it == element }' instead to continue using this behavior, or '.asList().indexOf(element: T)' to get the same search behavior as in a list.\", ReplaceWith(\"indexOfFirst { it == element }\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun FloatArray.indexOf(element: Float): Int {\n for (index in indices) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns first index of [element], or -1 if the array does not contain element.\n */\n@Deprecated(\"The function has unclear behavior when searching for NaN or zero values and will be removed soon. Use 'indexOfFirst { it == element }' instead to continue using this behavior, or '.asList().indexOf(element: T)' to get the same search behavior as in a list.\", ReplaceWith(\"indexOfFirst { it == element }\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun DoubleArray.indexOf(element: Double): Int {\n for (index in indices) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns first index of [element], or -1 if the array does not contain element.\n */\npublic fun BooleanArray.indexOf(element: Boolean): Int {\n for (index in indices) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns first index of [element], or -1 if the array does not contain element.\n */\npublic fun CharArray.indexOf(element: Char): Int {\n for (index in indices) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun Array.indexOfFirst(predicate: (T) -> Boolean): Int {\n for (index in indices) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun ByteArray.indexOfFirst(predicate: (Byte) -> Boolean): Int {\n for (index in indices) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun ShortArray.indexOfFirst(predicate: (Short) -> Boolean): Int {\n for (index in indices) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun IntArray.indexOfFirst(predicate: (Int) -> Boolean): Int {\n for (index in indices) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun LongArray.indexOfFirst(predicate: (Long) -> Boolean): Int {\n for (index in indices) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun FloatArray.indexOfFirst(predicate: (Float) -> Boolean): Int {\n for (index in indices) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun DoubleArray.indexOfFirst(predicate: (Double) -> Boolean): Int {\n for (index in indices) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun BooleanArray.indexOfFirst(predicate: (Boolean) -> Boolean): Int {\n for (index in indices) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun CharArray.indexOfFirst(predicate: (Char) -> Boolean): Int {\n for (index in indices) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun Array.indexOfLast(predicate: (T) -> Boolean): Int {\n for (index in indices.reversed()) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun ByteArray.indexOfLast(predicate: (Byte) -> Boolean): Int {\n for (index in indices.reversed()) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun ShortArray.indexOfLast(predicate: (Short) -> Boolean): Int {\n for (index in indices.reversed()) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun IntArray.indexOfLast(predicate: (Int) -> Boolean): Int {\n for (index in indices.reversed()) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun LongArray.indexOfLast(predicate: (Long) -> Boolean): Int {\n for (index in indices.reversed()) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun FloatArray.indexOfLast(predicate: (Float) -> Boolean): Int {\n for (index in indices.reversed()) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun DoubleArray.indexOfLast(predicate: (Double) -> Boolean): Int {\n for (index in indices.reversed()) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun BooleanArray.indexOfLast(predicate: (Boolean) -> Boolean): Int {\n for (index in indices.reversed()) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element.\n */\npublic inline fun CharArray.indexOfLast(predicate: (Char) -> Boolean): Int {\n for (index in indices.reversed()) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun Array.last(): T {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[lastIndex]\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun ByteArray.last(): Byte {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[lastIndex]\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun ShortArray.last(): Short {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[lastIndex]\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun IntArray.last(): Int {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[lastIndex]\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun LongArray.last(): Long {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[lastIndex]\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun FloatArray.last(): Float {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[lastIndex]\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun DoubleArray.last(): Double {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[lastIndex]\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun BooleanArray.last(): Boolean {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[lastIndex]\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun CharArray.last(): Char {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return this[lastIndex]\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun Array.last(predicate: (T) -> Boolean): T {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun ByteArray.last(predicate: (Byte) -> Boolean): Byte {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun ShortArray.last(predicate: (Short) -> Boolean): Short {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun IntArray.last(predicate: (Int) -> Boolean): Int {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun LongArray.last(predicate: (Long) -> Boolean): Long {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun FloatArray.last(predicate: (Float) -> Boolean): Float {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun DoubleArray.last(predicate: (Double) -> Boolean): Double {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun BooleanArray.last(predicate: (Boolean) -> Boolean): Boolean {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun CharArray.last(predicate: (Char) -> Boolean): Char {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns last index of [element], or -1 if the array does not contain element.\n */\npublic fun <@kotlin.internal.OnlyInputTypes T> Array.lastIndexOf(element: T): Int {\n if (element == null) {\n for (index in indices.reversed()) {\n if (this[index] == null) {\n return index\n }\n }\n } else {\n for (index in indices.reversed()) {\n if (element == this[index]) {\n return index\n }\n }\n }\n return -1\n}\n\n/**\n * Returns last index of [element], or -1 if the array does not contain element.\n */\npublic fun ByteArray.lastIndexOf(element: Byte): Int {\n for (index in indices.reversed()) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns last index of [element], or -1 if the array does not contain element.\n */\npublic fun ShortArray.lastIndexOf(element: Short): Int {\n for (index in indices.reversed()) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns last index of [element], or -1 if the array does not contain element.\n */\npublic fun IntArray.lastIndexOf(element: Int): Int {\n for (index in indices.reversed()) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns last index of [element], or -1 if the array does not contain element.\n */\npublic fun LongArray.lastIndexOf(element: Long): Int {\n for (index in indices.reversed()) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns last index of [element], or -1 if the array does not contain element.\n */\n@Deprecated(\"The function has unclear behavior when searching for NaN or zero values and will be removed soon. Use 'indexOfLast { it == element }' instead to continue using this behavior, or '.asList().lastIndexOf(element: T)' to get the same search behavior as in a list.\", ReplaceWith(\"indexOfLast { it == element }\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun FloatArray.lastIndexOf(element: Float): Int {\n for (index in indices.reversed()) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns last index of [element], or -1 if the array does not contain element.\n */\n@Deprecated(\"The function has unclear behavior when searching for NaN or zero values and will be removed soon. Use 'indexOfLast { it == element }' instead to continue using this behavior, or '.asList().lastIndexOf(element: T)' to get the same search behavior as in a list.\", ReplaceWith(\"indexOfLast { it == element }\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun DoubleArray.lastIndexOf(element: Double): Int {\n for (index in indices.reversed()) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns last index of [element], or -1 if the array does not contain element.\n */\npublic fun BooleanArray.lastIndexOf(element: Boolean): Int {\n for (index in indices.reversed()) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns last index of [element], or -1 if the array does not contain element.\n */\npublic fun CharArray.lastIndexOf(element: Char): Int {\n for (index in indices.reversed()) {\n if (element == this[index]) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns the last element, or `null` if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun Array.lastOrNull(): T? {\n return if (isEmpty()) null else this[size - 1]\n}\n\n/**\n * Returns the last element, or `null` if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun ByteArray.lastOrNull(): Byte? {\n return if (isEmpty()) null else this[size - 1]\n}\n\n/**\n * Returns the last element, or `null` if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun ShortArray.lastOrNull(): Short? {\n return if (isEmpty()) null else this[size - 1]\n}\n\n/**\n * Returns the last element, or `null` if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun IntArray.lastOrNull(): Int? {\n return if (isEmpty()) null else this[size - 1]\n}\n\n/**\n * Returns the last element, or `null` if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun LongArray.lastOrNull(): Long? {\n return if (isEmpty()) null else this[size - 1]\n}\n\n/**\n * Returns the last element, or `null` if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun FloatArray.lastOrNull(): Float? {\n return if (isEmpty()) null else this[size - 1]\n}\n\n/**\n * Returns the last element, or `null` if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun DoubleArray.lastOrNull(): Double? {\n return if (isEmpty()) null else this[size - 1]\n}\n\n/**\n * Returns the last element, or `null` if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun BooleanArray.lastOrNull(): Boolean? {\n return if (isEmpty()) null else this[size - 1]\n}\n\n/**\n * Returns the last element, or `null` if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun CharArray.lastOrNull(): Char? {\n return if (isEmpty()) null else this[size - 1]\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun Array.lastOrNull(predicate: (T) -> Boolean): T? {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun ByteArray.lastOrNull(predicate: (Byte) -> Boolean): Byte? {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun ShortArray.lastOrNull(predicate: (Short) -> Boolean): Short? {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun IntArray.lastOrNull(predicate: (Int) -> Boolean): Int? {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun LongArray.lastOrNull(predicate: (Long) -> Boolean): Long? {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun FloatArray.lastOrNull(predicate: (Float) -> Boolean): Float? {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun DoubleArray.lastOrNull(predicate: (Double) -> Boolean): Double? {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun BooleanArray.lastOrNull(predicate: (Boolean) -> Boolean): Boolean? {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun CharArray.lastOrNull(predicate: (Char) -> Boolean): Char? {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns a random element from this array.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun Array.random(): T {\n return random(Random)\n}\n\n/**\n * Returns a random element from this array.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.random(): Byte {\n return random(Random)\n}\n\n/**\n * Returns a random element from this array.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.random(): Short {\n return random(Random)\n}\n\n/**\n * Returns a random element from this array.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.random(): Int {\n return random(Random)\n}\n\n/**\n * Returns a random element from this array.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.random(): Long {\n return random(Random)\n}\n\n/**\n * Returns a random element from this array.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.random(): Float {\n return random(Random)\n}\n\n/**\n * Returns a random element from this array.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.random(): Double {\n return random(Random)\n}\n\n/**\n * Returns a random element from this array.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.random(): Boolean {\n return random(Random)\n}\n\n/**\n * Returns a random element from this array.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.random(): Char {\n return random(Random)\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun Array.random(random: Random): T {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun ByteArray.random(random: Random): Byte {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun ShortArray.random(random: Random): Short {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun IntArray.random(random: Random): Int {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun LongArray.random(random: Random): Long {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun FloatArray.random(random: Random): Float {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun DoubleArray.random(random: Random): Double {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun BooleanArray.random(random: Random): Boolean {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun CharArray.random(random: Random): Char {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun Array.randomOrNull(): T? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this array, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.randomOrNull(): Byte? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this array, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.randomOrNull(): Short? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this array, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.randomOrNull(): Int? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this array, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.randomOrNull(): Long? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this array, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.randomOrNull(): Float? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this array, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.randomOrNull(): Double? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this array, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.randomOrNull(): Boolean? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this array, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.randomOrNull(): Char? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun Array.randomOrNull(random: Random): T? {\n if (isEmpty())\n return null\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun ByteArray.randomOrNull(random: Random): Byte? {\n if (isEmpty())\n return null\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun ShortArray.randomOrNull(random: Random): Short? {\n if (isEmpty())\n return null\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun IntArray.randomOrNull(random: Random): Int? {\n if (isEmpty())\n return null\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun LongArray.randomOrNull(random: Random): Long? {\n if (isEmpty())\n return null\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun FloatArray.randomOrNull(random: Random): Float? {\n if (isEmpty())\n return null\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun DoubleArray.randomOrNull(random: Random): Double? {\n if (isEmpty())\n return null\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun BooleanArray.randomOrNull(random: Random): Boolean? {\n if (isEmpty())\n return null\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun CharArray.randomOrNull(random: Random): Char? {\n if (isEmpty())\n return null\n return get(random.nextInt(size))\n}\n\n/**\n * Returns the single element, or throws an exception if the array is empty or has more than one element.\n */\npublic fun Array.single(): T {\n return when (size) {\n 0 -> throw NoSuchElementException(\"Array is empty.\")\n 1 -> this[0]\n else -> throw IllegalArgumentException(\"Array has more than one element.\")\n }\n}\n\n/**\n * Returns the single element, or throws an exception if the array is empty or has more than one element.\n */\npublic fun ByteArray.single(): Byte {\n return when (size) {\n 0 -> throw NoSuchElementException(\"Array is empty.\")\n 1 -> this[0]\n else -> throw IllegalArgumentException(\"Array has more than one element.\")\n }\n}\n\n/**\n * Returns the single element, or throws an exception if the array is empty or has more than one element.\n */\npublic fun ShortArray.single(): Short {\n return when (size) {\n 0 -> throw NoSuchElementException(\"Array is empty.\")\n 1 -> this[0]\n else -> throw IllegalArgumentException(\"Array has more than one element.\")\n }\n}\n\n/**\n * Returns the single element, or throws an exception if the array is empty or has more than one element.\n */\npublic fun IntArray.single(): Int {\n return when (size) {\n 0 -> throw NoSuchElementException(\"Array is empty.\")\n 1 -> this[0]\n else -> throw IllegalArgumentException(\"Array has more than one element.\")\n }\n}\n\n/**\n * Returns the single element, or throws an exception if the array is empty or has more than one element.\n */\npublic fun LongArray.single(): Long {\n return when (size) {\n 0 -> throw NoSuchElementException(\"Array is empty.\")\n 1 -> this[0]\n else -> throw IllegalArgumentException(\"Array has more than one element.\")\n }\n}\n\n/**\n * Returns the single element, or throws an exception if the array is empty or has more than one element.\n */\npublic fun FloatArray.single(): Float {\n return when (size) {\n 0 -> throw NoSuchElementException(\"Array is empty.\")\n 1 -> this[0]\n else -> throw IllegalArgumentException(\"Array has more than one element.\")\n }\n}\n\n/**\n * Returns the single element, or throws an exception if the array is empty or has more than one element.\n */\npublic fun DoubleArray.single(): Double {\n return when (size) {\n 0 -> throw NoSuchElementException(\"Array is empty.\")\n 1 -> this[0]\n else -> throw IllegalArgumentException(\"Array has more than one element.\")\n }\n}\n\n/**\n * Returns the single element, or throws an exception if the array is empty or has more than one element.\n */\npublic fun BooleanArray.single(): Boolean {\n return when (size) {\n 0 -> throw NoSuchElementException(\"Array is empty.\")\n 1 -> this[0]\n else -> throw IllegalArgumentException(\"Array has more than one element.\")\n }\n}\n\n/**\n * Returns the single element, or throws an exception if the array is empty or has more than one element.\n */\npublic fun CharArray.single(): Char {\n return when (size) {\n 0 -> throw NoSuchElementException(\"Array is empty.\")\n 1 -> this[0]\n else -> throw IllegalArgumentException(\"Array has more than one element.\")\n }\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n */\npublic inline fun Array.single(predicate: (T) -> Boolean): T {\n var single: T? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Array contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as T\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n */\npublic inline fun ByteArray.single(predicate: (Byte) -> Boolean): Byte {\n var single: Byte? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Array contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as Byte\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n */\npublic inline fun ShortArray.single(predicate: (Short) -> Boolean): Short {\n var single: Short? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Array contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as Short\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n */\npublic inline fun IntArray.single(predicate: (Int) -> Boolean): Int {\n var single: Int? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Array contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as Int\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n */\npublic inline fun LongArray.single(predicate: (Long) -> Boolean): Long {\n var single: Long? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Array contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as Long\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n */\npublic inline fun FloatArray.single(predicate: (Float) -> Boolean): Float {\n var single: Float? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Array contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as Float\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n */\npublic inline fun DoubleArray.single(predicate: (Double) -> Boolean): Double {\n var single: Double? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Array contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as Double\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n */\npublic inline fun BooleanArray.single(predicate: (Boolean) -> Boolean): Boolean {\n var single: Boolean? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Array contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as Boolean\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n */\npublic inline fun CharArray.single(predicate: (Char) -> Boolean): Char {\n var single: Char? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Array contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as Char\n}\n\n/**\n * Returns single element, or `null` if the array is empty or has more than one element.\n */\npublic fun Array.singleOrNull(): T? {\n return if (size == 1) this[0] else null\n}\n\n/**\n * Returns single element, or `null` if the array is empty or has more than one element.\n */\npublic fun ByteArray.singleOrNull(): Byte? {\n return if (size == 1) this[0] else null\n}\n\n/**\n * Returns single element, or `null` if the array is empty or has more than one element.\n */\npublic fun ShortArray.singleOrNull(): Short? {\n return if (size == 1) this[0] else null\n}\n\n/**\n * Returns single element, or `null` if the array is empty or has more than one element.\n */\npublic fun IntArray.singleOrNull(): Int? {\n return if (size == 1) this[0] else null\n}\n\n/**\n * Returns single element, or `null` if the array is empty or has more than one element.\n */\npublic fun LongArray.singleOrNull(): Long? {\n return if (size == 1) this[0] else null\n}\n\n/**\n * Returns single element, or `null` if the array is empty or has more than one element.\n */\npublic fun FloatArray.singleOrNull(): Float? {\n return if (size == 1) this[0] else null\n}\n\n/**\n * Returns single element, or `null` if the array is empty or has more than one element.\n */\npublic fun DoubleArray.singleOrNull(): Double? {\n return if (size == 1) this[0] else null\n}\n\n/**\n * Returns single element, or `null` if the array is empty or has more than one element.\n */\npublic fun BooleanArray.singleOrNull(): Boolean? {\n return if (size == 1) this[0] else null\n}\n\n/**\n * Returns single element, or `null` if the array is empty or has more than one element.\n */\npublic fun CharArray.singleOrNull(): Char? {\n return if (size == 1) this[0] else null\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n */\npublic inline fun Array.singleOrNull(predicate: (T) -> Boolean): T? {\n var single: T? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n */\npublic inline fun ByteArray.singleOrNull(predicate: (Byte) -> Boolean): Byte? {\n var single: Byte? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n */\npublic inline fun ShortArray.singleOrNull(predicate: (Short) -> Boolean): Short? {\n var single: Short? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n */\npublic inline fun IntArray.singleOrNull(predicate: (Int) -> Boolean): Int? {\n var single: Int? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n */\npublic inline fun LongArray.singleOrNull(predicate: (Long) -> Boolean): Long? {\n var single: Long? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n */\npublic inline fun FloatArray.singleOrNull(predicate: (Float) -> Boolean): Float? {\n var single: Float? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n */\npublic inline fun DoubleArray.singleOrNull(predicate: (Double) -> Boolean): Double? {\n var single: Double? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n */\npublic inline fun BooleanArray.singleOrNull(predicate: (Boolean) -> Boolean): Boolean? {\n var single: Boolean? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n */\npublic inline fun CharArray.singleOrNull(predicate: (Char) -> Boolean): Char? {\n var single: Char? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns a list containing all elements except first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun Array.drop(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return takeLast((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun ByteArray.drop(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return takeLast((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun ShortArray.drop(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return takeLast((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun IntArray.drop(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return takeLast((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun LongArray.drop(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return takeLast((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun FloatArray.drop(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return takeLast((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun DoubleArray.drop(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return takeLast((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun BooleanArray.drop(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return takeLast((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun CharArray.drop(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return takeLast((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun Array.dropLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return take((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun ByteArray.dropLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return take((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun ShortArray.dropLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return take((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun IntArray.dropLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return take((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun LongArray.dropLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return take((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun FloatArray.dropLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return take((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun DoubleArray.dropLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return take((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun BooleanArray.dropLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return take((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun CharArray.dropLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return take((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun Array.dropLastWhile(predicate: (T) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return take(index + 1)\n }\n }\n return emptyList()\n}\n\n/**\n * Returns a list containing all elements except last elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun ByteArray.dropLastWhile(predicate: (Byte) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return take(index + 1)\n }\n }\n return emptyList()\n}\n\n/**\n * Returns a list containing all elements except last elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun ShortArray.dropLastWhile(predicate: (Short) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return take(index + 1)\n }\n }\n return emptyList()\n}\n\n/**\n * Returns a list containing all elements except last elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun IntArray.dropLastWhile(predicate: (Int) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return take(index + 1)\n }\n }\n return emptyList()\n}\n\n/**\n * Returns a list containing all elements except last elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun LongArray.dropLastWhile(predicate: (Long) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return take(index + 1)\n }\n }\n return emptyList()\n}\n\n/**\n * Returns a list containing all elements except last elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun FloatArray.dropLastWhile(predicate: (Float) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return take(index + 1)\n }\n }\n return emptyList()\n}\n\n/**\n * Returns a list containing all elements except last elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun DoubleArray.dropLastWhile(predicate: (Double) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return take(index + 1)\n }\n }\n return emptyList()\n}\n\n/**\n * Returns a list containing all elements except last elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun BooleanArray.dropLastWhile(predicate: (Boolean) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return take(index + 1)\n }\n }\n return emptyList()\n}\n\n/**\n * Returns a list containing all elements except last elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun CharArray.dropLastWhile(predicate: (Char) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return take(index + 1)\n }\n }\n return emptyList()\n}\n\n/**\n * Returns a list containing all elements except first elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun Array.dropWhile(predicate: (T) -> Boolean): List {\n var yielding = false\n val list = ArrayList()\n for (item in this)\n if (yielding)\n list.add(item)\n else if (!predicate(item)) {\n list.add(item)\n yielding = true\n }\n return list\n}\n\n/**\n * Returns a list containing all elements except first elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun ByteArray.dropWhile(predicate: (Byte) -> Boolean): List {\n var yielding = false\n val list = ArrayList()\n for (item in this)\n if (yielding)\n list.add(item)\n else if (!predicate(item)) {\n list.add(item)\n yielding = true\n }\n return list\n}\n\n/**\n * Returns a list containing all elements except first elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun ShortArray.dropWhile(predicate: (Short) -> Boolean): List {\n var yielding = false\n val list = ArrayList()\n for (item in this)\n if (yielding)\n list.add(item)\n else if (!predicate(item)) {\n list.add(item)\n yielding = true\n }\n return list\n}\n\n/**\n * Returns a list containing all elements except first elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun IntArray.dropWhile(predicate: (Int) -> Boolean): List {\n var yielding = false\n val list = ArrayList()\n for (item in this)\n if (yielding)\n list.add(item)\n else if (!predicate(item)) {\n list.add(item)\n yielding = true\n }\n return list\n}\n\n/**\n * Returns a list containing all elements except first elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun LongArray.dropWhile(predicate: (Long) -> Boolean): List {\n var yielding = false\n val list = ArrayList()\n for (item in this)\n if (yielding)\n list.add(item)\n else if (!predicate(item)) {\n list.add(item)\n yielding = true\n }\n return list\n}\n\n/**\n * Returns a list containing all elements except first elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun FloatArray.dropWhile(predicate: (Float) -> Boolean): List {\n var yielding = false\n val list = ArrayList()\n for (item in this)\n if (yielding)\n list.add(item)\n else if (!predicate(item)) {\n list.add(item)\n yielding = true\n }\n return list\n}\n\n/**\n * Returns a list containing all elements except first elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun DoubleArray.dropWhile(predicate: (Double) -> Boolean): List {\n var yielding = false\n val list = ArrayList()\n for (item in this)\n if (yielding)\n list.add(item)\n else if (!predicate(item)) {\n list.add(item)\n yielding = true\n }\n return list\n}\n\n/**\n * Returns a list containing all elements except first elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun BooleanArray.dropWhile(predicate: (Boolean) -> Boolean): List {\n var yielding = false\n val list = ArrayList()\n for (item in this)\n if (yielding)\n list.add(item)\n else if (!predicate(item)) {\n list.add(item)\n yielding = true\n }\n return list\n}\n\n/**\n * Returns a list containing all elements except first elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun CharArray.dropWhile(predicate: (Char) -> Boolean): List {\n var yielding = false\n val list = ArrayList()\n for (item in this)\n if (yielding)\n list.add(item)\n else if (!predicate(item)) {\n list.add(item)\n yielding = true\n }\n return list\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun Array.filter(predicate: (T) -> Boolean): List {\n return filterTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun ByteArray.filter(predicate: (Byte) -> Boolean): List {\n return filterTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun ShortArray.filter(predicate: (Short) -> Boolean): List {\n return filterTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun IntArray.filter(predicate: (Int) -> Boolean): List {\n return filterTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun LongArray.filter(predicate: (Long) -> Boolean): List {\n return filterTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun FloatArray.filter(predicate: (Float) -> Boolean): List {\n return filterTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun DoubleArray.filter(predicate: (Double) -> Boolean): List {\n return filterTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun BooleanArray.filter(predicate: (Boolean) -> Boolean): List {\n return filterTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun CharArray.filter(predicate: (Char) -> Boolean): List {\n return filterTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\npublic inline fun Array.filterIndexed(predicate: (index: Int, T) -> Boolean): List {\n return filterIndexedTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\npublic inline fun ByteArray.filterIndexed(predicate: (index: Int, Byte) -> Boolean): List {\n return filterIndexedTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\npublic inline fun ShortArray.filterIndexed(predicate: (index: Int, Short) -> Boolean): List {\n return filterIndexedTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\npublic inline fun IntArray.filterIndexed(predicate: (index: Int, Int) -> Boolean): List {\n return filterIndexedTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\npublic inline fun LongArray.filterIndexed(predicate: (index: Int, Long) -> Boolean): List {\n return filterIndexedTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\npublic inline fun FloatArray.filterIndexed(predicate: (index: Int, Float) -> Boolean): List {\n return filterIndexedTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\npublic inline fun DoubleArray.filterIndexed(predicate: (index: Int, Double) -> Boolean): List {\n return filterIndexedTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\npublic inline fun BooleanArray.filterIndexed(predicate: (index: Int, Boolean) -> Boolean): List {\n return filterIndexedTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\npublic inline fun CharArray.filterIndexed(predicate: (index: Int, Char) -> Boolean): List {\n return filterIndexedTo(ArrayList(), predicate)\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\npublic inline fun > Array.filterIndexedTo(destination: C, predicate: (index: Int, T) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\npublic inline fun > ByteArray.filterIndexedTo(destination: C, predicate: (index: Int, Byte) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\npublic inline fun > ShortArray.filterIndexedTo(destination: C, predicate: (index: Int, Short) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\npublic inline fun > IntArray.filterIndexedTo(destination: C, predicate: (index: Int, Int) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\npublic inline fun > LongArray.filterIndexedTo(destination: C, predicate: (index: Int, Long) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\npublic inline fun > FloatArray.filterIndexedTo(destination: C, predicate: (index: Int, Float) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\npublic inline fun > DoubleArray.filterIndexedTo(destination: C, predicate: (index: Int, Double) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\npublic inline fun > BooleanArray.filterIndexedTo(destination: C, predicate: (index: Int, Boolean) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\npublic inline fun > CharArray.filterIndexedTo(destination: C, predicate: (index: Int, Char) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Returns a list containing all elements that are instances of specified type parameter R.\n * \n * @sample samples.collections.Collections.Filtering.filterIsInstance\n */\npublic inline fun Array<*>.filterIsInstance(): List<@kotlin.internal.NoInfer R> {\n return filterIsInstanceTo(ArrayList())\n}\n\n/**\n * Appends all elements that are instances of specified type parameter R to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterIsInstanceTo\n */\npublic inline fun > Array<*>.filterIsInstanceTo(destination: C): C {\n for (element in this) if (element is R) destination.add(element)\n return destination\n}\n\n/**\n * Returns a list containing all elements not matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun Array.filterNot(predicate: (T) -> Boolean): List {\n return filterNotTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing all elements not matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun ByteArray.filterNot(predicate: (Byte) -> Boolean): List {\n return filterNotTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing all elements not matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun ShortArray.filterNot(predicate: (Short) -> Boolean): List {\n return filterNotTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing all elements not matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun IntArray.filterNot(predicate: (Int) -> Boolean): List {\n return filterNotTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing all elements not matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun LongArray.filterNot(predicate: (Long) -> Boolean): List {\n return filterNotTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing all elements not matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun FloatArray.filterNot(predicate: (Float) -> Boolean): List {\n return filterNotTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing all elements not matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun DoubleArray.filterNot(predicate: (Double) -> Boolean): List {\n return filterNotTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing all elements not matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun BooleanArray.filterNot(predicate: (Boolean) -> Boolean): List {\n return filterNotTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing all elements not matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun CharArray.filterNot(predicate: (Char) -> Boolean): List {\n return filterNotTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing all elements that are not `null`.\n * \n * @sample samples.collections.Collections.Filtering.filterNotNull\n */\npublic fun Array.filterNotNull(): List {\n return filterNotNullTo(ArrayList())\n}\n\n/**\n * Appends all elements that are not `null` to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterNotNullTo\n */\npublic fun , T : Any> Array.filterNotNullTo(destination: C): C {\n for (element in this) if (element != null) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > Array.filterNotTo(destination: C, predicate: (T) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > ByteArray.filterNotTo(destination: C, predicate: (Byte) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > ShortArray.filterNotTo(destination: C, predicate: (Short) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > IntArray.filterNotTo(destination: C, predicate: (Int) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > LongArray.filterNotTo(destination: C, predicate: (Long) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > FloatArray.filterNotTo(destination: C, predicate: (Float) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > DoubleArray.filterNotTo(destination: C, predicate: (Double) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > BooleanArray.filterNotTo(destination: C, predicate: (Boolean) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > CharArray.filterNotTo(destination: C, predicate: (Char) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > Array.filterTo(destination: C, predicate: (T) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > ByteArray.filterTo(destination: C, predicate: (Byte) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > ShortArray.filterTo(destination: C, predicate: (Short) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > IntArray.filterTo(destination: C, predicate: (Int) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > LongArray.filterTo(destination: C, predicate: (Long) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > FloatArray.filterTo(destination: C, predicate: (Float) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > DoubleArray.filterTo(destination: C, predicate: (Double) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > BooleanArray.filterTo(destination: C, predicate: (Boolean) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > CharArray.filterTo(destination: C, predicate: (Char) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Returns a list containing elements at indices in the specified [indices] range.\n */\npublic fun Array.slice(indices: IntRange): List {\n if (indices.isEmpty()) return listOf()\n return copyOfRange(indices.start, indices.endInclusive + 1).asList()\n}\n\n/**\n * Returns a list containing elements at indices in the specified [indices] range.\n */\npublic fun ByteArray.slice(indices: IntRange): List {\n if (indices.isEmpty()) return listOf()\n return copyOfRange(indices.start, indices.endInclusive + 1).asList()\n}\n\n/**\n * Returns a list containing elements at indices in the specified [indices] range.\n */\npublic fun ShortArray.slice(indices: IntRange): List {\n if (indices.isEmpty()) return listOf()\n return copyOfRange(indices.start, indices.endInclusive + 1).asList()\n}\n\n/**\n * Returns a list containing elements at indices in the specified [indices] range.\n */\npublic fun IntArray.slice(indices: IntRange): List {\n if (indices.isEmpty()) return listOf()\n return copyOfRange(indices.start, indices.endInclusive + 1).asList()\n}\n\n/**\n * Returns a list containing elements at indices in the specified [indices] range.\n */\npublic fun LongArray.slice(indices: IntRange): List {\n if (indices.isEmpty()) return listOf()\n return copyOfRange(indices.start, indices.endInclusive + 1).asList()\n}\n\n/**\n * Returns a list containing elements at indices in the specified [indices] range.\n */\npublic fun FloatArray.slice(indices: IntRange): List {\n if (indices.isEmpty()) return listOf()\n return copyOfRange(indices.start, indices.endInclusive + 1).asList()\n}\n\n/**\n * Returns a list containing elements at indices in the specified [indices] range.\n */\npublic fun DoubleArray.slice(indices: IntRange): List {\n if (indices.isEmpty()) return listOf()\n return copyOfRange(indices.start, indices.endInclusive + 1).asList()\n}\n\n/**\n * Returns a list containing elements at indices in the specified [indices] range.\n */\npublic fun BooleanArray.slice(indices: IntRange): List {\n if (indices.isEmpty()) return listOf()\n return copyOfRange(indices.start, indices.endInclusive + 1).asList()\n}\n\n/**\n * Returns a list containing elements at indices in the specified [indices] range.\n */\npublic fun CharArray.slice(indices: IntRange): List {\n if (indices.isEmpty()) return listOf()\n return copyOfRange(indices.start, indices.endInclusive + 1).asList()\n}\n\n/**\n * Returns a list containing elements at specified [indices].\n */\npublic fun Array.slice(indices: Iterable): List {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return emptyList()\n val list = ArrayList(size)\n for (index in indices) {\n list.add(get(index))\n }\n return list\n}\n\n/**\n * Returns a list containing elements at specified [indices].\n */\npublic fun ByteArray.slice(indices: Iterable): List {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return emptyList()\n val list = ArrayList(size)\n for (index in indices) {\n list.add(get(index))\n }\n return list\n}\n\n/**\n * Returns a list containing elements at specified [indices].\n */\npublic fun ShortArray.slice(indices: Iterable): List {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return emptyList()\n val list = ArrayList(size)\n for (index in indices) {\n list.add(get(index))\n }\n return list\n}\n\n/**\n * Returns a list containing elements at specified [indices].\n */\npublic fun IntArray.slice(indices: Iterable): List {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return emptyList()\n val list = ArrayList(size)\n for (index in indices) {\n list.add(get(index))\n }\n return list\n}\n\n/**\n * Returns a list containing elements at specified [indices].\n */\npublic fun LongArray.slice(indices: Iterable): List {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return emptyList()\n val list = ArrayList(size)\n for (index in indices) {\n list.add(get(index))\n }\n return list\n}\n\n/**\n * Returns a list containing elements at specified [indices].\n */\npublic fun FloatArray.slice(indices: Iterable): List {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return emptyList()\n val list = ArrayList(size)\n for (index in indices) {\n list.add(get(index))\n }\n return list\n}\n\n/**\n * Returns a list containing elements at specified [indices].\n */\npublic fun DoubleArray.slice(indices: Iterable): List {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return emptyList()\n val list = ArrayList(size)\n for (index in indices) {\n list.add(get(index))\n }\n return list\n}\n\n/**\n * Returns a list containing elements at specified [indices].\n */\npublic fun BooleanArray.slice(indices: Iterable): List {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return emptyList()\n val list = ArrayList(size)\n for (index in indices) {\n list.add(get(index))\n }\n return list\n}\n\n/**\n * Returns a list containing elements at specified [indices].\n */\npublic fun CharArray.slice(indices: Iterable): List {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return emptyList()\n val list = ArrayList(size)\n for (index in indices) {\n list.add(get(index))\n }\n return list\n}\n\n/**\n * Returns an array containing elements of this array at specified [indices].\n */\npublic fun Array.sliceArray(indices: Collection): Array {\n val result = arrayOfNulls(this, indices.size)\n var targetIndex = 0\n for (sourceIndex in indices) {\n result[targetIndex++] = this[sourceIndex]\n }\n return result\n}\n\n/**\n * Returns an array containing elements of this array at specified [indices].\n */\npublic fun ByteArray.sliceArray(indices: Collection): ByteArray {\n val result = ByteArray(indices.size)\n var targetIndex = 0\n for (sourceIndex in indices) {\n result[targetIndex++] = this[sourceIndex]\n }\n return result\n}\n\n/**\n * Returns an array containing elements of this array at specified [indices].\n */\npublic fun ShortArray.sliceArray(indices: Collection): ShortArray {\n val result = ShortArray(indices.size)\n var targetIndex = 0\n for (sourceIndex in indices) {\n result[targetIndex++] = this[sourceIndex]\n }\n return result\n}\n\n/**\n * Returns an array containing elements of this array at specified [indices].\n */\npublic fun IntArray.sliceArray(indices: Collection): IntArray {\n val result = IntArray(indices.size)\n var targetIndex = 0\n for (sourceIndex in indices) {\n result[targetIndex++] = this[sourceIndex]\n }\n return result\n}\n\n/**\n * Returns an array containing elements of this array at specified [indices].\n */\npublic fun LongArray.sliceArray(indices: Collection): LongArray {\n val result = LongArray(indices.size)\n var targetIndex = 0\n for (sourceIndex in indices) {\n result[targetIndex++] = this[sourceIndex]\n }\n return result\n}\n\n/**\n * Returns an array containing elements of this array at specified [indices].\n */\npublic fun FloatArray.sliceArray(indices: Collection): FloatArray {\n val result = FloatArray(indices.size)\n var targetIndex = 0\n for (sourceIndex in indices) {\n result[targetIndex++] = this[sourceIndex]\n }\n return result\n}\n\n/**\n * Returns an array containing elements of this array at specified [indices].\n */\npublic fun DoubleArray.sliceArray(indices: Collection): DoubleArray {\n val result = DoubleArray(indices.size)\n var targetIndex = 0\n for (sourceIndex in indices) {\n result[targetIndex++] = this[sourceIndex]\n }\n return result\n}\n\n/**\n * Returns an array containing elements of this array at specified [indices].\n */\npublic fun BooleanArray.sliceArray(indices: Collection): BooleanArray {\n val result = BooleanArray(indices.size)\n var targetIndex = 0\n for (sourceIndex in indices) {\n result[targetIndex++] = this[sourceIndex]\n }\n return result\n}\n\n/**\n * Returns an array containing elements of this array at specified [indices].\n */\npublic fun CharArray.sliceArray(indices: Collection): CharArray {\n val result = CharArray(indices.size)\n var targetIndex = 0\n for (sourceIndex in indices) {\n result[targetIndex++] = this[sourceIndex]\n }\n return result\n}\n\n/**\n * Returns an array containing elements at indices in the specified [indices] range.\n */\npublic fun Array.sliceArray(indices: IntRange): Array {\n if (indices.isEmpty()) return copyOfRange(0, 0)\n return copyOfRange(indices.start, indices.endInclusive + 1)\n}\n\n/**\n * Returns an array containing elements at indices in the specified [indices] range.\n */\npublic fun ByteArray.sliceArray(indices: IntRange): ByteArray {\n if (indices.isEmpty()) return ByteArray(0)\n return copyOfRange(indices.start, indices.endInclusive + 1)\n}\n\n/**\n * Returns an array containing elements at indices in the specified [indices] range.\n */\npublic fun ShortArray.sliceArray(indices: IntRange): ShortArray {\n if (indices.isEmpty()) return ShortArray(0)\n return copyOfRange(indices.start, indices.endInclusive + 1)\n}\n\n/**\n * Returns an array containing elements at indices in the specified [indices] range.\n */\npublic fun IntArray.sliceArray(indices: IntRange): IntArray {\n if (indices.isEmpty()) return IntArray(0)\n return copyOfRange(indices.start, indices.endInclusive + 1)\n}\n\n/**\n * Returns an array containing elements at indices in the specified [indices] range.\n */\npublic fun LongArray.sliceArray(indices: IntRange): LongArray {\n if (indices.isEmpty()) return LongArray(0)\n return copyOfRange(indices.start, indices.endInclusive + 1)\n}\n\n/**\n * Returns an array containing elements at indices in the specified [indices] range.\n */\npublic fun FloatArray.sliceArray(indices: IntRange): FloatArray {\n if (indices.isEmpty()) return FloatArray(0)\n return copyOfRange(indices.start, indices.endInclusive + 1)\n}\n\n/**\n * Returns an array containing elements at indices in the specified [indices] range.\n */\npublic fun DoubleArray.sliceArray(indices: IntRange): DoubleArray {\n if (indices.isEmpty()) return DoubleArray(0)\n return copyOfRange(indices.start, indices.endInclusive + 1)\n}\n\n/**\n * Returns an array containing elements at indices in the specified [indices] range.\n */\npublic fun BooleanArray.sliceArray(indices: IntRange): BooleanArray {\n if (indices.isEmpty()) return BooleanArray(0)\n return copyOfRange(indices.start, indices.endInclusive + 1)\n}\n\n/**\n * Returns an array containing elements at indices in the specified [indices] range.\n */\npublic fun CharArray.sliceArray(indices: IntRange): CharArray {\n if (indices.isEmpty()) return CharArray(0)\n return copyOfRange(indices.start, indices.endInclusive + 1)\n}\n\n/**\n * Returns a list containing first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun Array.take(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n if (n >= size) return toList()\n if (n == 1) return listOf(this[0])\n var count = 0\n val list = ArrayList(n)\n for (item in this) {\n list.add(item)\n if (++count == n)\n break\n }\n return list\n}\n\n/**\n * Returns a list containing first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun ByteArray.take(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n if (n >= size) return toList()\n if (n == 1) return listOf(this[0])\n var count = 0\n val list = ArrayList(n)\n for (item in this) {\n list.add(item)\n if (++count == n)\n break\n }\n return list\n}\n\n/**\n * Returns a list containing first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun ShortArray.take(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n if (n >= size) return toList()\n if (n == 1) return listOf(this[0])\n var count = 0\n val list = ArrayList(n)\n for (item in this) {\n list.add(item)\n if (++count == n)\n break\n }\n return list\n}\n\n/**\n * Returns a list containing first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun IntArray.take(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n if (n >= size) return toList()\n if (n == 1) return listOf(this[0])\n var count = 0\n val list = ArrayList(n)\n for (item in this) {\n list.add(item)\n if (++count == n)\n break\n }\n return list\n}\n\n/**\n * Returns a list containing first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun LongArray.take(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n if (n >= size) return toList()\n if (n == 1) return listOf(this[0])\n var count = 0\n val list = ArrayList(n)\n for (item in this) {\n list.add(item)\n if (++count == n)\n break\n }\n return list\n}\n\n/**\n * Returns a list containing first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun FloatArray.take(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n if (n >= size) return toList()\n if (n == 1) return listOf(this[0])\n var count = 0\n val list = ArrayList(n)\n for (item in this) {\n list.add(item)\n if (++count == n)\n break\n }\n return list\n}\n\n/**\n * Returns a list containing first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun DoubleArray.take(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n if (n >= size) return toList()\n if (n == 1) return listOf(this[0])\n var count = 0\n val list = ArrayList(n)\n for (item in this) {\n list.add(item)\n if (++count == n)\n break\n }\n return list\n}\n\n/**\n * Returns a list containing first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun BooleanArray.take(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n if (n >= size) return toList()\n if (n == 1) return listOf(this[0])\n var count = 0\n val list = ArrayList(n)\n for (item in this) {\n list.add(item)\n if (++count == n)\n break\n }\n return list\n}\n\n/**\n * Returns a list containing first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun CharArray.take(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n if (n >= size) return toList()\n if (n == 1) return listOf(this[0])\n var count = 0\n val list = ArrayList(n)\n for (item in this) {\n list.add(item)\n if (++count == n)\n break\n }\n return list\n}\n\n/**\n * Returns a list containing last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun Array.takeLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n val size = size\n if (n >= size) return toList()\n if (n == 1) return listOf(this[size - 1])\n val list = ArrayList(n)\n for (index in size - n until size)\n list.add(this[index])\n return list\n}\n\n/**\n * Returns a list containing last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun ByteArray.takeLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n val size = size\n if (n >= size) return toList()\n if (n == 1) return listOf(this[size - 1])\n val list = ArrayList(n)\n for (index in size - n until size)\n list.add(this[index])\n return list\n}\n\n/**\n * Returns a list containing last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun ShortArray.takeLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n val size = size\n if (n >= size) return toList()\n if (n == 1) return listOf(this[size - 1])\n val list = ArrayList(n)\n for (index in size - n until size)\n list.add(this[index])\n return list\n}\n\n/**\n * Returns a list containing last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun IntArray.takeLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n val size = size\n if (n >= size) return toList()\n if (n == 1) return listOf(this[size - 1])\n val list = ArrayList(n)\n for (index in size - n until size)\n list.add(this[index])\n return list\n}\n\n/**\n * Returns a list containing last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun LongArray.takeLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n val size = size\n if (n >= size) return toList()\n if (n == 1) return listOf(this[size - 1])\n val list = ArrayList(n)\n for (index in size - n until size)\n list.add(this[index])\n return list\n}\n\n/**\n * Returns a list containing last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun FloatArray.takeLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n val size = size\n if (n >= size) return toList()\n if (n == 1) return listOf(this[size - 1])\n val list = ArrayList(n)\n for (index in size - n until size)\n list.add(this[index])\n return list\n}\n\n/**\n * Returns a list containing last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun DoubleArray.takeLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n val size = size\n if (n >= size) return toList()\n if (n == 1) return listOf(this[size - 1])\n val list = ArrayList(n)\n for (index in size - n until size)\n list.add(this[index])\n return list\n}\n\n/**\n * Returns a list containing last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun BooleanArray.takeLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n val size = size\n if (n >= size) return toList()\n if (n == 1) return listOf(this[size - 1])\n val list = ArrayList(n)\n for (index in size - n until size)\n list.add(this[index])\n return list\n}\n\n/**\n * Returns a list containing last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun CharArray.takeLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n val size = size\n if (n >= size) return toList()\n if (n == 1) return listOf(this[size - 1])\n val list = ArrayList(n)\n for (index in size - n until size)\n list.add(this[index])\n return list\n}\n\n/**\n * Returns a list containing last elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun Array.takeLastWhile(predicate: (T) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return drop(index + 1)\n }\n }\n return toList()\n}\n\n/**\n * Returns a list containing last elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun ByteArray.takeLastWhile(predicate: (Byte) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return drop(index + 1)\n }\n }\n return toList()\n}\n\n/**\n * Returns a list containing last elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun ShortArray.takeLastWhile(predicate: (Short) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return drop(index + 1)\n }\n }\n return toList()\n}\n\n/**\n * Returns a list containing last elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun IntArray.takeLastWhile(predicate: (Int) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return drop(index + 1)\n }\n }\n return toList()\n}\n\n/**\n * Returns a list containing last elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun LongArray.takeLastWhile(predicate: (Long) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return drop(index + 1)\n }\n }\n return toList()\n}\n\n/**\n * Returns a list containing last elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun FloatArray.takeLastWhile(predicate: (Float) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return drop(index + 1)\n }\n }\n return toList()\n}\n\n/**\n * Returns a list containing last elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun DoubleArray.takeLastWhile(predicate: (Double) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return drop(index + 1)\n }\n }\n return toList()\n}\n\n/**\n * Returns a list containing last elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun BooleanArray.takeLastWhile(predicate: (Boolean) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return drop(index + 1)\n }\n }\n return toList()\n}\n\n/**\n * Returns a list containing last elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun CharArray.takeLastWhile(predicate: (Char) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return drop(index + 1)\n }\n }\n return toList()\n}\n\n/**\n * Returns a list containing first elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun Array.takeWhile(predicate: (T) -> Boolean): List {\n val list = ArrayList()\n for (item in this) {\n if (!predicate(item))\n break\n list.add(item)\n }\n return list\n}\n\n/**\n * Returns a list containing first elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun ByteArray.takeWhile(predicate: (Byte) -> Boolean): List {\n val list = ArrayList()\n for (item in this) {\n if (!predicate(item))\n break\n list.add(item)\n }\n return list\n}\n\n/**\n * Returns a list containing first elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun ShortArray.takeWhile(predicate: (Short) -> Boolean): List {\n val list = ArrayList()\n for (item in this) {\n if (!predicate(item))\n break\n list.add(item)\n }\n return list\n}\n\n/**\n * Returns a list containing first elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun IntArray.takeWhile(predicate: (Int) -> Boolean): List {\n val list = ArrayList()\n for (item in this) {\n if (!predicate(item))\n break\n list.add(item)\n }\n return list\n}\n\n/**\n * Returns a list containing first elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun LongArray.takeWhile(predicate: (Long) -> Boolean): List {\n val list = ArrayList()\n for (item in this) {\n if (!predicate(item))\n break\n list.add(item)\n }\n return list\n}\n\n/**\n * Returns a list containing first elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun FloatArray.takeWhile(predicate: (Float) -> Boolean): List {\n val list = ArrayList()\n for (item in this) {\n if (!predicate(item))\n break\n list.add(item)\n }\n return list\n}\n\n/**\n * Returns a list containing first elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun DoubleArray.takeWhile(predicate: (Double) -> Boolean): List {\n val list = ArrayList()\n for (item in this) {\n if (!predicate(item))\n break\n list.add(item)\n }\n return list\n}\n\n/**\n * Returns a list containing first elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun BooleanArray.takeWhile(predicate: (Boolean) -> Boolean): List {\n val list = ArrayList()\n for (item in this) {\n if (!predicate(item))\n break\n list.add(item)\n }\n return list\n}\n\n/**\n * Returns a list containing first elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun CharArray.takeWhile(predicate: (Char) -> Boolean): List {\n val list = ArrayList()\n for (item in this) {\n if (!predicate(item))\n break\n list.add(item)\n }\n return list\n}\n\n/**\n * Reverses elements in the array in-place.\n */\npublic fun Array.reverse(): Unit {\n val midPoint = (size / 2) - 1\n if (midPoint < 0) return\n var reverseIndex = lastIndex\n for (index in 0..midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements in the array in-place.\n */\npublic fun ByteArray.reverse(): Unit {\n val midPoint = (size / 2) - 1\n if (midPoint < 0) return\n var reverseIndex = lastIndex\n for (index in 0..midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements in the array in-place.\n */\npublic fun ShortArray.reverse(): Unit {\n val midPoint = (size / 2) - 1\n if (midPoint < 0) return\n var reverseIndex = lastIndex\n for (index in 0..midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements in the array in-place.\n */\npublic fun IntArray.reverse(): Unit {\n val midPoint = (size / 2) - 1\n if (midPoint < 0) return\n var reverseIndex = lastIndex\n for (index in 0..midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements in the array in-place.\n */\npublic fun LongArray.reverse(): Unit {\n val midPoint = (size / 2) - 1\n if (midPoint < 0) return\n var reverseIndex = lastIndex\n for (index in 0..midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements in the array in-place.\n */\npublic fun FloatArray.reverse(): Unit {\n val midPoint = (size / 2) - 1\n if (midPoint < 0) return\n var reverseIndex = lastIndex\n for (index in 0..midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements in the array in-place.\n */\npublic fun DoubleArray.reverse(): Unit {\n val midPoint = (size / 2) - 1\n if (midPoint < 0) return\n var reverseIndex = lastIndex\n for (index in 0..midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements in the array in-place.\n */\npublic fun BooleanArray.reverse(): Unit {\n val midPoint = (size / 2) - 1\n if (midPoint < 0) return\n var reverseIndex = lastIndex\n for (index in 0..midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements in the array in-place.\n */\npublic fun CharArray.reverse(): Unit {\n val midPoint = (size / 2) - 1\n if (midPoint < 0) return\n var reverseIndex = lastIndex\n for (index in 0..midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements of the array in the specified range in-place.\n * \n * @param fromIndex the start of the range (inclusive) to reverse.\n * @param toIndex the end of the range (exclusive) to reverse.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun Array.reverse(fromIndex: Int, toIndex: Int): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val midPoint = (fromIndex + toIndex) / 2\n if (fromIndex == midPoint) return\n var reverseIndex = toIndex - 1\n for (index in fromIndex until midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements of the array in the specified range in-place.\n * \n * @param fromIndex the start of the range (inclusive) to reverse.\n * @param toIndex the end of the range (exclusive) to reverse.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun ByteArray.reverse(fromIndex: Int, toIndex: Int): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val midPoint = (fromIndex + toIndex) / 2\n if (fromIndex == midPoint) return\n var reverseIndex = toIndex - 1\n for (index in fromIndex until midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements of the array in the specified range in-place.\n * \n * @param fromIndex the start of the range (inclusive) to reverse.\n * @param toIndex the end of the range (exclusive) to reverse.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun ShortArray.reverse(fromIndex: Int, toIndex: Int): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val midPoint = (fromIndex + toIndex) / 2\n if (fromIndex == midPoint) return\n var reverseIndex = toIndex - 1\n for (index in fromIndex until midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements of the array in the specified range in-place.\n * \n * @param fromIndex the start of the range (inclusive) to reverse.\n * @param toIndex the end of the range (exclusive) to reverse.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun IntArray.reverse(fromIndex: Int, toIndex: Int): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val midPoint = (fromIndex + toIndex) / 2\n if (fromIndex == midPoint) return\n var reverseIndex = toIndex - 1\n for (index in fromIndex until midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements of the array in the specified range in-place.\n * \n * @param fromIndex the start of the range (inclusive) to reverse.\n * @param toIndex the end of the range (exclusive) to reverse.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun LongArray.reverse(fromIndex: Int, toIndex: Int): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val midPoint = (fromIndex + toIndex) / 2\n if (fromIndex == midPoint) return\n var reverseIndex = toIndex - 1\n for (index in fromIndex until midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements of the array in the specified range in-place.\n * \n * @param fromIndex the start of the range (inclusive) to reverse.\n * @param toIndex the end of the range (exclusive) to reverse.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun FloatArray.reverse(fromIndex: Int, toIndex: Int): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val midPoint = (fromIndex + toIndex) / 2\n if (fromIndex == midPoint) return\n var reverseIndex = toIndex - 1\n for (index in fromIndex until midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements of the array in the specified range in-place.\n * \n * @param fromIndex the start of the range (inclusive) to reverse.\n * @param toIndex the end of the range (exclusive) to reverse.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun DoubleArray.reverse(fromIndex: Int, toIndex: Int): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val midPoint = (fromIndex + toIndex) / 2\n if (fromIndex == midPoint) return\n var reverseIndex = toIndex - 1\n for (index in fromIndex until midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements of the array in the specified range in-place.\n * \n * @param fromIndex the start of the range (inclusive) to reverse.\n * @param toIndex the end of the range (exclusive) to reverse.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun BooleanArray.reverse(fromIndex: Int, toIndex: Int): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val midPoint = (fromIndex + toIndex) / 2\n if (fromIndex == midPoint) return\n var reverseIndex = toIndex - 1\n for (index in fromIndex until midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Reverses elements of the array in the specified range in-place.\n * \n * @param fromIndex the start of the range (inclusive) to reverse.\n * @param toIndex the end of the range (exclusive) to reverse.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun CharArray.reverse(fromIndex: Int, toIndex: Int): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val midPoint = (fromIndex + toIndex) / 2\n if (fromIndex == midPoint) return\n var reverseIndex = toIndex - 1\n for (index in fromIndex until midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n/**\n * Returns a list with elements in reversed order.\n */\npublic fun Array.reversed(): List {\n if (isEmpty()) return emptyList()\n val list = toMutableList()\n list.reverse()\n return list\n}\n\n/**\n * Returns a list with elements in reversed order.\n */\npublic fun ByteArray.reversed(): List {\n if (isEmpty()) return emptyList()\n val list = toMutableList()\n list.reverse()\n return list\n}\n\n/**\n * Returns a list with elements in reversed order.\n */\npublic fun ShortArray.reversed(): List {\n if (isEmpty()) return emptyList()\n val list = toMutableList()\n list.reverse()\n return list\n}\n\n/**\n * Returns a list with elements in reversed order.\n */\npublic fun IntArray.reversed(): List {\n if (isEmpty()) return emptyList()\n val list = toMutableList()\n list.reverse()\n return list\n}\n\n/**\n * Returns a list with elements in reversed order.\n */\npublic fun LongArray.reversed(): List {\n if (isEmpty()) return emptyList()\n val list = toMutableList()\n list.reverse()\n return list\n}\n\n/**\n * Returns a list with elements in reversed order.\n */\npublic fun FloatArray.reversed(): List {\n if (isEmpty()) return emptyList()\n val list = toMutableList()\n list.reverse()\n return list\n}\n\n/**\n * Returns a list with elements in reversed order.\n */\npublic fun DoubleArray.reversed(): List {\n if (isEmpty()) return emptyList()\n val list = toMutableList()\n list.reverse()\n return list\n}\n\n/**\n * Returns a list with elements in reversed order.\n */\npublic fun BooleanArray.reversed(): List {\n if (isEmpty()) return emptyList()\n val list = toMutableList()\n list.reverse()\n return list\n}\n\n/**\n * Returns a list with elements in reversed order.\n */\npublic fun CharArray.reversed(): List {\n if (isEmpty()) return emptyList()\n val list = toMutableList()\n list.reverse()\n return list\n}\n\n/**\n * Returns an array with elements of this array in reversed order.\n */\npublic fun Array.reversedArray(): Array {\n if (isEmpty()) return this\n val result = arrayOfNulls(this, size)\n val lastIndex = lastIndex\n for (i in 0..lastIndex)\n result[lastIndex - i] = this[i]\n return result\n}\n\n/**\n * Returns an array with elements of this array in reversed order.\n */\npublic fun ByteArray.reversedArray(): ByteArray {\n if (isEmpty()) return this\n val result = ByteArray(size)\n val lastIndex = lastIndex\n for (i in 0..lastIndex)\n result[lastIndex - i] = this[i]\n return result\n}\n\n/**\n * Returns an array with elements of this array in reversed order.\n */\npublic fun ShortArray.reversedArray(): ShortArray {\n if (isEmpty()) return this\n val result = ShortArray(size)\n val lastIndex = lastIndex\n for (i in 0..lastIndex)\n result[lastIndex - i] = this[i]\n return result\n}\n\n/**\n * Returns an array with elements of this array in reversed order.\n */\npublic fun IntArray.reversedArray(): IntArray {\n if (isEmpty()) return this\n val result = IntArray(size)\n val lastIndex = lastIndex\n for (i in 0..lastIndex)\n result[lastIndex - i] = this[i]\n return result\n}\n\n/**\n * Returns an array with elements of this array in reversed order.\n */\npublic fun LongArray.reversedArray(): LongArray {\n if (isEmpty()) return this\n val result = LongArray(size)\n val lastIndex = lastIndex\n for (i in 0..lastIndex)\n result[lastIndex - i] = this[i]\n return result\n}\n\n/**\n * Returns an array with elements of this array in reversed order.\n */\npublic fun FloatArray.reversedArray(): FloatArray {\n if (isEmpty()) return this\n val result = FloatArray(size)\n val lastIndex = lastIndex\n for (i in 0..lastIndex)\n result[lastIndex - i] = this[i]\n return result\n}\n\n/**\n * Returns an array with elements of this array in reversed order.\n */\npublic fun DoubleArray.reversedArray(): DoubleArray {\n if (isEmpty()) return this\n val result = DoubleArray(size)\n val lastIndex = lastIndex\n for (i in 0..lastIndex)\n result[lastIndex - i] = this[i]\n return result\n}\n\n/**\n * Returns an array with elements of this array in reversed order.\n */\npublic fun BooleanArray.reversedArray(): BooleanArray {\n if (isEmpty()) return this\n val result = BooleanArray(size)\n val lastIndex = lastIndex\n for (i in 0..lastIndex)\n result[lastIndex - i] = this[i]\n return result\n}\n\n/**\n * Returns an array with elements of this array in reversed order.\n */\npublic fun CharArray.reversedArray(): CharArray {\n if (isEmpty()) return this\n val result = CharArray(size)\n val lastIndex = lastIndex\n for (i in 0..lastIndex)\n result[lastIndex - i] = this[i]\n return result\n}\n\n/**\n * Randomly shuffles elements in this array in-place.\n */\n@SinceKotlin(\"1.4\")\npublic fun Array.shuffle(): Unit {\n shuffle(Random)\n}\n\n/**\n * Randomly shuffles elements in this array in-place.\n */\n@SinceKotlin(\"1.4\")\npublic fun ByteArray.shuffle(): Unit {\n shuffle(Random)\n}\n\n/**\n * Randomly shuffles elements in this array in-place.\n */\n@SinceKotlin(\"1.4\")\npublic fun ShortArray.shuffle(): Unit {\n shuffle(Random)\n}\n\n/**\n * Randomly shuffles elements in this array in-place.\n */\n@SinceKotlin(\"1.4\")\npublic fun IntArray.shuffle(): Unit {\n shuffle(Random)\n}\n\n/**\n * Randomly shuffles elements in this array in-place.\n */\n@SinceKotlin(\"1.4\")\npublic fun LongArray.shuffle(): Unit {\n shuffle(Random)\n}\n\n/**\n * Randomly shuffles elements in this array in-place.\n */\n@SinceKotlin(\"1.4\")\npublic fun FloatArray.shuffle(): Unit {\n shuffle(Random)\n}\n\n/**\n * Randomly shuffles elements in this array in-place.\n */\n@SinceKotlin(\"1.4\")\npublic fun DoubleArray.shuffle(): Unit {\n shuffle(Random)\n}\n\n/**\n * Randomly shuffles elements in this array in-place.\n */\n@SinceKotlin(\"1.4\")\npublic fun BooleanArray.shuffle(): Unit {\n shuffle(Random)\n}\n\n/**\n * Randomly shuffles elements in this array in-place.\n */\n@SinceKotlin(\"1.4\")\npublic fun CharArray.shuffle(): Unit {\n shuffle(Random)\n}\n\n/**\n * Randomly shuffles elements in this array in-place using the specified [random] instance as the source of randomness.\n * \n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.4\")\npublic fun Array.shuffle(random: Random): Unit {\n for (i in lastIndex downTo 1) {\n val j = random.nextInt(i + 1)\n val copy = this[i]\n this[i] = this[j]\n this[j] = copy\n }\n}\n\n/**\n * Randomly shuffles elements in this array in-place using the specified [random] instance as the source of randomness.\n * \n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.4\")\npublic fun ByteArray.shuffle(random: Random): Unit {\n for (i in lastIndex downTo 1) {\n val j = random.nextInt(i + 1)\n val copy = this[i]\n this[i] = this[j]\n this[j] = copy\n }\n}\n\n/**\n * Randomly shuffles elements in this array in-place using the specified [random] instance as the source of randomness.\n * \n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.4\")\npublic fun ShortArray.shuffle(random: Random): Unit {\n for (i in lastIndex downTo 1) {\n val j = random.nextInt(i + 1)\n val copy = this[i]\n this[i] = this[j]\n this[j] = copy\n }\n}\n\n/**\n * Randomly shuffles elements in this array in-place using the specified [random] instance as the source of randomness.\n * \n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.4\")\npublic fun IntArray.shuffle(random: Random): Unit {\n for (i in lastIndex downTo 1) {\n val j = random.nextInt(i + 1)\n val copy = this[i]\n this[i] = this[j]\n this[j] = copy\n }\n}\n\n/**\n * Randomly shuffles elements in this array in-place using the specified [random] instance as the source of randomness.\n * \n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.4\")\npublic fun LongArray.shuffle(random: Random): Unit {\n for (i in lastIndex downTo 1) {\n val j = random.nextInt(i + 1)\n val copy = this[i]\n this[i] = this[j]\n this[j] = copy\n }\n}\n\n/**\n * Randomly shuffles elements in this array in-place using the specified [random] instance as the source of randomness.\n * \n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.4\")\npublic fun FloatArray.shuffle(random: Random): Unit {\n for (i in lastIndex downTo 1) {\n val j = random.nextInt(i + 1)\n val copy = this[i]\n this[i] = this[j]\n this[j] = copy\n }\n}\n\n/**\n * Randomly shuffles elements in this array in-place using the specified [random] instance as the source of randomness.\n * \n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.4\")\npublic fun DoubleArray.shuffle(random: Random): Unit {\n for (i in lastIndex downTo 1) {\n val j = random.nextInt(i + 1)\n val copy = this[i]\n this[i] = this[j]\n this[j] = copy\n }\n}\n\n/**\n * Randomly shuffles elements in this array in-place using the specified [random] instance as the source of randomness.\n * \n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.4\")\npublic fun BooleanArray.shuffle(random: Random): Unit {\n for (i in lastIndex downTo 1) {\n val j = random.nextInt(i + 1)\n val copy = this[i]\n this[i] = this[j]\n this[j] = copy\n }\n}\n\n/**\n * Randomly shuffles elements in this array in-place using the specified [random] instance as the source of randomness.\n * \n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.4\")\npublic fun CharArray.shuffle(random: Random): Unit {\n for (i in lastIndex downTo 1) {\n val j = random.nextInt(i + 1)\n val copy = this[i]\n this[i] = this[j]\n this[j] = copy\n }\n}\n\n/**\n * Sorts elements in the array in-place according to natural sort order of the value returned by specified [selector] function.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic inline fun > Array.sortBy(crossinline selector: (T) -> R?): Unit {\n if (size > 1) sortWith(compareBy(selector))\n}\n\n/**\n * Sorts elements in the array in-place descending according to natural sort order of the value returned by specified [selector] function.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic inline fun > Array.sortByDescending(crossinline selector: (T) -> R?): Unit {\n if (size > 1) sortWith(compareByDescending(selector))\n}\n\n/**\n * Sorts elements in the array in-place descending according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic fun > Array.sortDescending(): Unit {\n sortWith(reverseOrder())\n}\n\n/**\n * Sorts elements in the array in-place descending according to their natural sort order.\n */\npublic fun ByteArray.sortDescending(): Unit {\n if (size > 1) {\n sort()\n reverse()\n }\n}\n\n/**\n * Sorts elements in the array in-place descending according to their natural sort order.\n */\npublic fun ShortArray.sortDescending(): Unit {\n if (size > 1) {\n sort()\n reverse()\n }\n}\n\n/**\n * Sorts elements in the array in-place descending according to their natural sort order.\n */\npublic fun IntArray.sortDescending(): Unit {\n if (size > 1) {\n sort()\n reverse()\n }\n}\n\n/**\n * Sorts elements in the array in-place descending according to their natural sort order.\n */\npublic fun LongArray.sortDescending(): Unit {\n if (size > 1) {\n sort()\n reverse()\n }\n}\n\n/**\n * Sorts elements in the array in-place descending according to their natural sort order.\n */\npublic fun FloatArray.sortDescending(): Unit {\n if (size > 1) {\n sort()\n reverse()\n }\n}\n\n/**\n * Sorts elements in the array in-place descending according to their natural sort order.\n */\npublic fun DoubleArray.sortDescending(): Unit {\n if (size > 1) {\n sort()\n reverse()\n }\n}\n\n/**\n * Sorts elements in the array in-place descending according to their natural sort order.\n */\npublic fun CharArray.sortDescending(): Unit {\n if (size > 1) {\n sort()\n reverse()\n }\n}\n\n/**\n * Returns a list of all elements sorted according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic fun > Array.sorted(): List {\n return sortedArray().asList()\n}\n\n/**\n * Returns a list of all elements sorted according to their natural sort order.\n */\npublic fun ByteArray.sorted(): List {\n return toTypedArray().apply { sort() }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to their natural sort order.\n */\npublic fun ShortArray.sorted(): List {\n return toTypedArray().apply { sort() }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to their natural sort order.\n */\npublic fun IntArray.sorted(): List {\n return toTypedArray().apply { sort() }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to their natural sort order.\n */\npublic fun LongArray.sorted(): List {\n return toTypedArray().apply { sort() }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to their natural sort order.\n */\npublic fun FloatArray.sorted(): List {\n return toTypedArray().apply { sort() }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to their natural sort order.\n */\npublic fun DoubleArray.sorted(): List {\n return toTypedArray().apply { sort() }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to their natural sort order.\n */\npublic fun CharArray.sorted(): List {\n return toTypedArray().apply { sort() }.asList()\n}\n\n/**\n * Returns an array with all elements of this array sorted according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic fun > Array.sortedArray(): Array {\n if (isEmpty()) return this\n return this.copyOf().apply { sort() }\n}\n\n/**\n * Returns an array with all elements of this array sorted according to their natural sort order.\n */\npublic fun ByteArray.sortedArray(): ByteArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sort() }\n}\n\n/**\n * Returns an array with all elements of this array sorted according to their natural sort order.\n */\npublic fun ShortArray.sortedArray(): ShortArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sort() }\n}\n\n/**\n * Returns an array with all elements of this array sorted according to their natural sort order.\n */\npublic fun IntArray.sortedArray(): IntArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sort() }\n}\n\n/**\n * Returns an array with all elements of this array sorted according to their natural sort order.\n */\npublic fun LongArray.sortedArray(): LongArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sort() }\n}\n\n/**\n * Returns an array with all elements of this array sorted according to their natural sort order.\n */\npublic fun FloatArray.sortedArray(): FloatArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sort() }\n}\n\n/**\n * Returns an array with all elements of this array sorted according to their natural sort order.\n */\npublic fun DoubleArray.sortedArray(): DoubleArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sort() }\n}\n\n/**\n * Returns an array with all elements of this array sorted according to their natural sort order.\n */\npublic fun CharArray.sortedArray(): CharArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sort() }\n}\n\n/**\n * Returns an array with all elements of this array sorted descending according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic fun > Array.sortedArrayDescending(): Array {\n if (isEmpty()) return this\n return this.copyOf().apply { sortWith(reverseOrder()) }\n}\n\n/**\n * Returns an array with all elements of this array sorted descending according to their natural sort order.\n */\npublic fun ByteArray.sortedArrayDescending(): ByteArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sortDescending() }\n}\n\n/**\n * Returns an array with all elements of this array sorted descending according to their natural sort order.\n */\npublic fun ShortArray.sortedArrayDescending(): ShortArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sortDescending() }\n}\n\n/**\n * Returns an array with all elements of this array sorted descending according to their natural sort order.\n */\npublic fun IntArray.sortedArrayDescending(): IntArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sortDescending() }\n}\n\n/**\n * Returns an array with all elements of this array sorted descending according to their natural sort order.\n */\npublic fun LongArray.sortedArrayDescending(): LongArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sortDescending() }\n}\n\n/**\n * Returns an array with all elements of this array sorted descending according to their natural sort order.\n */\npublic fun FloatArray.sortedArrayDescending(): FloatArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sortDescending() }\n}\n\n/**\n * Returns an array with all elements of this array sorted descending according to their natural sort order.\n */\npublic fun DoubleArray.sortedArrayDescending(): DoubleArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sortDescending() }\n}\n\n/**\n * Returns an array with all elements of this array sorted descending according to their natural sort order.\n */\npublic fun CharArray.sortedArrayDescending(): CharArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sortDescending() }\n}\n\n/**\n * Returns an array with all elements of this array sorted according the specified [comparator].\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic fun Array.sortedArrayWith(comparator: Comparator): Array {\n if (isEmpty()) return this\n return this.copyOf().apply { sortWith(comparator) }\n}\n\n/**\n * Returns a list of all elements sorted according to natural sort order of the value returned by specified [selector] function.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n * \n * @sample samples.collections.Collections.Sorting.sortedBy\n */\npublic inline fun > Array.sortedBy(crossinline selector: (T) -> R?): List {\n return sortedWith(compareBy(selector))\n}\n\n/**\n * Returns a list of all elements sorted according to natural sort order of the value returned by specified [selector] function.\n * \n * @sample samples.collections.Collections.Sorting.sortedBy\n */\npublic inline fun > ByteArray.sortedBy(crossinline selector: (Byte) -> R?): List {\n return sortedWith(compareBy(selector))\n}\n\n/**\n * Returns a list of all elements sorted according to natural sort order of the value returned by specified [selector] function.\n * \n * @sample samples.collections.Collections.Sorting.sortedBy\n */\npublic inline fun > ShortArray.sortedBy(crossinline selector: (Short) -> R?): List {\n return sortedWith(compareBy(selector))\n}\n\n/**\n * Returns a list of all elements sorted according to natural sort order of the value returned by specified [selector] function.\n * \n * @sample samples.collections.Collections.Sorting.sortedBy\n */\npublic inline fun > IntArray.sortedBy(crossinline selector: (Int) -> R?): List {\n return sortedWith(compareBy(selector))\n}\n\n/**\n * Returns a list of all elements sorted according to natural sort order of the value returned by specified [selector] function.\n * \n * @sample samples.collections.Collections.Sorting.sortedBy\n */\npublic inline fun > LongArray.sortedBy(crossinline selector: (Long) -> R?): List {\n return sortedWith(compareBy(selector))\n}\n\n/**\n * Returns a list of all elements sorted according to natural sort order of the value returned by specified [selector] function.\n * \n * @sample samples.collections.Collections.Sorting.sortedBy\n */\npublic inline fun > FloatArray.sortedBy(crossinline selector: (Float) -> R?): List {\n return sortedWith(compareBy(selector))\n}\n\n/**\n * Returns a list of all elements sorted according to natural sort order of the value returned by specified [selector] function.\n * \n * @sample samples.collections.Collections.Sorting.sortedBy\n */\npublic inline fun > DoubleArray.sortedBy(crossinline selector: (Double) -> R?): List {\n return sortedWith(compareBy(selector))\n}\n\n/**\n * Returns a list of all elements sorted according to natural sort order of the value returned by specified [selector] function.\n * \n * @sample samples.collections.Collections.Sorting.sortedBy\n */\npublic inline fun > BooleanArray.sortedBy(crossinline selector: (Boolean) -> R?): List {\n return sortedWith(compareBy(selector))\n}\n\n/**\n * Returns a list of all elements sorted according to natural sort order of the value returned by specified [selector] function.\n * \n * @sample samples.collections.Collections.Sorting.sortedBy\n */\npublic inline fun > CharArray.sortedBy(crossinline selector: (Char) -> R?): List {\n return sortedWith(compareBy(selector))\n}\n\n/**\n * Returns a list of all elements sorted descending according to natural sort order of the value returned by specified [selector] function.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic inline fun > Array.sortedByDescending(crossinline selector: (T) -> R?): List {\n return sortedWith(compareByDescending(selector))\n}\n\n/**\n * Returns a list of all elements sorted descending according to natural sort order of the value returned by specified [selector] function.\n */\npublic inline fun > ByteArray.sortedByDescending(crossinline selector: (Byte) -> R?): List {\n return sortedWith(compareByDescending(selector))\n}\n\n/**\n * Returns a list of all elements sorted descending according to natural sort order of the value returned by specified [selector] function.\n */\npublic inline fun > ShortArray.sortedByDescending(crossinline selector: (Short) -> R?): List {\n return sortedWith(compareByDescending(selector))\n}\n\n/**\n * Returns a list of all elements sorted descending according to natural sort order of the value returned by specified [selector] function.\n */\npublic inline fun > IntArray.sortedByDescending(crossinline selector: (Int) -> R?): List {\n return sortedWith(compareByDescending(selector))\n}\n\n/**\n * Returns a list of all elements sorted descending according to natural sort order of the value returned by specified [selector] function.\n */\npublic inline fun > LongArray.sortedByDescending(crossinline selector: (Long) -> R?): List {\n return sortedWith(compareByDescending(selector))\n}\n\n/**\n * Returns a list of all elements sorted descending according to natural sort order of the value returned by specified [selector] function.\n */\npublic inline fun > FloatArray.sortedByDescending(crossinline selector: (Float) -> R?): List {\n return sortedWith(compareByDescending(selector))\n}\n\n/**\n * Returns a list of all elements sorted descending according to natural sort order of the value returned by specified [selector] function.\n */\npublic inline fun > DoubleArray.sortedByDescending(crossinline selector: (Double) -> R?): List {\n return sortedWith(compareByDescending(selector))\n}\n\n/**\n * Returns a list of all elements sorted descending according to natural sort order of the value returned by specified [selector] function.\n */\npublic inline fun > BooleanArray.sortedByDescending(crossinline selector: (Boolean) -> R?): List {\n return sortedWith(compareByDescending(selector))\n}\n\n/**\n * Returns a list of all elements sorted descending according to natural sort order of the value returned by specified [selector] function.\n */\npublic inline fun > CharArray.sortedByDescending(crossinline selector: (Char) -> R?): List {\n return sortedWith(compareByDescending(selector))\n}\n\n/**\n * Returns a list of all elements sorted descending according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic fun > Array.sortedDescending(): List {\n return sortedWith(reverseOrder())\n}\n\n/**\n * Returns a list of all elements sorted descending according to their natural sort order.\n */\npublic fun ByteArray.sortedDescending(): List {\n return copyOf().apply { sort() }.reversed()\n}\n\n/**\n * Returns a list of all elements sorted descending according to their natural sort order.\n */\npublic fun ShortArray.sortedDescending(): List {\n return copyOf().apply { sort() }.reversed()\n}\n\n/**\n * Returns a list of all elements sorted descending according to their natural sort order.\n */\npublic fun IntArray.sortedDescending(): List {\n return copyOf().apply { sort() }.reversed()\n}\n\n/**\n * Returns a list of all elements sorted descending according to their natural sort order.\n */\npublic fun LongArray.sortedDescending(): List {\n return copyOf().apply { sort() }.reversed()\n}\n\n/**\n * Returns a list of all elements sorted descending according to their natural sort order.\n */\npublic fun FloatArray.sortedDescending(): List {\n return copyOf().apply { sort() }.reversed()\n}\n\n/**\n * Returns a list of all elements sorted descending according to their natural sort order.\n */\npublic fun DoubleArray.sortedDescending(): List {\n return copyOf().apply { sort() }.reversed()\n}\n\n/**\n * Returns a list of all elements sorted descending according to their natural sort order.\n */\npublic fun CharArray.sortedDescending(): List {\n return copyOf().apply { sort() }.reversed()\n}\n\n/**\n * Returns a list of all elements sorted according to the specified [comparator].\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic fun Array.sortedWith(comparator: Comparator): List {\n return sortedArrayWith(comparator).asList()\n}\n\n/**\n * Returns a list of all elements sorted according to the specified [comparator].\n */\npublic fun ByteArray.sortedWith(comparator: Comparator): List {\n return toTypedArray().apply { sortWith(comparator) }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to the specified [comparator].\n */\npublic fun ShortArray.sortedWith(comparator: Comparator): List {\n return toTypedArray().apply { sortWith(comparator) }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to the specified [comparator].\n */\npublic fun IntArray.sortedWith(comparator: Comparator): List {\n return toTypedArray().apply { sortWith(comparator) }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to the specified [comparator].\n */\npublic fun LongArray.sortedWith(comparator: Comparator): List {\n return toTypedArray().apply { sortWith(comparator) }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to the specified [comparator].\n */\npublic fun FloatArray.sortedWith(comparator: Comparator): List {\n return toTypedArray().apply { sortWith(comparator) }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to the specified [comparator].\n */\npublic fun DoubleArray.sortedWith(comparator: Comparator): List {\n return toTypedArray().apply { sortWith(comparator) }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to the specified [comparator].\n */\npublic fun BooleanArray.sortedWith(comparator: Comparator): List {\n return toTypedArray().apply { sortWith(comparator) }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to the specified [comparator].\n */\npublic fun CharArray.sortedWith(comparator: Comparator): List {\n return toTypedArray().apply { sortWith(comparator) }.asList()\n}\n\n/**\n * Returns a [List] that wraps the original array.\n */\npublic expect fun Array.asList(): List\n\n/**\n * Returns a [List] that wraps the original array.\n */\npublic expect fun ByteArray.asList(): List\n\n/**\n * Returns a [List] that wraps the original array.\n */\npublic expect fun ShortArray.asList(): List\n\n/**\n * Returns a [List] that wraps the original array.\n */\npublic expect fun IntArray.asList(): List\n\n/**\n * Returns a [List] that wraps the original array.\n */\npublic expect fun LongArray.asList(): List\n\n/**\n * Returns a [List] that wraps the original array.\n */\npublic expect fun FloatArray.asList(): List\n\n/**\n * Returns a [List] that wraps the original array.\n */\npublic expect fun DoubleArray.asList(): List\n\n/**\n * Returns a [List] that wraps the original array.\n */\npublic expect fun BooleanArray.asList(): List\n\n/**\n * Returns a [List] that wraps the original array.\n */\npublic expect fun CharArray.asList(): List\n\n/**\n * Returns `true` if the two specified arrays are *deeply* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * If two corresponding elements are nested arrays, they are also compared deeply.\n * If any of arrays contains itself on any nesting level the behavior is undefined.\n * \n * The elements of other types are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.LowPriorityInOverloadResolution\npublic expect infix fun Array.contentDeepEquals(other: Array): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *deeply* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The specified arrays are also considered deeply equal if both are `null`.\n * \n * If two corresponding elements are nested arrays, they are also compared deeply.\n * If any of arrays contains itself on any nesting level the behavior is undefined.\n * \n * The elements of other types are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\npublic expect infix fun Array?.contentDeepEquals(other: Array?): Boolean\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n * Nested arrays are treated as lists too.\n * \n * If any of arrays contains itself on any nesting level the behavior is undefined.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.LowPriorityInOverloadResolution\npublic expect fun Array.contentDeepHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n * Nested arrays are treated as lists too.\n * \n * If any of arrays contains itself on any nesting level the behavior is undefined.\n */\n@SinceKotlin(\"1.4\")\npublic expect fun Array?.contentDeepHashCode(): Int\n\n/**\n * Returns a string representation of the contents of this array as if it is a [List].\n * Nested arrays are treated as lists too.\n * \n * If any of arrays contains itself on any nesting level that reference\n * is rendered as `\"[...]\"` to prevent recursion.\n * \n * @sample samples.collections.Arrays.ContentOperations.contentDeepToString\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.LowPriorityInOverloadResolution\npublic expect fun Array.contentDeepToString(): String\n\n/**\n * Returns a string representation of the contents of this array as if it is a [List].\n * Nested arrays are treated as lists too.\n * \n * If any of arrays contains itself on any nesting level that reference\n * is rendered as `\"[...]\"` to prevent recursion.\n * \n * @sample samples.collections.Arrays.ContentOperations.contentDeepToString\n */\n@SinceKotlin(\"1.4\")\npublic expect fun Array?.contentDeepToString(): String\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect infix fun Array.contentEquals(other: Array): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect infix fun ByteArray.contentEquals(other: ByteArray): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect infix fun ShortArray.contentEquals(other: ShortArray): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect infix fun IntArray.contentEquals(other: IntArray): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect infix fun LongArray.contentEquals(other: LongArray): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect infix fun FloatArray.contentEquals(other: FloatArray): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect infix fun DoubleArray.contentEquals(other: DoubleArray): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect infix fun BooleanArray.contentEquals(other: BooleanArray): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect infix fun CharArray.contentEquals(other: CharArray): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\npublic expect infix fun Array?.contentEquals(other: Array?): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\npublic expect infix fun ByteArray?.contentEquals(other: ByteArray?): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\npublic expect infix fun ShortArray?.contentEquals(other: ShortArray?): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\npublic expect infix fun IntArray?.contentEquals(other: IntArray?): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\npublic expect infix fun LongArray?.contentEquals(other: LongArray?): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\npublic expect infix fun FloatArray?.contentEquals(other: FloatArray?): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\npublic expect infix fun DoubleArray?.contentEquals(other: DoubleArray?): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\npublic expect infix fun BooleanArray?.contentEquals(other: BooleanArray?): Boolean\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\npublic expect infix fun CharArray?.contentEquals(other: CharArray?): Boolean\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun Array.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun ByteArray.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun ShortArray.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun IntArray.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun LongArray.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun FloatArray.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun DoubleArray.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun BooleanArray.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun CharArray.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\npublic expect fun Array?.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\npublic expect fun ByteArray?.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\npublic expect fun ShortArray?.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\npublic expect fun IntArray?.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\npublic expect fun LongArray?.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\npublic expect fun FloatArray?.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\npublic expect fun DoubleArray?.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\npublic expect fun BooleanArray?.contentHashCode(): Int\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\npublic expect fun CharArray?.contentHashCode(): Int\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun Array.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun ByteArray.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun ShortArray.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun IntArray.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun LongArray.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun FloatArray.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun DoubleArray.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun BooleanArray.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic expect fun CharArray.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\npublic expect fun Array?.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\npublic expect fun ByteArray?.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\npublic expect fun ShortArray?.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\npublic expect fun IntArray?.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\npublic expect fun LongArray?.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\npublic expect fun FloatArray?.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\npublic expect fun DoubleArray?.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\npublic expect fun BooleanArray?.contentToString(): String\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\npublic expect fun CharArray?.contentToString(): String\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\npublic expect fun Array.copyInto(destination: Array, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): Array\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\npublic expect fun ByteArray.copyInto(destination: ByteArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): ByteArray\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\npublic expect fun ShortArray.copyInto(destination: ShortArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): ShortArray\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\npublic expect fun IntArray.copyInto(destination: IntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): IntArray\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\npublic expect fun LongArray.copyInto(destination: LongArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): LongArray\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\npublic expect fun FloatArray.copyInto(destination: FloatArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): FloatArray\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\npublic expect fun DoubleArray.copyInto(destination: DoubleArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): DoubleArray\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\npublic expect fun BooleanArray.copyInto(destination: BooleanArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): BooleanArray\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\npublic expect fun CharArray.copyInto(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): CharArray\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\n@Suppress(\"NO_ACTUAL_FOR_EXPECT\")\npublic expect fun Array.copyOf(): Array\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\npublic expect fun ByteArray.copyOf(): ByteArray\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\npublic expect fun ShortArray.copyOf(): ShortArray\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\npublic expect fun IntArray.copyOf(): IntArray\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\npublic expect fun LongArray.copyOf(): LongArray\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\npublic expect fun FloatArray.copyOf(): FloatArray\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\npublic expect fun DoubleArray.copyOf(): DoubleArray\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\npublic expect fun BooleanArray.copyOf(): BooleanArray\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\npublic expect fun CharArray.copyOf(): CharArray\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic expect fun ByteArray.copyOf(newSize: Int): ByteArray\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic expect fun ShortArray.copyOf(newSize: Int): ShortArray\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic expect fun IntArray.copyOf(newSize: Int): IntArray\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic expect fun LongArray.copyOf(newSize: Int): LongArray\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic expect fun FloatArray.copyOf(newSize: Int): FloatArray\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic expect fun DoubleArray.copyOf(newSize: Int): DoubleArray\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with `false` values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with `false` values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic expect fun BooleanArray.copyOf(newSize: Int): BooleanArray\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with null char (`\\u0000`) values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with null char (`\\u0000`) values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic expect fun CharArray.copyOf(newSize: Int): CharArray\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with `null` values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with `null` values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizingCopyOf\n */\n@Suppress(\"NO_ACTUAL_FOR_EXPECT\")\npublic expect fun Array.copyOf(newSize: Int): Array\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@Suppress(\"NO_ACTUAL_FOR_EXPECT\")\npublic expect fun Array.copyOfRange(fromIndex: Int, toIndex: Int): Array\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic expect fun ByteArray.copyOfRange(fromIndex: Int, toIndex: Int): ByteArray\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic expect fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArray\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic expect fun IntArray.copyOfRange(fromIndex: Int, toIndex: Int): IntArray\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic expect fun LongArray.copyOfRange(fromIndex: Int, toIndex: Int): LongArray\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic expect fun FloatArray.copyOfRange(fromIndex: Int, toIndex: Int): FloatArray\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic expect fun DoubleArray.copyOfRange(fromIndex: Int, toIndex: Int): DoubleArray\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic expect fun BooleanArray.copyOfRange(fromIndex: Int, toIndex: Int): BooleanArray\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic expect fun CharArray.copyOfRange(fromIndex: Int, toIndex: Int): CharArray\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\npublic expect fun Array.fill(element: T, fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\npublic expect fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\npublic expect fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\npublic expect fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\npublic expect fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\npublic expect fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\npublic expect fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\npublic expect fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\npublic expect fun CharArray.fill(element: Char, fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Returns the range of valid indices for the array.\n */\npublic val Array.indices: IntRange\n get() = IntRange(0, lastIndex)\n\n/**\n * Returns the range of valid indices for the array.\n */\npublic val ByteArray.indices: IntRange\n get() = IntRange(0, lastIndex)\n\n/**\n * Returns the range of valid indices for the array.\n */\npublic val ShortArray.indices: IntRange\n get() = IntRange(0, lastIndex)\n\n/**\n * Returns the range of valid indices for the array.\n */\npublic val IntArray.indices: IntRange\n get() = IntRange(0, lastIndex)\n\n/**\n * Returns the range of valid indices for the array.\n */\npublic val LongArray.indices: IntRange\n get() = IntRange(0, lastIndex)\n\n/**\n * Returns the range of valid indices for the array.\n */\npublic val FloatArray.indices: IntRange\n get() = IntRange(0, lastIndex)\n\n/**\n * Returns the range of valid indices for the array.\n */\npublic val DoubleArray.indices: IntRange\n get() = IntRange(0, lastIndex)\n\n/**\n * Returns the range of valid indices for the array.\n */\npublic val BooleanArray.indices: IntRange\n get() = IntRange(0, lastIndex)\n\n/**\n * Returns the range of valid indices for the array.\n */\npublic val CharArray.indices: IntRange\n get() = IntRange(0, lastIndex)\n\n/**\n * Returns `true` if the array is empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun Array.isEmpty(): Boolean {\n return size == 0\n}\n\n/**\n * Returns `true` if the array is empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.isEmpty(): Boolean {\n return size == 0\n}\n\n/**\n * Returns `true` if the array is empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.isEmpty(): Boolean {\n return size == 0\n}\n\n/**\n * Returns `true` if the array is empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.isEmpty(): Boolean {\n return size == 0\n}\n\n/**\n * Returns `true` if the array is empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.isEmpty(): Boolean {\n return size == 0\n}\n\n/**\n * Returns `true` if the array is empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.isEmpty(): Boolean {\n return size == 0\n}\n\n/**\n * Returns `true` if the array is empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.isEmpty(): Boolean {\n return size == 0\n}\n\n/**\n * Returns `true` if the array is empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.isEmpty(): Boolean {\n return size == 0\n}\n\n/**\n * Returns `true` if the array is empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.isEmpty(): Boolean {\n return size == 0\n}\n\n/**\n * Returns `true` if the array is not empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun Array.isNotEmpty(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if the array is not empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.isNotEmpty(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if the array is not empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.isNotEmpty(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if the array is not empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.isNotEmpty(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if the array is not empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.isNotEmpty(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if the array is not empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.isNotEmpty(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if the array is not empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.isNotEmpty(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if the array is not empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.isNotEmpty(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if the array is not empty.\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.isNotEmpty(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns the last valid index for the array.\n */\npublic val Array.lastIndex: Int\n get() = size - 1\n\n/**\n * Returns the last valid index for the array.\n */\npublic val ByteArray.lastIndex: Int\n get() = size - 1\n\n/**\n * Returns the last valid index for the array.\n */\npublic val ShortArray.lastIndex: Int\n get() = size - 1\n\n/**\n * Returns the last valid index for the array.\n */\npublic val IntArray.lastIndex: Int\n get() = size - 1\n\n/**\n * Returns the last valid index for the array.\n */\npublic val LongArray.lastIndex: Int\n get() = size - 1\n\n/**\n * Returns the last valid index for the array.\n */\npublic val FloatArray.lastIndex: Int\n get() = size - 1\n\n/**\n * Returns the last valid index for the array.\n */\npublic val DoubleArray.lastIndex: Int\n get() = size - 1\n\n/**\n * Returns the last valid index for the array.\n */\npublic val BooleanArray.lastIndex: Int\n get() = size - 1\n\n/**\n * Returns the last valid index for the array.\n */\npublic val CharArray.lastIndex: Int\n get() = size - 1\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@Suppress(\"NO_ACTUAL_FOR_EXPECT\")\npublic expect operator fun Array.plus(element: T): Array\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\npublic expect operator fun ByteArray.plus(element: Byte): ByteArray\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\npublic expect operator fun ShortArray.plus(element: Short): ShortArray\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\npublic expect operator fun IntArray.plus(element: Int): IntArray\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\npublic expect operator fun LongArray.plus(element: Long): LongArray\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\npublic expect operator fun FloatArray.plus(element: Float): FloatArray\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\npublic expect operator fun DoubleArray.plus(element: Double): DoubleArray\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\npublic expect operator fun BooleanArray.plus(element: Boolean): BooleanArray\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\npublic expect operator fun CharArray.plus(element: Char): CharArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\n@Suppress(\"NO_ACTUAL_FOR_EXPECT\")\npublic expect operator fun Array.plus(elements: Collection): Array\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic expect operator fun ByteArray.plus(elements: Collection): ByteArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic expect operator fun ShortArray.plus(elements: Collection): ShortArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic expect operator fun IntArray.plus(elements: Collection): IntArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic expect operator fun LongArray.plus(elements: Collection): LongArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic expect operator fun FloatArray.plus(elements: Collection): FloatArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic expect operator fun DoubleArray.plus(elements: Collection): DoubleArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic expect operator fun BooleanArray.plus(elements: Collection): BooleanArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic expect operator fun CharArray.plus(elements: Collection): CharArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\n@Suppress(\"NO_ACTUAL_FOR_EXPECT\")\npublic expect operator fun Array.plus(elements: Array): Array\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\npublic expect operator fun ByteArray.plus(elements: ByteArray): ByteArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\npublic expect operator fun ShortArray.plus(elements: ShortArray): ShortArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\npublic expect operator fun IntArray.plus(elements: IntArray): IntArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\npublic expect operator fun LongArray.plus(elements: LongArray): LongArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\npublic expect operator fun FloatArray.plus(elements: FloatArray): FloatArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\npublic expect operator fun DoubleArray.plus(elements: DoubleArray): DoubleArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\npublic expect operator fun BooleanArray.plus(elements: BooleanArray): BooleanArray\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\npublic expect operator fun CharArray.plus(elements: CharArray): CharArray\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@Suppress(\"NO_ACTUAL_FOR_EXPECT\")\npublic expect fun Array.plusElement(element: T): Array\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\npublic expect fun IntArray.sort(): Unit\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\npublic expect fun LongArray.sort(): Unit\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\npublic expect fun ByteArray.sort(): Unit\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\npublic expect fun ShortArray.sort(): Unit\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\npublic expect fun DoubleArray.sort(): Unit\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\npublic expect fun FloatArray.sort(): Unit\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\npublic expect fun CharArray.sort(): Unit\n\n/**\n * Sorts the array in-place according to the natural order of its elements.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n * \n * @sample samples.collections.Arrays.Sorting.sortArrayOfComparable\n */\npublic expect fun > Array.sort(): Unit\n\n/**\n * Sorts a range in the array in-place.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArrayOfComparable\n */\n@SinceKotlin(\"1.4\")\npublic expect fun > Array.sort(fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\npublic expect fun ByteArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\npublic expect fun ShortArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\npublic expect fun IntArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\npublic expect fun LongArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\npublic expect fun FloatArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\npublic expect fun DoubleArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\npublic expect fun CharArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Sorts elements of the array in the specified range in-place.\n * The elements are sorted descending according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n * \n * @param fromIndex the start of the range (inclusive) to sort.\n * @param toIndex the end of the range (exclusive) to sort.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun > Array.sortDescending(fromIndex: Int, toIndex: Int): Unit {\n sortWith(reverseOrder(), fromIndex, toIndex)\n}\n\n/**\n * Sorts elements of the array in the specified range in-place.\n * The elements are sorted descending according to their natural sort order.\n * \n * @param fromIndex the start of the range (inclusive) to sort.\n * @param toIndex the end of the range (exclusive) to sort.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun ByteArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {\n sort(fromIndex, toIndex)\n reverse(fromIndex, toIndex)\n}\n\n/**\n * Sorts elements of the array in the specified range in-place.\n * The elements are sorted descending according to their natural sort order.\n * \n * @param fromIndex the start of the range (inclusive) to sort.\n * @param toIndex the end of the range (exclusive) to sort.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun ShortArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {\n sort(fromIndex, toIndex)\n reverse(fromIndex, toIndex)\n}\n\n/**\n * Sorts elements of the array in the specified range in-place.\n * The elements are sorted descending according to their natural sort order.\n * \n * @param fromIndex the start of the range (inclusive) to sort.\n * @param toIndex the end of the range (exclusive) to sort.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun IntArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {\n sort(fromIndex, toIndex)\n reverse(fromIndex, toIndex)\n}\n\n/**\n * Sorts elements of the array in the specified range in-place.\n * The elements are sorted descending according to their natural sort order.\n * \n * @param fromIndex the start of the range (inclusive) to sort.\n * @param toIndex the end of the range (exclusive) to sort.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun LongArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {\n sort(fromIndex, toIndex)\n reverse(fromIndex, toIndex)\n}\n\n/**\n * Sorts elements of the array in the specified range in-place.\n * The elements are sorted descending according to their natural sort order.\n * \n * @param fromIndex the start of the range (inclusive) to sort.\n * @param toIndex the end of the range (exclusive) to sort.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun FloatArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {\n sort(fromIndex, toIndex)\n reverse(fromIndex, toIndex)\n}\n\n/**\n * Sorts elements of the array in the specified range in-place.\n * The elements are sorted descending according to their natural sort order.\n * \n * @param fromIndex the start of the range (inclusive) to sort.\n * @param toIndex the end of the range (exclusive) to sort.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun DoubleArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {\n sort(fromIndex, toIndex)\n reverse(fromIndex, toIndex)\n}\n\n/**\n * Sorts elements of the array in the specified range in-place.\n * The elements are sorted descending according to their natural sort order.\n * \n * @param fromIndex the start of the range (inclusive) to sort.\n * @param toIndex the end of the range (exclusive) to sort.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\npublic fun CharArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {\n sort(fromIndex, toIndex)\n reverse(fromIndex, toIndex)\n}\n\n/**\n * Sorts the array in-place according to the order specified by the given [comparator].\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic expect fun Array.sortWith(comparator: Comparator): Unit\n\n/**\n * Sorts a range in the array in-place with the given [comparator].\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic expect fun Array.sortWith(comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size): Unit\n\n/**\n * Returns an array of Boolean containing all of the elements of this generic array.\n */\npublic fun Array.toBooleanArray(): BooleanArray {\n return BooleanArray(size) { index -> this[index] }\n}\n\n/**\n * Returns an array of Byte containing all of the elements of this generic array.\n */\npublic fun Array.toByteArray(): ByteArray {\n return ByteArray(size) { index -> this[index] }\n}\n\n/**\n * Returns an array of Char containing all of the elements of this generic array.\n */\npublic fun Array.toCharArray(): CharArray {\n return CharArray(size) { index -> this[index] }\n}\n\n/**\n * Returns an array of Double containing all of the elements of this generic array.\n */\npublic fun Array.toDoubleArray(): DoubleArray {\n return DoubleArray(size) { index -> this[index] }\n}\n\n/**\n * Returns an array of Float containing all of the elements of this generic array.\n */\npublic fun Array.toFloatArray(): FloatArray {\n return FloatArray(size) { index -> this[index] }\n}\n\n/**\n * Returns an array of Int containing all of the elements of this generic array.\n */\npublic fun Array.toIntArray(): IntArray {\n return IntArray(size) { index -> this[index] }\n}\n\n/**\n * Returns an array of Long containing all of the elements of this generic array.\n */\npublic fun Array.toLongArray(): LongArray {\n return LongArray(size) { index -> this[index] }\n}\n\n/**\n * Returns an array of Short containing all of the elements of this generic array.\n */\npublic fun Array.toShortArray(): ShortArray {\n return ShortArray(size) { index -> this[index] }\n}\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic expect fun ByteArray.toTypedArray(): Array\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic expect fun ShortArray.toTypedArray(): Array\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic expect fun IntArray.toTypedArray(): Array\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic expect fun LongArray.toTypedArray(): Array\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic expect fun FloatArray.toTypedArray(): Array\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic expect fun DoubleArray.toTypedArray(): Array\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic expect fun BooleanArray.toTypedArray(): Array\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic expect fun CharArray.toTypedArray(): Array\n\n/**\n * Returns a [Map] containing key-value pairs provided by [transform] function\n * applied to elements of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitives\n */\npublic inline fun Array.associate(transform: (T) -> Pair): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateTo(LinkedHashMap(capacity), transform)\n}\n\n/**\n * Returns a [Map] containing key-value pairs provided by [transform] function\n * applied to elements of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitives\n */\npublic inline fun ByteArray.associate(transform: (Byte) -> Pair): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateTo(LinkedHashMap(capacity), transform)\n}\n\n/**\n * Returns a [Map] containing key-value pairs provided by [transform] function\n * applied to elements of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitives\n */\npublic inline fun ShortArray.associate(transform: (Short) -> Pair): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateTo(LinkedHashMap(capacity), transform)\n}\n\n/**\n * Returns a [Map] containing key-value pairs provided by [transform] function\n * applied to elements of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitives\n */\npublic inline fun IntArray.associate(transform: (Int) -> Pair): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateTo(LinkedHashMap(capacity), transform)\n}\n\n/**\n * Returns a [Map] containing key-value pairs provided by [transform] function\n * applied to elements of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitives\n */\npublic inline fun LongArray.associate(transform: (Long) -> Pair): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateTo(LinkedHashMap(capacity), transform)\n}\n\n/**\n * Returns a [Map] containing key-value pairs provided by [transform] function\n * applied to elements of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitives\n */\npublic inline fun FloatArray.associate(transform: (Float) -> Pair): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateTo(LinkedHashMap(capacity), transform)\n}\n\n/**\n * Returns a [Map] containing key-value pairs provided by [transform] function\n * applied to elements of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitives\n */\npublic inline fun DoubleArray.associate(transform: (Double) -> Pair): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateTo(LinkedHashMap(capacity), transform)\n}\n\n/**\n * Returns a [Map] containing key-value pairs provided by [transform] function\n * applied to elements of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitives\n */\npublic inline fun BooleanArray.associate(transform: (Boolean) -> Pair): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateTo(LinkedHashMap(capacity), transform)\n}\n\n/**\n * Returns a [Map] containing key-value pairs provided by [transform] function\n * applied to elements of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitives\n */\npublic inline fun CharArray.associate(transform: (Char) -> Pair): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateTo(LinkedHashMap(capacity), transform)\n}\n\n/**\n * Returns a [Map] containing the elements from the given array indexed by the key\n * returned from [keySelector] function applied to each element.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesBy\n */\npublic inline fun Array.associateBy(keySelector: (T) -> K): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector)\n}\n\n/**\n * Returns a [Map] containing the elements from the given array indexed by the key\n * returned from [keySelector] function applied to each element.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesBy\n */\npublic inline fun ByteArray.associateBy(keySelector: (Byte) -> K): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector)\n}\n\n/**\n * Returns a [Map] containing the elements from the given array indexed by the key\n * returned from [keySelector] function applied to each element.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesBy\n */\npublic inline fun ShortArray.associateBy(keySelector: (Short) -> K): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector)\n}\n\n/**\n * Returns a [Map] containing the elements from the given array indexed by the key\n * returned from [keySelector] function applied to each element.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesBy\n */\npublic inline fun IntArray.associateBy(keySelector: (Int) -> K): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector)\n}\n\n/**\n * Returns a [Map] containing the elements from the given array indexed by the key\n * returned from [keySelector] function applied to each element.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesBy\n */\npublic inline fun LongArray.associateBy(keySelector: (Long) -> K): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector)\n}\n\n/**\n * Returns a [Map] containing the elements from the given array indexed by the key\n * returned from [keySelector] function applied to each element.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesBy\n */\npublic inline fun FloatArray.associateBy(keySelector: (Float) -> K): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector)\n}\n\n/**\n * Returns a [Map] containing the elements from the given array indexed by the key\n * returned from [keySelector] function applied to each element.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesBy\n */\npublic inline fun DoubleArray.associateBy(keySelector: (Double) -> K): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector)\n}\n\n/**\n * Returns a [Map] containing the elements from the given array indexed by the key\n * returned from [keySelector] function applied to each element.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesBy\n */\npublic inline fun BooleanArray.associateBy(keySelector: (Boolean) -> K): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector)\n}\n\n/**\n * Returns a [Map] containing the elements from the given array indexed by the key\n * returned from [keySelector] function applied to each element.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesBy\n */\npublic inline fun CharArray.associateBy(keySelector: (Char) -> K): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector)\n}\n\n/**\n * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByWithValueTransform\n */\npublic inline fun Array.associateBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector, valueTransform)\n}\n\n/**\n * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByWithValueTransform\n */\npublic inline fun ByteArray.associateBy(keySelector: (Byte) -> K, valueTransform: (Byte) -> V): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector, valueTransform)\n}\n\n/**\n * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByWithValueTransform\n */\npublic inline fun ShortArray.associateBy(keySelector: (Short) -> K, valueTransform: (Short) -> V): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector, valueTransform)\n}\n\n/**\n * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByWithValueTransform\n */\npublic inline fun IntArray.associateBy(keySelector: (Int) -> K, valueTransform: (Int) -> V): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector, valueTransform)\n}\n\n/**\n * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByWithValueTransform\n */\npublic inline fun LongArray.associateBy(keySelector: (Long) -> K, valueTransform: (Long) -> V): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector, valueTransform)\n}\n\n/**\n * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByWithValueTransform\n */\npublic inline fun FloatArray.associateBy(keySelector: (Float) -> K, valueTransform: (Float) -> V): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector, valueTransform)\n}\n\n/**\n * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByWithValueTransform\n */\npublic inline fun DoubleArray.associateBy(keySelector: (Double) -> K, valueTransform: (Double) -> V): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector, valueTransform)\n}\n\n/**\n * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByWithValueTransform\n */\npublic inline fun BooleanArray.associateBy(keySelector: (Boolean) -> K, valueTransform: (Boolean) -> V): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector, valueTransform)\n}\n\n/**\n * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByWithValueTransform\n */\npublic inline fun CharArray.associateBy(keySelector: (Char) -> K, valueTransform: (Char) -> V): Map {\n val capacity = mapCapacity(size).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector, valueTransform)\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function applied to each element of the given array\n * and value is the element itself.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByTo\n */\npublic inline fun > Array.associateByTo(destination: M, keySelector: (T) -> K): M {\n for (element in this) {\n destination.put(keySelector(element), element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function applied to each element of the given array\n * and value is the element itself.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByTo\n */\npublic inline fun > ByteArray.associateByTo(destination: M, keySelector: (Byte) -> K): M {\n for (element in this) {\n destination.put(keySelector(element), element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function applied to each element of the given array\n * and value is the element itself.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByTo\n */\npublic inline fun > ShortArray.associateByTo(destination: M, keySelector: (Short) -> K): M {\n for (element in this) {\n destination.put(keySelector(element), element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function applied to each element of the given array\n * and value is the element itself.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByTo\n */\npublic inline fun > IntArray.associateByTo(destination: M, keySelector: (Int) -> K): M {\n for (element in this) {\n destination.put(keySelector(element), element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function applied to each element of the given array\n * and value is the element itself.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByTo\n */\npublic inline fun > LongArray.associateByTo(destination: M, keySelector: (Long) -> K): M {\n for (element in this) {\n destination.put(keySelector(element), element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function applied to each element of the given array\n * and value is the element itself.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByTo\n */\npublic inline fun > FloatArray.associateByTo(destination: M, keySelector: (Float) -> K): M {\n for (element in this) {\n destination.put(keySelector(element), element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function applied to each element of the given array\n * and value is the element itself.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByTo\n */\npublic inline fun > DoubleArray.associateByTo(destination: M, keySelector: (Double) -> K): M {\n for (element in this) {\n destination.put(keySelector(element), element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function applied to each element of the given array\n * and value is the element itself.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByTo\n */\npublic inline fun > BooleanArray.associateByTo(destination: M, keySelector: (Boolean) -> K): M {\n for (element in this) {\n destination.put(keySelector(element), element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function applied to each element of the given array\n * and value is the element itself.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByTo\n */\npublic inline fun > CharArray.associateByTo(destination: M, keySelector: (Char) -> K): M {\n for (element in this) {\n destination.put(keySelector(element), element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function and\n * and value is provided by the [valueTransform] function applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByToWithValueTransform\n */\npublic inline fun > Array.associateByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M {\n for (element in this) {\n destination.put(keySelector(element), valueTransform(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function and\n * and value is provided by the [valueTransform] function applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByToWithValueTransform\n */\npublic inline fun > ByteArray.associateByTo(destination: M, keySelector: (Byte) -> K, valueTransform: (Byte) -> V): M {\n for (element in this) {\n destination.put(keySelector(element), valueTransform(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function and\n * and value is provided by the [valueTransform] function applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByToWithValueTransform\n */\npublic inline fun > ShortArray.associateByTo(destination: M, keySelector: (Short) -> K, valueTransform: (Short) -> V): M {\n for (element in this) {\n destination.put(keySelector(element), valueTransform(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function and\n * and value is provided by the [valueTransform] function applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByToWithValueTransform\n */\npublic inline fun > IntArray.associateByTo(destination: M, keySelector: (Int) -> K, valueTransform: (Int) -> V): M {\n for (element in this) {\n destination.put(keySelector(element), valueTransform(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function and\n * and value is provided by the [valueTransform] function applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByToWithValueTransform\n */\npublic inline fun > LongArray.associateByTo(destination: M, keySelector: (Long) -> K, valueTransform: (Long) -> V): M {\n for (element in this) {\n destination.put(keySelector(element), valueTransform(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function and\n * and value is provided by the [valueTransform] function applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByToWithValueTransform\n */\npublic inline fun > FloatArray.associateByTo(destination: M, keySelector: (Float) -> K, valueTransform: (Float) -> V): M {\n for (element in this) {\n destination.put(keySelector(element), valueTransform(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function and\n * and value is provided by the [valueTransform] function applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByToWithValueTransform\n */\npublic inline fun > DoubleArray.associateByTo(destination: M, keySelector: (Double) -> K, valueTransform: (Double) -> V): M {\n for (element in this) {\n destination.put(keySelector(element), valueTransform(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function and\n * and value is provided by the [valueTransform] function applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByToWithValueTransform\n */\npublic inline fun > BooleanArray.associateByTo(destination: M, keySelector: (Boolean) -> K, valueTransform: (Boolean) -> V): M {\n for (element in this) {\n destination.put(keySelector(element), valueTransform(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function and\n * and value is provided by the [valueTransform] function applied to elements of the given array.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesByToWithValueTransform\n */\npublic inline fun > CharArray.associateByTo(destination: M, keySelector: (Char) -> K, valueTransform: (Char) -> V): M {\n for (element in this) {\n destination.put(keySelector(element), valueTransform(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs\n * provided by [transform] function applied to each element of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesTo\n */\npublic inline fun > Array.associateTo(destination: M, transform: (T) -> Pair): M {\n for (element in this) {\n destination += transform(element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs\n * provided by [transform] function applied to each element of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesTo\n */\npublic inline fun > ByteArray.associateTo(destination: M, transform: (Byte) -> Pair): M {\n for (element in this) {\n destination += transform(element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs\n * provided by [transform] function applied to each element of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesTo\n */\npublic inline fun > ShortArray.associateTo(destination: M, transform: (Short) -> Pair): M {\n for (element in this) {\n destination += transform(element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs\n * provided by [transform] function applied to each element of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesTo\n */\npublic inline fun > IntArray.associateTo(destination: M, transform: (Int) -> Pair): M {\n for (element in this) {\n destination += transform(element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs\n * provided by [transform] function applied to each element of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesTo\n */\npublic inline fun > LongArray.associateTo(destination: M, transform: (Long) -> Pair): M {\n for (element in this) {\n destination += transform(element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs\n * provided by [transform] function applied to each element of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesTo\n */\npublic inline fun > FloatArray.associateTo(destination: M, transform: (Float) -> Pair): M {\n for (element in this) {\n destination += transform(element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs\n * provided by [transform] function applied to each element of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesTo\n */\npublic inline fun > DoubleArray.associateTo(destination: M, transform: (Double) -> Pair): M {\n for (element in this) {\n destination += transform(element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs\n * provided by [transform] function applied to each element of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesTo\n */\npublic inline fun > BooleanArray.associateTo(destination: M, transform: (Boolean) -> Pair): M {\n for (element in this) {\n destination += transform(element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs\n * provided by [transform] function applied to each element of the given array.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * @sample samples.collections.Arrays.Transformations.associateArrayOfPrimitivesTo\n */\npublic inline fun > CharArray.associateTo(destination: M, transform: (Char) -> Pair): M {\n for (element in this) {\n destination += transform(element)\n }\n return destination\n}\n\n/**\n * Returns a [Map] where keys are elements from the given array and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.4\")\npublic inline fun Array.associateWith(valueSelector: (K) -> V): Map {\n val result = LinkedHashMap(mapCapacity(size).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Returns a [Map] where keys are elements from the given array and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.associateWith(valueSelector: (Byte) -> V): Map {\n val result = LinkedHashMap(mapCapacity(size).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Returns a [Map] where keys are elements from the given array and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.associateWith(valueSelector: (Short) -> V): Map {\n val result = LinkedHashMap(mapCapacity(size).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Returns a [Map] where keys are elements from the given array and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.associateWith(valueSelector: (Int) -> V): Map {\n val result = LinkedHashMap(mapCapacity(size).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Returns a [Map] where keys are elements from the given array and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.associateWith(valueSelector: (Long) -> V): Map {\n val result = LinkedHashMap(mapCapacity(size).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Returns a [Map] where keys are elements from the given array and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.associateWith(valueSelector: (Float) -> V): Map {\n val result = LinkedHashMap(mapCapacity(size).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Returns a [Map] where keys are elements from the given array and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.associateWith(valueSelector: (Double) -> V): Map {\n val result = LinkedHashMap(mapCapacity(size).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Returns a [Map] where keys are elements from the given array and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.associateWith(valueSelector: (Boolean) -> V): Map {\n val result = LinkedHashMap(mapCapacity(size).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Returns a [Map] where keys are elements from the given array and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.associateWith(valueSelector: (Char) -> V): Map {\n val result = LinkedHashMap(mapCapacity(size.coerceAtMost(128)).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given array,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > Array.associateWithTo(destination: M, valueSelector: (K) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given array,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun > ByteArray.associateWithTo(destination: M, valueSelector: (Byte) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given array,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun > ShortArray.associateWithTo(destination: M, valueSelector: (Short) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given array,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun > IntArray.associateWithTo(destination: M, valueSelector: (Int) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given array,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun > LongArray.associateWithTo(destination: M, valueSelector: (Long) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given array,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun > FloatArray.associateWithTo(destination: M, valueSelector: (Float) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given array,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun > DoubleArray.associateWithTo(destination: M, valueSelector: (Double) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given array,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun > BooleanArray.associateWithTo(destination: M, valueSelector: (Boolean) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given array,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun > CharArray.associateWithTo(destination: M, valueSelector: (Char) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Appends all elements to the given [destination] collection.\n */\npublic fun > Array.toCollection(destination: C): C {\n for (item in this) {\n destination.add(item)\n }\n return destination\n}\n\n/**\n * Appends all elements to the given [destination] collection.\n */\npublic fun > ByteArray.toCollection(destination: C): C {\n for (item in this) {\n destination.add(item)\n }\n return destination\n}\n\n/**\n * Appends all elements to the given [destination] collection.\n */\npublic fun > ShortArray.toCollection(destination: C): C {\n for (item in this) {\n destination.add(item)\n }\n return destination\n}\n\n/**\n * Appends all elements to the given [destination] collection.\n */\npublic fun > IntArray.toCollection(destination: C): C {\n for (item in this) {\n destination.add(item)\n }\n return destination\n}\n\n/**\n * Appends all elements to the given [destination] collection.\n */\npublic fun > LongArray.toCollection(destination: C): C {\n for (item in this) {\n destination.add(item)\n }\n return destination\n}\n\n/**\n * Appends all elements to the given [destination] collection.\n */\npublic fun > FloatArray.toCollection(destination: C): C {\n for (item in this) {\n destination.add(item)\n }\n return destination\n}\n\n/**\n * Appends all elements to the given [destination] collection.\n */\npublic fun > DoubleArray.toCollection(destination: C): C {\n for (item in this) {\n destination.add(item)\n }\n return destination\n}\n\n/**\n * Appends all elements to the given [destination] collection.\n */\npublic fun > BooleanArray.toCollection(destination: C): C {\n for (item in this) {\n destination.add(item)\n }\n return destination\n}\n\n/**\n * Appends all elements to the given [destination] collection.\n */\npublic fun > CharArray.toCollection(destination: C): C {\n for (item in this) {\n destination.add(item)\n }\n return destination\n}\n\n/**\n * Returns a new [HashSet] of all elements.\n */\npublic fun Array.toHashSet(): HashSet {\n return toCollection(HashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [HashSet] of all elements.\n */\npublic fun ByteArray.toHashSet(): HashSet {\n return toCollection(HashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [HashSet] of all elements.\n */\npublic fun ShortArray.toHashSet(): HashSet {\n return toCollection(HashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [HashSet] of all elements.\n */\npublic fun IntArray.toHashSet(): HashSet {\n return toCollection(HashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [HashSet] of all elements.\n */\npublic fun LongArray.toHashSet(): HashSet {\n return toCollection(HashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [HashSet] of all elements.\n */\npublic fun FloatArray.toHashSet(): HashSet {\n return toCollection(HashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [HashSet] of all elements.\n */\npublic fun DoubleArray.toHashSet(): HashSet {\n return toCollection(HashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [HashSet] of all elements.\n */\npublic fun BooleanArray.toHashSet(): HashSet {\n return toCollection(HashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [HashSet] of all elements.\n */\npublic fun CharArray.toHashSet(): HashSet {\n return toCollection(HashSet(mapCapacity(size.coerceAtMost(128))))\n}\n\n/**\n * Returns a [List] containing all elements.\n */\npublic fun Array.toList(): List {\n return when (size) {\n 0 -> emptyList()\n 1 -> listOf(this[0])\n else -> this.toMutableList()\n }\n}\n\n/**\n * Returns a [List] containing all elements.\n */\npublic fun ByteArray.toList(): List {\n return when (size) {\n 0 -> emptyList()\n 1 -> listOf(this[0])\n else -> this.toMutableList()\n }\n}\n\n/**\n * Returns a [List] containing all elements.\n */\npublic fun ShortArray.toList(): List {\n return when (size) {\n 0 -> emptyList()\n 1 -> listOf(this[0])\n else -> this.toMutableList()\n }\n}\n\n/**\n * Returns a [List] containing all elements.\n */\npublic fun IntArray.toList(): List {\n return when (size) {\n 0 -> emptyList()\n 1 -> listOf(this[0])\n else -> this.toMutableList()\n }\n}\n\n/**\n * Returns a [List] containing all elements.\n */\npublic fun LongArray.toList(): List {\n return when (size) {\n 0 -> emptyList()\n 1 -> listOf(this[0])\n else -> this.toMutableList()\n }\n}\n\n/**\n * Returns a [List] containing all elements.\n */\npublic fun FloatArray.toList(): List {\n return when (size) {\n 0 -> emptyList()\n 1 -> listOf(this[0])\n else -> this.toMutableList()\n }\n}\n\n/**\n * Returns a [List] containing all elements.\n */\npublic fun DoubleArray.toList(): List {\n return when (size) {\n 0 -> emptyList()\n 1 -> listOf(this[0])\n else -> this.toMutableList()\n }\n}\n\n/**\n * Returns a [List] containing all elements.\n */\npublic fun BooleanArray.toList(): List {\n return when (size) {\n 0 -> emptyList()\n 1 -> listOf(this[0])\n else -> this.toMutableList()\n }\n}\n\n/**\n * Returns a [List] containing all elements.\n */\npublic fun CharArray.toList(): List {\n return when (size) {\n 0 -> emptyList()\n 1 -> listOf(this[0])\n else -> this.toMutableList()\n }\n}\n\n/**\n * Returns a new [MutableList] filled with all elements of this array.\n */\npublic fun Array.toMutableList(): MutableList {\n return ArrayList(this.asCollection())\n}\n\n/**\n * Returns a new [MutableList] filled with all elements of this array.\n */\npublic fun ByteArray.toMutableList(): MutableList {\n val list = ArrayList(size)\n for (item in this) list.add(item)\n return list\n}\n\n/**\n * Returns a new [MutableList] filled with all elements of this array.\n */\npublic fun ShortArray.toMutableList(): MutableList {\n val list = ArrayList(size)\n for (item in this) list.add(item)\n return list\n}\n\n/**\n * Returns a new [MutableList] filled with all elements of this array.\n */\npublic fun IntArray.toMutableList(): MutableList {\n val list = ArrayList(size)\n for (item in this) list.add(item)\n return list\n}\n\n/**\n * Returns a new [MutableList] filled with all elements of this array.\n */\npublic fun LongArray.toMutableList(): MutableList {\n val list = ArrayList(size)\n for (item in this) list.add(item)\n return list\n}\n\n/**\n * Returns a new [MutableList] filled with all elements of this array.\n */\npublic fun FloatArray.toMutableList(): MutableList {\n val list = ArrayList(size)\n for (item in this) list.add(item)\n return list\n}\n\n/**\n * Returns a new [MutableList] filled with all elements of this array.\n */\npublic fun DoubleArray.toMutableList(): MutableList {\n val list = ArrayList(size)\n for (item in this) list.add(item)\n return list\n}\n\n/**\n * Returns a new [MutableList] filled with all elements of this array.\n */\npublic fun BooleanArray.toMutableList(): MutableList {\n val list = ArrayList(size)\n for (item in this) list.add(item)\n return list\n}\n\n/**\n * Returns a new [MutableList] filled with all elements of this array.\n */\npublic fun CharArray.toMutableList(): MutableList {\n val list = ArrayList(size)\n for (item in this) list.add(item)\n return list\n}\n\n/**\n * Returns a [Set] of all elements.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun Array.toSet(): Set {\n return when (size) {\n 0 -> emptySet()\n 1 -> setOf(this[0])\n else -> toCollection(LinkedHashSet(mapCapacity(size)))\n }\n}\n\n/**\n * Returns a [Set] of all elements.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun ByteArray.toSet(): Set {\n return when (size) {\n 0 -> emptySet()\n 1 -> setOf(this[0])\n else -> toCollection(LinkedHashSet(mapCapacity(size)))\n }\n}\n\n/**\n * Returns a [Set] of all elements.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun ShortArray.toSet(): Set {\n return when (size) {\n 0 -> emptySet()\n 1 -> setOf(this[0])\n else -> toCollection(LinkedHashSet(mapCapacity(size)))\n }\n}\n\n/**\n * Returns a [Set] of all elements.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun IntArray.toSet(): Set {\n return when (size) {\n 0 -> emptySet()\n 1 -> setOf(this[0])\n else -> toCollection(LinkedHashSet(mapCapacity(size)))\n }\n}\n\n/**\n * Returns a [Set] of all elements.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun LongArray.toSet(): Set {\n return when (size) {\n 0 -> emptySet()\n 1 -> setOf(this[0])\n else -> toCollection(LinkedHashSet(mapCapacity(size)))\n }\n}\n\n/**\n * Returns a [Set] of all elements.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun FloatArray.toSet(): Set {\n return when (size) {\n 0 -> emptySet()\n 1 -> setOf(this[0])\n else -> toCollection(LinkedHashSet(mapCapacity(size)))\n }\n}\n\n/**\n * Returns a [Set] of all elements.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun DoubleArray.toSet(): Set {\n return when (size) {\n 0 -> emptySet()\n 1 -> setOf(this[0])\n else -> toCollection(LinkedHashSet(mapCapacity(size)))\n }\n}\n\n/**\n * Returns a [Set] of all elements.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun BooleanArray.toSet(): Set {\n return when (size) {\n 0 -> emptySet()\n 1 -> setOf(this[0])\n else -> toCollection(LinkedHashSet(mapCapacity(size)))\n }\n}\n\n/**\n * Returns a [Set] of all elements.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun CharArray.toSet(): Set {\n return when (size) {\n 0 -> emptySet()\n 1 -> setOf(this[0])\n else -> toCollection(LinkedHashSet(mapCapacity(size.coerceAtMost(128))))\n }\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\npublic inline fun Array.flatMap(transform: (T) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\npublic inline fun ByteArray.flatMap(transform: (Byte) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\npublic inline fun ShortArray.flatMap(transform: (Short) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\npublic inline fun IntArray.flatMap(transform: (Int) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\npublic inline fun LongArray.flatMap(transform: (Long) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\npublic inline fun FloatArray.flatMap(transform: (Float) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\npublic inline fun DoubleArray.flatMap(transform: (Double) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\npublic inline fun BooleanArray.flatMap(transform: (Boolean) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\npublic inline fun CharArray.flatMap(transform: (Char) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapSequence\")\npublic inline fun Array.flatMap(transform: (T) -> Sequence): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterable\")\n@kotlin.internal.InlineOnly\npublic inline fun Array.flatMapIndexed(transform: (index: Int, T) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterable\")\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.flatMapIndexed(transform: (index: Int, Byte) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterable\")\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.flatMapIndexed(transform: (index: Int, Short) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterable\")\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.flatMapIndexed(transform: (index: Int, Int) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterable\")\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.flatMapIndexed(transform: (index: Int, Long) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterable\")\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.flatMapIndexed(transform: (index: Int, Float) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterable\")\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.flatMapIndexed(transform: (index: Int, Double) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterable\")\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.flatMapIndexed(transform: (index: Int, Boolean) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterable\")\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.flatMapIndexed(transform: (index: Int, Char) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedSequence\")\n@kotlin.internal.InlineOnly\npublic inline fun Array.flatMapIndexed(transform: (index: Int, T) -> Sequence): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterableTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > Array.flatMapIndexedTo(destination: C, transform: (index: Int, T) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterableTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > ByteArray.flatMapIndexedTo(destination: C, transform: (index: Int, Byte) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterableTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > ShortArray.flatMapIndexedTo(destination: C, transform: (index: Int, Short) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterableTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > IntArray.flatMapIndexedTo(destination: C, transform: (index: Int, Int) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterableTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > LongArray.flatMapIndexedTo(destination: C, transform: (index: Int, Long) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterableTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > FloatArray.flatMapIndexedTo(destination: C, transform: (index: Int, Float) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterableTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > DoubleArray.flatMapIndexedTo(destination: C, transform: (index: Int, Double) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterableTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > BooleanArray.flatMapIndexedTo(destination: C, transform: (index: Int, Boolean) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterableTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > CharArray.flatMapIndexedTo(destination: C, transform: (index: Int, Char) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedSequenceTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > Array.flatMapIndexedTo(destination: C, transform: (index: Int, T) -> Sequence): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].\n */\npublic inline fun > Array.flatMapTo(destination: C, transform: (T) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].\n */\npublic inline fun > ByteArray.flatMapTo(destination: C, transform: (Byte) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].\n */\npublic inline fun > ShortArray.flatMapTo(destination: C, transform: (Short) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].\n */\npublic inline fun > IntArray.flatMapTo(destination: C, transform: (Int) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].\n */\npublic inline fun > LongArray.flatMapTo(destination: C, transform: (Long) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].\n */\npublic inline fun > FloatArray.flatMapTo(destination: C, transform: (Float) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].\n */\npublic inline fun > DoubleArray.flatMapTo(destination: C, transform: (Double) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].\n */\npublic inline fun > BooleanArray.flatMapTo(destination: C, transform: (Boolean) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].\n */\npublic inline fun > CharArray.flatMapTo(destination: C, transform: (Char) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapSequenceTo\")\npublic inline fun > Array.flatMapTo(destination: C, transform: (T) -> Sequence): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun Array.groupBy(keySelector: (T) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun ByteArray.groupBy(keySelector: (Byte) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun ShortArray.groupBy(keySelector: (Short) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun IntArray.groupBy(keySelector: (Int) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun LongArray.groupBy(keySelector: (Long) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun FloatArray.groupBy(keySelector: (Float) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun DoubleArray.groupBy(keySelector: (Double) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun BooleanArray.groupBy(keySelector: (Boolean) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun CharArray.groupBy(keySelector: (Char) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun Array.groupBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun ByteArray.groupBy(keySelector: (Byte) -> K, valueTransform: (Byte) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun ShortArray.groupBy(keySelector: (Short) -> K, valueTransform: (Short) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun IntArray.groupBy(keySelector: (Int) -> K, valueTransform: (Int) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun LongArray.groupBy(keySelector: (Long) -> K, valueTransform: (Long) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun FloatArray.groupBy(keySelector: (Float) -> K, valueTransform: (Float) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun DoubleArray.groupBy(keySelector: (Double) -> K, valueTransform: (Double) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun BooleanArray.groupBy(keySelector: (Boolean) -> K, valueTransform: (Boolean) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun CharArray.groupBy(keySelector: (Char) -> K, valueTransform: (Char) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun >> Array.groupByTo(destination: M, keySelector: (T) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun >> ByteArray.groupByTo(destination: M, keySelector: (Byte) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun >> ShortArray.groupByTo(destination: M, keySelector: (Short) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun >> IntArray.groupByTo(destination: M, keySelector: (Int) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun >> LongArray.groupByTo(destination: M, keySelector: (Long) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun >> FloatArray.groupByTo(destination: M, keySelector: (Float) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun >> DoubleArray.groupByTo(destination: M, keySelector: (Double) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun >> BooleanArray.groupByTo(destination: M, keySelector: (Boolean) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun >> CharArray.groupByTo(destination: M, keySelector: (Char) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun >> Array.groupByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun >> ByteArray.groupByTo(destination: M, keySelector: (Byte) -> K, valueTransform: (Byte) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun >> ShortArray.groupByTo(destination: M, keySelector: (Short) -> K, valueTransform: (Short) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun >> IntArray.groupByTo(destination: M, keySelector: (Int) -> K, valueTransform: (Int) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun >> LongArray.groupByTo(destination: M, keySelector: (Long) -> K, valueTransform: (Long) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun >> FloatArray.groupByTo(destination: M, keySelector: (Float) -> K, valueTransform: (Float) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun >> DoubleArray.groupByTo(destination: M, keySelector: (Double) -> K, valueTransform: (Double) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun >> BooleanArray.groupByTo(destination: M, keySelector: (Boolean) -> K, valueTransform: (Boolean) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun >> CharArray.groupByTo(destination: M, keySelector: (Char) -> K, valueTransform: (Char) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Creates a [Grouping] source from an array to be used later with one of group-and-fold operations\n * using the specified [keySelector] function to extract a key from each element.\n * \n * @sample samples.collections.Grouping.groupingByEachCount\n */\n@SinceKotlin(\"1.1\")\npublic inline fun Array.groupingBy(crossinline keySelector: (T) -> K): Grouping {\n return object : Grouping {\n override fun sourceIterator(): Iterator = this@groupingBy.iterator()\n override fun keyOf(element: T): K = keySelector(element)\n }\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element in the original array.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\npublic inline fun Array.map(transform: (T) -> R): List {\n return mapTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element in the original array.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\npublic inline fun ByteArray.map(transform: (Byte) -> R): List {\n return mapTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element in the original array.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\npublic inline fun ShortArray.map(transform: (Short) -> R): List {\n return mapTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element in the original array.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\npublic inline fun IntArray.map(transform: (Int) -> R): List {\n return mapTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element in the original array.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\npublic inline fun LongArray.map(transform: (Long) -> R): List {\n return mapTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element in the original array.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\npublic inline fun FloatArray.map(transform: (Float) -> R): List {\n return mapTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element in the original array.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\npublic inline fun DoubleArray.map(transform: (Double) -> R): List {\n return mapTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element in the original array.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\npublic inline fun BooleanArray.map(transform: (Boolean) -> R): List {\n return mapTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element in the original array.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\npublic inline fun CharArray.map(transform: (Char) -> R): List {\n return mapTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element and its index in the original array.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun Array.mapIndexed(transform: (index: Int, T) -> R): List {\n return mapIndexedTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element and its index in the original array.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun ByteArray.mapIndexed(transform: (index: Int, Byte) -> R): List {\n return mapIndexedTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element and its index in the original array.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun ShortArray.mapIndexed(transform: (index: Int, Short) -> R): List {\n return mapIndexedTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element and its index in the original array.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun IntArray.mapIndexed(transform: (index: Int, Int) -> R): List {\n return mapIndexedTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element and its index in the original array.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun LongArray.mapIndexed(transform: (index: Int, Long) -> R): List {\n return mapIndexedTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element and its index in the original array.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun FloatArray.mapIndexed(transform: (index: Int, Float) -> R): List {\n return mapIndexedTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element and its index in the original array.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun DoubleArray.mapIndexed(transform: (index: Int, Double) -> R): List {\n return mapIndexedTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element and its index in the original array.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun BooleanArray.mapIndexed(transform: (index: Int, Boolean) -> R): List {\n return mapIndexedTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element and its index in the original array.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun CharArray.mapIndexed(transform: (index: Int, Char) -> R): List {\n return mapIndexedTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing only the non-null results of applying the given [transform] function\n * to each element and its index in the original array.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun Array.mapIndexedNotNull(transform: (index: Int, T) -> R?): List {\n return mapIndexedNotNullTo(ArrayList(), transform)\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original array\n * and appends only the non-null results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun > Array.mapIndexedNotNullTo(destination: C, transform: (index: Int, T) -> R?): C {\n forEachIndexed { index, element -> transform(index, element)?.let { destination.add(it) } }\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original array\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun > Array.mapIndexedTo(destination: C, transform: (index: Int, T) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(index++, item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original array\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun > ByteArray.mapIndexedTo(destination: C, transform: (index: Int, Byte) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(index++, item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original array\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun > ShortArray.mapIndexedTo(destination: C, transform: (index: Int, Short) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(index++, item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original array\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun > IntArray.mapIndexedTo(destination: C, transform: (index: Int, Int) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(index++, item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original array\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun > LongArray.mapIndexedTo(destination: C, transform: (index: Int, Long) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(index++, item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original array\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun > FloatArray.mapIndexedTo(destination: C, transform: (index: Int, Float) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(index++, item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original array\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun > DoubleArray.mapIndexedTo(destination: C, transform: (index: Int, Double) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(index++, item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original array\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun > BooleanArray.mapIndexedTo(destination: C, transform: (index: Int, Boolean) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(index++, item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original array\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun > CharArray.mapIndexedTo(destination: C, transform: (index: Int, Char) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(index++, item))\n return destination\n}\n\n/**\n * Returns a list containing only the non-null results of applying the given [transform] function\n * to each element in the original array.\n * \n * @sample samples.collections.Collections.Transformations.mapNotNull\n */\npublic inline fun Array.mapNotNull(transform: (T) -> R?): List {\n return mapNotNullTo(ArrayList(), transform)\n}\n\n/**\n * Applies the given [transform] function to each element in the original array\n * and appends only the non-null results to the given [destination].\n */\npublic inline fun > Array.mapNotNullTo(destination: C, transform: (T) -> R?): C {\n forEach { element -> transform(element)?.let { destination.add(it) } }\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original array\n * and appends the results to the given [destination].\n */\npublic inline fun > Array.mapTo(destination: C, transform: (T) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original array\n * and appends the results to the given [destination].\n */\npublic inline fun > ByteArray.mapTo(destination: C, transform: (Byte) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original array\n * and appends the results to the given [destination].\n */\npublic inline fun > ShortArray.mapTo(destination: C, transform: (Short) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original array\n * and appends the results to the given [destination].\n */\npublic inline fun > IntArray.mapTo(destination: C, transform: (Int) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original array\n * and appends the results to the given [destination].\n */\npublic inline fun > LongArray.mapTo(destination: C, transform: (Long) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original array\n * and appends the results to the given [destination].\n */\npublic inline fun > FloatArray.mapTo(destination: C, transform: (Float) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original array\n * and appends the results to the given [destination].\n */\npublic inline fun > DoubleArray.mapTo(destination: C, transform: (Double) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original array\n * and appends the results to the given [destination].\n */\npublic inline fun > BooleanArray.mapTo(destination: C, transform: (Boolean) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original array\n * and appends the results to the given [destination].\n */\npublic inline fun > CharArray.mapTo(destination: C, transform: (Char) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each element of the original array\n * into an [IndexedValue] containing the index of that element and the element itself.\n */\npublic fun Array.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each element of the original array\n * into an [IndexedValue] containing the index of that element and the element itself.\n */\npublic fun ByteArray.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each element of the original array\n * into an [IndexedValue] containing the index of that element and the element itself.\n */\npublic fun ShortArray.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each element of the original array\n * into an [IndexedValue] containing the index of that element and the element itself.\n */\npublic fun IntArray.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each element of the original array\n * into an [IndexedValue] containing the index of that element and the element itself.\n */\npublic fun LongArray.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each element of the original array\n * into an [IndexedValue] containing the index of that element and the element itself.\n */\npublic fun FloatArray.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each element of the original array\n * into an [IndexedValue] containing the index of that element and the element itself.\n */\npublic fun DoubleArray.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each element of the original array\n * into an [IndexedValue] containing the index of that element and the element itself.\n */\npublic fun BooleanArray.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each element of the original array\n * into an [IndexedValue] containing the index of that element and the element itself.\n */\npublic fun CharArray.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns a list containing only distinct elements from the given array.\n * \n * Among equal elements of the given array, only the first one will be present in the resulting list.\n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic fun Array.distinct(): List {\n return this.toMutableSet().toList()\n}\n\n/**\n * Returns a list containing only distinct elements from the given array.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic fun ByteArray.distinct(): List {\n return this.toMutableSet().toList()\n}\n\n/**\n * Returns a list containing only distinct elements from the given array.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic fun ShortArray.distinct(): List {\n return this.toMutableSet().toList()\n}\n\n/**\n * Returns a list containing only distinct elements from the given array.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic fun IntArray.distinct(): List {\n return this.toMutableSet().toList()\n}\n\n/**\n * Returns a list containing only distinct elements from the given array.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic fun LongArray.distinct(): List {\n return this.toMutableSet().toList()\n}\n\n/**\n * Returns a list containing only distinct elements from the given array.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic fun FloatArray.distinct(): List {\n return this.toMutableSet().toList()\n}\n\n/**\n * Returns a list containing only distinct elements from the given array.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic fun DoubleArray.distinct(): List {\n return this.toMutableSet().toList()\n}\n\n/**\n * Returns a list containing only distinct elements from the given array.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic fun BooleanArray.distinct(): List {\n return this.toMutableSet().toList()\n}\n\n/**\n * Returns a list containing only distinct elements from the given array.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic fun CharArray.distinct(): List {\n return this.toMutableSet().toList()\n}\n\n/**\n * Returns a list containing only elements from the given array\n * having distinct keys returned by the given [selector] function.\n * \n * Among elements of the given array with equal keys, only the first one will be present in the resulting list.\n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic inline fun Array.distinctBy(selector: (T) -> K): List {\n val set = HashSet()\n val list = ArrayList()\n for (e in this) {\n val key = selector(e)\n if (set.add(key))\n list.add(e)\n }\n return list\n}\n\n/**\n * Returns a list containing only elements from the given array\n * having distinct keys returned by the given [selector] function.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic inline fun ByteArray.distinctBy(selector: (Byte) -> K): List {\n val set = HashSet()\n val list = ArrayList()\n for (e in this) {\n val key = selector(e)\n if (set.add(key))\n list.add(e)\n }\n return list\n}\n\n/**\n * Returns a list containing only elements from the given array\n * having distinct keys returned by the given [selector] function.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic inline fun ShortArray.distinctBy(selector: (Short) -> K): List {\n val set = HashSet()\n val list = ArrayList()\n for (e in this) {\n val key = selector(e)\n if (set.add(key))\n list.add(e)\n }\n return list\n}\n\n/**\n * Returns a list containing only elements from the given array\n * having distinct keys returned by the given [selector] function.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic inline fun IntArray.distinctBy(selector: (Int) -> K): List {\n val set = HashSet()\n val list = ArrayList()\n for (e in this) {\n val key = selector(e)\n if (set.add(key))\n list.add(e)\n }\n return list\n}\n\n/**\n * Returns a list containing only elements from the given array\n * having distinct keys returned by the given [selector] function.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic inline fun LongArray.distinctBy(selector: (Long) -> K): List {\n val set = HashSet()\n val list = ArrayList()\n for (e in this) {\n val key = selector(e)\n if (set.add(key))\n list.add(e)\n }\n return list\n}\n\n/**\n * Returns a list containing only elements from the given array\n * having distinct keys returned by the given [selector] function.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic inline fun FloatArray.distinctBy(selector: (Float) -> K): List {\n val set = HashSet()\n val list = ArrayList()\n for (e in this) {\n val key = selector(e)\n if (set.add(key))\n list.add(e)\n }\n return list\n}\n\n/**\n * Returns a list containing only elements from the given array\n * having distinct keys returned by the given [selector] function.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic inline fun DoubleArray.distinctBy(selector: (Double) -> K): List {\n val set = HashSet()\n val list = ArrayList()\n for (e in this) {\n val key = selector(e)\n if (set.add(key))\n list.add(e)\n }\n return list\n}\n\n/**\n * Returns a list containing only elements from the given array\n * having distinct keys returned by the given [selector] function.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic inline fun BooleanArray.distinctBy(selector: (Boolean) -> K): List {\n val set = HashSet()\n val list = ArrayList()\n for (e in this) {\n val key = selector(e)\n if (set.add(key))\n list.add(e)\n }\n return list\n}\n\n/**\n * Returns a list containing only elements from the given array\n * having distinct keys returned by the given [selector] function.\n * \n * The elements in the resulting list are in the same order as they were in the source array.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic inline fun CharArray.distinctBy(selector: (Char) -> K): List {\n val set = HashSet()\n val list = ArrayList()\n for (e in this) {\n val key = selector(e)\n if (set.add(key))\n list.add(e)\n }\n return list\n}\n\n/**\n * Returns a set containing all elements that are contained by both this array and the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n * \n * To get a set containing all elements that are contained at least in one of these collections use [union].\n */\npublic infix fun Array.intersect(other: Iterable): Set {\n val set = this.toMutableSet()\n set.retainAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by both this array and the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n * \n * To get a set containing all elements that are contained at least in one of these collections use [union].\n */\npublic infix fun ByteArray.intersect(other: Iterable): Set {\n val set = this.toMutableSet()\n set.retainAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by both this array and the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n * \n * To get a set containing all elements that are contained at least in one of these collections use [union].\n */\npublic infix fun ShortArray.intersect(other: Iterable): Set {\n val set = this.toMutableSet()\n set.retainAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by both this array and the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n * \n * To get a set containing all elements that are contained at least in one of these collections use [union].\n */\npublic infix fun IntArray.intersect(other: Iterable): Set {\n val set = this.toMutableSet()\n set.retainAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by both this array and the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n * \n * To get a set containing all elements that are contained at least in one of these collections use [union].\n */\npublic infix fun LongArray.intersect(other: Iterable): Set {\n val set = this.toMutableSet()\n set.retainAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by both this array and the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n * \n * To get a set containing all elements that are contained at least in one of these collections use [union].\n */\npublic infix fun FloatArray.intersect(other: Iterable): Set {\n val set = this.toMutableSet()\n set.retainAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by both this array and the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n * \n * To get a set containing all elements that are contained at least in one of these collections use [union].\n */\npublic infix fun DoubleArray.intersect(other: Iterable): Set {\n val set = this.toMutableSet()\n set.retainAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by both this array and the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n * \n * To get a set containing all elements that are contained at least in one of these collections use [union].\n */\npublic infix fun BooleanArray.intersect(other: Iterable): Set {\n val set = this.toMutableSet()\n set.retainAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by both this array and the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n * \n * To get a set containing all elements that are contained at least in one of these collections use [union].\n */\npublic infix fun CharArray.intersect(other: Iterable): Set {\n val set = this.toMutableSet()\n set.retainAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by this array and not contained by the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic infix fun Array.subtract(other: Iterable): Set {\n val set = this.toMutableSet()\n set.removeAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by this array and not contained by the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic infix fun ByteArray.subtract(other: Iterable): Set {\n val set = this.toMutableSet()\n set.removeAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by this array and not contained by the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic infix fun ShortArray.subtract(other: Iterable): Set {\n val set = this.toMutableSet()\n set.removeAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by this array and not contained by the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic infix fun IntArray.subtract(other: Iterable): Set {\n val set = this.toMutableSet()\n set.removeAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by this array and not contained by the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic infix fun LongArray.subtract(other: Iterable): Set {\n val set = this.toMutableSet()\n set.removeAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by this array and not contained by the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic infix fun FloatArray.subtract(other: Iterable): Set {\n val set = this.toMutableSet()\n set.removeAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by this array and not contained by the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic infix fun DoubleArray.subtract(other: Iterable): Set {\n val set = this.toMutableSet()\n set.removeAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by this array and not contained by the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic infix fun BooleanArray.subtract(other: Iterable): Set {\n val set = this.toMutableSet()\n set.removeAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by this array and not contained by the specified collection.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic infix fun CharArray.subtract(other: Iterable): Set {\n val set = this.toMutableSet()\n set.removeAll(other)\n return set\n}\n\n/**\n * Returns a new [MutableSet] containing all distinct elements from the given array.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun Array.toMutableSet(): MutableSet {\n return toCollection(LinkedHashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [MutableSet] containing all distinct elements from the given array.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun ByteArray.toMutableSet(): MutableSet {\n return toCollection(LinkedHashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [MutableSet] containing all distinct elements from the given array.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun ShortArray.toMutableSet(): MutableSet {\n return toCollection(LinkedHashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [MutableSet] containing all distinct elements from the given array.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun IntArray.toMutableSet(): MutableSet {\n return toCollection(LinkedHashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [MutableSet] containing all distinct elements from the given array.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun LongArray.toMutableSet(): MutableSet {\n return toCollection(LinkedHashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [MutableSet] containing all distinct elements from the given array.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun FloatArray.toMutableSet(): MutableSet {\n return toCollection(LinkedHashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [MutableSet] containing all distinct elements from the given array.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun DoubleArray.toMutableSet(): MutableSet {\n return toCollection(LinkedHashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [MutableSet] containing all distinct elements from the given array.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun BooleanArray.toMutableSet(): MutableSet {\n return toCollection(LinkedHashSet(mapCapacity(size)))\n}\n\n/**\n * Returns a new [MutableSet] containing all distinct elements from the given array.\n * \n * The returned set preserves the element iteration order of the original array.\n */\npublic fun CharArray.toMutableSet(): MutableSet {\n return toCollection(LinkedHashSet(mapCapacity(size.coerceAtMost(128))))\n}\n\n/**\n * Returns a set containing all distinct elements from both collections.\n * \n * The returned set preserves the element iteration order of the original array.\n * Those elements of the [other] collection that are unique are iterated in the end\n * in the order of the [other] collection.\n * \n * To get a set containing all elements that are contained in both collections use [intersect].\n */\npublic infix fun Array.union(other: Iterable): Set {\n val set = this.toMutableSet()\n set.addAll(other)\n return set\n}\n\n/**\n * Returns a set containing all distinct elements from both collections.\n * \n * The returned set preserves the element iteration order of the original array.\n * Those elements of the [other] collection that are unique are iterated in the end\n * in the order of the [other] collection.\n * \n * To get a set containing all elements that are contained in both collections use [intersect].\n */\npublic infix fun ByteArray.union(other: Iterable): Set {\n val set = this.toMutableSet()\n set.addAll(other)\n return set\n}\n\n/**\n * Returns a set containing all distinct elements from both collections.\n * \n * The returned set preserves the element iteration order of the original array.\n * Those elements of the [other] collection that are unique are iterated in the end\n * in the order of the [other] collection.\n * \n * To get a set containing all elements that are contained in both collections use [intersect].\n */\npublic infix fun ShortArray.union(other: Iterable): Set {\n val set = this.toMutableSet()\n set.addAll(other)\n return set\n}\n\n/**\n * Returns a set containing all distinct elements from both collections.\n * \n * The returned set preserves the element iteration order of the original array.\n * Those elements of the [other] collection that are unique are iterated in the end\n * in the order of the [other] collection.\n * \n * To get a set containing all elements that are contained in both collections use [intersect].\n */\npublic infix fun IntArray.union(other: Iterable): Set {\n val set = this.toMutableSet()\n set.addAll(other)\n return set\n}\n\n/**\n * Returns a set containing all distinct elements from both collections.\n * \n * The returned set preserves the element iteration order of the original array.\n * Those elements of the [other] collection that are unique are iterated in the end\n * in the order of the [other] collection.\n * \n * To get a set containing all elements that are contained in both collections use [intersect].\n */\npublic infix fun LongArray.union(other: Iterable): Set {\n val set = this.toMutableSet()\n set.addAll(other)\n return set\n}\n\n/**\n * Returns a set containing all distinct elements from both collections.\n * \n * The returned set preserves the element iteration order of the original array.\n * Those elements of the [other] collection that are unique are iterated in the end\n * in the order of the [other] collection.\n * \n * To get a set containing all elements that are contained in both collections use [intersect].\n */\npublic infix fun FloatArray.union(other: Iterable): Set {\n val set = this.toMutableSet()\n set.addAll(other)\n return set\n}\n\n/**\n * Returns a set containing all distinct elements from both collections.\n * \n * The returned set preserves the element iteration order of the original array.\n * Those elements of the [other] collection that are unique are iterated in the end\n * in the order of the [other] collection.\n * \n * To get a set containing all elements that are contained in both collections use [intersect].\n */\npublic infix fun DoubleArray.union(other: Iterable): Set {\n val set = this.toMutableSet()\n set.addAll(other)\n return set\n}\n\n/**\n * Returns a set containing all distinct elements from both collections.\n * \n * The returned set preserves the element iteration order of the original array.\n * Those elements of the [other] collection that are unique are iterated in the end\n * in the order of the [other] collection.\n * \n * To get a set containing all elements that are contained in both collections use [intersect].\n */\npublic infix fun BooleanArray.union(other: Iterable): Set {\n val set = this.toMutableSet()\n set.addAll(other)\n return set\n}\n\n/**\n * Returns a set containing all distinct elements from both collections.\n * \n * The returned set preserves the element iteration order of the original array.\n * Those elements of the [other] collection that are unique are iterated in the end\n * in the order of the [other] collection.\n * \n * To get a set containing all elements that are contained in both collections use [intersect].\n */\npublic infix fun CharArray.union(other: Iterable): Set {\n val set = this.toMutableSet()\n set.addAll(other)\n return set\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\npublic inline fun Array.all(predicate: (T) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\npublic inline fun ByteArray.all(predicate: (Byte) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\npublic inline fun ShortArray.all(predicate: (Short) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\npublic inline fun IntArray.all(predicate: (Int) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\npublic inline fun LongArray.all(predicate: (Long) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\npublic inline fun FloatArray.all(predicate: (Float) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\npublic inline fun DoubleArray.all(predicate: (Double) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\npublic inline fun BooleanArray.all(predicate: (Boolean) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\npublic inline fun CharArray.all(predicate: (Char) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if array has at least one element.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\npublic fun Array.any(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if array has at least one element.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\npublic fun ByteArray.any(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if array has at least one element.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\npublic fun ShortArray.any(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if array has at least one element.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\npublic fun IntArray.any(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if array has at least one element.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\npublic fun LongArray.any(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if array has at least one element.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\npublic fun FloatArray.any(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if array has at least one element.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\npublic fun DoubleArray.any(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if array has at least one element.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\npublic fun BooleanArray.any(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if array has at least one element.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\npublic fun CharArray.any(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\npublic inline fun Array.any(predicate: (T) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\npublic inline fun ByteArray.any(predicate: (Byte) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\npublic inline fun ShortArray.any(predicate: (Short) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\npublic inline fun IntArray.any(predicate: (Int) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\npublic inline fun LongArray.any(predicate: (Long) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\npublic inline fun FloatArray.any(predicate: (Float) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\npublic inline fun DoubleArray.any(predicate: (Double) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\npublic inline fun BooleanArray.any(predicate: (Boolean) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\npublic inline fun CharArray.any(predicate: (Char) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns the number of elements in this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun Array.count(): Int {\n return size\n}\n\n/**\n * Returns the number of elements in this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.count(): Int {\n return size\n}\n\n/**\n * Returns the number of elements in this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.count(): Int {\n return size\n}\n\n/**\n * Returns the number of elements in this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.count(): Int {\n return size\n}\n\n/**\n * Returns the number of elements in this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.count(): Int {\n return size\n}\n\n/**\n * Returns the number of elements in this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.count(): Int {\n return size\n}\n\n/**\n * Returns the number of elements in this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.count(): Int {\n return size\n}\n\n/**\n * Returns the number of elements in this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.count(): Int {\n return size\n}\n\n/**\n * Returns the number of elements in this array.\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.count(): Int {\n return size\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n */\npublic inline fun Array.count(predicate: (T) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n */\npublic inline fun ByteArray.count(predicate: (Byte) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n */\npublic inline fun ShortArray.count(predicate: (Short) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n */\npublic inline fun IntArray.count(predicate: (Int) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n */\npublic inline fun LongArray.count(predicate: (Long) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n */\npublic inline fun FloatArray.count(predicate: (Float) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n */\npublic inline fun DoubleArray.count(predicate: (Double) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n */\npublic inline fun BooleanArray.count(predicate: (Boolean) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n */\npublic inline fun CharArray.count(predicate: (Char) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n */\npublic inline fun Array.fold(initial: R, operation: (acc: R, T) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n */\npublic inline fun ByteArray.fold(initial: R, operation: (acc: R, Byte) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n */\npublic inline fun ShortArray.fold(initial: R, operation: (acc: R, Short) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n */\npublic inline fun IntArray.fold(initial: R, operation: (acc: R, Int) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n */\npublic inline fun LongArray.fold(initial: R, operation: (acc: R, Long) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n */\npublic inline fun FloatArray.fold(initial: R, operation: (acc: R, Float) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n */\npublic inline fun DoubleArray.fold(initial: R, operation: (acc: R, Double) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n */\npublic inline fun BooleanArray.fold(initial: R, operation: (acc: R, Boolean) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n */\npublic inline fun CharArray.fold(initial: R, operation: (acc: R, Char) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n */\npublic inline fun Array.foldIndexed(initial: R, operation: (index: Int, acc: R, T) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(index++, accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n */\npublic inline fun ByteArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Byte) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(index++, accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n */\npublic inline fun ShortArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Short) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(index++, accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n */\npublic inline fun IntArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Int) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(index++, accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n */\npublic inline fun LongArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Long) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(index++, accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n */\npublic inline fun FloatArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Float) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(index++, accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n */\npublic inline fun DoubleArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Double) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(index++, accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n */\npublic inline fun BooleanArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Boolean) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(index++, accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n */\npublic inline fun CharArray.foldIndexed(initial: R, operation: (index: Int, acc: R, Char) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(index++, accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun Array.foldRight(initial: R, operation: (T, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun ByteArray.foldRight(initial: R, operation: (Byte, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun ShortArray.foldRight(initial: R, operation: (Short, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun IntArray.foldRight(initial: R, operation: (Int, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun LongArray.foldRight(initial: R, operation: (Long, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun FloatArray.foldRight(initial: R, operation: (Float, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun DoubleArray.foldRight(initial: R, operation: (Double, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun BooleanArray.foldRight(initial: R, operation: (Boolean, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun CharArray.foldRight(initial: R, operation: (Char, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself\n * and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun Array.foldRightIndexed(initial: R, operation: (index: Int, T, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself\n * and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun ByteArray.foldRightIndexed(initial: R, operation: (index: Int, Byte, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself\n * and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun ShortArray.foldRightIndexed(initial: R, operation: (index: Int, Short, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself\n * and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun IntArray.foldRightIndexed(initial: R, operation: (index: Int, Int, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself\n * and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun LongArray.foldRightIndexed(initial: R, operation: (index: Int, Long, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself\n * and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun FloatArray.foldRightIndexed(initial: R, operation: (index: Int, Float, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself\n * and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun DoubleArray.foldRightIndexed(initial: R, operation: (index: Int, Double, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself\n * and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun BooleanArray.foldRightIndexed(initial: R, operation: (index: Int, Boolean, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself\n * and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun CharArray.foldRightIndexed(initial: R, operation: (index: Int, Char, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Performs the given [action] on each element.\n */\npublic inline fun Array.forEach(action: (T) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element.\n */\npublic inline fun ByteArray.forEach(action: (Byte) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element.\n */\npublic inline fun ShortArray.forEach(action: (Short) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element.\n */\npublic inline fun IntArray.forEach(action: (Int) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element.\n */\npublic inline fun LongArray.forEach(action: (Long) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element.\n */\npublic inline fun FloatArray.forEach(action: (Float) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element.\n */\npublic inline fun DoubleArray.forEach(action: (Double) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element.\n */\npublic inline fun BooleanArray.forEach(action: (Boolean) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element.\n */\npublic inline fun CharArray.forEach(action: (Char) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\npublic inline fun Array.forEachIndexed(action: (index: Int, T) -> Unit): Unit {\n var index = 0\n for (item in this) action(index++, item)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\npublic inline fun ByteArray.forEachIndexed(action: (index: Int, Byte) -> Unit): Unit {\n var index = 0\n for (item in this) action(index++, item)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\npublic inline fun ShortArray.forEachIndexed(action: (index: Int, Short) -> Unit): Unit {\n var index = 0\n for (item in this) action(index++, item)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\npublic inline fun IntArray.forEachIndexed(action: (index: Int, Int) -> Unit): Unit {\n var index = 0\n for (item in this) action(index++, item)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\npublic inline fun LongArray.forEachIndexed(action: (index: Int, Long) -> Unit): Unit {\n var index = 0\n for (item in this) action(index++, item)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\npublic inline fun FloatArray.forEachIndexed(action: (index: Int, Float) -> Unit): Unit {\n var index = 0\n for (item in this) action(index++, item)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\npublic inline fun DoubleArray.forEachIndexed(action: (index: Int, Double) -> Unit): Unit {\n var index = 0\n for (item in this) action(index++, item)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\npublic inline fun BooleanArray.forEachIndexed(action: (index: Int, Boolean) -> Unit): Unit {\n var index = 0\n for (item in this) action(index++, item)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\npublic inline fun CharArray.forEachIndexed(action: (index: Int, Char) -> Unit): Unit {\n var index = 0\n for (item in this) action(index++, item)\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.1\")\npublic fun Array.max(): Double? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.1\")\npublic fun Array.max(): Float? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun > Array.max(): T? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun ByteArray.max(): Byte? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun ShortArray.max(): Short? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun IntArray.max(): Int? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun LongArray.max(): Long? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun FloatArray.max(): Float? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun DoubleArray.max(): Double? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun CharArray.max(): Char? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > Array.maxBy(selector: (T) -> R): T? {\n return maxByOrNull(selector)\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > ByteArray.maxBy(selector: (Byte) -> R): Byte? {\n return maxByOrNull(selector)\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > ShortArray.maxBy(selector: (Short) -> R): Short? {\n return maxByOrNull(selector)\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > IntArray.maxBy(selector: (Int) -> R): Int? {\n return maxByOrNull(selector)\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > LongArray.maxBy(selector: (Long) -> R): Long? {\n return maxByOrNull(selector)\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > FloatArray.maxBy(selector: (Float) -> R): Float? {\n return maxByOrNull(selector)\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > DoubleArray.maxBy(selector: (Double) -> R): Double? {\n return maxByOrNull(selector)\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > BooleanArray.maxBy(selector: (Boolean) -> R): Boolean? {\n return maxByOrNull(selector)\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > CharArray.maxBy(selector: (Char) -> R): Char? {\n return maxByOrNull(selector)\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > Array.maxByOrNull(selector: (T) -> R): T? {\n if (isEmpty()) return null\n var maxElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return maxElem\n var maxValue = selector(maxElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n }\n return maxElem\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > ByteArray.maxByOrNull(selector: (Byte) -> R): Byte? {\n if (isEmpty()) return null\n var maxElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return maxElem\n var maxValue = selector(maxElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n }\n return maxElem\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > ShortArray.maxByOrNull(selector: (Short) -> R): Short? {\n if (isEmpty()) return null\n var maxElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return maxElem\n var maxValue = selector(maxElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n }\n return maxElem\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > IntArray.maxByOrNull(selector: (Int) -> R): Int? {\n if (isEmpty()) return null\n var maxElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return maxElem\n var maxValue = selector(maxElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n }\n return maxElem\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > LongArray.maxByOrNull(selector: (Long) -> R): Long? {\n if (isEmpty()) return null\n var maxElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return maxElem\n var maxValue = selector(maxElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n }\n return maxElem\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > FloatArray.maxByOrNull(selector: (Float) -> R): Float? {\n if (isEmpty()) return null\n var maxElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return maxElem\n var maxValue = selector(maxElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n }\n return maxElem\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > DoubleArray.maxByOrNull(selector: (Double) -> R): Double? {\n if (isEmpty()) return null\n var maxElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return maxElem\n var maxValue = selector(maxElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n }\n return maxElem\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > BooleanArray.maxByOrNull(selector: (Boolean) -> R): Boolean? {\n if (isEmpty()) return null\n var maxElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return maxElem\n var maxValue = selector(maxElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n }\n return maxElem\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > CharArray.maxByOrNull(selector: (Char) -> R): Char? {\n if (isEmpty()) return null\n var maxElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return maxElem\n var maxValue = selector(maxElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n }\n return maxElem\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Array.maxOf(selector: (T) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.maxOf(selector: (Byte) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.maxOf(selector: (Short) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.maxOf(selector: (Int) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.maxOf(selector: (Long) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.maxOf(selector: (Float) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.maxOf(selector: (Double) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.maxOf(selector: (Boolean) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.maxOf(selector: (Char) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Array.maxOf(selector: (T) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.maxOf(selector: (Byte) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.maxOf(selector: (Short) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.maxOf(selector: (Int) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.maxOf(selector: (Long) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.maxOf(selector: (Float) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.maxOf(selector: (Double) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.maxOf(selector: (Boolean) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.maxOf(selector: (Char) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Array.maxOf(selector: (T) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > ByteArray.maxOf(selector: (Byte) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > ShortArray.maxOf(selector: (Short) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > IntArray.maxOf(selector: (Int) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > LongArray.maxOf(selector: (Long) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > FloatArray.maxOf(selector: (Float) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > DoubleArray.maxOf(selector: (Double) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > BooleanArray.maxOf(selector: (Boolean) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > CharArray.maxOf(selector: (Char) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Array.maxOfOrNull(selector: (T) -> Double): Double? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.maxOfOrNull(selector: (Byte) -> Double): Double? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.maxOfOrNull(selector: (Short) -> Double): Double? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.maxOfOrNull(selector: (Int) -> Double): Double? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.maxOfOrNull(selector: (Long) -> Double): Double? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.maxOfOrNull(selector: (Float) -> Double): Double? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.maxOfOrNull(selector: (Double) -> Double): Double? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.maxOfOrNull(selector: (Boolean) -> Double): Double? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.maxOfOrNull(selector: (Char) -> Double): Double? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Array.maxOfOrNull(selector: (T) -> Float): Float? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.maxOfOrNull(selector: (Byte) -> Float): Float? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.maxOfOrNull(selector: (Short) -> Float): Float? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.maxOfOrNull(selector: (Int) -> Float): Float? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.maxOfOrNull(selector: (Long) -> Float): Float? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.maxOfOrNull(selector: (Float) -> Float): Float? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.maxOfOrNull(selector: (Double) -> Float): Float? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.maxOfOrNull(selector: (Boolean) -> Float): Float? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.maxOfOrNull(selector: (Char) -> Float): Float? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Array.maxOfOrNull(selector: (T) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > ByteArray.maxOfOrNull(selector: (Byte) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > ShortArray.maxOfOrNull(selector: (Short) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > IntArray.maxOfOrNull(selector: (Int) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > LongArray.maxOfOrNull(selector: (Long) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > FloatArray.maxOfOrNull(selector: (Float) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > DoubleArray.maxOfOrNull(selector: (Double) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > BooleanArray.maxOfOrNull(selector: (Boolean) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > CharArray.maxOfOrNull(selector: (Char) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Array.maxOfWith(comparator: Comparator, selector: (T) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.maxOfWith(comparator: Comparator, selector: (Byte) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.maxOfWith(comparator: Comparator, selector: (Short) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.maxOfWith(comparator: Comparator, selector: (Int) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.maxOfWith(comparator: Comparator, selector: (Long) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.maxOfWith(comparator: Comparator, selector: (Float) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.maxOfWith(comparator: Comparator, selector: (Double) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.maxOfWith(comparator: Comparator, selector: (Boolean) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.maxOfWith(comparator: Comparator, selector: (Char) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Array.maxOfWithOrNull(comparator: Comparator, selector: (T) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.maxOfWithOrNull(comparator: Comparator, selector: (Byte) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.maxOfWithOrNull(comparator: Comparator, selector: (Short) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.maxOfWithOrNull(comparator: Comparator, selector: (Int) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.maxOfWithOrNull(comparator: Comparator, selector: (Long) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.maxOfWithOrNull(comparator: Comparator, selector: (Float) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.maxOfWithOrNull(comparator: Comparator, selector: (Double) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.maxOfWithOrNull(comparator: Comparator, selector: (Boolean) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.maxOfWithOrNull(comparator: Comparator, selector: (Char) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic fun Array.maxOrNull(): Double? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n max = maxOf(max, e)\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic fun Array.maxOrNull(): Float? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n max = maxOf(max, e)\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun > Array.maxOrNull(): T? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (max < e) max = e\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun ByteArray.maxOrNull(): Byte? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (max < e) max = e\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun ShortArray.maxOrNull(): Short? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (max < e) max = e\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun IntArray.maxOrNull(): Int? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (max < e) max = e\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun LongArray.maxOrNull(): Long? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (max < e) max = e\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic fun FloatArray.maxOrNull(): Float? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n max = maxOf(max, e)\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic fun DoubleArray.maxOrNull(): Double? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n max = maxOf(max, e)\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun CharArray.maxOrNull(): Char? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (max < e) max = e\n }\n return max\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun Array.maxWith(comparator: Comparator): T? {\n return maxWithOrNull(comparator)\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun ByteArray.maxWith(comparator: Comparator): Byte? {\n return maxWithOrNull(comparator)\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun ShortArray.maxWith(comparator: Comparator): Short? {\n return maxWithOrNull(comparator)\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun IntArray.maxWith(comparator: Comparator): Int? {\n return maxWithOrNull(comparator)\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun LongArray.maxWith(comparator: Comparator): Long? {\n return maxWithOrNull(comparator)\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun FloatArray.maxWith(comparator: Comparator): Float? {\n return maxWithOrNull(comparator)\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun DoubleArray.maxWith(comparator: Comparator): Double? {\n return maxWithOrNull(comparator)\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun BooleanArray.maxWith(comparator: Comparator): Boolean? {\n return maxWithOrNull(comparator)\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun CharArray.maxWith(comparator: Comparator): Char? {\n return maxWithOrNull(comparator)\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun Array.maxWithOrNull(comparator: Comparator): T? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun ByteArray.maxWithOrNull(comparator: Comparator): Byte? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun ShortArray.maxWithOrNull(comparator: Comparator): Short? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun IntArray.maxWithOrNull(comparator: Comparator): Int? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun LongArray.maxWithOrNull(comparator: Comparator): Long? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun FloatArray.maxWithOrNull(comparator: Comparator): Float? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun DoubleArray.maxWithOrNull(comparator: Comparator): Double? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun BooleanArray.maxWithOrNull(comparator: Comparator): Boolean? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun CharArray.maxWithOrNull(comparator: Comparator): Char? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.1\")\npublic fun Array.min(): Double? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.1\")\npublic fun Array.min(): Float? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun > Array.min(): T? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun ByteArray.min(): Byte? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun ShortArray.min(): Short? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun IntArray.min(): Int? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun LongArray.min(): Long? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun FloatArray.min(): Float? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun DoubleArray.min(): Double? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun CharArray.min(): Char? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > Array.minBy(selector: (T) -> R): T? {\n return minByOrNull(selector)\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > ByteArray.minBy(selector: (Byte) -> R): Byte? {\n return minByOrNull(selector)\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > ShortArray.minBy(selector: (Short) -> R): Short? {\n return minByOrNull(selector)\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > IntArray.minBy(selector: (Int) -> R): Int? {\n return minByOrNull(selector)\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > LongArray.minBy(selector: (Long) -> R): Long? {\n return minByOrNull(selector)\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > FloatArray.minBy(selector: (Float) -> R): Float? {\n return minByOrNull(selector)\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > DoubleArray.minBy(selector: (Double) -> R): Double? {\n return minByOrNull(selector)\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > BooleanArray.minBy(selector: (Boolean) -> R): Boolean? {\n return minByOrNull(selector)\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > CharArray.minBy(selector: (Char) -> R): Char? {\n return minByOrNull(selector)\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > Array.minByOrNull(selector: (T) -> R): T? {\n if (isEmpty()) return null\n var minElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return minElem\n var minValue = selector(minElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n }\n return minElem\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > ByteArray.minByOrNull(selector: (Byte) -> R): Byte? {\n if (isEmpty()) return null\n var minElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return minElem\n var minValue = selector(minElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n }\n return minElem\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > ShortArray.minByOrNull(selector: (Short) -> R): Short? {\n if (isEmpty()) return null\n var minElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return minElem\n var minValue = selector(minElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n }\n return minElem\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > IntArray.minByOrNull(selector: (Int) -> R): Int? {\n if (isEmpty()) return null\n var minElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return minElem\n var minValue = selector(minElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n }\n return minElem\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > LongArray.minByOrNull(selector: (Long) -> R): Long? {\n if (isEmpty()) return null\n var minElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return minElem\n var minValue = selector(minElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n }\n return minElem\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > FloatArray.minByOrNull(selector: (Float) -> R): Float? {\n if (isEmpty()) return null\n var minElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return minElem\n var minValue = selector(minElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n }\n return minElem\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > DoubleArray.minByOrNull(selector: (Double) -> R): Double? {\n if (isEmpty()) return null\n var minElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return minElem\n var minValue = selector(minElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n }\n return minElem\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > BooleanArray.minByOrNull(selector: (Boolean) -> R): Boolean? {\n if (isEmpty()) return null\n var minElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return minElem\n var minValue = selector(minElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n }\n return minElem\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > CharArray.minByOrNull(selector: (Char) -> R): Char? {\n if (isEmpty()) return null\n var minElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return minElem\n var minValue = selector(minElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n }\n return minElem\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Array.minOf(selector: (T) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.minOf(selector: (Byte) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.minOf(selector: (Short) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.minOf(selector: (Int) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.minOf(selector: (Long) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.minOf(selector: (Float) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.minOf(selector: (Double) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.minOf(selector: (Boolean) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.minOf(selector: (Char) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Array.minOf(selector: (T) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.minOf(selector: (Byte) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.minOf(selector: (Short) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.minOf(selector: (Int) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.minOf(selector: (Long) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.minOf(selector: (Float) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.minOf(selector: (Double) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.minOf(selector: (Boolean) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.minOf(selector: (Char) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Array.minOf(selector: (T) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > ByteArray.minOf(selector: (Byte) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > ShortArray.minOf(selector: (Short) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > IntArray.minOf(selector: (Int) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > LongArray.minOf(selector: (Long) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > FloatArray.minOf(selector: (Float) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > DoubleArray.minOf(selector: (Double) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > BooleanArray.minOf(selector: (Boolean) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > CharArray.minOf(selector: (Char) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Array.minOfOrNull(selector: (T) -> Double): Double? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.minOfOrNull(selector: (Byte) -> Double): Double? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.minOfOrNull(selector: (Short) -> Double): Double? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.minOfOrNull(selector: (Int) -> Double): Double? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.minOfOrNull(selector: (Long) -> Double): Double? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.minOfOrNull(selector: (Float) -> Double): Double? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.minOfOrNull(selector: (Double) -> Double): Double? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.minOfOrNull(selector: (Boolean) -> Double): Double? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.minOfOrNull(selector: (Char) -> Double): Double? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Array.minOfOrNull(selector: (T) -> Float): Float? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.minOfOrNull(selector: (Byte) -> Float): Float? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.minOfOrNull(selector: (Short) -> Float): Float? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.minOfOrNull(selector: (Int) -> Float): Float? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.minOfOrNull(selector: (Long) -> Float): Float? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.minOfOrNull(selector: (Float) -> Float): Float? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.minOfOrNull(selector: (Double) -> Float): Float? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.minOfOrNull(selector: (Boolean) -> Float): Float? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.minOfOrNull(selector: (Char) -> Float): Float? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Array.minOfOrNull(selector: (T) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > ByteArray.minOfOrNull(selector: (Byte) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > ShortArray.minOfOrNull(selector: (Short) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > IntArray.minOfOrNull(selector: (Int) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > LongArray.minOfOrNull(selector: (Long) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > FloatArray.minOfOrNull(selector: (Float) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > DoubleArray.minOfOrNull(selector: (Double) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > BooleanArray.minOfOrNull(selector: (Boolean) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > CharArray.minOfOrNull(selector: (Char) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Array.minOfWith(comparator: Comparator, selector: (T) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.minOfWith(comparator: Comparator, selector: (Byte) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.minOfWith(comparator: Comparator, selector: (Short) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.minOfWith(comparator: Comparator, selector: (Int) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.minOfWith(comparator: Comparator, selector: (Long) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.minOfWith(comparator: Comparator, selector: (Float) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.minOfWith(comparator: Comparator, selector: (Double) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.minOfWith(comparator: Comparator, selector: (Boolean) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.minOfWith(comparator: Comparator, selector: (Char) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Array.minOfWithOrNull(comparator: Comparator, selector: (T) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.minOfWithOrNull(comparator: Comparator, selector: (Byte) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.minOfWithOrNull(comparator: Comparator, selector: (Short) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.minOfWithOrNull(comparator: Comparator, selector: (Int) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.minOfWithOrNull(comparator: Comparator, selector: (Long) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.minOfWithOrNull(comparator: Comparator, selector: (Float) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.minOfWithOrNull(comparator: Comparator, selector: (Double) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.minOfWithOrNull(comparator: Comparator, selector: (Boolean) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.minOfWithOrNull(comparator: Comparator, selector: (Char) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic fun Array.minOrNull(): Double? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n min = minOf(min, e)\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic fun Array.minOrNull(): Float? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n min = minOf(min, e)\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun > Array.minOrNull(): T? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (min > e) min = e\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun ByteArray.minOrNull(): Byte? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (min > e) min = e\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun ShortArray.minOrNull(): Short? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (min > e) min = e\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun IntArray.minOrNull(): Int? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (min > e) min = e\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun LongArray.minOrNull(): Long? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (min > e) min = e\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic fun FloatArray.minOrNull(): Float? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n min = minOf(min, e)\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic fun DoubleArray.minOrNull(): Double? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n min = minOf(min, e)\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun CharArray.minOrNull(): Char? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (min > e) min = e\n }\n return min\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun Array.minWith(comparator: Comparator): T? {\n return minWithOrNull(comparator)\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun ByteArray.minWith(comparator: Comparator): Byte? {\n return minWithOrNull(comparator)\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun ShortArray.minWith(comparator: Comparator): Short? {\n return minWithOrNull(comparator)\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun IntArray.minWith(comparator: Comparator): Int? {\n return minWithOrNull(comparator)\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun LongArray.minWith(comparator: Comparator): Long? {\n return minWithOrNull(comparator)\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun FloatArray.minWith(comparator: Comparator): Float? {\n return minWithOrNull(comparator)\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun DoubleArray.minWith(comparator: Comparator): Double? {\n return minWithOrNull(comparator)\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun BooleanArray.minWith(comparator: Comparator): Boolean? {\n return minWithOrNull(comparator)\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun CharArray.minWith(comparator: Comparator): Char? {\n return minWithOrNull(comparator)\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun Array.minWithOrNull(comparator: Comparator): T? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun ByteArray.minWithOrNull(comparator: Comparator): Byte? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun ShortArray.minWithOrNull(comparator: Comparator): Short? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun IntArray.minWithOrNull(comparator: Comparator): Int? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun LongArray.minWithOrNull(comparator: Comparator): Long? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun FloatArray.minWithOrNull(comparator: Comparator): Float? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun DoubleArray.minWithOrNull(comparator: Comparator): Double? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun BooleanArray.minWithOrNull(comparator: Comparator): Boolean? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun CharArray.minWithOrNull(comparator: Comparator): Char? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns `true` if the array has no elements.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\npublic fun Array.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if the array has no elements.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\npublic fun ByteArray.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if the array has no elements.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\npublic fun ShortArray.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if the array has no elements.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\npublic fun IntArray.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if the array has no elements.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\npublic fun LongArray.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if the array has no elements.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\npublic fun FloatArray.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if the array has no elements.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\npublic fun DoubleArray.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if the array has no elements.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\npublic fun BooleanArray.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if the array has no elements.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\npublic fun CharArray.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\npublic inline fun Array.none(predicate: (T) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\npublic inline fun ByteArray.none(predicate: (Byte) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\npublic inline fun ShortArray.none(predicate: (Short) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\npublic inline fun IntArray.none(predicate: (Int) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\npublic inline fun LongArray.none(predicate: (Long) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\npublic inline fun FloatArray.none(predicate: (Float) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\npublic inline fun DoubleArray.none(predicate: (Double) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\npublic inline fun BooleanArray.none(predicate: (Boolean) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\npublic inline fun CharArray.none(predicate: (Char) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Performs the given [action] on each element and returns the array itself afterwards.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun Array.onEach(action: (T) -> Unit): Array {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each element and returns the array itself afterwards.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.onEach(action: (Byte) -> Unit): ByteArray {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each element and returns the array itself afterwards.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.onEach(action: (Short) -> Unit): ShortArray {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each element and returns the array itself afterwards.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.onEach(action: (Int) -> Unit): IntArray {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each element and returns the array itself afterwards.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.onEach(action: (Long) -> Unit): LongArray {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each element and returns the array itself afterwards.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.onEach(action: (Float) -> Unit): FloatArray {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each element and returns the array itself afterwards.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.onEach(action: (Double) -> Unit): DoubleArray {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each element and returns the array itself afterwards.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.onEach(action: (Boolean) -> Unit): BooleanArray {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each element and returns the array itself afterwards.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.onEach(action: (Char) -> Unit): CharArray {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element,\n * and returns the array itself afterwards.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun Array.onEachIndexed(action: (index: Int, T) -> Unit): Array {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element,\n * and returns the array itself afterwards.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.onEachIndexed(action: (index: Int, Byte) -> Unit): ByteArray {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element,\n * and returns the array itself afterwards.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.onEachIndexed(action: (index: Int, Short) -> Unit): ShortArray {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element,\n * and returns the array itself afterwards.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.onEachIndexed(action: (index: Int, Int) -> Unit): IntArray {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element,\n * and returns the array itself afterwards.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.onEachIndexed(action: (index: Int, Long) -> Unit): LongArray {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element,\n * and returns the array itself afterwards.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.onEachIndexed(action: (index: Int, Float) -> Unit): FloatArray {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element,\n * and returns the array itself afterwards.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.onEachIndexed(action: (index: Int, Double) -> Unit): DoubleArray {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element,\n * and returns the array itself afterwards.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.onEachIndexed(action: (index: Int, Boolean) -> Unit): BooleanArray {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element,\n * and returns the array itself afterwards.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.onEachIndexed(action: (index: Int, Char) -> Unit): CharArray {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun Array.reduce(operation: (acc: S, T) -> S): S {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator: S = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun ByteArray.reduce(operation: (acc: Byte, Byte) -> Byte): Byte {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun ShortArray.reduce(operation: (acc: Short, Short) -> Short): Short {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun IntArray.reduce(operation: (acc: Int, Int) -> Int): Int {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun LongArray.reduce(operation: (acc: Long, Long) -> Long): Long {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun FloatArray.reduce(operation: (acc: Float, Float) -> Float): Float {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun DoubleArray.reduce(operation: (acc: Double, Double) -> Double): Double {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun BooleanArray.reduce(operation: (acc: Boolean, Boolean) -> Boolean): Boolean {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun CharArray.reduce(operation: (acc: Char, Char) -> Char): Char {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun Array.reduceIndexed(operation: (index: Int, acc: S, T) -> S): S {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator: S = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun ByteArray.reduceIndexed(operation: (index: Int, acc: Byte, Byte) -> Byte): Byte {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun ShortArray.reduceIndexed(operation: (index: Int, acc: Short, Short) -> Short): Short {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun IntArray.reduceIndexed(operation: (index: Int, acc: Int, Int) -> Int): Int {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun LongArray.reduceIndexed(operation: (index: Int, acc: Long, Long) -> Long): Long {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun FloatArray.reduceIndexed(operation: (index: Int, acc: Float, Float) -> Float): Float {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun DoubleArray.reduceIndexed(operation: (index: Int, acc: Double, Double) -> Double): Double {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun BooleanArray.reduceIndexed(operation: (index: Int, acc: Boolean, Boolean) -> Boolean): Boolean {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun CharArray.reduceIndexed(operation: (index: Int, acc: Char, Char) -> Char): Char {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun Array.reduceIndexedOrNull(operation: (index: Int, acc: S, T) -> S): S? {\n if (isEmpty())\n return null\n var accumulator: S = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun ByteArray.reduceIndexedOrNull(operation: (index: Int, acc: Byte, Byte) -> Byte): Byte? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun ShortArray.reduceIndexedOrNull(operation: (index: Int, acc: Short, Short) -> Short): Short? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun IntArray.reduceIndexedOrNull(operation: (index: Int, acc: Int, Int) -> Int): Int? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun LongArray.reduceIndexedOrNull(operation: (index: Int, acc: Long, Long) -> Long): Long? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun FloatArray.reduceIndexedOrNull(operation: (index: Int, acc: Float, Float) -> Float): Float? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun DoubleArray.reduceIndexedOrNull(operation: (index: Int, acc: Double, Double) -> Double): Double? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun BooleanArray.reduceIndexedOrNull(operation: (index: Int, acc: Boolean, Boolean) -> Boolean): Boolean? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun CharArray.reduceIndexedOrNull(operation: (index: Int, acc: Char, Char) -> Char): Char? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun Array.reduceOrNull(operation: (acc: S, T) -> S): S? {\n if (isEmpty())\n return null\n var accumulator: S = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun ByteArray.reduceOrNull(operation: (acc: Byte, Byte) -> Byte): Byte? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun ShortArray.reduceOrNull(operation: (acc: Short, Short) -> Short): Short? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun IntArray.reduceOrNull(operation: (acc: Int, Int) -> Int): Int? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun LongArray.reduceOrNull(operation: (acc: Long, Long) -> Long): Long? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun FloatArray.reduceOrNull(operation: (acc: Float, Float) -> Float): Float? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun DoubleArray.reduceOrNull(operation: (acc: Double, Double) -> Double): Double? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun BooleanArray.reduceOrNull(operation: (acc: Boolean, Boolean) -> Boolean): Boolean? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun CharArray.reduceOrNull(operation: (acc: Char, Char) -> Char): Char? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun Array.reduceRight(operation: (T, acc: S) -> S): S {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator: S = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun ByteArray.reduceRight(operation: (Byte, acc: Byte) -> Byte): Byte {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun ShortArray.reduceRight(operation: (Short, acc: Short) -> Short): Short {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun IntArray.reduceRight(operation: (Int, acc: Int) -> Int): Int {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun LongArray.reduceRight(operation: (Long, acc: Long) -> Long): Long {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun FloatArray.reduceRight(operation: (Float, acc: Float) -> Float): Float {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun DoubleArray.reduceRight(operation: (Double, acc: Double) -> Double): Double {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun BooleanArray.reduceRight(operation: (Boolean, acc: Boolean) -> Boolean): Boolean {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun CharArray.reduceRight(operation: (Char, acc: Char) -> Char): Char {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun Array.reduceRightIndexed(operation: (index: Int, T, acc: S) -> S): S {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator: S = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun ByteArray.reduceRightIndexed(operation: (index: Int, Byte, acc: Byte) -> Byte): Byte {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun ShortArray.reduceRightIndexed(operation: (index: Int, Short, acc: Short) -> Short): Short {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun IntArray.reduceRightIndexed(operation: (index: Int, Int, acc: Int) -> Int): Int {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun LongArray.reduceRightIndexed(operation: (index: Int, Long, acc: Long) -> Long): Long {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun FloatArray.reduceRightIndexed(operation: (index: Int, Float, acc: Float) -> Float): Float {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun DoubleArray.reduceRightIndexed(operation: (index: Int, Double, acc: Double) -> Double): Double {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun BooleanArray.reduceRightIndexed(operation: (index: Int, Boolean, acc: Boolean) -> Boolean): Boolean {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun CharArray.reduceRightIndexed(operation: (index: Int, Char, acc: Char) -> Char): Char {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun Array.reduceRightIndexedOrNull(operation: (index: Int, T, acc: S) -> S): S? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator: S = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun ByteArray.reduceRightIndexedOrNull(operation: (index: Int, Byte, acc: Byte) -> Byte): Byte? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun ShortArray.reduceRightIndexedOrNull(operation: (index: Int, Short, acc: Short) -> Short): Short? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun IntArray.reduceRightIndexedOrNull(operation: (index: Int, Int, acc: Int) -> Int): Int? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun LongArray.reduceRightIndexedOrNull(operation: (index: Int, Long, acc: Long) -> Long): Long? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun FloatArray.reduceRightIndexedOrNull(operation: (index: Int, Float, acc: Float) -> Float): Float? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun DoubleArray.reduceRightIndexedOrNull(operation: (index: Int, Double, acc: Double) -> Double): Double? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun BooleanArray.reduceRightIndexedOrNull(operation: (index: Int, Boolean, acc: Boolean) -> Boolean): Boolean? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun CharArray.reduceRightIndexedOrNull(operation: (index: Int, Char, acc: Char) -> Char): Char? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun Array.reduceRightOrNull(operation: (T, acc: S) -> S): S? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator: S = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun ByteArray.reduceRightOrNull(operation: (Byte, acc: Byte) -> Byte): Byte? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun ShortArray.reduceRightOrNull(operation: (Short, acc: Short) -> Short): Short? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun IntArray.reduceRightOrNull(operation: (Int, acc: Int) -> Int): Int? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun LongArray.reduceRightOrNull(operation: (Long, acc: Long) -> Long): Long? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun FloatArray.reduceRightOrNull(operation: (Float, acc: Float) -> Float): Float? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun DoubleArray.reduceRightOrNull(operation: (Double, acc: Double) -> Double): Double? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun BooleanArray.reduceRightOrNull(operation: (Boolean, acc: Boolean) -> Boolean): Boolean? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun CharArray.reduceRightOrNull(operation: (Char, acc: Char) -> Char): Char? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\npublic inline fun Array.runningFold(initial: R, operation: (acc: R, T) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.runningFold(initial: R, operation: (acc: R, Byte) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.runningFold(initial: R, operation: (acc: R, Short) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.runningFold(initial: R, operation: (acc: R, Int) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.runningFold(initial: R, operation: (acc: R, Long) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.runningFold(initial: R, operation: (acc: R, Float) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.runningFold(initial: R, operation: (acc: R, Double) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.runningFold(initial: R, operation: (acc: R, Boolean) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.runningFold(initial: R, operation: (acc: R, Char) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\npublic inline fun Array.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, T) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (index in indices) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, Byte) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (index in indices) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, Short) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (index in indices) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, Int) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (index in indices) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, Long) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (index in indices) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, Float) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (index in indices) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, Double) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (index in indices) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, Boolean) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (index in indices) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, Char) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (index in indices) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this array.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and the element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun Array.runningReduce(operation: (acc: S, T) -> S): List {\n if (isEmpty()) return emptyList()\n var accumulator: S = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.runningReduce(operation: (acc: Byte, Byte) -> Byte): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.runningReduce(operation: (acc: Short, Short) -> Short): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.runningReduce(operation: (acc: Int, Int) -> Int): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.runningReduce(operation: (acc: Long, Long) -> Long): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.runningReduce(operation: (acc: Float, Float) -> Float): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.runningReduce(operation: (acc: Double, Double) -> Double): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.runningReduce(operation: (acc: Boolean, Boolean) -> Boolean): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.runningReduce(operation: (acc: Char, Char) -> Char): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with the first element of this array.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\npublic inline fun Array.runningReduceIndexed(operation: (index: Int, acc: S, T) -> S): List {\n if (isEmpty()) return emptyList()\n var accumulator: S = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.runningReduceIndexed(operation: (index: Int, acc: Byte, Byte) -> Byte): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.runningReduceIndexed(operation: (index: Int, acc: Short, Short) -> Short): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.runningReduceIndexed(operation: (index: Int, acc: Int, Int) -> Int): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.runningReduceIndexed(operation: (index: Int, acc: Long, Long) -> Long): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.runningReduceIndexed(operation: (index: Int, acc: Float, Float) -> Float): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.runningReduceIndexed(operation: (index: Int, acc: Double, Double) -> Double): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.runningReduceIndexed(operation: (index: Int, acc: Boolean, Boolean) -> Boolean): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with the first element of this array.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.runningReduceIndexed(operation: (index: Int, acc: Char, Char) -> Char): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun Array.scan(initial: R, operation: (acc: R, T) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.scan(initial: R, operation: (acc: R, Byte) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.scan(initial: R, operation: (acc: R, Short) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.scan(initial: R, operation: (acc: R, Int) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.scan(initial: R, operation: (acc: R, Long) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.scan(initial: R, operation: (acc: R, Float) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.scan(initial: R, operation: (acc: R, Double) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.scan(initial: R, operation: (acc: R, Boolean) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.scan(initial: R, operation: (acc: R, Char) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun Array.scanIndexed(initial: R, operation: (index: Int, acc: R, T) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.scanIndexed(initial: R, operation: (index: Int, acc: R, Byte) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.scanIndexed(initial: R, operation: (index: Int, acc: R, Short) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.scanIndexed(initial: R, operation: (index: Int, acc: R, Int) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.scanIndexed(initial: R, operation: (index: Int, acc: R, Long) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.scanIndexed(initial: R, operation: (index: Int, acc: R, Float) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.scanIndexed(initial: R, operation: (index: Int, acc: R, Double) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.scanIndexed(initial: R, operation: (index: Int, acc: R, Boolean) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.scanIndexed(initial: R, operation: (index: Int, acc: R, Char) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\npublic inline fun Array.scanReduce(operation: (acc: S, T) -> S): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.scanReduce(operation: (acc: Byte, Byte) -> Byte): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.scanReduce(operation: (acc: Short, Short) -> Short): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.scanReduce(operation: (acc: Int, Int) -> Int): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.scanReduce(operation: (acc: Long, Long) -> Long): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.scanReduce(operation: (acc: Float, Float) -> Float): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.scanReduce(operation: (acc: Double, Double) -> Double): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.scanReduce(operation: (acc: Boolean, Boolean) -> Boolean): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.scanReduce(operation: (acc: Char, Char) -> Char): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\npublic inline fun Array.scanReduceIndexed(operation: (index: Int, acc: S, T) -> S): List {\n return runningReduceIndexed(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.scanReduceIndexed(operation: (index: Int, acc: Byte, Byte) -> Byte): List {\n return runningReduceIndexed(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.scanReduceIndexed(operation: (index: Int, acc: Short, Short) -> Short): List {\n return runningReduceIndexed(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.scanReduceIndexed(operation: (index: Int, acc: Int, Int) -> Int): List {\n return runningReduceIndexed(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.scanReduceIndexed(operation: (index: Int, acc: Long, Long) -> Long): List {\n return runningReduceIndexed(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.scanReduceIndexed(operation: (index: Int, acc: Float, Float) -> Float): List {\n return runningReduceIndexed(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.scanReduceIndexed(operation: (index: Int, acc: Double, Double) -> Double): List {\n return runningReduceIndexed(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.scanReduceIndexed(operation: (index: Int, acc: Boolean, Boolean) -> Boolean): List {\n return runningReduceIndexed(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.scanReduceIndexed(operation: (index: Int, acc: Char, Char) -> Char): List {\n return runningReduceIndexed(operation)\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun Array.sumBy(selector: (T) -> Int): Int {\n var sum: Int = 0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun ByteArray.sumBy(selector: (Byte) -> Int): Int {\n var sum: Int = 0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun ShortArray.sumBy(selector: (Short) -> Int): Int {\n var sum: Int = 0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun IntArray.sumBy(selector: (Int) -> Int): Int {\n var sum: Int = 0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun LongArray.sumBy(selector: (Long) -> Int): Int {\n var sum: Int = 0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun FloatArray.sumBy(selector: (Float) -> Int): Int {\n var sum: Int = 0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun DoubleArray.sumBy(selector: (Double) -> Int): Int {\n var sum: Int = 0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun BooleanArray.sumBy(selector: (Boolean) -> Int): Int {\n var sum: Int = 0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun CharArray.sumBy(selector: (Char) -> Int): Int {\n var sum: Int = 0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun Array.sumByDouble(selector: (T) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun ByteArray.sumByDouble(selector: (Byte) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun ShortArray.sumByDouble(selector: (Short) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun IntArray.sumByDouble(selector: (Int) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun LongArray.sumByDouble(selector: (Long) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun FloatArray.sumByDouble(selector: (Float) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun DoubleArray.sumByDouble(selector: (Double) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun BooleanArray.sumByDouble(selector: (Boolean) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\npublic inline fun CharArray.sumByDouble(selector: (Char) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@kotlin.internal.InlineOnly\npublic inline fun Array.sumOf(selector: (T) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.sumOf(selector: (Byte) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.sumOf(selector: (Short) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.sumOf(selector: (Int) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.sumOf(selector: (Long) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.sumOf(selector: (Float) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.sumOf(selector: (Double) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.sumOf(selector: (Boolean) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.sumOf(selector: (Char) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@kotlin.internal.InlineOnly\npublic inline fun Array.sumOf(selector: (T) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.sumOf(selector: (Byte) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.sumOf(selector: (Short) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.sumOf(selector: (Int) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.sumOf(selector: (Long) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.sumOf(selector: (Float) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.sumOf(selector: (Double) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.sumOf(selector: (Boolean) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.sumOf(selector: (Char) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@kotlin.internal.InlineOnly\npublic inline fun Array.sumOf(selector: (T) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.sumOf(selector: (Byte) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.sumOf(selector: (Short) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.sumOf(selector: (Int) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.sumOf(selector: (Long) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.sumOf(selector: (Float) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.sumOf(selector: (Double) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.sumOf(selector: (Boolean) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.sumOf(selector: (Char) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Array.sumOf(selector: (T) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.sumOf(selector: (Byte) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.sumOf(selector: (Short) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.sumOf(selector: (Int) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.sumOf(selector: (Long) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.sumOf(selector: (Float) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.sumOf(selector: (Double) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.sumOf(selector: (Boolean) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.sumOf(selector: (Char) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Array.sumOf(selector: (T) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.sumOf(selector: (Byte) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.sumOf(selector: (Short) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.sumOf(selector: (Int) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.sumOf(selector: (Long) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.sumOf(selector: (Float) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.sumOf(selector: (Double) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun BooleanArray.sumOf(selector: (Boolean) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.sumOf(selector: (Char) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns an original collection containing all the non-`null` elements, throwing an [IllegalArgumentException] if there are any `null` elements.\n */\npublic fun Array.requireNoNulls(): Array {\n for (element in this) {\n if (element == null) {\n throw IllegalArgumentException(\"null element found in $this.\")\n }\n }\n @Suppress(\"UNCHECKED_CAST\")\n return this as Array\n}\n\n/**\n * Splits the original array into pair of lists,\n * where *first* list contains elements for which [predicate] yielded `true`,\n * while *second* list contains elements for which [predicate] yielded `false`.\n * \n * @sample samples.collections.Arrays.Transformations.partitionArrayOfPrimitives\n */\npublic inline fun Array.partition(predicate: (T) -> Boolean): Pair, List> {\n val first = ArrayList()\n val second = ArrayList()\n for (element in this) {\n if (predicate(element)) {\n first.add(element)\n } else {\n second.add(element)\n }\n }\n return Pair(first, second)\n}\n\n/**\n * Splits the original array into pair of lists,\n * where *first* list contains elements for which [predicate] yielded `true`,\n * while *second* list contains elements for which [predicate] yielded `false`.\n * \n * @sample samples.collections.Arrays.Transformations.partitionArrayOfPrimitives\n */\npublic inline fun ByteArray.partition(predicate: (Byte) -> Boolean): Pair, List> {\n val first = ArrayList()\n val second = ArrayList()\n for (element in this) {\n if (predicate(element)) {\n first.add(element)\n } else {\n second.add(element)\n }\n }\n return Pair(first, second)\n}\n\n/**\n * Splits the original array into pair of lists,\n * where *first* list contains elements for which [predicate] yielded `true`,\n * while *second* list contains elements for which [predicate] yielded `false`.\n * \n * @sample samples.collections.Arrays.Transformations.partitionArrayOfPrimitives\n */\npublic inline fun ShortArray.partition(predicate: (Short) -> Boolean): Pair, List> {\n val first = ArrayList()\n val second = ArrayList()\n for (element in this) {\n if (predicate(element)) {\n first.add(element)\n } else {\n second.add(element)\n }\n }\n return Pair(first, second)\n}\n\n/**\n * Splits the original array into pair of lists,\n * where *first* list contains elements for which [predicate] yielded `true`,\n * while *second* list contains elements for which [predicate] yielded `false`.\n * \n * @sample samples.collections.Arrays.Transformations.partitionArrayOfPrimitives\n */\npublic inline fun IntArray.partition(predicate: (Int) -> Boolean): Pair, List> {\n val first = ArrayList()\n val second = ArrayList()\n for (element in this) {\n if (predicate(element)) {\n first.add(element)\n } else {\n second.add(element)\n }\n }\n return Pair(first, second)\n}\n\n/**\n * Splits the original array into pair of lists,\n * where *first* list contains elements for which [predicate] yielded `true`,\n * while *second* list contains elements for which [predicate] yielded `false`.\n * \n * @sample samples.collections.Arrays.Transformations.partitionArrayOfPrimitives\n */\npublic inline fun LongArray.partition(predicate: (Long) -> Boolean): Pair, List> {\n val first = ArrayList()\n val second = ArrayList()\n for (element in this) {\n if (predicate(element)) {\n first.add(element)\n } else {\n second.add(element)\n }\n }\n return Pair(first, second)\n}\n\n/**\n * Splits the original array into pair of lists,\n * where *first* list contains elements for which [predicate] yielded `true`,\n * while *second* list contains elements for which [predicate] yielded `false`.\n * \n * @sample samples.collections.Arrays.Transformations.partitionArrayOfPrimitives\n */\npublic inline fun FloatArray.partition(predicate: (Float) -> Boolean): Pair, List> {\n val first = ArrayList()\n val second = ArrayList()\n for (element in this) {\n if (predicate(element)) {\n first.add(element)\n } else {\n second.add(element)\n }\n }\n return Pair(first, second)\n}\n\n/**\n * Splits the original array into pair of lists,\n * where *first* list contains elements for which [predicate] yielded `true`,\n * while *second* list contains elements for which [predicate] yielded `false`.\n * \n * @sample samples.collections.Arrays.Transformations.partitionArrayOfPrimitives\n */\npublic inline fun DoubleArray.partition(predicate: (Double) -> Boolean): Pair, List> {\n val first = ArrayList()\n val second = ArrayList()\n for (element in this) {\n if (predicate(element)) {\n first.add(element)\n } else {\n second.add(element)\n }\n }\n return Pair(first, second)\n}\n\n/**\n * Splits the original array into pair of lists,\n * where *first* list contains elements for which [predicate] yielded `true`,\n * while *second* list contains elements for which [predicate] yielded `false`.\n * \n * @sample samples.collections.Arrays.Transformations.partitionArrayOfPrimitives\n */\npublic inline fun BooleanArray.partition(predicate: (Boolean) -> Boolean): Pair, List> {\n val first = ArrayList()\n val second = ArrayList()\n for (element in this) {\n if (predicate(element)) {\n first.add(element)\n } else {\n second.add(element)\n }\n }\n return Pair(first, second)\n}\n\n/**\n * Splits the original array into pair of lists,\n * where *first* list contains elements for which [predicate] yielded `true`,\n * while *second* list contains elements for which [predicate] yielded `false`.\n * \n * @sample samples.collections.Arrays.Transformations.partitionArrayOfPrimitives\n */\npublic inline fun CharArray.partition(predicate: (Char) -> Boolean): Pair, List> {\n val first = ArrayList()\n val second = ArrayList()\n for (element in this) {\n if (predicate(element)) {\n first.add(element)\n } else {\n second.add(element)\n }\n }\n return Pair(first, second)\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun Array.zip(other: Array): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun ByteArray.zip(other: Array): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun ShortArray.zip(other: Array): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun IntArray.zip(other: Array): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun LongArray.zip(other: Array): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun FloatArray.zip(other: Array): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun DoubleArray.zip(other: Array): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun BooleanArray.zip(other: Array): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun CharArray.zip(other: Array): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun Array.zip(other: Array, transform: (a: T, b: R) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun ByteArray.zip(other: Array, transform: (a: Byte, b: R) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun ShortArray.zip(other: Array, transform: (a: Short, b: R) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun IntArray.zip(other: Array, transform: (a: Int, b: R) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun LongArray.zip(other: Array, transform: (a: Long, b: R) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun FloatArray.zip(other: Array, transform: (a: Float, b: R) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun DoubleArray.zip(other: Array, transform: (a: Double, b: R) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun BooleanArray.zip(other: Array, transform: (a: Boolean, b: R) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun CharArray.zip(other: Array, transform: (a: Char, b: R) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun Array.zip(other: Iterable): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun ByteArray.zip(other: Iterable): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun ShortArray.zip(other: Iterable): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun IntArray.zip(other: Iterable): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun LongArray.zip(other: Iterable): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun FloatArray.zip(other: Iterable): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun DoubleArray.zip(other: Iterable): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun BooleanArray.zip(other: Iterable): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun CharArray.zip(other: Iterable): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] collection with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun Array.zip(other: Iterable, transform: (a: T, b: R) -> V): List {\n val arraySize = size\n val list = ArrayList(minOf(other.collectionSizeOrDefault(10), arraySize))\n var i = 0\n for (element in other) {\n if (i >= arraySize) break\n list.add(transform(this[i++], element))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] collection with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun ByteArray.zip(other: Iterable, transform: (a: Byte, b: R) -> V): List {\n val arraySize = size\n val list = ArrayList(minOf(other.collectionSizeOrDefault(10), arraySize))\n var i = 0\n for (element in other) {\n if (i >= arraySize) break\n list.add(transform(this[i++], element))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] collection with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun ShortArray.zip(other: Iterable, transform: (a: Short, b: R) -> V): List {\n val arraySize = size\n val list = ArrayList(minOf(other.collectionSizeOrDefault(10), arraySize))\n var i = 0\n for (element in other) {\n if (i >= arraySize) break\n list.add(transform(this[i++], element))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] collection with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun IntArray.zip(other: Iterable, transform: (a: Int, b: R) -> V): List {\n val arraySize = size\n val list = ArrayList(minOf(other.collectionSizeOrDefault(10), arraySize))\n var i = 0\n for (element in other) {\n if (i >= arraySize) break\n list.add(transform(this[i++], element))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] collection with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun LongArray.zip(other: Iterable, transform: (a: Long, b: R) -> V): List {\n val arraySize = size\n val list = ArrayList(minOf(other.collectionSizeOrDefault(10), arraySize))\n var i = 0\n for (element in other) {\n if (i >= arraySize) break\n list.add(transform(this[i++], element))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] collection with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun FloatArray.zip(other: Iterable, transform: (a: Float, b: R) -> V): List {\n val arraySize = size\n val list = ArrayList(minOf(other.collectionSizeOrDefault(10), arraySize))\n var i = 0\n for (element in other) {\n if (i >= arraySize) break\n list.add(transform(this[i++], element))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] collection with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun DoubleArray.zip(other: Iterable, transform: (a: Double, b: R) -> V): List {\n val arraySize = size\n val list = ArrayList(minOf(other.collectionSizeOrDefault(10), arraySize))\n var i = 0\n for (element in other) {\n if (i >= arraySize) break\n list.add(transform(this[i++], element))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] collection with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun BooleanArray.zip(other: Iterable, transform: (a: Boolean, b: R) -> V): List {\n val arraySize = size\n val list = ArrayList(minOf(other.collectionSizeOrDefault(10), arraySize))\n var i = 0\n for (element in other) {\n if (i >= arraySize) break\n list.add(transform(this[i++], element))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] collection with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun CharArray.zip(other: Iterable, transform: (a: Char, b: R) -> V): List {\n val arraySize = size\n val list = ArrayList(minOf(other.collectionSizeOrDefault(10), arraySize))\n var i = 0\n for (element in other) {\n if (i >= arraySize) break\n list.add(transform(this[i++], element))\n }\n return list\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun ByteArray.zip(other: ByteArray): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun ShortArray.zip(other: ShortArray): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun IntArray.zip(other: IntArray): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun LongArray.zip(other: LongArray): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun FloatArray.zip(other: FloatArray): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun DoubleArray.zip(other: DoubleArray): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun BooleanArray.zip(other: BooleanArray): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun CharArray.zip(other: CharArray): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest array.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun ByteArray.zip(other: ByteArray, transform: (a: Byte, b: Byte) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest array.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun ShortArray.zip(other: ShortArray, transform: (a: Short, b: Short) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest array.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun IntArray.zip(other: IntArray, transform: (a: Int, b: Int) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest array.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun LongArray.zip(other: LongArray, transform: (a: Long, b: Long) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest array.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun FloatArray.zip(other: FloatArray, transform: (a: Float, b: Float) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest array.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun DoubleArray.zip(other: DoubleArray, transform: (a: Double, b: Double) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest array.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun BooleanArray.zip(other: BooleanArray, transform: (a: Boolean, b: Boolean) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest array.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun CharArray.zip(other: CharArray, transform: (a: Char, b: Char) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinTo\n */\npublic fun Array.joinTo(buffer: A, separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((T) -> CharSequence)? = null): A {\n buffer.append(prefix)\n var count = 0\n for (element in this) {\n if (++count > 1) buffer.append(separator)\n if (limit < 0 || count <= limit) {\n buffer.appendElement(element, transform)\n } else break\n }\n if (limit >= 0 && count > limit) buffer.append(truncated)\n buffer.append(postfix)\n return buffer\n}\n\n/**\n * Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinTo\n */\npublic fun ByteArray.joinTo(buffer: A, separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Byte) -> CharSequence)? = null): A {\n buffer.append(prefix)\n var count = 0\n for (element in this) {\n if (++count > 1) buffer.append(separator)\n if (limit < 0 || count <= limit) {\n if (transform != null)\n buffer.append(transform(element))\n else\n buffer.append(element.toString())\n } else break\n }\n if (limit >= 0 && count > limit) buffer.append(truncated)\n buffer.append(postfix)\n return buffer\n}\n\n/**\n * Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinTo\n */\npublic fun ShortArray.joinTo(buffer: A, separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Short) -> CharSequence)? = null): A {\n buffer.append(prefix)\n var count = 0\n for (element in this) {\n if (++count > 1) buffer.append(separator)\n if (limit < 0 || count <= limit) {\n if (transform != null)\n buffer.append(transform(element))\n else\n buffer.append(element.toString())\n } else break\n }\n if (limit >= 0 && count > limit) buffer.append(truncated)\n buffer.append(postfix)\n return buffer\n}\n\n/**\n * Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinTo\n */\npublic fun IntArray.joinTo(buffer: A, separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Int) -> CharSequence)? = null): A {\n buffer.append(prefix)\n var count = 0\n for (element in this) {\n if (++count > 1) buffer.append(separator)\n if (limit < 0 || count <= limit) {\n if (transform != null)\n buffer.append(transform(element))\n else\n buffer.append(element.toString())\n } else break\n }\n if (limit >= 0 && count > limit) buffer.append(truncated)\n buffer.append(postfix)\n return buffer\n}\n\n/**\n * Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinTo\n */\npublic fun LongArray.joinTo(buffer: A, separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Long) -> CharSequence)? = null): A {\n buffer.append(prefix)\n var count = 0\n for (element in this) {\n if (++count > 1) buffer.append(separator)\n if (limit < 0 || count <= limit) {\n if (transform != null)\n buffer.append(transform(element))\n else\n buffer.append(element.toString())\n } else break\n }\n if (limit >= 0 && count > limit) buffer.append(truncated)\n buffer.append(postfix)\n return buffer\n}\n\n/**\n * Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinTo\n */\npublic fun FloatArray.joinTo(buffer: A, separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Float) -> CharSequence)? = null): A {\n buffer.append(prefix)\n var count = 0\n for (element in this) {\n if (++count > 1) buffer.append(separator)\n if (limit < 0 || count <= limit) {\n if (transform != null)\n buffer.append(transform(element))\n else\n buffer.append(element.toString())\n } else break\n }\n if (limit >= 0 && count > limit) buffer.append(truncated)\n buffer.append(postfix)\n return buffer\n}\n\n/**\n * Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinTo\n */\npublic fun DoubleArray.joinTo(buffer: A, separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Double) -> CharSequence)? = null): A {\n buffer.append(prefix)\n var count = 0\n for (element in this) {\n if (++count > 1) buffer.append(separator)\n if (limit < 0 || count <= limit) {\n if (transform != null)\n buffer.append(transform(element))\n else\n buffer.append(element.toString())\n } else break\n }\n if (limit >= 0 && count > limit) buffer.append(truncated)\n buffer.append(postfix)\n return buffer\n}\n\n/**\n * Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinTo\n */\npublic fun BooleanArray.joinTo(buffer: A, separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Boolean) -> CharSequence)? = null): A {\n buffer.append(prefix)\n var count = 0\n for (element in this) {\n if (++count > 1) buffer.append(separator)\n if (limit < 0 || count <= limit) {\n if (transform != null)\n buffer.append(transform(element))\n else\n buffer.append(element.toString())\n } else break\n }\n if (limit >= 0 && count > limit) buffer.append(truncated)\n buffer.append(postfix)\n return buffer\n}\n\n/**\n * Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinTo\n */\npublic fun CharArray.joinTo(buffer: A, separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Char) -> CharSequence)? = null): A {\n buffer.append(prefix)\n var count = 0\n for (element in this) {\n if (++count > 1) buffer.append(separator)\n if (limit < 0 || count <= limit) {\n if (transform != null)\n buffer.append(transform(element))\n else\n buffer.append(element)\n } else break\n }\n if (limit >= 0 && count > limit) buffer.append(truncated)\n buffer.append(postfix)\n return buffer\n}\n\n/**\n * Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinToString\n */\npublic fun Array.joinToString(separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((T) -> CharSequence)? = null): String {\n return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()\n}\n\n/**\n * Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinToString\n */\npublic fun ByteArray.joinToString(separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Byte) -> CharSequence)? = null): String {\n return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()\n}\n\n/**\n * Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinToString\n */\npublic fun ShortArray.joinToString(separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Short) -> CharSequence)? = null): String {\n return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()\n}\n\n/**\n * Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinToString\n */\npublic fun IntArray.joinToString(separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Int) -> CharSequence)? = null): String {\n return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()\n}\n\n/**\n * Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinToString\n */\npublic fun LongArray.joinToString(separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Long) -> CharSequence)? = null): String {\n return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()\n}\n\n/**\n * Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinToString\n */\npublic fun FloatArray.joinToString(separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Float) -> CharSequence)? = null): String {\n return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()\n}\n\n/**\n * Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinToString\n */\npublic fun DoubleArray.joinToString(separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Double) -> CharSequence)? = null): String {\n return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()\n}\n\n/**\n * Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinToString\n */\npublic fun BooleanArray.joinToString(separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Boolean) -> CharSequence)? = null): String {\n return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()\n}\n\n/**\n * Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinToString\n */\npublic fun CharArray.joinToString(separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((Char) -> CharSequence)? = null): String {\n return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()\n}\n\n/**\n * Creates an [Iterable] instance that wraps the original array returning its elements when being iterated.\n */\npublic fun Array.asIterable(): Iterable {\n if (isEmpty()) return emptyList()\n return Iterable { this.iterator() }\n}\n\n/**\n * Creates an [Iterable] instance that wraps the original array returning its elements when being iterated.\n */\npublic fun ByteArray.asIterable(): Iterable {\n if (isEmpty()) return emptyList()\n return Iterable { this.iterator() }\n}\n\n/**\n * Creates an [Iterable] instance that wraps the original array returning its elements when being iterated.\n */\npublic fun ShortArray.asIterable(): Iterable {\n if (isEmpty()) return emptyList()\n return Iterable { this.iterator() }\n}\n\n/**\n * Creates an [Iterable] instance that wraps the original array returning its elements when being iterated.\n */\npublic fun IntArray.asIterable(): Iterable {\n if (isEmpty()) return emptyList()\n return Iterable { this.iterator() }\n}\n\n/**\n * Creates an [Iterable] instance that wraps the original array returning its elements when being iterated.\n */\npublic fun LongArray.asIterable(): Iterable {\n if (isEmpty()) return emptyList()\n return Iterable { this.iterator() }\n}\n\n/**\n * Creates an [Iterable] instance that wraps the original array returning its elements when being iterated.\n */\npublic fun FloatArray.asIterable(): Iterable {\n if (isEmpty()) return emptyList()\n return Iterable { this.iterator() }\n}\n\n/**\n * Creates an [Iterable] instance that wraps the original array returning its elements when being iterated.\n */\npublic fun DoubleArray.asIterable(): Iterable {\n if (isEmpty()) return emptyList()\n return Iterable { this.iterator() }\n}\n\n/**\n * Creates an [Iterable] instance that wraps the original array returning its elements when being iterated.\n */\npublic fun BooleanArray.asIterable(): Iterable {\n if (isEmpty()) return emptyList()\n return Iterable { this.iterator() }\n}\n\n/**\n * Creates an [Iterable] instance that wraps the original array returning its elements when being iterated.\n */\npublic fun CharArray.asIterable(): Iterable {\n if (isEmpty()) return emptyList()\n return Iterable { this.iterator() }\n}\n\n/**\n * Creates a [Sequence] instance that wraps the original array returning its elements when being iterated.\n * \n * @sample samples.collections.Sequences.Building.sequenceFromArray\n */\npublic fun Array.asSequence(): Sequence {\n if (isEmpty()) return emptySequence()\n return Sequence { this.iterator() }\n}\n\n/**\n * Creates a [Sequence] instance that wraps the original array returning its elements when being iterated.\n * \n * @sample samples.collections.Sequences.Building.sequenceFromArray\n */\npublic fun ByteArray.asSequence(): Sequence {\n if (isEmpty()) return emptySequence()\n return Sequence { this.iterator() }\n}\n\n/**\n * Creates a [Sequence] instance that wraps the original array returning its elements when being iterated.\n * \n * @sample samples.collections.Sequences.Building.sequenceFromArray\n */\npublic fun ShortArray.asSequence(): Sequence {\n if (isEmpty()) return emptySequence()\n return Sequence { this.iterator() }\n}\n\n/**\n * Creates a [Sequence] instance that wraps the original array returning its elements when being iterated.\n * \n * @sample samples.collections.Sequences.Building.sequenceFromArray\n */\npublic fun IntArray.asSequence(): Sequence {\n if (isEmpty()) return emptySequence()\n return Sequence { this.iterator() }\n}\n\n/**\n * Creates a [Sequence] instance that wraps the original array returning its elements when being iterated.\n * \n * @sample samples.collections.Sequences.Building.sequenceFromArray\n */\npublic fun LongArray.asSequence(): Sequence {\n if (isEmpty()) return emptySequence()\n return Sequence { this.iterator() }\n}\n\n/**\n * Creates a [Sequence] instance that wraps the original array returning its elements when being iterated.\n * \n * @sample samples.collections.Sequences.Building.sequenceFromArray\n */\npublic fun FloatArray.asSequence(): Sequence {\n if (isEmpty()) return emptySequence()\n return Sequence { this.iterator() }\n}\n\n/**\n * Creates a [Sequence] instance that wraps the original array returning its elements when being iterated.\n * \n * @sample samples.collections.Sequences.Building.sequenceFromArray\n */\npublic fun DoubleArray.asSequence(): Sequence {\n if (isEmpty()) return emptySequence()\n return Sequence { this.iterator() }\n}\n\n/**\n * Creates a [Sequence] instance that wraps the original array returning its elements when being iterated.\n * \n * @sample samples.collections.Sequences.Building.sequenceFromArray\n */\npublic fun BooleanArray.asSequence(): Sequence {\n if (isEmpty()) return emptySequence()\n return Sequence { this.iterator() }\n}\n\n/**\n * Creates a [Sequence] instance that wraps the original array returning its elements when being iterated.\n * \n * @sample samples.collections.Sequences.Building.sequenceFromArray\n */\npublic fun CharArray.asSequence(): Sequence {\n if (isEmpty()) return emptySequence()\n return Sequence { this.iterator() }\n}\n\n/**\n * Returns an average value of elements in the array.\n */\n@kotlin.jvm.JvmName(\"averageOfByte\")\npublic fun Array.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n ++count\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the array.\n */\n@kotlin.jvm.JvmName(\"averageOfShort\")\npublic fun Array.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n ++count\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the array.\n */\n@kotlin.jvm.JvmName(\"averageOfInt\")\npublic fun Array.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n ++count\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the array.\n */\n@kotlin.jvm.JvmName(\"averageOfLong\")\npublic fun Array.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n ++count\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the array.\n */\n@kotlin.jvm.JvmName(\"averageOfFloat\")\npublic fun Array.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n ++count\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the array.\n */\n@kotlin.jvm.JvmName(\"averageOfDouble\")\npublic fun Array.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n ++count\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the array.\n */\npublic fun ByteArray.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n ++count\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the array.\n */\npublic fun ShortArray.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n ++count\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the array.\n */\npublic fun IntArray.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n ++count\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the array.\n */\npublic fun LongArray.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n ++count\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the array.\n */\npublic fun FloatArray.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n ++count\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the array.\n */\npublic fun DoubleArray.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n ++count\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\n@kotlin.jvm.JvmName(\"sumOfByte\")\npublic fun Array.sum(): Int {\n var sum: Int = 0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\n@kotlin.jvm.JvmName(\"sumOfShort\")\npublic fun Array.sum(): Int {\n var sum: Int = 0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\n@kotlin.jvm.JvmName(\"sumOfInt\")\npublic fun Array.sum(): Int {\n var sum: Int = 0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\n@kotlin.jvm.JvmName(\"sumOfLong\")\npublic fun Array.sum(): Long {\n var sum: Long = 0L\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\n@kotlin.jvm.JvmName(\"sumOfFloat\")\npublic fun Array.sum(): Float {\n var sum: Float = 0.0f\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\n@kotlin.jvm.JvmName(\"sumOfDouble\")\npublic fun Array.sum(): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\npublic fun ByteArray.sum(): Int {\n var sum: Int = 0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\npublic fun ShortArray.sum(): Int {\n var sum: Int = 0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\npublic fun IntArray.sum(): Int {\n var sum: Int = 0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\npublic fun LongArray.sum(): Long {\n var sum: Long = 0L\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\npublic fun FloatArray.sum(): Float {\n var sum: Float = 0.0f\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\npublic fun DoubleArray.sum(): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"RangesKt\")\n\npackage kotlin.ranges\n\n//\n// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt\n// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib\n//\n\nimport kotlin.random.*\n\n/**\n * Returns a random element from this range.\n * \n * @throws IllegalArgumentException if this range is empty.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun IntRange.random(): Int {\n return random(Random)\n}\n\n/**\n * Returns a random element from this range.\n * \n * @throws IllegalArgumentException if this range is empty.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun LongRange.random(): Long {\n return random(Random)\n}\n\n/**\n * Returns a random element from this range.\n * \n * @throws IllegalArgumentException if this range is empty.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun CharRange.random(): Char {\n return random(Random)\n}\n\n/**\n * Returns a random element from this range using the specified source of randomness.\n * \n * @throws IllegalArgumentException if this range is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun IntRange.random(random: Random): Int {\n try {\n return random.nextInt(this)\n } catch(e: IllegalArgumentException) {\n throw NoSuchElementException(e.message)\n }\n}\n\n/**\n * Returns a random element from this range using the specified source of randomness.\n * \n * @throws IllegalArgumentException if this range is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun LongRange.random(random: Random): Long {\n try {\n return random.nextLong(this)\n } catch(e: IllegalArgumentException) {\n throw NoSuchElementException(e.message)\n }\n}\n\n/**\n * Returns a random element from this range using the specified source of randomness.\n * \n * @throws IllegalArgumentException if this range is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun CharRange.random(random: Random): Char {\n try {\n return random.nextInt(first.toInt(), last.toInt() + 1).toChar()\n } catch(e: IllegalArgumentException) {\n throw NoSuchElementException(e.message)\n }\n}\n\n/**\n * Returns a random element from this range, or `null` if this range is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun IntRange.randomOrNull(): Int? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this range, or `null` if this range is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun LongRange.randomOrNull(): Long? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this range, or `null` if this range is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun CharRange.randomOrNull(): Char? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this range using the specified source of randomness, or `null` if this range is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun IntRange.randomOrNull(random: Random): Int? {\n if (isEmpty())\n return null\n return random.nextInt(this)\n}\n\n/**\n * Returns a random element from this range using the specified source of randomness, or `null` if this range is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun LongRange.randomOrNull(random: Random): Long? {\n if (isEmpty())\n return null\n return random.nextLong(this)\n}\n\n/**\n * Returns a random element from this range using the specified source of randomness, or `null` if this range is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun CharRange.randomOrNull(random: Random): Char? {\n if (isEmpty())\n return null\n return random.nextInt(first.toInt(), last.toInt() + 1).toChar()\n}\n\n/**\n * Returns `true` if this range contains the specified [element].\n * \n * Always returns `false` if the [element] is `null`.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline operator fun IntRange.contains(element: Int?): Boolean {\n return element != null && contains(element)\n}\n\n/**\n * Returns `true` if this range contains the specified [element].\n * \n * Always returns `false` if the [element] is `null`.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline operator fun LongRange.contains(element: Long?): Boolean {\n return element != null && contains(element)\n}\n\n/**\n * Returns `true` if this range contains the specified [element].\n * \n * Always returns `false` if the [element] is `null`.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline operator fun CharRange.contains(element: Char?): Boolean {\n return element != null && contains(element)\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@kotlin.jvm.JvmName(\"intRangeContains\")\npublic operator fun ClosedRange.contains(value: Byte): Boolean {\n return contains(value.toInt())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@kotlin.jvm.JvmName(\"longRangeContains\")\npublic operator fun ClosedRange.contains(value: Byte): Boolean {\n return contains(value.toLong())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@kotlin.jvm.JvmName(\"shortRangeContains\")\npublic operator fun ClosedRange.contains(value: Byte): Boolean {\n return contains(value.toShort())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"doubleRangeContains\")\npublic operator fun ClosedRange.contains(value: Byte): Boolean {\n return contains(value.toDouble())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"floatRangeContains\")\npublic operator fun ClosedRange.contains(value: Byte): Boolean {\n return contains(value.toFloat())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"intRangeContains\")\npublic operator fun ClosedRange.contains(value: Double): Boolean {\n return value.toIntExactOrNull().let { if (it != null) contains(it) else false }\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"longRangeContains\")\npublic operator fun ClosedRange.contains(value: Double): Boolean {\n return value.toLongExactOrNull().let { if (it != null) contains(it) else false }\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"byteRangeContains\")\npublic operator fun ClosedRange.contains(value: Double): Boolean {\n return value.toByteExactOrNull().let { if (it != null) contains(it) else false }\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"shortRangeContains\")\npublic operator fun ClosedRange.contains(value: Double): Boolean {\n return value.toShortExactOrNull().let { if (it != null) contains(it) else false }\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@kotlin.jvm.JvmName(\"floatRangeContains\")\npublic operator fun ClosedRange.contains(value: Double): Boolean {\n return contains(value.toFloat())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"intRangeContains\")\npublic operator fun ClosedRange.contains(value: Float): Boolean {\n return value.toIntExactOrNull().let { if (it != null) contains(it) else false }\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"longRangeContains\")\npublic operator fun ClosedRange.contains(value: Float): Boolean {\n return value.toLongExactOrNull().let { if (it != null) contains(it) else false }\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"byteRangeContains\")\npublic operator fun ClosedRange.contains(value: Float): Boolean {\n return value.toByteExactOrNull().let { if (it != null) contains(it) else false }\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"shortRangeContains\")\npublic operator fun ClosedRange.contains(value: Float): Boolean {\n return value.toShortExactOrNull().let { if (it != null) contains(it) else false }\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@kotlin.jvm.JvmName(\"doubleRangeContains\")\npublic operator fun ClosedRange.contains(value: Float): Boolean {\n return contains(value.toDouble())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@kotlin.jvm.JvmName(\"longRangeContains\")\npublic operator fun ClosedRange.contains(value: Int): Boolean {\n return contains(value.toLong())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@kotlin.jvm.JvmName(\"byteRangeContains\")\npublic operator fun ClosedRange.contains(value: Int): Boolean {\n return value.toByteExactOrNull().let { if (it != null) contains(it) else false }\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@kotlin.jvm.JvmName(\"shortRangeContains\")\npublic operator fun ClosedRange.contains(value: Int): Boolean {\n return value.toShortExactOrNull().let { if (it != null) contains(it) else false }\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"doubleRangeContains\")\npublic operator fun ClosedRange.contains(value: Int): Boolean {\n return contains(value.toDouble())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"floatRangeContains\")\npublic operator fun ClosedRange.contains(value: Int): Boolean {\n return contains(value.toFloat())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@kotlin.jvm.JvmName(\"intRangeContains\")\npublic operator fun ClosedRange.contains(value: Long): Boolean {\n return value.toIntExactOrNull().let { if (it != null) contains(it) else false }\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@kotlin.jvm.JvmName(\"byteRangeContains\")\npublic operator fun ClosedRange.contains(value: Long): Boolean {\n return value.toByteExactOrNull().let { if (it != null) contains(it) else false }\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@kotlin.jvm.JvmName(\"shortRangeContains\")\npublic operator fun ClosedRange.contains(value: Long): Boolean {\n return value.toShortExactOrNull().let { if (it != null) contains(it) else false }\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"doubleRangeContains\")\npublic operator fun ClosedRange.contains(value: Long): Boolean {\n return contains(value.toDouble())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"floatRangeContains\")\npublic operator fun ClosedRange.contains(value: Long): Boolean {\n return contains(value.toFloat())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@kotlin.jvm.JvmName(\"intRangeContains\")\npublic operator fun ClosedRange.contains(value: Short): Boolean {\n return contains(value.toInt())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@kotlin.jvm.JvmName(\"longRangeContains\")\npublic operator fun ClosedRange.contains(value: Short): Boolean {\n return contains(value.toLong())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@kotlin.jvm.JvmName(\"byteRangeContains\")\npublic operator fun ClosedRange.contains(value: Short): Boolean {\n return value.toByteExactOrNull().let { if (it != null) contains(it) else false }\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"doubleRangeContains\")\npublic operator fun ClosedRange.contains(value: Short): Boolean {\n return contains(value.toDouble())\n}\n\n/**\n * Checks if the specified [value] belongs to this range.\n */\n@Deprecated(\"This `contains` operation mixing integer and floating point arguments has ambiguous semantics and is going to be removed.\")\n@DeprecatedSinceKotlin(warningSince = \"1.3\", errorSince = \"1.4\")\n@kotlin.jvm.JvmName(\"floatRangeContains\")\npublic operator fun ClosedRange.contains(value: Short): Boolean {\n return contains(value.toFloat())\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Int.downTo(to: Byte): IntProgression {\n return IntProgression.fromClosedRange(this, to.toInt(), -1)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Long.downTo(to: Byte): LongProgression {\n return LongProgression.fromClosedRange(this, to.toLong(), -1L)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Byte.downTo(to: Byte): IntProgression {\n return IntProgression.fromClosedRange(this.toInt(), to.toInt(), -1)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Short.downTo(to: Byte): IntProgression {\n return IntProgression.fromClosedRange(this.toInt(), to.toInt(), -1)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Char.downTo(to: Char): CharProgression {\n return CharProgression.fromClosedRange(this, to, -1)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Int.downTo(to: Int): IntProgression {\n return IntProgression.fromClosedRange(this, to, -1)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Long.downTo(to: Int): LongProgression {\n return LongProgression.fromClosedRange(this, to.toLong(), -1L)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Byte.downTo(to: Int): IntProgression {\n return IntProgression.fromClosedRange(this.toInt(), to, -1)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Short.downTo(to: Int): IntProgression {\n return IntProgression.fromClosedRange(this.toInt(), to, -1)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Int.downTo(to: Long): LongProgression {\n return LongProgression.fromClosedRange(this.toLong(), to, -1L)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Long.downTo(to: Long): LongProgression {\n return LongProgression.fromClosedRange(this, to, -1L)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Byte.downTo(to: Long): LongProgression {\n return LongProgression.fromClosedRange(this.toLong(), to, -1L)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Short.downTo(to: Long): LongProgression {\n return LongProgression.fromClosedRange(this.toLong(), to, -1L)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Int.downTo(to: Short): IntProgression {\n return IntProgression.fromClosedRange(this, to.toInt(), -1)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Long.downTo(to: Short): LongProgression {\n return LongProgression.fromClosedRange(this, to.toLong(), -1L)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Byte.downTo(to: Short): IntProgression {\n return IntProgression.fromClosedRange(this.toInt(), to.toInt(), -1)\n}\n\n/**\n * Returns a progression from this value down to the specified [to] value with the step -1.\n * \n * The [to] value should be less than or equal to `this` value.\n * If the [to] value is greater than `this` value the returned progression is empty.\n */\npublic infix fun Short.downTo(to: Short): IntProgression {\n return IntProgression.fromClosedRange(this.toInt(), to.toInt(), -1)\n}\n\n/**\n * Returns a progression that goes over the same range in the opposite direction with the same step.\n */\npublic fun IntProgression.reversed(): IntProgression {\n return IntProgression.fromClosedRange(last, first, -step)\n}\n\n/**\n * Returns a progression that goes over the same range in the opposite direction with the same step.\n */\npublic fun LongProgression.reversed(): LongProgression {\n return LongProgression.fromClosedRange(last, first, -step)\n}\n\n/**\n * Returns a progression that goes over the same range in the opposite direction with the same step.\n */\npublic fun CharProgression.reversed(): CharProgression {\n return CharProgression.fromClosedRange(last, first, -step)\n}\n\n/**\n * Returns a progression that goes over the same range with the given step.\n */\npublic infix fun IntProgression.step(step: Int): IntProgression {\n checkStepIsPositive(step > 0, step)\n return IntProgression.fromClosedRange(first, last, if (this.step > 0) step else -step)\n}\n\n/**\n * Returns a progression that goes over the same range with the given step.\n */\npublic infix fun LongProgression.step(step: Long): LongProgression {\n checkStepIsPositive(step > 0, step)\n return LongProgression.fromClosedRange(first, last, if (this.step > 0) step else -step)\n}\n\n/**\n * Returns a progression that goes over the same range with the given step.\n */\npublic infix fun CharProgression.step(step: Int): CharProgression {\n checkStepIsPositive(step > 0, step)\n return CharProgression.fromClosedRange(first, last, if (this.step > 0) step else -step)\n}\n\ninternal fun Int.toByteExactOrNull(): Byte? {\n return if (this in Byte.MIN_VALUE.toInt()..Byte.MAX_VALUE.toInt()) this.toByte() else null\n}\n\ninternal fun Long.toByteExactOrNull(): Byte? {\n return if (this in Byte.MIN_VALUE.toLong()..Byte.MAX_VALUE.toLong()) this.toByte() else null\n}\n\ninternal fun Short.toByteExactOrNull(): Byte? {\n return if (this in Byte.MIN_VALUE.toShort()..Byte.MAX_VALUE.toShort()) this.toByte() else null\n}\n\ninternal fun Double.toByteExactOrNull(): Byte? {\n return if (this in Byte.MIN_VALUE.toDouble()..Byte.MAX_VALUE.toDouble()) this.toInt().toByte() else null\n}\n\ninternal fun Float.toByteExactOrNull(): Byte? {\n return if (this in Byte.MIN_VALUE.toFloat()..Byte.MAX_VALUE.toFloat()) this.toInt().toByte() else null\n}\n\ninternal fun Long.toIntExactOrNull(): Int? {\n return if (this in Int.MIN_VALUE.toLong()..Int.MAX_VALUE.toLong()) this.toInt() else null\n}\n\ninternal fun Double.toIntExactOrNull(): Int? {\n return if (this in Int.MIN_VALUE.toDouble()..Int.MAX_VALUE.toDouble()) this.toInt() else null\n}\n\ninternal fun Float.toIntExactOrNull(): Int? {\n return if (this in Int.MIN_VALUE.toFloat()..Int.MAX_VALUE.toFloat()) this.toInt() else null\n}\n\ninternal fun Double.toLongExactOrNull(): Long? {\n return if (this in Long.MIN_VALUE.toDouble()..Long.MAX_VALUE.toDouble()) this.toLong() else null\n}\n\ninternal fun Float.toLongExactOrNull(): Long? {\n return if (this in Long.MIN_VALUE.toFloat()..Long.MAX_VALUE.toFloat()) this.toLong() else null\n}\n\ninternal fun Int.toShortExactOrNull(): Short? {\n return if (this in Short.MIN_VALUE.toInt()..Short.MAX_VALUE.toInt()) this.toShort() else null\n}\n\ninternal fun Long.toShortExactOrNull(): Short? {\n return if (this in Short.MIN_VALUE.toLong()..Short.MAX_VALUE.toLong()) this.toShort() else null\n}\n\ninternal fun Double.toShortExactOrNull(): Short? {\n return if (this in Short.MIN_VALUE.toDouble()..Short.MAX_VALUE.toDouble()) this.toInt().toShort() else null\n}\n\ninternal fun Float.toShortExactOrNull(): Short? {\n return if (this in Short.MIN_VALUE.toFloat()..Short.MAX_VALUE.toFloat()) this.toInt().toShort() else null\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Int.until(to: Byte): IntRange {\n return this .. (to.toInt() - 1).toInt()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Long.until(to: Byte): LongRange {\n return this .. (to.toLong() - 1).toLong()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Byte.until(to: Byte): IntRange {\n return this.toInt() .. (to.toInt() - 1).toInt()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Short.until(to: Byte): IntRange {\n return this.toInt() .. (to.toInt() - 1).toInt()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Char.until(to: Char): CharRange {\n if (to <= '\\u0000') return CharRange.EMPTY\n return this .. (to - 1).toChar()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Int.until(to: Int): IntRange {\n if (to <= Int.MIN_VALUE) return IntRange.EMPTY\n return this .. (to - 1).toInt()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Long.until(to: Int): LongRange {\n return this .. (to.toLong() - 1).toLong()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Byte.until(to: Int): IntRange {\n if (to <= Int.MIN_VALUE) return IntRange.EMPTY\n return this.toInt() .. (to - 1).toInt()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Short.until(to: Int): IntRange {\n if (to <= Int.MIN_VALUE) return IntRange.EMPTY\n return this.toInt() .. (to - 1).toInt()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Int.until(to: Long): LongRange {\n if (to <= Long.MIN_VALUE) return LongRange.EMPTY\n return this.toLong() .. (to - 1).toLong()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Long.until(to: Long): LongRange {\n if (to <= Long.MIN_VALUE) return LongRange.EMPTY\n return this .. (to - 1).toLong()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Byte.until(to: Long): LongRange {\n if (to <= Long.MIN_VALUE) return LongRange.EMPTY\n return this.toLong() .. (to - 1).toLong()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Short.until(to: Long): LongRange {\n if (to <= Long.MIN_VALUE) return LongRange.EMPTY\n return this.toLong() .. (to - 1).toLong()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Int.until(to: Short): IntRange {\n return this .. (to.toInt() - 1).toInt()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Long.until(to: Short): LongRange {\n return this .. (to.toLong() - 1).toLong()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Byte.until(to: Short): IntRange {\n return this.toInt() .. (to.toInt() - 1).toInt()\n}\n\n/**\n * Returns a range from this value up to but excluding the specified [to] value.\n * \n * If the [to] value is less than or equal to `this` value, then the returned range is empty.\n */\npublic infix fun Short.until(to: Short): IntRange {\n return this.toInt() .. (to.toInt() - 1).toInt()\n}\n\n/**\n * Ensures that this value is not less than the specified [minimumValue].\n * \n * @return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.\n * \n * @sample samples.comparisons.ComparableOps.coerceAtLeastComparable\n */\npublic fun > T.coerceAtLeast(minimumValue: T): T {\n return if (this < minimumValue) minimumValue else this\n}\n\n/**\n * Ensures that this value is not less than the specified [minimumValue].\n * \n * @return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.\n * \n * @sample samples.comparisons.ComparableOps.coerceAtLeast\n */\npublic fun Byte.coerceAtLeast(minimumValue: Byte): Byte {\n return if (this < minimumValue) minimumValue else this\n}\n\n/**\n * Ensures that this value is not less than the specified [minimumValue].\n * \n * @return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.\n * \n * @sample samples.comparisons.ComparableOps.coerceAtLeast\n */\npublic fun Short.coerceAtLeast(minimumValue: Short): Short {\n return if (this < minimumValue) minimumValue else this\n}\n\n/**\n * Ensures that this value is not less than the specified [minimumValue].\n * \n * @return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.\n * \n * @sample samples.comparisons.ComparableOps.coerceAtLeast\n */\npublic fun Int.coerceAtLeast(minimumValue: Int): Int {\n return if (this < minimumValue) minimumValue else this\n}\n\n/**\n * Ensures that this value is not less than the specified [minimumValue].\n * \n * @return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.\n * \n * @sample samples.comparisons.ComparableOps.coerceAtLeast\n */\npublic fun Long.coerceAtLeast(minimumValue: Long): Long {\n return if (this < minimumValue) minimumValue else this\n}\n\n/**\n * Ensures that this value is not less than the specified [minimumValue].\n * \n * @return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.\n * \n * @sample samples.comparisons.ComparableOps.coerceAtLeast\n */\npublic fun Float.coerceAtLeast(minimumValue: Float): Float {\n return if (this < minimumValue) minimumValue else this\n}\n\n/**\n * Ensures that this value is not less than the specified [minimumValue].\n * \n * @return this value if it's greater than or equal to the [minimumValue] or the [minimumValue] otherwise.\n * \n * @sample samples.comparisons.ComparableOps.coerceAtLeast\n */\npublic fun Double.coerceAtLeast(minimumValue: Double): Double {\n return if (this < minimumValue) minimumValue else this\n}\n\n/**\n * Ensures that this value is not greater than the specified [maximumValue].\n * \n * @return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.\n * \n * @sample samples.comparisons.ComparableOps.coerceAtMostComparable\n */\npublic fun > T.coerceAtMost(maximumValue: T): T {\n return if (this > maximumValue) maximumValue else this\n}\n\n/**\n * Ensures that this value is not greater than the specified [maximumValue].\n * \n * @return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.\n * \n * @sample samples.comparisons.ComparableOps.coerceAtMost\n */\npublic fun Byte.coerceAtMost(maximumValue: Byte): Byte {\n return if (this > maximumValue) maximumValue else this\n}\n\n/**\n * Ensures that this value is not greater than the specified [maximumValue].\n * \n * @return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.\n * \n * @sample samples.comparisons.ComparableOps.coerceAtMost\n */\npublic fun Short.coerceAtMost(maximumValue: Short): Short {\n return if (this > maximumValue) maximumValue else this\n}\n\n/**\n * Ensures that this value is not greater than the specified [maximumValue].\n * \n * @return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.\n * \n * @sample samples.comparisons.ComparableOps.coerceAtMost\n */\npublic fun Int.coerceAtMost(maximumValue: Int): Int {\n return if (this > maximumValue) maximumValue else this\n}\n\n/**\n * Ensures that this value is not greater than the specified [maximumValue].\n * \n * @return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.\n * \n * @sample samples.comparisons.ComparableOps.coerceAtMost\n */\npublic fun Long.coerceAtMost(maximumValue: Long): Long {\n return if (this > maximumValue) maximumValue else this\n}\n\n/**\n * Ensures that this value is not greater than the specified [maximumValue].\n * \n * @return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.\n * \n * @sample samples.comparisons.ComparableOps.coerceAtMost\n */\npublic fun Float.coerceAtMost(maximumValue: Float): Float {\n return if (this > maximumValue) maximumValue else this\n}\n\n/**\n * Ensures that this value is not greater than the specified [maximumValue].\n * \n * @return this value if it's less than or equal to the [maximumValue] or the [maximumValue] otherwise.\n * \n * @sample samples.comparisons.ComparableOps.coerceAtMost\n */\npublic fun Double.coerceAtMost(maximumValue: Double): Double {\n return if (this > maximumValue) maximumValue else this\n}\n\n/**\n * Ensures that this value lies in the specified range [minimumValue]..[maximumValue].\n * \n * @return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].\n * \n * @sample samples.comparisons.ComparableOps.coerceInComparable\n */\npublic fun > T.coerceIn(minimumValue: T?, maximumValue: T?): T {\n if (minimumValue !== null && maximumValue !== null) {\n if (minimumValue > maximumValue) throw IllegalArgumentException(\"Cannot coerce value to an empty range: maximum $maximumValue is less than minimum $minimumValue.\")\n if (this < minimumValue) return minimumValue\n if (this > maximumValue) return maximumValue\n }\n else {\n if (minimumValue !== null && this < minimumValue) return minimumValue\n if (maximumValue !== null && this > maximumValue) return maximumValue\n }\n return this\n}\n\n/**\n * Ensures that this value lies in the specified range [minimumValue]..[maximumValue].\n * \n * @return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].\n * \n * @sample samples.comparisons.ComparableOps.coerceIn\n */\npublic fun Byte.coerceIn(minimumValue: Byte, maximumValue: Byte): Byte {\n if (minimumValue > maximumValue) throw IllegalArgumentException(\"Cannot coerce value to an empty range: maximum $maximumValue is less than minimum $minimumValue.\")\n if (this < minimumValue) return minimumValue\n if (this > maximumValue) return maximumValue\n return this\n}\n\n/**\n * Ensures that this value lies in the specified range [minimumValue]..[maximumValue].\n * \n * @return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].\n * \n * @sample samples.comparisons.ComparableOps.coerceIn\n */\npublic fun Short.coerceIn(minimumValue: Short, maximumValue: Short): Short {\n if (minimumValue > maximumValue) throw IllegalArgumentException(\"Cannot coerce value to an empty range: maximum $maximumValue is less than minimum $minimumValue.\")\n if (this < minimumValue) return minimumValue\n if (this > maximumValue) return maximumValue\n return this\n}\n\n/**\n * Ensures that this value lies in the specified range [minimumValue]..[maximumValue].\n * \n * @return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].\n * \n * @sample samples.comparisons.ComparableOps.coerceIn\n */\npublic fun Int.coerceIn(minimumValue: Int, maximumValue: Int): Int {\n if (minimumValue > maximumValue) throw IllegalArgumentException(\"Cannot coerce value to an empty range: maximum $maximumValue is less than minimum $minimumValue.\")\n if (this < minimumValue) return minimumValue\n if (this > maximumValue) return maximumValue\n return this\n}\n\n/**\n * Ensures that this value lies in the specified range [minimumValue]..[maximumValue].\n * \n * @return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].\n * \n * @sample samples.comparisons.ComparableOps.coerceIn\n */\npublic fun Long.coerceIn(minimumValue: Long, maximumValue: Long): Long {\n if (minimumValue > maximumValue) throw IllegalArgumentException(\"Cannot coerce value to an empty range: maximum $maximumValue is less than minimum $minimumValue.\")\n if (this < minimumValue) return minimumValue\n if (this > maximumValue) return maximumValue\n return this\n}\n\n/**\n * Ensures that this value lies in the specified range [minimumValue]..[maximumValue].\n * \n * @return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].\n * \n * @sample samples.comparisons.ComparableOps.coerceIn\n */\npublic fun Float.coerceIn(minimumValue: Float, maximumValue: Float): Float {\n if (minimumValue > maximumValue) throw IllegalArgumentException(\"Cannot coerce value to an empty range: maximum $maximumValue is less than minimum $minimumValue.\")\n if (this < minimumValue) return minimumValue\n if (this > maximumValue) return maximumValue\n return this\n}\n\n/**\n * Ensures that this value lies in the specified range [minimumValue]..[maximumValue].\n * \n * @return this value if it's in the range, or [minimumValue] if this value is less than [minimumValue], or [maximumValue] if this value is greater than [maximumValue].\n * \n * @sample samples.comparisons.ComparableOps.coerceIn\n */\npublic fun Double.coerceIn(minimumValue: Double, maximumValue: Double): Double {\n if (minimumValue > maximumValue) throw IllegalArgumentException(\"Cannot coerce value to an empty range: maximum $maximumValue is less than minimum $minimumValue.\")\n if (this < minimumValue) return minimumValue\n if (this > maximumValue) return maximumValue\n return this\n}\n\n/**\n * Ensures that this value lies in the specified [range].\n * \n * @return this value if it's in the [range], or `range.start` if this value is less than `range.start`, or `range.endInclusive` if this value is greater than `range.endInclusive`.\n * \n * @sample samples.comparisons.ComparableOps.coerceInFloatingPointRange\n */\n@SinceKotlin(\"1.1\")\npublic fun > T.coerceIn(range: ClosedFloatingPointRange): T {\n if (range.isEmpty()) throw IllegalArgumentException(\"Cannot coerce value to an empty range: $range.\")\n return when {\n // this < start equiv to this <= start && !(this >= start)\n range.lessThanOrEquals(this, range.start) && !range.lessThanOrEquals(range.start, this) -> range.start\n // this > end equiv to this >= end && !(this <= end)\n range.lessThanOrEquals(range.endInclusive, this) && !range.lessThanOrEquals(this, range.endInclusive) -> range.endInclusive\n else -> this\n }\n}\n\n/**\n * Ensures that this value lies in the specified [range].\n * \n * @return this value if it's in the [range], or `range.start` if this value is less than `range.start`, or `range.endInclusive` if this value is greater than `range.endInclusive`.\n * \n * @sample samples.comparisons.ComparableOps.coerceInComparable\n */\npublic fun > T.coerceIn(range: ClosedRange): T {\n if (range is ClosedFloatingPointRange) {\n return this.coerceIn(range)\n }\n if (range.isEmpty()) throw IllegalArgumentException(\"Cannot coerce value to an empty range: $range.\")\n return when {\n this < range.start -> range.start\n this > range.endInclusive -> range.endInclusive\n else -> this\n }\n}\n\n/**\n * Ensures that this value lies in the specified [range].\n * \n * @return this value if it's in the [range], or `range.start` if this value is less than `range.start`, or `range.endInclusive` if this value is greater than `range.endInclusive`.\n * \n * @sample samples.comparisons.ComparableOps.coerceIn\n */\npublic fun Int.coerceIn(range: ClosedRange): Int {\n if (range is ClosedFloatingPointRange) {\n return this.coerceIn(range)\n }\n if (range.isEmpty()) throw IllegalArgumentException(\"Cannot coerce value to an empty range: $range.\")\n return when {\n this < range.start -> range.start\n this > range.endInclusive -> range.endInclusive\n else -> this\n }\n}\n\n/**\n * Ensures that this value lies in the specified [range].\n * \n * @return this value if it's in the [range], or `range.start` if this value is less than `range.start`, or `range.endInclusive` if this value is greater than `range.endInclusive`.\n * \n * @sample samples.comparisons.ComparableOps.coerceIn\n */\npublic fun Long.coerceIn(range: ClosedRange): Long {\n if (range is ClosedFloatingPointRange) {\n return this.coerceIn(range)\n }\n if (range.isEmpty()) throw IllegalArgumentException(\"Cannot coerce value to an empty range: $range.\")\n return when {\n this < range.start -> range.start\n this > range.endInclusive -> range.endInclusive\n else -> this\n }\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// Auto-generated file. DO NOT EDIT!\n\npackage kotlin\n\nimport kotlin.experimental.*\n\n@Suppress(\"NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic inline class UByte @PublishedApi internal constructor(@PublishedApi internal val data: Byte) : Comparable {\n\n companion object {\n /**\n * A constant holding the minimum value an instance of UByte can have.\n */\n public const val MIN_VALUE: UByte = UByte(0)\n\n /**\n * A constant holding the maximum value an instance of UByte can have.\n */\n public const val MAX_VALUE: UByte = UByte(-1)\n\n /**\n * The number of bytes used to represent an instance of UByte in a binary form.\n */\n public const val SIZE_BYTES: Int = 1\n\n /**\n * The number of bits used to represent an instance of UByte in a binary form.\n */\n public const val SIZE_BITS: Int = 8\n }\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n @Suppress(\"OVERRIDE_BY_INLINE\")\n public override inline operator fun compareTo(other: UByte): Int = this.toInt().compareTo(other.toInt())\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n public inline operator fun compareTo(other: UShort): Int = this.toInt().compareTo(other.toInt())\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n public inline operator fun compareTo(other: UInt): Int = this.toUInt().compareTo(other)\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n public inline operator fun compareTo(other: ULong): Int = this.toULong().compareTo(other)\n\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: UByte): UInt = this.toUInt().plus(other.toUInt())\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: UShort): UInt = this.toUInt().plus(other.toUInt())\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: UInt): UInt = this.toUInt().plus(other)\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: ULong): ULong = this.toULong().plus(other)\n\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: UByte): UInt = this.toUInt().minus(other.toUInt())\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: UShort): UInt = this.toUInt().minus(other.toUInt())\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: UInt): UInt = this.toUInt().minus(other)\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: ULong): ULong = this.toULong().minus(other)\n\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: UByte): UInt = this.toUInt().times(other.toUInt())\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: UShort): UInt = this.toUInt().times(other.toUInt())\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: UInt): UInt = this.toUInt().times(other)\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: ULong): ULong = this.toULong().times(other)\n\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: UByte): UInt = this.toUInt().div(other.toUInt())\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: UShort): UInt = this.toUInt().div(other.toUInt())\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: UInt): UInt = this.toUInt().div(other)\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: ULong): ULong = this.toULong().div(other)\n\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: UByte): UInt = this.toUInt().rem(other.toUInt())\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: UShort): UInt = this.toUInt().rem(other.toUInt())\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: UInt): UInt = this.toUInt().rem(other)\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: ULong): ULong = this.toULong().rem(other)\n\n /** Increments this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun inc(): UByte = UByte(data.inc())\n /** Decrements this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun dec(): UByte = UByte(data.dec())\n\n /** Creates a range from this value to the specified [other] value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rangeTo(other: UByte): UIntRange = UIntRange(this.toUInt(), other.toUInt())\n\n /** Performs a bitwise AND operation between the two values. */\n @kotlin.internal.InlineOnly\n public inline infix fun and(other: UByte): UByte = UByte(this.data and other.data)\n /** Performs a bitwise OR operation between the two values. */\n @kotlin.internal.InlineOnly\n public inline infix fun or(other: UByte): UByte = UByte(this.data or other.data)\n /** Performs a bitwise XOR operation between the two values. */\n @kotlin.internal.InlineOnly\n public inline infix fun xor(other: UByte): UByte = UByte(this.data xor other.data)\n /** Inverts the bits in this value. */\n @kotlin.internal.InlineOnly\n public inline fun inv(): UByte = UByte(data.inv())\n\n /**\n * Converts this [UByte] value to [Byte].\n *\n * If this value is less than or equals to [Byte.MAX_VALUE], the resulting `Byte` value represents\n * the same numerical value as this `UByte`. Otherwise the result is negative.\n *\n * The resulting `Byte` value has the same binary representation as this `UByte` value.\n */\n @kotlin.internal.InlineOnly\n public inline fun toByte(): Byte = data\n /**\n * Converts this [UByte] value to [Short].\n *\n * The resulting `Short` value represents the same numerical value as this `UByte`.\n *\n * The least significant 8 bits of the resulting `Short` value are the same as the bits of this `UByte` value,\n * whereas the most significant 8 bits are filled with zeros.\n */\n @kotlin.internal.InlineOnly\n public inline fun toShort(): Short = data.toShort() and 0xFF\n /**\n * Converts this [UByte] value to [Int].\n *\n * The resulting `Int` value represents the same numerical value as this `UByte`.\n *\n * The least significant 8 bits of the resulting `Int` value are the same as the bits of this `UByte` value,\n * whereas the most significant 24 bits are filled with zeros.\n */\n @kotlin.internal.InlineOnly\n public inline fun toInt(): Int = data.toInt() and 0xFF\n /**\n * Converts this [UByte] value to [Long].\n *\n * The resulting `Long` value represents the same numerical value as this `UByte`.\n *\n * The least significant 8 bits of the resulting `Long` value are the same as the bits of this `UByte` value,\n * whereas the most significant 56 bits are filled with zeros.\n */\n @kotlin.internal.InlineOnly\n public inline fun toLong(): Long = data.toLong() and 0xFF\n\n /** Returns this value. */\n @kotlin.internal.InlineOnly\n public inline fun toUByte(): UByte = this\n /**\n * Converts this [UByte] value to [UShort].\n *\n * The resulting `UShort` value represents the same numerical value as this `UByte`.\n *\n * The least significant 8 bits of the resulting `UShort` value are the same as the bits of this `UByte` value,\n * whereas the most significant 8 bits are filled with zeros.\n */\n @kotlin.internal.InlineOnly\n public inline fun toUShort(): UShort = UShort(data.toShort() and 0xFF)\n /**\n * Converts this [UByte] value to [UInt].\n *\n * The resulting `UInt` value represents the same numerical value as this `UByte`.\n *\n * The least significant 8 bits of the resulting `UInt` value are the same as the bits of this `UByte` value,\n * whereas the most significant 24 bits are filled with zeros.\n */\n @kotlin.internal.InlineOnly\n public inline fun toUInt(): UInt = UInt(data.toInt() and 0xFF)\n /**\n * Converts this [UByte] value to [ULong].\n *\n * The resulting `ULong` value represents the same numerical value as this `UByte`.\n *\n * The least significant 8 bits of the resulting `ULong` value are the same as the bits of this `UByte` value,\n * whereas the most significant 56 bits are filled with zeros.\n */\n @kotlin.internal.InlineOnly\n public inline fun toULong(): ULong = ULong(data.toLong() and 0xFF)\n\n /**\n * Converts this [UByte] value to [Float].\n *\n * The resulting `Float` value represents the same numerical value as this `UByte`.\n */\n @kotlin.internal.InlineOnly\n public inline fun toFloat(): Float = this.toInt().toFloat()\n /**\n * Converts this [UByte] value to [Double].\n *\n * The resulting `Double` value represents the same numerical value as this `UByte`.\n */\n @kotlin.internal.InlineOnly\n public inline fun toDouble(): Double = this.toInt().toDouble()\n\n public override fun toString(): String = toInt().toString()\n\n}\n\n/**\n * Converts this [Byte] value to [UByte].\n *\n * If this value is positive, the resulting `UByte` value represents the same numerical value as this `Byte`.\n *\n * The resulting `UByte` value has the same binary representation as this `Byte` value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Byte.toUByte(): UByte = UByte(this)\n/**\n * Converts this [Short] value to [UByte].\n *\n * If this value is positive and less than or equals to [UByte.MAX_VALUE], the resulting `UByte` value represents\n * the same numerical value as this `Short`.\n *\n * The resulting `UByte` value is represented by the least significant 8 bits of this `Short` value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Short.toUByte(): UByte = UByte(this.toByte())\n/**\n * Converts this [Int] value to [UByte].\n *\n * If this value is positive and less than or equals to [UByte.MAX_VALUE], the resulting `UByte` value represents\n * the same numerical value as this `Int`.\n *\n * The resulting `UByte` value is represented by the least significant 8 bits of this `Int` value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Int.toUByte(): UByte = UByte(this.toByte())\n/**\n * Converts this [Long] value to [UByte].\n *\n * If this value is positive and less than or equals to [UByte.MAX_VALUE], the resulting `UByte` value represents\n * the same numerical value as this `Long`.\n *\n * The resulting `UByte` value is represented by the least significant 8 bits of this `Long` value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Long.toUByte(): UByte = UByte(this.toByte())\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// Auto-generated file. DO NOT EDIT!\n\npackage kotlin\n\nimport kotlin.experimental.*\n\n@Suppress(\"NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic inline class UInt @PublishedApi internal constructor(@PublishedApi internal val data: Int) : Comparable {\n\n companion object {\n /**\n * A constant holding the minimum value an instance of UInt can have.\n */\n public const val MIN_VALUE: UInt = UInt(0)\n\n /**\n * A constant holding the maximum value an instance of UInt can have.\n */\n public const val MAX_VALUE: UInt = UInt(-1)\n\n /**\n * The number of bytes used to represent an instance of UInt in a binary form.\n */\n public const val SIZE_BYTES: Int = 4\n\n /**\n * The number of bits used to represent an instance of UInt in a binary form.\n */\n public const val SIZE_BITS: Int = 32\n }\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n public inline operator fun compareTo(other: UByte): Int = this.compareTo(other.toUInt())\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n public inline operator fun compareTo(other: UShort): Int = this.compareTo(other.toUInt())\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n @Suppress(\"OVERRIDE_BY_INLINE\")\n public override inline operator fun compareTo(other: UInt): Int = uintCompare(this.data, other.data)\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n public inline operator fun compareTo(other: ULong): Int = this.toULong().compareTo(other)\n\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: UByte): UInt = this.plus(other.toUInt())\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: UShort): UInt = this.plus(other.toUInt())\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: UInt): UInt = UInt(this.data.plus(other.data))\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: ULong): ULong = this.toULong().plus(other)\n\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: UByte): UInt = this.minus(other.toUInt())\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: UShort): UInt = this.minus(other.toUInt())\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: UInt): UInt = UInt(this.data.minus(other.data))\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: ULong): ULong = this.toULong().minus(other)\n\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: UByte): UInt = this.times(other.toUInt())\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: UShort): UInt = this.times(other.toUInt())\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: UInt): UInt = UInt(this.data.times(other.data))\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: ULong): ULong = this.toULong().times(other)\n\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: UByte): UInt = this.div(other.toUInt())\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: UShort): UInt = this.div(other.toUInt())\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: UInt): UInt = uintDivide(this, other)\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: ULong): ULong = this.toULong().div(other)\n\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: UByte): UInt = this.rem(other.toUInt())\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: UShort): UInt = this.rem(other.toUInt())\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: UInt): UInt = uintRemainder(this, other)\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: ULong): ULong = this.toULong().rem(other)\n\n /** Increments this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun inc(): UInt = UInt(data.inc())\n /** Decrements this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun dec(): UInt = UInt(data.dec())\n\n /** Creates a range from this value to the specified [other] value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rangeTo(other: UInt): UIntRange = UIntRange(this, other)\n\n /**\n * Shifts this value left by the [bitCount] number of bits.\n *\n * Note that only the five lowest-order bits of the [bitCount] are used as the shift distance.\n * The shift distance actually used is therefore always in the range `0..31`.\n */\n @kotlin.internal.InlineOnly\n public inline infix fun shl(bitCount: Int): UInt = UInt(data shl bitCount)\n\n /**\n * Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with zeros.\n *\n * Note that only the five lowest-order bits of the [bitCount] are used as the shift distance.\n * The shift distance actually used is therefore always in the range `0..31`.\n */\n @kotlin.internal.InlineOnly\n public inline infix fun shr(bitCount: Int): UInt = UInt(data ushr bitCount)\n\n /** Performs a bitwise AND operation between the two values. */\n @kotlin.internal.InlineOnly\n public inline infix fun and(other: UInt): UInt = UInt(this.data and other.data)\n /** Performs a bitwise OR operation between the two values. */\n @kotlin.internal.InlineOnly\n public inline infix fun or(other: UInt): UInt = UInt(this.data or other.data)\n /** Performs a bitwise XOR operation between the two values. */\n @kotlin.internal.InlineOnly\n public inline infix fun xor(other: UInt): UInt = UInt(this.data xor other.data)\n /** Inverts the bits in this value. */\n @kotlin.internal.InlineOnly\n public inline fun inv(): UInt = UInt(data.inv())\n\n /**\n * Converts this [UInt] value to [Byte].\n *\n * If this value is less than or equals to [Byte.MAX_VALUE], the resulting `Byte` value represents\n * the same numerical value as this `UInt`.\n *\n * The resulting `Byte` value is represented by the least significant 8 bits of this `UInt` value.\n * Note that the resulting `Byte` value may be negative.\n */\n @kotlin.internal.InlineOnly\n public inline fun toByte(): Byte = data.toByte()\n /**\n * Converts this [UInt] value to [Short].\n *\n * If this value is less than or equals to [Short.MAX_VALUE], the resulting `Short` value represents\n * the same numerical value as this `UInt`.\n *\n * The resulting `Short` value is represented by the least significant 16 bits of this `UInt` value.\n * Note that the resulting `Short` value may be negative.\n */\n @kotlin.internal.InlineOnly\n public inline fun toShort(): Short = data.toShort()\n /**\n * Converts this [UInt] value to [Int].\n *\n * If this value is less than or equals to [Int.MAX_VALUE], the resulting `Int` value represents\n * the same numerical value as this `UInt`. Otherwise the result is negative.\n *\n * The resulting `Int` value has the same binary representation as this `UInt` value.\n */\n @kotlin.internal.InlineOnly\n public inline fun toInt(): Int = data\n /**\n * Converts this [UInt] value to [Long].\n *\n * The resulting `Long` value represents the same numerical value as this `UInt`.\n *\n * The least significant 32 bits of the resulting `Long` value are the same as the bits of this `UInt` value,\n * whereas the most significant 32 bits are filled with zeros.\n */\n @kotlin.internal.InlineOnly\n public inline fun toLong(): Long = data.toLong() and 0xFFFF_FFFF\n\n /**\n * Converts this [UInt] value to [UByte].\n *\n * If this value is less than or equals to [UByte.MAX_VALUE], the resulting `UByte` value represents\n * the same numerical value as this `UInt`.\n *\n * The resulting `UByte` value is represented by the least significant 8 bits of this `UInt` value.\n */\n @kotlin.internal.InlineOnly\n public inline fun toUByte(): UByte = data.toUByte()\n /**\n * Converts this [UInt] value to [UShort].\n *\n * If this value is less than or equals to [UShort.MAX_VALUE], the resulting `UShort` value represents\n * the same numerical value as this `UInt`.\n *\n * The resulting `UShort` value is represented by the least significant 16 bits of this `UInt` value.\n */\n @kotlin.internal.InlineOnly\n public inline fun toUShort(): UShort = data.toUShort()\n /** Returns this value. */\n @kotlin.internal.InlineOnly\n public inline fun toUInt(): UInt = this\n /**\n * Converts this [UInt] value to [ULong].\n *\n * The resulting `ULong` value represents the same numerical value as this `UInt`.\n *\n * The least significant 32 bits of the resulting `ULong` value are the same as the bits of this `UInt` value,\n * whereas the most significant 32 bits are filled with zeros.\n */\n @kotlin.internal.InlineOnly\n public inline fun toULong(): ULong = ULong(data.toLong() and 0xFFFF_FFFF)\n\n /**\n * Converts this [UInt] value to [Float].\n *\n * The resulting value is the closest `Float` to this `UInt` value.\n * In case when this `UInt` value is exactly between two `Float`s,\n * the one with zero at least significant bit of mantissa is selected.\n */\n @kotlin.internal.InlineOnly\n public inline fun toFloat(): Float = this.toDouble().toFloat()\n /**\n * Converts this [UInt] value to [Double].\n *\n * The resulting `Double` value represents the same numerical value as this `UInt`.\n */\n @kotlin.internal.InlineOnly\n public inline fun toDouble(): Double = uintToDouble(data)\n\n public override fun toString(): String = toLong().toString()\n\n}\n\n/**\n * Converts this [Byte] value to [UInt].\n *\n * If this value is positive, the resulting `UInt` value represents the same numerical value as this `Byte`.\n *\n * The least significant 8 bits of the resulting `UInt` value are the same as the bits of this `Byte` value,\n * whereas the most significant 24 bits are filled with the sign bit of this value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Byte.toUInt(): UInt = UInt(this.toInt())\n/**\n * Converts this [Short] value to [UInt].\n *\n * If this value is positive, the resulting `UInt` value represents the same numerical value as this `Short`.\n *\n * The least significant 16 bits of the resulting `UInt` value are the same as the bits of this `Short` value,\n * whereas the most significant 16 bits are filled with the sign bit of this value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Short.toUInt(): UInt = UInt(this.toInt())\n/**\n * Converts this [Int] value to [UInt].\n *\n * If this value is positive, the resulting `UInt` value represents the same numerical value as this `Int`.\n *\n * The resulting `UInt` value has the same binary representation as this `Int` value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Int.toUInt(): UInt = UInt(this)\n/**\n * Converts this [Long] value to [UInt].\n *\n * If this value is positive and less than or equals to [UInt.MAX_VALUE], the resulting `UInt` value represents\n * the same numerical value as this `Long`.\n *\n * The resulting `UInt` value is represented by the least significant 32 bits of this `Long` value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Long.toUInt(): UInt = UInt(this.toInt())\n\n/**\n * Converts this [Float] value to [UInt].\n *\n * The fractional part, if any, is rounded down towards zero.\n * Returns zero if this `Float` value is negative or `NaN`, [UInt.MAX_VALUE] if it's bigger than `UInt.MAX_VALUE`.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Float.toUInt(): UInt = doubleToUInt(this.toDouble())\n/**\n * Converts this [Double] value to [UInt].\n *\n * The fractional part, if any, is rounded down towards zero.\n * Returns zero if this `Double` value is negative or `NaN`, [UInt.MAX_VALUE] if it's bigger than `UInt.MAX_VALUE`.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Double.toUInt(): UInt = doubleToUInt(this)\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// Auto-generated file. DO NOT EDIT!\n\npackage kotlin\n\nimport kotlin.experimental.*\n\n@Suppress(\"NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic inline class UShort @PublishedApi internal constructor(@PublishedApi internal val data: Short) : Comparable {\n\n companion object {\n /**\n * A constant holding the minimum value an instance of UShort can have.\n */\n public const val MIN_VALUE: UShort = UShort(0)\n\n /**\n * A constant holding the maximum value an instance of UShort can have.\n */\n public const val MAX_VALUE: UShort = UShort(-1)\n\n /**\n * The number of bytes used to represent an instance of UShort in a binary form.\n */\n public const val SIZE_BYTES: Int = 2\n\n /**\n * The number of bits used to represent an instance of UShort in a binary form.\n */\n public const val SIZE_BITS: Int = 16\n }\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n public inline operator fun compareTo(other: UByte): Int = this.toInt().compareTo(other.toInt())\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n @Suppress(\"OVERRIDE_BY_INLINE\")\n public override inline operator fun compareTo(other: UShort): Int = this.toInt().compareTo(other.toInt())\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n public inline operator fun compareTo(other: UInt): Int = this.toUInt().compareTo(other)\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n public inline operator fun compareTo(other: ULong): Int = this.toULong().compareTo(other)\n\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: UByte): UInt = this.toUInt().plus(other.toUInt())\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: UShort): UInt = this.toUInt().plus(other.toUInt())\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: UInt): UInt = this.toUInt().plus(other)\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: ULong): ULong = this.toULong().plus(other)\n\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: UByte): UInt = this.toUInt().minus(other.toUInt())\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: UShort): UInt = this.toUInt().minus(other.toUInt())\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: UInt): UInt = this.toUInt().minus(other)\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: ULong): ULong = this.toULong().minus(other)\n\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: UByte): UInt = this.toUInt().times(other.toUInt())\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: UShort): UInt = this.toUInt().times(other.toUInt())\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: UInt): UInt = this.toUInt().times(other)\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: ULong): ULong = this.toULong().times(other)\n\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: UByte): UInt = this.toUInt().div(other.toUInt())\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: UShort): UInt = this.toUInt().div(other.toUInt())\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: UInt): UInt = this.toUInt().div(other)\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: ULong): ULong = this.toULong().div(other)\n\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: UByte): UInt = this.toUInt().rem(other.toUInt())\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: UShort): UInt = this.toUInt().rem(other.toUInt())\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: UInt): UInt = this.toUInt().rem(other)\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: ULong): ULong = this.toULong().rem(other)\n\n /** Increments this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun inc(): UShort = UShort(data.inc())\n /** Decrements this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun dec(): UShort = UShort(data.dec())\n\n /** Creates a range from this value to the specified [other] value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rangeTo(other: UShort): UIntRange = UIntRange(this.toUInt(), other.toUInt())\n\n /** Performs a bitwise AND operation between the two values. */\n @kotlin.internal.InlineOnly\n public inline infix fun and(other: UShort): UShort = UShort(this.data and other.data)\n /** Performs a bitwise OR operation between the two values. */\n @kotlin.internal.InlineOnly\n public inline infix fun or(other: UShort): UShort = UShort(this.data or other.data)\n /** Performs a bitwise XOR operation between the two values. */\n @kotlin.internal.InlineOnly\n public inline infix fun xor(other: UShort): UShort = UShort(this.data xor other.data)\n /** Inverts the bits in this value. */\n @kotlin.internal.InlineOnly\n public inline fun inv(): UShort = UShort(data.inv())\n\n /**\n * Converts this [UShort] value to [Byte].\n *\n * If this value is less than or equals to [Byte.MAX_VALUE], the resulting `Byte` value represents\n * the same numerical value as this `UShort`.\n *\n * The resulting `Byte` value is represented by the least significant 8 bits of this `UShort` value.\n * Note that the resulting `Byte` value may be negative.\n */\n @kotlin.internal.InlineOnly\n public inline fun toByte(): Byte = data.toByte()\n /**\n * Converts this [UShort] value to [Short].\n *\n * If this value is less than or equals to [Short.MAX_VALUE], the resulting `Short` value represents\n * the same numerical value as this `UShort`. Otherwise the result is negative.\n *\n * The resulting `Short` value has the same binary representation as this `UShort` value.\n */\n @kotlin.internal.InlineOnly\n public inline fun toShort(): Short = data\n /**\n * Converts this [UShort] value to [Int].\n *\n * The resulting `Int` value represents the same numerical value as this `UShort`.\n *\n * The least significant 16 bits of the resulting `Int` value are the same as the bits of this `UShort` value,\n * whereas the most significant 16 bits are filled with zeros.\n */\n @kotlin.internal.InlineOnly\n public inline fun toInt(): Int = data.toInt() and 0xFFFF\n /**\n * Converts this [UShort] value to [Long].\n *\n * The resulting `Long` value represents the same numerical value as this `UShort`.\n *\n * The least significant 16 bits of the resulting `Long` value are the same as the bits of this `UShort` value,\n * whereas the most significant 48 bits are filled with zeros.\n */\n @kotlin.internal.InlineOnly\n public inline fun toLong(): Long = data.toLong() and 0xFFFF\n\n /**\n * Converts this [UShort] value to [UByte].\n *\n * If this value is less than or equals to [UByte.MAX_VALUE], the resulting `UByte` value represents\n * the same numerical value as this `UShort`.\n *\n * The resulting `UByte` value is represented by the least significant 8 bits of this `UShort` value.\n */\n @kotlin.internal.InlineOnly\n public inline fun toUByte(): UByte = data.toUByte()\n /** Returns this value. */\n @kotlin.internal.InlineOnly\n public inline fun toUShort(): UShort = this\n /**\n * Converts this [UShort] value to [UInt].\n *\n * The resulting `UInt` value represents the same numerical value as this `UShort`.\n *\n * The least significant 16 bits of the resulting `UInt` value are the same as the bits of this `UShort` value,\n * whereas the most significant 16 bits are filled with zeros.\n */\n @kotlin.internal.InlineOnly\n public inline fun toUInt(): UInt = UInt(data.toInt() and 0xFFFF)\n /**\n * Converts this [UShort] value to [ULong].\n *\n * The resulting `ULong` value represents the same numerical value as this `UShort`.\n *\n * The least significant 16 bits of the resulting `ULong` value are the same as the bits of this `UShort` value,\n * whereas the most significant 48 bits are filled with zeros.\n */\n @kotlin.internal.InlineOnly\n public inline fun toULong(): ULong = ULong(data.toLong() and 0xFFFF)\n\n /**\n * Converts this [UShort] value to [Float].\n *\n * The resulting `Float` value represents the same numerical value as this `UShort`.\n */\n @kotlin.internal.InlineOnly\n public inline fun toFloat(): Float = this.toInt().toFloat()\n /**\n * Converts this [UShort] value to [Double].\n *\n * The resulting `Double` value represents the same numerical value as this `UShort`.\n */\n @kotlin.internal.InlineOnly\n public inline fun toDouble(): Double = this.toInt().toDouble()\n\n public override fun toString(): String = toInt().toString()\n\n}\n\n/**\n * Converts this [Byte] value to [UShort].\n *\n * If this value is positive, the resulting `UShort` value represents the same numerical value as this `Byte`.\n *\n * The least significant 8 bits of the resulting `UShort` value are the same as the bits of this `Byte` value,\n * whereas the most significant 8 bits are filled with the sign bit of this value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Byte.toUShort(): UShort = UShort(this.toShort())\n/**\n * Converts this [Short] value to [UShort].\n *\n * If this value is positive, the resulting `UShort` value represents the same numerical value as this `Short`.\n *\n * The resulting `UShort` value has the same binary representation as this `Short` value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Short.toUShort(): UShort = UShort(this)\n/**\n * Converts this [Int] value to [UShort].\n *\n * If this value is positive and less than or equals to [UShort.MAX_VALUE], the resulting `UShort` value represents\n * the same numerical value as this `Int`.\n *\n * The resulting `UShort` value is represented by the least significant 16 bits of this `Int` value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Int.toUShort(): UShort = UShort(this.toShort())\n/**\n * Converts this [Long] value to [UShort].\n *\n * If this value is positive and less than or equals to [UShort.MAX_VALUE], the resulting `UShort` value represents\n * the same numerical value as this `Long`.\n *\n * The resulting `UShort` value is represented by the least significant 16 bits of this `Long` value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Long.toUShort(): UShort = UShort(this.toShort())\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// Auto-generated file. DO NOT EDIT!\n\npackage kotlin.ranges\n\n/**\n * A range of values of type `Char`.\n */\npublic class CharRange(start: Char, endInclusive: Char) : CharProgression(start, endInclusive, 1), ClosedRange {\n override val start: Char get() = first\n override val endInclusive: Char get() = last\n\n override fun contains(value: Char): Boolean = first <= value && value <= last\n\n override fun isEmpty(): Boolean = first > last\n\n override fun equals(other: Any?): Boolean =\n other is CharRange && (isEmpty() && other.isEmpty() ||\n first == other.first && last == other.last)\n\n override fun hashCode(): Int =\n if (isEmpty()) -1 else (31 * first.toInt() + last.toInt())\n\n override fun toString(): String = \"$first..$last\"\n\n companion object {\n /** An empty range of values of type Char. */\n public val EMPTY: CharRange = CharRange(1.toChar(), 0.toChar())\n }\n}\n\n/**\n * A range of values of type `Int`.\n */\npublic class IntRange(start: Int, endInclusive: Int) : IntProgression(start, endInclusive, 1), ClosedRange {\n override val start: Int get() = first\n override val endInclusive: Int get() = last\n\n override fun contains(value: Int): Boolean = first <= value && value <= last\n\n override fun isEmpty(): Boolean = first > last\n\n override fun equals(other: Any?): Boolean =\n other is IntRange && (isEmpty() && other.isEmpty() ||\n first == other.first && last == other.last)\n\n override fun hashCode(): Int =\n if (isEmpty()) -1 else (31 * first + last)\n\n override fun toString(): String = \"$first..$last\"\n\n companion object {\n /** An empty range of values of type Int. */\n public val EMPTY: IntRange = IntRange(1, 0)\n }\n}\n\n/**\n * A range of values of type `Long`.\n */\npublic class LongRange(start: Long, endInclusive: Long) : LongProgression(start, endInclusive, 1), ClosedRange {\n override val start: Long get() = first\n override val endInclusive: Long get() = last\n\n override fun contains(value: Long): Boolean = first <= value && value <= last\n\n override fun isEmpty(): Boolean = first > last\n\n override fun equals(other: Any?): Boolean =\n other is LongRange && (isEmpty() && other.isEmpty() ||\n first == other.first && last == other.last)\n\n override fun hashCode(): Int =\n if (isEmpty()) -1 else (31 * (first xor (first ushr 32)) + (last xor (last ushr 32))).toInt()\n\n override fun toString(): String = \"$first..$last\"\n\n companion object {\n /** An empty range of values of type Long. */\n public val EMPTY: LongRange = LongRange(1, 0)\n }\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"CollectionsKt\")\n@file:OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n\npackage kotlin.collections\n\nimport kotlin.contracts.*\nimport kotlin.random.Random\n\ninternal object EmptyIterator : ListIterator {\n override fun hasNext(): Boolean = false\n override fun hasPrevious(): Boolean = false\n override fun nextIndex(): Int = 0\n override fun previousIndex(): Int = -1\n override fun next(): Nothing = throw NoSuchElementException()\n override fun previous(): Nothing = throw NoSuchElementException()\n}\n\ninternal object EmptyList : List, Serializable, RandomAccess {\n private const val serialVersionUID: Long = -7390468764508069838L\n\n override fun equals(other: Any?): Boolean = other is List<*> && other.isEmpty()\n override fun hashCode(): Int = 1\n override fun toString(): String = \"[]\"\n\n override val size: Int get() = 0\n override fun isEmpty(): Boolean = true\n override fun contains(element: Nothing): Boolean = false\n override fun containsAll(elements: Collection): Boolean = elements.isEmpty()\n\n override fun get(index: Int): Nothing = throw IndexOutOfBoundsException(\"Empty list doesn't contain element at index $index.\")\n override fun indexOf(element: Nothing): Int = -1\n override fun lastIndexOf(element: Nothing): Int = -1\n\n override fun iterator(): Iterator = EmptyIterator\n override fun listIterator(): ListIterator = EmptyIterator\n override fun listIterator(index: Int): ListIterator {\n if (index != 0) throw IndexOutOfBoundsException(\"Index: $index\")\n return EmptyIterator\n }\n\n override fun subList(fromIndex: Int, toIndex: Int): List {\n if (fromIndex == 0 && toIndex == 0) return this\n throw IndexOutOfBoundsException(\"fromIndex: $fromIndex, toIndex: $toIndex\")\n }\n\n private fun readResolve(): Any = EmptyList\n}\n\ninternal fun Array.asCollection(): Collection = ArrayAsCollection(this, isVarargs = false)\n\nprivate class ArrayAsCollection(val values: Array, val isVarargs: Boolean) : Collection {\n override val size: Int get() = values.size\n override fun isEmpty(): Boolean = values.isEmpty()\n override fun contains(element: T): Boolean = values.contains(element)\n override fun containsAll(elements: Collection): Boolean = elements.all { contains(it) }\n override fun iterator(): Iterator = values.iterator()\n // override hidden toArray implementation to prevent copying of values array\n public fun toArray(): Array = values.copyToArrayOfAny(isVarargs)\n}\n\n/**\n * Returns an empty read-only list. The returned list is serializable (JVM).\n * @sample samples.collections.Collections.Lists.emptyReadOnlyList\n */\npublic fun emptyList(): List = EmptyList\n\n/**\n * Returns a new read-only list of given elements. The returned list is serializable (JVM).\n * @sample samples.collections.Collections.Lists.readOnlyList\n */\npublic fun listOf(vararg elements: T): List = if (elements.size > 0) elements.asList() else emptyList()\n\n/**\n * Returns an empty read-only list. The returned list is serializable (JVM).\n * @sample samples.collections.Collections.Lists.emptyReadOnlyList\n */\n@kotlin.internal.InlineOnly\npublic inline fun listOf(): List = emptyList()\n\n/**\n * Returns an empty new [MutableList].\n * @sample samples.collections.Collections.Lists.emptyMutableList\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline fun mutableListOf(): MutableList = ArrayList()\n\n/**\n * Returns an empty new [ArrayList].\n * @sample samples.collections.Collections.Lists.emptyArrayList\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline fun arrayListOf(): ArrayList = ArrayList()\n\n/**\n * Returns a new [MutableList] with the given elements.\n * @sample samples.collections.Collections.Lists.mutableList\n */\npublic fun mutableListOf(vararg elements: T): MutableList =\n if (elements.size == 0) ArrayList() else ArrayList(ArrayAsCollection(elements, isVarargs = true))\n\n/**\n * Returns a new [ArrayList] with the given elements.\n * @sample samples.collections.Collections.Lists.arrayList\n */\npublic fun arrayListOf(vararg elements: T): ArrayList =\n if (elements.size == 0) ArrayList() else ArrayList(ArrayAsCollection(elements, isVarargs = true))\n\n/**\n * Returns a new read-only list either of single given element, if it is not null, or empty list if the element is null. The returned list is serializable (JVM).\n * @sample samples.collections.Collections.Lists.listOfNotNull\n */\npublic fun listOfNotNull(element: T?): List = if (element != null) listOf(element) else emptyList()\n\n/**\n * Returns a new read-only list only of those given elements, that are not null. The returned list is serializable (JVM).\n * @sample samples.collections.Collections.Lists.listOfNotNull\n */\npublic fun listOfNotNull(vararg elements: T?): List = elements.filterNotNull()\n\n/**\n * Creates a new read-only list with the specified [size], where each element is calculated by calling the specified\n * [init] function.\n *\n * The function [init] is called for each list element sequentially starting from the first one.\n * It should return the value for a list element given its index.\n *\n * @sample samples.collections.Collections.Lists.readOnlyListFromInitializer\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline fun List(size: Int, init: (index: Int) -> T): List = MutableList(size, init)\n\n/**\n * Creates a new mutable list with the specified [size], where each element is calculated by calling the specified\n * [init] function.\n *\n * The function [init] is called for each list element sequentially starting from the first one.\n * It should return the value for a list element given its index.\n *\n * @sample samples.collections.Collections.Lists.mutableListFromInitializer\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline fun MutableList(size: Int, init: (index: Int) -> T): MutableList {\n val list = ArrayList(size)\n repeat(size) { index -> list.add(init(index)) }\n return list\n}\n\n/**\n * Builds a new read-only [List] by populating a [MutableList] using the given [builderAction]\n * and returning a read-only list with the same elements.\n *\n * The list passed as a receiver to the [builderAction] is valid only inside that function.\n * Using it outside of the function produces an unspecified behavior.\n *\n * @sample samples.collections.Builders.Lists.buildListSample\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun buildList(@BuilderInference builderAction: MutableList.() -> Unit): List {\n contract { callsInPlace(builderAction, InvocationKind.EXACTLY_ONCE) }\n return buildListInternal(builderAction)\n}\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\ninternal expect inline fun buildListInternal(builderAction: MutableList.() -> Unit): List\n\n/**\n * Builds a new read-only [List] by populating a [MutableList] using the given [builderAction]\n * and returning a read-only list with the same elements.\n *\n * The list passed as a receiver to the [builderAction] is valid only inside that function.\n * Using it outside of the function produces an unspecified behavior.\n *\n * [capacity] is used to hint the expected number of elements added in the [builderAction].\n *\n * @throws IllegalArgumentException if the given [capacity] is negative.\n *\n * @sample samples.collections.Builders.Lists.buildListSampleWithCapacity\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun buildList(capacity: Int, @BuilderInference builderAction: MutableList.() -> Unit): List {\n contract { callsInPlace(builderAction, InvocationKind.EXACTLY_ONCE) }\n return buildListInternal(capacity, builderAction)\n}\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\ninternal expect inline fun buildListInternal(capacity: Int, builderAction: MutableList.() -> Unit): List\n\n/**\n * Returns an [IntRange] of the valid indices for this collection.\n * @sample samples.collections.Collections.Collections.indicesOfCollection\n */\npublic val Collection<*>.indices: IntRange\n get() = 0..size - 1\n\n/**\n * Returns the index of the last item in the list or -1 if the list is empty.\n *\n * @sample samples.collections.Collections.Lists.lastIndexOfList\n */\npublic val List.lastIndex: Int\n get() = this.size - 1\n\n/**\n * Returns `true` if the collection is not empty.\n * @sample samples.collections.Collections.Collections.collectionIsNotEmpty\n */\n@kotlin.internal.InlineOnly\npublic inline fun Collection.isNotEmpty(): Boolean = !isEmpty()\n\n/**\n * Returns `true` if this nullable collection is either null or empty.\n * @sample samples.collections.Collections.Collections.collectionIsNullOrEmpty\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun Collection?.isNullOrEmpty(): Boolean {\n contract {\n returns(false) implies (this@isNullOrEmpty != null)\n }\n\n return this == null || this.isEmpty()\n}\n\n/**\n * Returns this Collection if it's not `null` and the empty list otherwise.\n * @sample samples.collections.Collections.Collections.collectionOrEmpty\n */\n@kotlin.internal.InlineOnly\npublic inline fun Collection?.orEmpty(): Collection = this ?: emptyList()\n\n/**\n * Returns this List if it's not `null` and the empty list otherwise.\n * @sample samples.collections.Collections.Lists.listOrEmpty\n */\n@kotlin.internal.InlineOnly\npublic inline fun List?.orEmpty(): List = this ?: emptyList()\n\n/**\n * Returns this collection if it's not empty\n * or the result of calling [defaultValue] function if the collection is empty.\n *\n * @sample samples.collections.Collections.Collections.collectionIfEmpty\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun C.ifEmpty(defaultValue: () -> R): R where C : Collection<*>, C : R =\n if (isEmpty()) defaultValue() else this\n\n\n/**\n * Checks if all elements in the specified collection are contained in this collection.\n *\n * Allows to overcome type-safety restriction of `containsAll` that requires to pass a collection of type `Collection`.\n * @sample samples.collections.Collections.Collections.collectionContainsAll\n */\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\") // false warning, extension takes precedence in some cases\n@kotlin.internal.InlineOnly\npublic inline fun <@kotlin.internal.OnlyInputTypes T> Collection.containsAll(elements: Collection): Boolean = this.containsAll(elements)\n\n\n/**\n * Returns a new list with the elements of this list randomly shuffled\n * using the specified [random] instance as the source of randomness.\n */\n@SinceKotlin(\"1.3\")\npublic fun Iterable.shuffled(random: Random): List = toMutableList().apply { shuffle(random) }\n\n\ninternal fun List.optimizeReadOnlyList() = when (size) {\n 0 -> emptyList()\n 1 -> listOf(this[0])\n else -> this\n}\n\n/**\n * Searches this list or its range for the provided [element] using the binary search algorithm.\n * The list is expected to be sorted into ascending order according to the Comparable natural ordering of its elements,\n * otherwise the result is undefined.\n *\n * If the list contains multiple elements equal to the specified [element], there is no guarantee which one will be found.\n *\n * `null` value is considered to be less than any non-null value.\n *\n * @return the index of the element, if it is contained in the list within the specified range;\n * otherwise, the inverted insertion point `(-insertion point - 1)`.\n * The insertion point is defined as the index at which the element should be inserted,\n * so that the list (or the specified subrange of list) still remains sorted.\n * @sample samples.collections.Collections.Lists.binarySearchOnComparable\n * @sample samples.collections.Collections.Lists.binarySearchWithBoundaries\n */\npublic fun > List.binarySearch(element: T?, fromIndex: Int = 0, toIndex: Int = size): Int {\n rangeCheck(size, fromIndex, toIndex)\n\n var low = fromIndex\n var high = toIndex - 1\n\n while (low <= high) {\n val mid = (low + high).ushr(1) // safe from overflows\n val midVal = get(mid)\n val cmp = compareValues(midVal, element)\n\n if (cmp < 0)\n low = mid + 1\n else if (cmp > 0)\n high = mid - 1\n else\n return mid // key found\n }\n return -(low + 1) // key not found\n}\n\n/**\n * Searches this list or its range for the provided [element] using the binary search algorithm.\n * The list is expected to be sorted into ascending order according to the specified [comparator],\n * otherwise the result is undefined.\n *\n * If the list contains multiple elements equal to the specified [element], there is no guarantee which one will be found.\n *\n * `null` value is considered to be less than any non-null value.\n *\n * @return the index of the element, if it is contained in the list within the specified range;\n * otherwise, the inverted insertion point `(-insertion point - 1)`.\n * The insertion point is defined as the index at which the element should be inserted,\n * so that the list (or the specified subrange of list) still remains sorted according to the specified [comparator].\n * @sample samples.collections.Collections.Lists.binarySearchWithComparator\n */\npublic fun List.binarySearch(element: T, comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size): Int {\n rangeCheck(size, fromIndex, toIndex)\n\n var low = fromIndex\n var high = toIndex - 1\n\n while (low <= high) {\n val mid = (low + high).ushr(1) // safe from overflows\n val midVal = get(mid)\n val cmp = comparator.compare(midVal, element)\n\n if (cmp < 0)\n low = mid + 1\n else if (cmp > 0)\n high = mid - 1\n else\n return mid // key found\n }\n return -(low + 1) // key not found\n}\n\n/**\n * Searches this list or its range for an element having the key returned by the specified [selector] function\n * equal to the provided [key] value using the binary search algorithm.\n * The list is expected to be sorted into ascending order according to the Comparable natural ordering of keys of its elements.\n * otherwise the result is undefined.\n *\n * If the list contains multiple elements with the specified [key], there is no guarantee which one will be found.\n *\n * `null` value is considered to be less than any non-null value.\n *\n * @return the index of the element with the specified [key], if it is contained in the list within the specified range;\n * otherwise, the inverted insertion point `(-insertion point - 1)`.\n * The insertion point is defined as the index at which the element should be inserted,\n * so that the list (or the specified subrange of list) still remains sorted.\n * @sample samples.collections.Collections.Lists.binarySearchByKey\n */\npublic inline fun > List.binarySearchBy(\n key: K?,\n fromIndex: Int = 0,\n toIndex: Int = size,\n crossinline selector: (T) -> K?\n): Int =\n binarySearch(fromIndex, toIndex) { compareValues(selector(it), key) }\n\n// do not introduce this overload --- too rare\n//public fun List.binarySearchBy(key: K, comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size(), selector: (T) -> K): Int =\n// binarySearch(fromIndex, toIndex) { comparator.compare(selector(it), key) }\n\n\n/**\n * Searches this list or its range for an element for which the given [comparison] function returns zero using the binary search algorithm.\n *\n * The list is expected to be sorted so that the signs of the [comparison] function's return values ascend on the list elements,\n * i.e. negative values come before zero and zeroes come before positive values.\n * Otherwise, the result is undefined.\n *\n * If the list contains multiple elements for which [comparison] returns zero, there is no guarantee which one will be found.\n *\n * @param comparison function that returns zero when called on the list element being searched.\n * On the elements coming before the target element, the function must return negative values;\n * on the elements coming after the target element, the function must return positive values.\n *\n * @return the index of the found element, if it is contained in the list within the specified range;\n * otherwise, the inverted insertion point `(-insertion point - 1)`.\n * The insertion point is defined as the index at which the element should be inserted,\n * so that the list (or the specified subrange of list) still remains sorted.\n * @sample samples.collections.Collections.Lists.binarySearchWithComparisonFunction\n */\npublic fun List.binarySearch(fromIndex: Int = 0, toIndex: Int = size, comparison: (T) -> Int): Int {\n rangeCheck(size, fromIndex, toIndex)\n\n var low = fromIndex\n var high = toIndex - 1\n\n while (low <= high) {\n val mid = (low + high).ushr(1) // safe from overflows\n val midVal = get(mid)\n val cmp = comparison(midVal)\n\n if (cmp < 0)\n low = mid + 1\n else if (cmp > 0)\n high = mid - 1\n else\n return mid // key found\n }\n return -(low + 1) // key not found\n}\n\n/**\n * Checks that `from` and `to` are in\n * the range of [0..size] and throws an appropriate exception, if they aren't.\n */\nprivate fun rangeCheck(size: Int, fromIndex: Int, toIndex: Int) {\n when {\n fromIndex > toIndex -> throw IllegalArgumentException(\"fromIndex ($fromIndex) is greater than toIndex ($toIndex).\")\n fromIndex < 0 -> throw IndexOutOfBoundsException(\"fromIndex ($fromIndex) is less than zero.\")\n toIndex > size -> throw IndexOutOfBoundsException(\"toIndex ($toIndex) is greater than size ($size).\")\n }\n}\n\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\ninternal expect fun checkIndexOverflow(index: Int): Int\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\ninternal expect fun checkCountOverflow(count: Int): Int\n\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\ninternal fun throwIndexOverflow() { throw ArithmeticException(\"Index overflow has happened.\") }\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\ninternal fun throwCountOverflow() { throw ArithmeticException(\"Count overflow has happened.\") }\n\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"MapsKt\")\n@file:OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n\npackage kotlin.collections\n\nimport kotlin.contracts.*\n\nprivate object EmptyMap : Map, Serializable {\n private const val serialVersionUID: Long = 8246714829545688274\n\n override fun equals(other: Any?): Boolean = other is Map<*, *> && other.isEmpty()\n override fun hashCode(): Int = 0\n override fun toString(): String = \"{}\"\n\n override val size: Int get() = 0\n override fun isEmpty(): Boolean = true\n\n override fun containsKey(key: Any?): Boolean = false\n override fun containsValue(value: Nothing): Boolean = false\n override fun get(key: Any?): Nothing? = null\n override val entries: Set> get() = EmptySet\n override val keys: Set get() = EmptySet\n override val values: Collection get() = EmptyList\n\n private fun readResolve(): Any = EmptyMap\n}\n\n/**\n * Returns an empty read-only map of specified type.\n *\n * The returned map is serializable (JVM).\n * @sample samples.collections.Maps.Instantiation.emptyReadOnlyMap\n */\npublic fun emptyMap(): Map = @Suppress(\"UNCHECKED_CAST\") (EmptyMap as Map)\n\n/**\n * Returns a new read-only map with the specified contents, given as a list of pairs\n * where the first value is the key and the second is the value.\n *\n * If multiple pairs have the same key, the resulting map will contain the value from the last of those pairs.\n *\n * Entries of the map are iterated in the order they were specified.\n *\n * The returned map is serializable (JVM).\n *\n * @sample samples.collections.Maps.Instantiation.mapFromPairs\n */\npublic fun mapOf(vararg pairs: Pair): Map =\n if (pairs.size > 0) pairs.toMap(LinkedHashMap(mapCapacity(pairs.size))) else emptyMap()\n\n/**\n * Returns an empty read-only map.\n *\n * The returned map is serializable (JVM).\n * @sample samples.collections.Maps.Instantiation.emptyReadOnlyMap\n */\n@kotlin.internal.InlineOnly\npublic inline fun mapOf(): Map = emptyMap()\n\n/**\n * Returns an empty new [MutableMap].\n *\n * The returned map preserves the entry iteration order.\n * @sample samples.collections.Maps.Instantiation.emptyMutableMap\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline fun mutableMapOf(): MutableMap = LinkedHashMap()\n\n/**\n * Returns a new [MutableMap] with the specified contents, given as a list of pairs\n * where the first component is the key and the second is the value.\n *\n * If multiple pairs have the same key, the resulting map will contain the value from the last of those pairs.\n *\n * Entries of the map are iterated in the order they were specified.\n *\n * @sample samples.collections.Maps.Instantiation.mutableMapFromPairs\n * @sample samples.collections.Maps.Instantiation.emptyMutableMap\n */\npublic fun mutableMapOf(vararg pairs: Pair): MutableMap =\n LinkedHashMap(mapCapacity(pairs.size)).apply { putAll(pairs) }\n\n/**\n * Returns an empty new [HashMap].\n *\n * @sample samples.collections.Maps.Instantiation.emptyHashMap\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline fun hashMapOf(): HashMap = HashMap()\n\n/**\n * Returns a new [HashMap] with the specified contents, given as a list of pairs\n * where the first component is the key and the second is the value.\n *\n * @sample samples.collections.Maps.Instantiation.hashMapFromPairs\n */\npublic fun hashMapOf(vararg pairs: Pair): HashMap = HashMap(mapCapacity(pairs.size)).apply { putAll(pairs) }\n\n/**\n * Returns an empty new [LinkedHashMap].\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline fun linkedMapOf(): LinkedHashMap = LinkedHashMap()\n\n/**\n * Returns a new [LinkedHashMap] with the specified contents, given as a list of pairs\n * where the first component is the key and the second is the value.\n *\n * If multiple pairs have the same key, the resulting map will contain the value from the last of those pairs.\n *\n * Entries of the map are iterated in the order they were specified.\n *\n * @sample samples.collections.Maps.Instantiation.linkedMapFromPairs\n */\npublic fun linkedMapOf(vararg pairs: Pair): LinkedHashMap = pairs.toMap(LinkedHashMap(mapCapacity(pairs.size)))\n\n/**\n * Builds a new read-only [Map] by populating a [MutableMap] using the given [builderAction]\n * and returning a read-only map with the same key-value pairs.\n *\n * The map passed as a receiver to the [builderAction] is valid only inside that function.\n * Using it outside of the function produces an unspecified behavior.\n *\n * Entries of the map are iterated in the order they were added by the [builderAction].\n *\n * @sample samples.collections.Builders.Maps.buildMapSample\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun buildMap(@BuilderInference builderAction: MutableMap.() -> Unit): Map {\n contract { callsInPlace(builderAction, InvocationKind.EXACTLY_ONCE) }\n return buildMapInternal(builderAction)\n}\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\ninternal expect inline fun buildMapInternal(builderAction: MutableMap.() -> Unit): Map\n\n/**\n * Builds a new read-only [Map] by populating a [MutableMap] using the given [builderAction]\n * and returning a read-only map with the same key-value pairs.\n *\n * The map passed as a receiver to the [builderAction] is valid only inside that function.\n * Using it outside of the function produces an unspecified behavior.\n *\n * [capacity] is used to hint the expected number of pairs added in the [builderAction].\n *\n * Entries of the map are iterated in the order they were added by the [builderAction].\n *\n * @throws IllegalArgumentException if the given [capacity] is negative.\n *\n * @sample samples.collections.Builders.Maps.buildMapSample\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun buildMap(capacity: Int, @BuilderInference builderAction: MutableMap.() -> Unit): Map {\n contract { callsInPlace(builderAction, InvocationKind.EXACTLY_ONCE) }\n return buildMapInternal(capacity, builderAction)\n}\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\ninternal expect inline fun buildMapInternal(capacity: Int, builderAction: MutableMap.() -> Unit): Map\n\n/**\n * Calculate the initial capacity of a map.\n */\n@PublishedApi\ninternal expect fun mapCapacity(expectedSize: Int): Int\n\n/**\n * Returns `true` if this map is not empty.\n * @sample samples.collections.Maps.Usage.mapIsNotEmpty\n */\n@kotlin.internal.InlineOnly\npublic inline fun Map.isNotEmpty(): Boolean = !isEmpty()\n\n/**\n * Returns `true` if this nullable map is either null or empty.\n * @sample samples.collections.Maps.Usage.mapIsNullOrEmpty\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun Map?.isNullOrEmpty(): Boolean {\n contract {\n returns(false) implies (this@isNullOrEmpty != null)\n }\n\n return this == null || isEmpty()\n}\n\n/**\n * Returns the [Map] if its not `null`, or the empty [Map] otherwise.\n *\n * @sample samples.collections.Maps.Usage.mapOrEmpty\n */\n@kotlin.internal.InlineOnly\npublic inline fun Map?.orEmpty(): Map = this ?: emptyMap()\n\n/**\n * Returns this map if it's not empty\n * or the result of calling [defaultValue] function if the map is empty.\n *\n * @sample samples.collections.Maps.Usage.mapIfEmpty\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun M.ifEmpty(defaultValue: () -> R): R where M : Map<*, *>, M : R =\n if (isEmpty()) defaultValue() else this\n\n/**\n * Checks if the map contains the given key.\n *\n * This method allows to use the `x in map` syntax for checking whether an object is contained in the map.\n *\n * @sample samples.collections.Maps.Usage.containsKey\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun <@kotlin.internal.OnlyInputTypes K, V> Map.contains(key: K): Boolean = containsKey(key)\n\n/**\n * Returns the value corresponding to the given [key], or `null` if such a key is not present in the map.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun <@kotlin.internal.OnlyInputTypes K, V> Map.get(key: K): V? =\n @Suppress(\"UNCHECKED_CAST\") (this as Map).get(key)\n\n/**\n * Allows to use the index operator for storing values in a mutable map.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableMap.set(key: K, value: V): Unit {\n put(key, value)\n}\n\n/**\n * Returns `true` if the map contains the specified [key].\n *\n * Allows to overcome type-safety restriction of `containsKey` that requires to pass a key of type `K`.\n */\n@kotlin.internal.InlineOnly\npublic inline fun <@kotlin.internal.OnlyInputTypes K> Map.containsKey(key: K): Boolean =\n @Suppress(\"UNCHECKED_CAST\") (this as Map).containsKey(key)\n\n/**\n * Returns `true` if the map maps one or more keys to the specified [value].\n *\n * Allows to overcome type-safety restriction of `containsValue` that requires to pass a value of type `V`.\n *\n * @sample samples.collections.Maps.Usage.containsValue\n */\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\") // false warning, extension takes precedence in some cases\n@kotlin.internal.InlineOnly\npublic inline fun Map.containsValue(value: V): Boolean = this.containsValue(value)\n\n\n/**\n * Removes the specified key and its corresponding value from this map.\n *\n * @return the previous value associated with the key, or `null` if the key was not present in the map.\n\n * Allows to overcome type-safety restriction of `remove` that requires to pass a key of type `K`.\n */\n@kotlin.internal.InlineOnly\npublic inline fun <@kotlin.internal.OnlyInputTypes K, V> MutableMap.remove(key: K): V? =\n @Suppress(\"UNCHECKED_CAST\") (this as MutableMap).remove(key)\n\n/**\n * Returns the key component of the map entry.\n *\n * This method allows to use destructuring declarations when working with maps, for example:\n * ```\n * for ((key, value) in map) {\n * // do something with the key and the value\n * }\n * ```\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun Map.Entry.component1(): K = key\n\n/**\n * Returns the value component of the map entry.\n *\n * This method allows to use destructuring declarations when working with maps, for example:\n * ```\n * for ((key, value) in map) {\n * // do something with the key and the value\n * }\n * ```\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun Map.Entry.component2(): V = value\n\n/**\n * Converts entry to [Pair] with key being first component and value being second.\n */\n@kotlin.internal.InlineOnly\npublic inline fun Map.Entry.toPair(): Pair = Pair(key, value)\n\n/**\n * Returns the value for the given key, or the result of the [defaultValue] function if there was no entry for the given key.\n *\n * @sample samples.collections.Maps.Usage.getOrElse\n */\n@kotlin.internal.InlineOnly\npublic inline fun Map.getOrElse(key: K, defaultValue: () -> V): V = get(key) ?: defaultValue()\n\n\ninternal inline fun Map.getOrElseNullable(key: K, defaultValue: () -> V): V {\n val value = get(key)\n if (value == null && !containsKey(key)) {\n return defaultValue()\n } else {\n @Suppress(\"UNCHECKED_CAST\")\n return value as V\n }\n}\n\n/**\n * Returns the value for the given [key] or throws an exception if there is no such key in the map.\n *\n * If the map was created by [withDefault], resorts to its `defaultValue` provider function\n * instead of throwing an exception.\n *\n * @throws NoSuchElementException when the map doesn't contain a value for the specified key and\n * no implicit default value was provided for that map.\n */\n@SinceKotlin(\"1.1\")\npublic fun Map.getValue(key: K): V = getOrImplicitDefault(key)\n\n/**\n * Returns the value for the given key. If the key is not found in the map, calls the [defaultValue] function,\n * puts its result into the map under the given key and returns it.\n *\n * Note that the operation is not guaranteed to be atomic if the map is being modified concurrently.\n *\n * @sample samples.collections.Maps.Usage.getOrPut\n */\npublic inline fun MutableMap.getOrPut(key: K, defaultValue: () -> V): V {\n val value = get(key)\n return if (value == null) {\n val answer = defaultValue()\n put(key, answer)\n answer\n } else {\n value\n }\n}\n\n/**\n * Returns an [Iterator] over the entries in the [Map].\n *\n * @sample samples.collections.Maps.Usage.forOverEntries\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun Map.iterator(): Iterator> = entries.iterator()\n\n/**\n * Returns a [MutableIterator] over the mutable entries in the [MutableMap].\n *\n */\n@kotlin.jvm.JvmName(\"mutableIterator\")\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableMap.iterator(): MutableIterator> = entries.iterator()\n\n/**\n * Populates the given [destination] map with entries having the keys of this map and the values obtained\n * by applying the [transform] function to each entry in this [Map].\n */\npublic inline fun > Map.mapValuesTo(destination: M, transform: (Map.Entry) -> R): M {\n return entries.associateByTo(destination, { it.key }, transform)\n}\n\n/**\n * Populates the given [destination] map with entries having the keys obtained\n * by applying the [transform] function to each entry in this [Map] and the values of this map.\n *\n * In case if any two entries are mapped to the equal keys, the value of the latter one will overwrite\n * the value associated with the former one.\n */\npublic inline fun > Map.mapKeysTo(destination: M, transform: (Map.Entry) -> R): M {\n return entries.associateByTo(destination, transform, { it.value })\n}\n\n/**\n * Puts all the given [pairs] into this [MutableMap] with the first component in the pair being the key and the second the value.\n */\npublic fun MutableMap.putAll(pairs: Array>): Unit {\n for ((key, value) in pairs) {\n put(key, value)\n }\n}\n\n/**\n * Puts all the elements of the given collection into this [MutableMap] with the first component in the pair being the key and the second the value.\n */\npublic fun MutableMap.putAll(pairs: Iterable>): Unit {\n for ((key, value) in pairs) {\n put(key, value)\n }\n}\n\n/**\n * Puts all the elements of the given sequence into this [MutableMap] with the first component in the pair being the key and the second the value.\n */\npublic fun MutableMap.putAll(pairs: Sequence>): Unit {\n for ((key, value) in pairs) {\n put(key, value)\n }\n}\n\n/**\n * Returns a new map with entries having the keys of this map and the values obtained by applying the [transform]\n * function to each entry in this [Map].\n *\n * The returned map preserves the entry iteration order of the original map.\n *\n * @sample samples.collections.Maps.Transformations.mapValues\n */\npublic inline fun Map.mapValues(transform: (Map.Entry) -> R): Map {\n return mapValuesTo(LinkedHashMap(mapCapacity(size)), transform) // .optimizeReadOnlyMap()\n}\n\n/**\n * Returns a new Map with entries having the keys obtained by applying the [transform] function to each entry in this\n * [Map] and the values of this map.\n *\n * In case if any two entries are mapped to the equal keys, the value of the latter one will overwrite\n * the value associated with the former one.\n *\n * The returned map preserves the entry iteration order of the original map.\n *\n * @sample samples.collections.Maps.Transformations.mapKeys\n */\npublic inline fun Map.mapKeys(transform: (Map.Entry) -> R): Map {\n return mapKeysTo(LinkedHashMap(mapCapacity(size)), transform) // .optimizeReadOnlyMap()\n}\n\n/**\n * Returns a map containing all key-value pairs with keys matching the given [predicate].\n *\n * The returned map preserves the entry iteration order of the original map.\n * @sample samples.collections.Maps.Filtering.filterKeys\n */\npublic inline fun Map.filterKeys(predicate: (K) -> Boolean): Map {\n val result = LinkedHashMap()\n for (entry in this) {\n if (predicate(entry.key)) {\n result.put(entry.key, entry.value)\n }\n }\n return result\n}\n\n/**\n * Returns a map containing all key-value pairs with values matching the given [predicate].\n *\n * The returned map preserves the entry iteration order of the original map.\n * @sample samples.collections.Maps.Filtering.filterValues\n */\npublic inline fun Map.filterValues(predicate: (V) -> Boolean): Map {\n val result = LinkedHashMap()\n for (entry in this) {\n if (predicate(entry.value)) {\n result.put(entry.key, entry.value)\n }\n }\n return result\n}\n\n\n/**\n * Appends all entries matching the given [predicate] into the mutable map given as [destination] parameter.\n *\n * @return the destination map.\n * @sample samples.collections.Maps.Filtering.filterTo\n */\npublic inline fun > Map.filterTo(destination: M, predicate: (Map.Entry) -> Boolean): M {\n for (element in this) {\n if (predicate(element)) {\n destination.put(element.key, element.value)\n }\n }\n return destination\n}\n\n/**\n * Returns a new map containing all key-value pairs matching the given [predicate].\n *\n * The returned map preserves the entry iteration order of the original map.\n * @sample samples.collections.Maps.Filtering.filter\n */\npublic inline fun Map.filter(predicate: (Map.Entry) -> Boolean): Map {\n return filterTo(LinkedHashMap(), predicate)\n}\n\n/**\n * Appends all entries not matching the given [predicate] into the given [destination].\n *\n * @return the destination map.\n * @sample samples.collections.Maps.Filtering.filterNotTo\n */\npublic inline fun > Map.filterNotTo(destination: M, predicate: (Map.Entry) -> Boolean): M {\n for (element in this) {\n if (!predicate(element)) {\n destination.put(element.key, element.value)\n }\n }\n return destination\n}\n\n/**\n * Returns a new map containing all key-value pairs not matching the given [predicate].\n *\n * The returned map preserves the entry iteration order of the original map.\n * @sample samples.collections.Maps.Filtering.filterNot\n */\npublic inline fun Map.filterNot(predicate: (Map.Entry) -> Boolean): Map {\n return filterNotTo(LinkedHashMap(), predicate)\n}\n\n/**\n * Returns a new map containing all key-value pairs from the given collection of pairs.\n *\n * The returned map preserves the entry iteration order of the original collection.\n * If any of two pairs would have the same key the last one gets added to the map.\n */\npublic fun Iterable>.toMap(): Map {\n if (this is Collection) {\n return when (size) {\n 0 -> emptyMap()\n 1 -> mapOf(if (this is List) this[0] else iterator().next())\n else -> toMap(LinkedHashMap(mapCapacity(size)))\n }\n }\n return toMap(LinkedHashMap()).optimizeReadOnlyMap()\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs from the given collection of pairs.\n */\npublic fun > Iterable>.toMap(destination: M): M =\n destination.apply { putAll(this@toMap) }\n\n/**\n * Returns a new map containing all key-value pairs from the given array of pairs.\n *\n * The returned map preserves the entry iteration order of the original array.\n * If any of two pairs would have the same key the last one gets added to the map.\n */\npublic fun Array>.toMap(): Map = when (size) {\n 0 -> emptyMap()\n 1 -> mapOf(this[0])\n else -> toMap(LinkedHashMap(mapCapacity(size)))\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs from the given array of pairs.\n */\npublic fun > Array>.toMap(destination: M): M =\n destination.apply { putAll(this@toMap) }\n\n/**\n * Returns a new map containing all key-value pairs from the given sequence of pairs.\n *\n * The returned map preserves the entry iteration order of the original sequence.\n * If any of two pairs would have the same key the last one gets added to the map.\n */\npublic fun Sequence>.toMap(): Map = toMap(LinkedHashMap()).optimizeReadOnlyMap()\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs from the given sequence of pairs.\n */\npublic fun > Sequence>.toMap(destination: M): M =\n destination.apply { putAll(this@toMap) }\n\n/**\n * Returns a new read-only map containing all key-value pairs from the original map.\n *\n * The returned map preserves the entry iteration order of the original map.\n */\n@SinceKotlin(\"1.1\")\npublic fun Map.toMap(): Map = when (size) {\n 0 -> emptyMap()\n 1 -> toSingletonMap()\n else -> toMutableMap()\n}\n\n/**\n * Returns a new mutable map containing all key-value pairs from the original map.\n *\n * The returned map preserves the entry iteration order of the original map.\n */\n@SinceKotlin(\"1.1\")\npublic fun Map.toMutableMap(): MutableMap = LinkedHashMap(this)\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs from the given map.\n */\n@SinceKotlin(\"1.1\")\npublic fun > Map.toMap(destination: M): M =\n destination.apply { putAll(this@toMap) }\n\n/**\n * Creates a new read-only map by replacing or adding an entry to this map from a given key-value [pair].\n *\n * The returned map preserves the entry iteration order of the original map.\n * The [pair] is iterated in the end if it has a unique key.\n */\npublic operator fun Map.plus(pair: Pair): Map =\n if (this.isEmpty()) mapOf(pair) else LinkedHashMap(this).apply { put(pair.first, pair.second) }\n\n/**\n * Creates a new read-only map by replacing or adding entries to this map from a given collection of key-value [pairs].\n *\n * The returned map preserves the entry iteration order of the original map.\n * Those [pairs] with unique keys are iterated in the end in the order of [pairs] collection.\n */\npublic operator fun Map.plus(pairs: Iterable>): Map =\n if (this.isEmpty()) pairs.toMap() else LinkedHashMap(this).apply { putAll(pairs) }\n\n/**\n * Creates a new read-only map by replacing or adding entries to this map from a given array of key-value [pairs].\n *\n * The returned map preserves the entry iteration order of the original map.\n * Those [pairs] with unique keys are iterated in the end in the order of [pairs] array.\n */\npublic operator fun Map.plus(pairs: Array>): Map =\n if (this.isEmpty()) pairs.toMap() else LinkedHashMap(this).apply { putAll(pairs) }\n\n/**\n * Creates a new read-only map by replacing or adding entries to this map from a given sequence of key-value [pairs].\n *\n * The returned map preserves the entry iteration order of the original map.\n * Those [pairs] with unique keys are iterated in the end in the order of [pairs] sequence.\n */\npublic operator fun Map.plus(pairs: Sequence>): Map =\n LinkedHashMap(this).apply { putAll(pairs) }.optimizeReadOnlyMap()\n\n/**\n * Creates a new read-only map by replacing or adding entries to this map from another [map].\n *\n * The returned map preserves the entry iteration order of the original map.\n * Those entries of another [map] that are missing in this map are iterated in the end in the order of that [map].\n */\npublic operator fun Map.plus(map: Map): Map =\n LinkedHashMap(this).apply { putAll(map) }\n\n\n/**\n * Appends or replaces the given [pair] in this mutable map.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableMap.plusAssign(pair: Pair) {\n put(pair.first, pair.second)\n}\n\n/**\n * Appends or replaces all pairs from the given collection of [pairs] in this mutable map.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableMap.plusAssign(pairs: Iterable>) {\n putAll(pairs)\n}\n\n/**\n * Appends or replaces all pairs from the given array of [pairs] in this mutable map.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableMap.plusAssign(pairs: Array>) {\n putAll(pairs)\n}\n\n/**\n * Appends or replaces all pairs from the given sequence of [pairs] in this mutable map.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableMap.plusAssign(pairs: Sequence>) {\n putAll(pairs)\n}\n\n/**\n * Appends or replaces all entries from the given [map] in this mutable map.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableMap.plusAssign(map: Map) {\n putAll(map)\n}\n\n/**\n * Returns a map containing all entries of the original map except the entry with the given [key].\n *\n * The returned map preserves the entry iteration order of the original map.\n */\n@SinceKotlin(\"1.1\")\npublic operator fun Map.minus(key: K): Map =\n this.toMutableMap().apply { minusAssign(key) }.optimizeReadOnlyMap()\n\n/**\n * Returns a map containing all entries of the original map except those entries\n * the keys of which are contained in the given [keys] collection.\n *\n * The returned map preserves the entry iteration order of the original map.\n */\n@SinceKotlin(\"1.1\")\npublic operator fun Map.minus(keys: Iterable): Map =\n this.toMutableMap().apply { minusAssign(keys) }.optimizeReadOnlyMap()\n\n/**\n * Returns a map containing all entries of the original map except those entries\n * the keys of which are contained in the given [keys] array.\n *\n * The returned map preserves the entry iteration order of the original map.\n */\n@SinceKotlin(\"1.1\")\npublic operator fun Map.minus(keys: Array): Map =\n this.toMutableMap().apply { minusAssign(keys) }.optimizeReadOnlyMap()\n\n/**\n * Returns a map containing all entries of the original map except those entries\n * the keys of which are contained in the given [keys] sequence.\n *\n * The returned map preserves the entry iteration order of the original map.\n */\n@SinceKotlin(\"1.1\")\npublic operator fun Map.minus(keys: Sequence): Map =\n this.toMutableMap().apply { minusAssign(keys) }.optimizeReadOnlyMap()\n\n/**\n * Removes the entry with the given [key] from this mutable map.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableMap.minusAssign(key: K) {\n remove(key)\n}\n\n/**\n * Removes all entries the keys of which are contained in the given [keys] collection from this mutable map.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableMap.minusAssign(keys: Iterable) {\n this.keys.removeAll(keys)\n}\n\n/**\n * Removes all entries the keys of which are contained in the given [keys] array from this mutable map.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableMap.minusAssign(keys: Array) {\n this.keys.removeAll(keys)\n}\n\n/**\n * Removes all entries from the keys of which are contained in the given [keys] sequence from this mutable map.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableMap.minusAssign(keys: Sequence) {\n this.keys.removeAll(keys)\n}\n\n\n// do not expose for now @PublishedApi\ninternal fun Map.optimizeReadOnlyMap() = when (size) {\n 0 -> emptyMap()\n 1 -> toSingletonMapOrSelf()\n else -> this\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"SetsKt\")\n@file:OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n\npackage kotlin.collections\n\nimport kotlin.contracts.*\n\ninternal object EmptySet : Set, Serializable {\n private const val serialVersionUID: Long = 3406603774387020532\n\n override fun equals(other: Any?): Boolean = other is Set<*> && other.isEmpty()\n override fun hashCode(): Int = 0\n override fun toString(): String = \"[]\"\n\n override val size: Int get() = 0\n override fun isEmpty(): Boolean = true\n override fun contains(element: Nothing): Boolean = false\n override fun containsAll(elements: Collection): Boolean = elements.isEmpty()\n\n override fun iterator(): Iterator = EmptyIterator\n\n private fun readResolve(): Any = EmptySet\n}\n\n\n/**\n * Returns an empty read-only set. The returned set is serializable (JVM).\n * @sample samples.collections.Collections.Sets.emptyReadOnlySet\n */\npublic fun emptySet(): Set = EmptySet\n\n/**\n * Returns a new read-only set with the given elements.\n * Elements of the set are iterated in the order they were specified.\n * The returned set is serializable (JVM).\n * @sample samples.collections.Collections.Sets.readOnlySet\n */\npublic fun setOf(vararg elements: T): Set = if (elements.size > 0) elements.toSet() else emptySet()\n\n/**\n * Returns an empty read-only set. The returned set is serializable (JVM).\n * @sample samples.collections.Collections.Sets.emptyReadOnlySet\n */\n@kotlin.internal.InlineOnly\npublic inline fun setOf(): Set = emptySet()\n\n/**\n * Returns an empty new [MutableSet].\n *\n * The returned set preserves the element iteration order.\n * @sample samples.collections.Collections.Sets.emptyMutableSet\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline fun mutableSetOf(): MutableSet = LinkedHashSet()\n\n/**\n * Returns a new [MutableSet] with the given elements.\n * Elements of the set are iterated in the order they were specified.\n * @sample samples.collections.Collections.Sets.mutableSet\n */\npublic fun mutableSetOf(vararg elements: T): MutableSet = elements.toCollection(LinkedHashSet(mapCapacity(elements.size)))\n\n/** Returns an empty new [HashSet]. */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline fun hashSetOf(): HashSet = HashSet()\n\n/** Returns a new [HashSet] with the given elements. */\npublic fun hashSetOf(vararg elements: T): HashSet = elements.toCollection(HashSet(mapCapacity(elements.size)))\n\n/**\n * Returns an empty new [LinkedHashSet].\n * @sample samples.collections.Collections.Sets.emptyLinkedHashSet\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline fun linkedSetOf(): LinkedHashSet = LinkedHashSet()\n\n/**\n * Returns a new [LinkedHashSet] with the given elements.\n * Elements of the set are iterated in the order they were specified.\n * @sample samples.collections.Collections.Sets.linkedHashSet\n */\npublic fun linkedSetOf(vararg elements: T): LinkedHashSet = elements.toCollection(LinkedHashSet(mapCapacity(elements.size)))\n\n/**\n * Returns a new read-only set either with single given element, if it is not null, or empty set if the element is null.\n * The returned set is serializable (JVM).\n * @sample samples.collections.Collections.Sets.setOfNotNull\n */\n@SinceKotlin(\"1.4\")\npublic fun setOfNotNull(element: T?): Set = if (element != null) setOf(element) else emptySet()\n\n/**\n * Returns a new read-only set only with those given elements, that are not null.\n * Elements of the set are iterated in the order they were specified.\n * The returned set is serializable (JVM).\n * @sample samples.collections.Collections.Sets.setOfNotNull\n */\n@SinceKotlin(\"1.4\")\npublic fun setOfNotNull(vararg elements: T?): Set {\n return elements.filterNotNullTo(LinkedHashSet())\n}\n\n/**\n * Builds a new read-only [Set] by populating a [MutableSet] using the given [builderAction]\n * and returning a read-only set with the same elements.\n *\n * The set passed as a receiver to the [builderAction] is valid only inside that function.\n * Using it outside of the function produces an unspecified behavior.\n *\n * Elements of the set are iterated in the order they were added by the [builderAction].\n *\n * @sample samples.collections.Builders.Sets.buildSetSample\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun buildSet(@BuilderInference builderAction: MutableSet.() -> Unit): Set {\n contract { callsInPlace(builderAction, InvocationKind.EXACTLY_ONCE) }\n return buildSetInternal(builderAction)\n}\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\ninternal expect inline fun buildSetInternal(builderAction: MutableSet.() -> Unit): Set\n\n/**\n * Builds a new read-only [Set] by populating a [MutableSet] using the given [builderAction]\n * and returning a read-only set with the same elements.\n *\n * The set passed as a receiver to the [builderAction] is valid only inside that function.\n * Using it outside of the function produces an unspecified behavior.\n *\n * [capacity] is used to hint the expected number of elements added in the [builderAction].\n *\n * Elements of the set are iterated in the order they were added by the [builderAction].\n *\n * @throws IllegalArgumentException if the given [capacity] is negative.\n *\n * @sample samples.collections.Builders.Sets.buildSetSample\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic inline fun buildSet(capacity: Int, @BuilderInference builderAction: MutableSet.() -> Unit): Set {\n contract { callsInPlace(builderAction, InvocationKind.EXACTLY_ONCE) }\n return buildSetInternal(capacity, builderAction)\n}\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\ninternal expect inline fun buildSetInternal(capacity: Int, builderAction: MutableSet.() -> Unit): Set\n\n\n/** Returns this Set if it's not `null` and the empty set otherwise. */\n@kotlin.internal.InlineOnly\npublic inline fun Set?.orEmpty(): Set = this ?: emptySet()\n\ninternal fun Set.optimizeReadOnlySet() = when (size) {\n 0 -> emptySet()\n 1 -> setOf(iterator().next())\n else -> this\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"StringsKt\")\n@file:Suppress(\"PLATFORM_CLASS_MAPPED_TO_KOTLIN\")\n\npackage kotlin.text\n\n/**\n * Parses the string as a signed [Byte] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n */\n@SinceKotlin(\"1.1\")\npublic fun String.toByteOrNull(): Byte? = toByteOrNull(radix = 10)\n\n/**\n * Parses the string as a signed [Byte] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\n@SinceKotlin(\"1.1\")\npublic fun String.toByteOrNull(radix: Int): Byte? {\n val int = this.toIntOrNull(radix) ?: return null\n if (int < Byte.MIN_VALUE || int > Byte.MAX_VALUE) return null\n return int.toByte()\n}\n\n/**\n * Parses the string as a [Short] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n */\n@SinceKotlin(\"1.1\")\npublic fun String.toShortOrNull(): Short? = toShortOrNull(radix = 10)\n\n/**\n * Parses the string as a [Short] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\n@SinceKotlin(\"1.1\")\npublic fun String.toShortOrNull(radix: Int): Short? {\n val int = this.toIntOrNull(radix) ?: return null\n if (int < Short.MIN_VALUE || int > Short.MAX_VALUE) return null\n return int.toShort()\n}\n\n/**\n * Parses the string as an [Int] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n */\n@SinceKotlin(\"1.1\")\npublic fun String.toIntOrNull(): Int? = toIntOrNull(radix = 10)\n\n/**\n * Parses the string as an [Int] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\n@SinceKotlin(\"1.1\")\npublic fun String.toIntOrNull(radix: Int): Int? {\n checkRadix(radix)\n\n val length = this.length\n if (length == 0) return null\n\n val start: Int\n val isNegative: Boolean\n val limit: Int\n\n val firstChar = this[0]\n if (firstChar < '0') { // Possible leading sign\n if (length == 1) return null // non-digit (possible sign) only, no digits after\n\n start = 1\n\n if (firstChar == '-') {\n isNegative = true\n limit = Int.MIN_VALUE\n } else if (firstChar == '+') {\n isNegative = false\n limit = -Int.MAX_VALUE\n } else\n return null\n } else {\n start = 0\n isNegative = false\n limit = -Int.MAX_VALUE\n }\n\n\n val limitForMaxRadix = (-Int.MAX_VALUE) / 36\n\n var limitBeforeMul = limitForMaxRadix\n var result = 0\n for (i in start until length) {\n val digit = digitOf(this[i], radix)\n\n if (digit < 0) return null\n if (result < limitBeforeMul) {\n if (limitBeforeMul == limitForMaxRadix) {\n limitBeforeMul = limit / radix\n\n if (result < limitBeforeMul) {\n return null\n }\n } else {\n return null\n }\n }\n\n result *= radix\n\n if (result < limit + digit) return null\n\n result -= digit\n }\n\n return if (isNegative) result else -result\n}\n\n/**\n * Parses the string as a [Long] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n */\n@SinceKotlin(\"1.1\")\npublic fun String.toLongOrNull(): Long? = toLongOrNull(radix = 10)\n\n/**\n * Parses the string as a [Long] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\n@SinceKotlin(\"1.1\")\npublic fun String.toLongOrNull(radix: Int): Long? {\n checkRadix(radix)\n\n val length = this.length\n if (length == 0) return null\n\n val start: Int\n val isNegative: Boolean\n val limit: Long\n\n val firstChar = this[0]\n if (firstChar < '0') { // Possible leading sign\n if (length == 1) return null // non-digit (possible sign) only, no digits after\n\n start = 1\n\n if (firstChar == '-') {\n isNegative = true\n limit = Long.MIN_VALUE\n } else if (firstChar == '+') {\n isNegative = false\n limit = -Long.MAX_VALUE\n } else\n return null\n } else {\n start = 0\n isNegative = false\n limit = -Long.MAX_VALUE\n }\n\n\n val limitForMaxRadix = (-Long.MAX_VALUE) / 36\n\n var limitBeforeMul = limitForMaxRadix\n var result = 0L\n for (i in start until length) {\n val digit = digitOf(this[i], radix)\n\n if (digit < 0) return null\n if (result < limitBeforeMul) {\n if (limitBeforeMul == limitForMaxRadix) {\n limitBeforeMul = limit / radix\n\n if (result < limitBeforeMul) {\n return null\n }\n } else {\n return null\n }\n }\n\n result *= radix\n\n if (result < limit + digit) return null\n\n result -= digit\n }\n\n return if (isNegative) result else -result\n}\n\n\ninternal fun numberFormatError(input: String): Nothing = throw NumberFormatException(\"Invalid number format: '$input'\")\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n@file:kotlin.jvm.JvmName(\"UnsignedKt\")\n@file:OptIn(ExperimentalUnsignedTypes::class)\npackage kotlin\n\n@PublishedApi\ninternal fun uintCompare(v1: Int, v2: Int): Int = (v1 xor Int.MIN_VALUE).compareTo(v2 xor Int.MIN_VALUE)\n@PublishedApi\ninternal fun ulongCompare(v1: Long, v2: Long): Int = (v1 xor Long.MIN_VALUE).compareTo(v2 xor Long.MIN_VALUE)\n\n@PublishedApi\ninternal fun uintDivide(v1: UInt, v2: UInt): UInt = (v1.toLong() / v2.toLong()).toUInt()\n@PublishedApi\ninternal fun uintRemainder(v1: UInt, v2: UInt): UInt = (v1.toLong() % v2.toLong()).toUInt()\n\n// Division and remainder are based on Guava's UnsignedLongs implementation\n// Copyright 2011 The Guava Authors\n\n@PublishedApi\ninternal fun ulongDivide(v1: ULong, v2: ULong): ULong {\n val dividend = v1.toLong()\n val divisor = v2.toLong()\n if (divisor < 0) { // i.e., divisor >= 2^63:\n return if (v1 < v2) ULong(0) else ULong(1)\n }\n\n // Optimization - use signed division if both dividend and divisor < 2^63\n if (dividend >= 0) {\n return ULong(dividend / divisor)\n }\n\n // Otherwise, approximate the quotient, check, and correct if necessary.\n val quotient = ((dividend ushr 1) / divisor) shl 1\n val rem = dividend - quotient * divisor\n return ULong(quotient + if (ULong(rem) >= ULong(divisor)) 1 else 0)\n\n}\n\n@PublishedApi\ninternal fun ulongRemainder(v1: ULong, v2: ULong): ULong {\n val dividend = v1.toLong()\n val divisor = v2.toLong()\n if (divisor < 0) { // i.e., divisor >= 2^63:\n return if (v1 < v2) {\n v1 // dividend < divisor\n } else {\n v1 - v2 // dividend >= divisor\n }\n }\n\n // Optimization - use signed modulus if both dividend and divisor < 2^63\n if (dividend >= 0) {\n return ULong(dividend % divisor)\n }\n\n // Otherwise, approximate the quotient, check, and correct if necessary.\n val quotient = ((dividend ushr 1) / divisor) shl 1\n val rem = dividend - quotient * divisor\n return ULong(rem - if (ULong(rem) >= ULong(divisor)) divisor else 0)\n}\n\n@PublishedApi\ninternal fun doubleToUInt(v: Double): UInt = when {\n v.isNaN() -> 0u\n v <= UInt.MIN_VALUE.toDouble() -> UInt.MIN_VALUE\n v >= UInt.MAX_VALUE.toDouble() -> UInt.MAX_VALUE\n v <= Int.MAX_VALUE -> v.toInt().toUInt()\n else -> (v - Int.MAX_VALUE).toInt().toUInt() + Int.MAX_VALUE.toUInt() // Int.MAX_VALUE < v < UInt.MAX_VALUE\n}\n\n@PublishedApi\ninternal fun doubleToULong(v: Double): ULong = when {\n v.isNaN() -> 0u\n v <= ULong.MIN_VALUE.toDouble() -> ULong.MIN_VALUE\n v >= ULong.MAX_VALUE.toDouble() -> ULong.MAX_VALUE\n v < Long.MAX_VALUE -> v.toLong().toULong()\n\n // Real values from Long.MAX_VALUE to (Long.MAX_VALUE + 1) are not representable in Double, so don't handle them.\n else -> (v - 9223372036854775808.0).toLong().toULong() + 9223372036854775808uL // Long.MAX_VALUE + 1 < v < ULong.MAX_VALUE\n}\n\n\n@PublishedApi\ninternal fun uintToDouble(v: Int): Double = (v and Int.MAX_VALUE).toDouble() + (v ushr 31 shl 30).toDouble() * 2\n\n@PublishedApi\ninternal fun ulongToDouble(v: Long): Double = (v ushr 11).toDouble() * 2048 + (v and 2047)\n\n\ninternal fun ulongToString(v: Long): String = ulongToString(v, 10)\n\ninternal fun ulongToString(v: Long, base: Int): String {\n if (v >= 0) return v.toString(base)\n\n var quotient = ((v ushr 1) / base) shl 1\n var rem = v - quotient * base\n if (rem >= base) {\n rem -= base\n quotient += 1\n }\n return quotient.toString(base) + rem.toString(base)\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"SequencesKt\")\n\npackage kotlin.sequences\n\nimport kotlin.random.Random\n\n/**\n * Given an [iterator] function constructs a [Sequence] that returns values through the [Iterator]\n * provided by that function.\n * The values are evaluated lazily, and the sequence is potentially infinite.\n *\n * @sample samples.collections.Sequences.Building.sequenceFromIterator\n */\n@kotlin.internal.InlineOnly\npublic inline fun Sequence(crossinline iterator: () -> Iterator): Sequence = object : Sequence {\n override fun iterator(): Iterator = iterator()\n}\n\n/**\n * Creates a sequence that returns all elements from this iterator. The sequence is constrained to be iterated only once.\n *\n * @sample samples.collections.Sequences.Building.sequenceFromIterator\n */\npublic fun Iterator.asSequence(): Sequence = Sequence { this }.constrainOnce()\n\n/**\n * Creates a sequence that returns the specified values.\n *\n * @sample samples.collections.Sequences.Building.sequenceOfValues\n */\npublic fun sequenceOf(vararg elements: T): Sequence = if (elements.isEmpty()) emptySequence() else elements.asSequence()\n\n/**\n * Returns an empty sequence.\n */\npublic fun emptySequence(): Sequence = EmptySequence\n\nprivate object EmptySequence : Sequence, DropTakeSequence {\n override fun iterator(): Iterator = EmptyIterator\n override fun drop(n: Int) = EmptySequence\n override fun take(n: Int) = EmptySequence\n}\n\n/**\n * Returns this sequence if it's not `null` and the empty sequence otherwise.\n * @sample samples.collections.Sequences.Usage.sequenceOrEmpty\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun Sequence?.orEmpty(): Sequence = this ?: emptySequence()\n\n\n/**\n * Returns a sequence that iterates through the elements either of this sequence\n * or, if this sequence turns out to be empty, of the sequence returned by [defaultValue] function.\n *\n * @sample samples.collections.Sequences.Usage.sequenceIfEmpty\n */\n@SinceKotlin(\"1.3\")\npublic fun Sequence.ifEmpty(defaultValue: () -> Sequence): Sequence = sequence {\n val iterator = this@ifEmpty.iterator()\n if (iterator.hasNext()) {\n yieldAll(iterator)\n } else {\n yieldAll(defaultValue())\n }\n}\n\n/**\n * Returns a sequence of all elements from all sequences in this sequence.\n *\n * The operation is _intermediate_ and _stateless_.\n *\n * @sample samples.collections.Sequences.Transformations.flattenSequenceOfSequences\n */\npublic fun Sequence>.flatten(): Sequence = flatten { it.iterator() }\n\n/**\n * Returns a sequence of all elements from all iterables in this sequence.\n *\n * The operation is _intermediate_ and _stateless_.\n *\n * @sample samples.collections.Sequences.Transformations.flattenSequenceOfLists\n */\n@kotlin.jvm.JvmName(\"flattenSequenceOfIterable\")\npublic fun Sequence>.flatten(): Sequence = flatten { it.iterator() }\n\nprivate fun Sequence.flatten(iterator: (T) -> Iterator): Sequence {\n if (this is TransformingSequence<*, *>) {\n return (this as TransformingSequence<*, T>).flatten(iterator)\n }\n return FlatteningSequence(this, { it }, iterator)\n}\n\n/**\n * Returns a pair of lists, where\n * *first* list is built from the first values of each pair from this sequence,\n * *second* list is built from the second values of each pair from this sequence.\n *\n * The operation is _terminal_.\n *\n * @sample samples.collections.Sequences.Transformations.unzip\n */\npublic fun Sequence>.unzip(): Pair, List> {\n val listT = ArrayList()\n val listR = ArrayList()\n for (pair in this) {\n listT.add(pair.first)\n listR.add(pair.second)\n }\n return listT to listR\n}\n\n/**\n * Returns a sequence that yields elements of this sequence randomly shuffled.\n *\n * Note that every iteration of the sequence returns elements in a different order.\n *\n * The operation is _intermediate_ and _stateful_.\n */\n@SinceKotlin(\"1.4\")\npublic fun Sequence.shuffled(): Sequence = shuffled(Random)\n\n/**\n * Returns a sequence that yields elements of this sequence randomly shuffled\n * using the specified [random] instance as the source of randomness.\n *\n * Note that every iteration of the sequence returns elements in a different order.\n *\n * The operation is _intermediate_ and _stateful_.\n */\n@SinceKotlin(\"1.4\")\npublic fun Sequence.shuffled(random: Random): Sequence = sequence {\n val buffer = toMutableList()\n while (buffer.isNotEmpty()) {\n val j = random.nextInt(buffer.size)\n val last = @OptIn(ExperimentalStdlibApi::class) buffer.removeLast()\n val value = if (j < buffer.size) buffer.set(j, last) else last\n yield(value)\n }\n}\n\n\n/**\n * A sequence that returns the values from the underlying [sequence] that either match or do not match\n * the specified [predicate].\n *\n * @param sendWhen If `true`, values for which the predicate returns `true` are returned. Otherwise,\n * values for which the predicate returns `false` are returned\n */\ninternal class FilteringSequence(\n private val sequence: Sequence,\n private val sendWhen: Boolean = true,\n private val predicate: (T) -> Boolean\n) : Sequence {\n\n override fun iterator(): Iterator = object : Iterator {\n val iterator = sequence.iterator()\n var nextState: Int = -1 // -1 for unknown, 0 for done, 1 for continue\n var nextItem: T? = null\n\n private fun calcNext() {\n while (iterator.hasNext()) {\n val item = iterator.next()\n if (predicate(item) == sendWhen) {\n nextItem = item\n nextState = 1\n return\n }\n }\n nextState = 0\n }\n\n override fun next(): T {\n if (nextState == -1)\n calcNext()\n if (nextState == 0)\n throw NoSuchElementException()\n val result = nextItem\n nextItem = null\n nextState = -1\n @Suppress(\"UNCHECKED_CAST\")\n return result as T\n }\n\n override fun hasNext(): Boolean {\n if (nextState == -1)\n calcNext()\n return nextState == 1\n }\n }\n}\n\n/**\n * A sequence which returns the results of applying the given [transformer] function to the values\n * in the underlying [sequence].\n */\n\ninternal class TransformingSequence\nconstructor(private val sequence: Sequence, private val transformer: (T) -> R) : Sequence {\n override fun iterator(): Iterator = object : Iterator {\n val iterator = sequence.iterator()\n override fun next(): R {\n return transformer(iterator.next())\n }\n\n override fun hasNext(): Boolean {\n return iterator.hasNext()\n }\n }\n\n internal fun flatten(iterator: (R) -> Iterator): Sequence {\n return FlatteningSequence(sequence, transformer, iterator)\n }\n}\n\n/**\n * A sequence which returns the results of applying the given [transformer] function to the values\n * in the underlying [sequence], where the transformer function takes the index of the value in the underlying\n * sequence along with the value itself.\n */\ninternal class TransformingIndexedSequence\nconstructor(private val sequence: Sequence, private val transformer: (Int, T) -> R) : Sequence {\n override fun iterator(): Iterator = object : Iterator {\n val iterator = sequence.iterator()\n var index = 0\n override fun next(): R {\n return transformer(checkIndexOverflow(index++), iterator.next())\n }\n\n override fun hasNext(): Boolean {\n return iterator.hasNext()\n }\n }\n}\n\n/**\n * A sequence which combines values from the underlying [sequence] with their indices and returns them as\n * [IndexedValue] objects.\n */\ninternal class IndexingSequence\nconstructor(private val sequence: Sequence) : Sequence> {\n override fun iterator(): Iterator> = object : Iterator> {\n val iterator = sequence.iterator()\n var index = 0\n override fun next(): IndexedValue {\n return IndexedValue(checkIndexOverflow(index++), iterator.next())\n }\n\n override fun hasNext(): Boolean {\n return iterator.hasNext()\n }\n }\n}\n\n/**\n * A sequence which takes the values from two parallel underlying sequences, passes them to the given\n * [transform] function and returns the values returned by that function. The sequence stops returning\n * values as soon as one of the underlying sequences stops returning values.\n */\ninternal class MergingSequence\nconstructor(\n private val sequence1: Sequence,\n private val sequence2: Sequence,\n private val transform: (T1, T2) -> V\n) : Sequence {\n override fun iterator(): Iterator = object : Iterator {\n val iterator1 = sequence1.iterator()\n val iterator2 = sequence2.iterator()\n override fun next(): V {\n return transform(iterator1.next(), iterator2.next())\n }\n\n override fun hasNext(): Boolean {\n return iterator1.hasNext() && iterator2.hasNext()\n }\n }\n}\n\ninternal class FlatteningSequence\nconstructor(\n private val sequence: Sequence,\n private val transformer: (T) -> R,\n private val iterator: (R) -> Iterator\n) : Sequence {\n override fun iterator(): Iterator = object : Iterator {\n val iterator = sequence.iterator()\n var itemIterator: Iterator? = null\n\n override fun next(): E {\n if (!ensureItemIterator())\n throw NoSuchElementException()\n return itemIterator!!.next()\n }\n\n override fun hasNext(): Boolean {\n return ensureItemIterator()\n }\n\n private fun ensureItemIterator(): Boolean {\n if (itemIterator?.hasNext() == false)\n itemIterator = null\n\n while (itemIterator == null) {\n if (!iterator.hasNext()) {\n return false\n } else {\n val element = iterator.next()\n val nextItemIterator = iterator(transformer(element))\n if (nextItemIterator.hasNext()) {\n itemIterator = nextItemIterator\n return true\n }\n }\n }\n return true\n }\n }\n}\n\ninternal fun flatMapIndexed(source: Sequence, transform: (Int, T) -> C, iterator: (C) -> Iterator): Sequence =\n sequence {\n var index = 0\n for (element in source) {\n val result = transform(checkIndexOverflow(index++), element)\n yieldAll(iterator(result))\n }\n }\n\n/**\n * A sequence that supports drop(n) and take(n) operations\n */\ninternal interface DropTakeSequence : Sequence {\n fun drop(n: Int): Sequence\n fun take(n: Int): Sequence\n}\n\n/**\n * A sequence that skips [startIndex] values from the underlying [sequence]\n * and stops returning values right before [endIndex], i.e. stops at `endIndex - 1`\n */\ninternal class SubSequence(\n private val sequence: Sequence,\n private val startIndex: Int,\n private val endIndex: Int\n) : Sequence, DropTakeSequence {\n\n init {\n require(startIndex >= 0) { \"startIndex should be non-negative, but is $startIndex\" }\n require(endIndex >= 0) { \"endIndex should be non-negative, but is $endIndex\" }\n require(endIndex >= startIndex) { \"endIndex should be not less than startIndex, but was $endIndex < $startIndex\" }\n }\n\n private val count: Int get() = endIndex - startIndex\n\n override fun drop(n: Int): Sequence = if (n >= count) emptySequence() else SubSequence(sequence, startIndex + n, endIndex)\n override fun take(n: Int): Sequence = if (n >= count) this else SubSequence(sequence, startIndex, startIndex + n)\n\n override fun iterator() = object : Iterator {\n\n val iterator = sequence.iterator()\n var position = 0\n\n // Shouldn't be called from constructor to avoid premature iteration\n private fun drop() {\n while (position < startIndex && iterator.hasNext()) {\n iterator.next()\n position++\n }\n }\n\n override fun hasNext(): Boolean {\n drop()\n return (position < endIndex) && iterator.hasNext()\n }\n\n override fun next(): T {\n drop()\n if (position >= endIndex)\n throw NoSuchElementException()\n position++\n return iterator.next()\n }\n }\n}\n\n/**\n * A sequence that returns at most [count] values from the underlying [sequence], and stops returning values\n * as soon as that count is reached.\n */\ninternal class TakeSequence(\n private val sequence: Sequence,\n private val count: Int\n) : Sequence, DropTakeSequence {\n\n init {\n require(count >= 0) { \"count must be non-negative, but was $count.\" }\n }\n\n override fun drop(n: Int): Sequence = if (n >= count) emptySequence() else SubSequence(sequence, n, count)\n override fun take(n: Int): Sequence = if (n >= count) this else TakeSequence(sequence, n)\n\n override fun iterator(): Iterator = object : Iterator {\n var left = count\n val iterator = sequence.iterator()\n\n override fun next(): T {\n if (left == 0)\n throw NoSuchElementException()\n left--\n return iterator.next()\n }\n\n override fun hasNext(): Boolean {\n return left > 0 && iterator.hasNext()\n }\n }\n}\n\n/**\n * A sequence that returns values from the underlying [sequence] while the [predicate] function returns\n * `true`, and stops returning values once the function returns `false` for the next element.\n */\ninternal class TakeWhileSequence\nconstructor(\n private val sequence: Sequence,\n private val predicate: (T) -> Boolean\n) : Sequence {\n override fun iterator(): Iterator = object : Iterator {\n val iterator = sequence.iterator()\n var nextState: Int = -1 // -1 for unknown, 0 for done, 1 for continue\n var nextItem: T? = null\n\n private fun calcNext() {\n if (iterator.hasNext()) {\n val item = iterator.next()\n if (predicate(item)) {\n nextState = 1\n nextItem = item\n return\n }\n }\n nextState = 0\n }\n\n override fun next(): T {\n if (nextState == -1)\n calcNext() // will change nextState\n if (nextState == 0)\n throw NoSuchElementException()\n @Suppress(\"UNCHECKED_CAST\")\n val result = nextItem as T\n\n // Clean next to avoid keeping reference on yielded instance\n nextItem = null\n nextState = -1\n return result\n }\n\n override fun hasNext(): Boolean {\n if (nextState == -1)\n calcNext() // will change nextState\n return nextState == 1\n }\n }\n}\n\n/**\n * A sequence that skips the specified number of values from the underlying [sequence] and returns\n * all values after that.\n */\ninternal class DropSequence(\n private val sequence: Sequence,\n private val count: Int\n) : Sequence, DropTakeSequence {\n init {\n require(count >= 0) { \"count must be non-negative, but was $count.\" }\n }\n\n override fun drop(n: Int): Sequence = (count + n).let { n1 -> if (n1 < 0) DropSequence(this, n) else DropSequence(sequence, n1) }\n override fun take(n: Int): Sequence = (count + n).let { n1 -> if (n1 < 0) TakeSequence(this, n) else SubSequence(sequence, count, n1) }\n\n override fun iterator(): Iterator = object : Iterator {\n val iterator = sequence.iterator()\n var left = count\n\n // Shouldn't be called from constructor to avoid premature iteration\n private fun drop() {\n while (left > 0 && iterator.hasNext()) {\n iterator.next()\n left--\n }\n }\n\n override fun next(): T {\n drop()\n return iterator.next()\n }\n\n override fun hasNext(): Boolean {\n drop()\n return iterator.hasNext()\n }\n }\n}\n\n/**\n * A sequence that skips the values from the underlying [sequence] while the given [predicate] returns `true` and returns\n * all values after that.\n */\ninternal class DropWhileSequence\nconstructor(\n private val sequence: Sequence,\n private val predicate: (T) -> Boolean\n) : Sequence {\n\n override fun iterator(): Iterator = object : Iterator {\n val iterator = sequence.iterator()\n var dropState: Int = -1 // -1 for not dropping, 1 for nextItem, 0 for normal iteration\n var nextItem: T? = null\n\n private fun drop() {\n while (iterator.hasNext()) {\n val item = iterator.next()\n if (!predicate(item)) {\n nextItem = item\n dropState = 1\n return\n }\n }\n dropState = 0\n }\n\n override fun next(): T {\n if (dropState == -1)\n drop()\n\n if (dropState == 1) {\n @Suppress(\"UNCHECKED_CAST\")\n val result = nextItem as T\n nextItem = null\n dropState = 0\n return result\n }\n return iterator.next()\n }\n\n override fun hasNext(): Boolean {\n if (dropState == -1)\n drop()\n return dropState == 1 || iterator.hasNext()\n }\n }\n}\n\ninternal class DistinctSequence(private val source: Sequence, private val keySelector: (T) -> K) : Sequence {\n override fun iterator(): Iterator = DistinctIterator(source.iterator(), keySelector)\n}\n\nprivate class DistinctIterator(private val source: Iterator, private val keySelector: (T) -> K) : AbstractIterator() {\n private val observed = HashSet()\n\n override fun computeNext() {\n while (source.hasNext()) {\n val next = source.next()\n val key = keySelector(next)\n\n if (observed.add(key)) {\n setNext(next)\n return\n }\n }\n\n done()\n }\n}\n\n\nprivate class GeneratorSequence(private val getInitialValue: () -> T?, private val getNextValue: (T) -> T?) : Sequence {\n override fun iterator(): Iterator = object : Iterator {\n var nextItem: T? = null\n var nextState: Int = -2 // -2 for initial unknown, -1 for next unknown, 0 for done, 1 for continue\n\n private fun calcNext() {\n nextItem = if (nextState == -2) getInitialValue() else getNextValue(nextItem!!)\n nextState = if (nextItem == null) 0 else 1\n }\n\n override fun next(): T {\n if (nextState < 0)\n calcNext()\n\n if (nextState == 0)\n throw NoSuchElementException()\n val result = nextItem as T\n // Do not clean nextItem (to avoid keeping reference on yielded instance) -- need to keep state for getNextValue\n nextState = -1\n return result\n }\n\n override fun hasNext(): Boolean {\n if (nextState < 0)\n calcNext()\n return nextState == 1\n }\n }\n}\n\n/**\n * Returns a wrapper sequence that provides values of this sequence, but ensures it can be iterated only one time.\n *\n * The operation is _intermediate_ and _stateless_.\n *\n * [IllegalStateException] is thrown on iterating the returned sequence from the second time.\n *\n */\npublic fun Sequence.constrainOnce(): Sequence {\n // as? does not work in js\n //return this as? ConstrainedOnceSequence ?: ConstrainedOnceSequence(this)\n return if (this is ConstrainedOnceSequence) this else ConstrainedOnceSequence(this)\n}\n\n\n/**\n * Returns a sequence which invokes the function to calculate the next value on each iteration until the function returns `null`.\n *\n * The returned sequence is constrained to be iterated only once.\n *\n * @see constrainOnce\n * @see kotlin.sequences.sequence\n *\n * @sample samples.collections.Sequences.Building.generateSequence\n */\npublic fun generateSequence(nextFunction: () -> T?): Sequence {\n return GeneratorSequence(nextFunction, { nextFunction() }).constrainOnce()\n}\n\n/**\n * Returns a sequence defined by the starting value [seed] and the function [nextFunction],\n * which is invoked to calculate the next value based on the previous one on each iteration.\n *\n * The sequence produces values until it encounters first `null` value.\n * If [seed] is `null`, an empty sequence is produced.\n *\n * The sequence can be iterated multiple times, each time starting with [seed].\n *\n * @see kotlin.sequences.sequence\n *\n * @sample samples.collections.Sequences.Building.generateSequenceWithSeed\n */\n@kotlin.internal.LowPriorityInOverloadResolution\npublic fun generateSequence(seed: T?, nextFunction: (T) -> T?): Sequence =\n if (seed == null)\n EmptySequence\n else\n GeneratorSequence({ seed }, nextFunction)\n\n/**\n * Returns a sequence defined by the function [seedFunction], which is invoked to produce the starting value,\n * and the [nextFunction], which is invoked to calculate the next value based on the previous one on each iteration.\n *\n * The sequence produces values until it encounters first `null` value.\n * If [seedFunction] returns `null`, an empty sequence is produced.\n *\n * The sequence can be iterated multiple times.\n *\n * @see kotlin.sequences.sequence\n *\n * @sample samples.collections.Sequences.Building.generateSequenceWithLazySeed\n */\npublic fun generateSequence(seedFunction: () -> T?, nextFunction: (T) -> T?): Sequence =\n GeneratorSequence(seedFunction, nextFunction)\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"CollectionsKt\")\n\npackage kotlin.collections\n\n//\n// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt\n// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib\n//\n\nimport kotlin.random.*\nimport kotlin.ranges.contains\nimport kotlin.ranges.reversed\n\n/**\n * Returns 1st *element* from the list.\n * \n * Throws an [IndexOutOfBoundsException] if the size of this list is less than 1.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun List.component1(): T {\n return get(0)\n}\n\n/**\n * Returns 2nd *element* from the list.\n * \n * Throws an [IndexOutOfBoundsException] if the size of this list is less than 2.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun List.component2(): T {\n return get(1)\n}\n\n/**\n * Returns 3rd *element* from the list.\n * \n * Throws an [IndexOutOfBoundsException] if the size of this list is less than 3.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun List.component3(): T {\n return get(2)\n}\n\n/**\n * Returns 4th *element* from the list.\n * \n * Throws an [IndexOutOfBoundsException] if the size of this list is less than 4.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun List.component4(): T {\n return get(3)\n}\n\n/**\n * Returns 5th *element* from the list.\n * \n * Throws an [IndexOutOfBoundsException] if the size of this list is less than 5.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun List.component5(): T {\n return get(4)\n}\n\n/**\n * Returns `true` if [element] is found in the collection.\n */\npublic operator fun <@kotlin.internal.OnlyInputTypes T> Iterable.contains(element: T): Boolean {\n if (this is Collection)\n return contains(element)\n return indexOf(element) >= 0\n}\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this collection.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic fun Iterable.elementAt(index: Int): T {\n if (this is List)\n return get(index)\n return elementAtOrElse(index) { throw IndexOutOfBoundsException(\"Collection doesn't contain element at index $index.\") }\n}\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this list.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\n@kotlin.internal.InlineOnly\npublic inline fun List.elementAt(index: Int): T {\n return get(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this collection.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\npublic fun Iterable.elementAtOrElse(index: Int, defaultValue: (Int) -> T): T {\n if (this is List)\n return this.getOrElse(index, defaultValue)\n if (index < 0)\n return defaultValue(index)\n val iterator = iterator()\n var count = 0\n while (iterator.hasNext()) {\n val element = iterator.next()\n if (index == count++)\n return element\n }\n return defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this list.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@kotlin.internal.InlineOnly\npublic inline fun List.elementAtOrElse(index: Int, defaultValue: (Int) -> T): T {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this collection.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\npublic fun Iterable.elementAtOrNull(index: Int): T? {\n if (this is List)\n return this.getOrNull(index)\n if (index < 0)\n return null\n val iterator = iterator()\n var count = 0\n while (iterator.hasNext()) {\n val element = iterator.next()\n if (index == count++)\n return element\n }\n return null\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this list.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@kotlin.internal.InlineOnly\npublic inline fun List.elementAtOrNull(index: Int): T? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.find(predicate: (T) -> Boolean): T? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.findLast(predicate: (T) -> Boolean): T? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun List.findLast(predicate: (T) -> Boolean): T? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the collection is empty.\n */\npublic fun Iterable.first(): T {\n when (this) {\n is List -> return this.first()\n else -> {\n val iterator = iterator()\n if (!iterator.hasNext())\n throw NoSuchElementException(\"Collection is empty.\")\n return iterator.next()\n }\n }\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the list is empty.\n */\npublic fun List.first(): T {\n if (isEmpty())\n throw NoSuchElementException(\"List is empty.\")\n return this[0]\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n */\npublic inline fun Iterable.first(predicate: (T) -> Boolean): T {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Collection contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element, or `null` if the collection is empty.\n */\npublic fun Iterable.firstOrNull(): T? {\n when (this) {\n is List -> {\n if (isEmpty())\n return null\n else\n return this[0]\n }\n else -> {\n val iterator = iterator()\n if (!iterator.hasNext())\n return null\n return iterator.next()\n }\n }\n}\n\n/**\n * Returns the first element, or `null` if the list is empty.\n */\npublic fun List.firstOrNull(): T? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n */\npublic inline fun Iterable.firstOrNull(predicate: (T) -> Boolean): T? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this list.\n */\n@kotlin.internal.InlineOnly\npublic inline fun List.getOrElse(index: Int, defaultValue: (Int) -> T): T {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this list.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\npublic fun List.getOrNull(index: Int): T? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns first index of [element], or -1 if the collection does not contain element.\n */\npublic fun <@kotlin.internal.OnlyInputTypes T> Iterable.indexOf(element: T): Int {\n if (this is List) return this.indexOf(element)\n var index = 0\n for (item in this) {\n checkIndexOverflow(index)\n if (element == item)\n return index\n index++\n }\n return -1\n}\n\n/**\n * Returns first index of [element], or -1 if the list does not contain element.\n */\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\") // false warning, extension takes precedence in some cases\npublic fun <@kotlin.internal.OnlyInputTypes T> List.indexOf(element: T): Int {\n return indexOf(element)\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the collection does not contain such element.\n */\npublic inline fun Iterable.indexOfFirst(predicate: (T) -> Boolean): Int {\n var index = 0\n for (item in this) {\n checkIndexOverflow(index)\n if (predicate(item))\n return index\n index++\n }\n return -1\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the list does not contain such element.\n */\npublic inline fun List.indexOfFirst(predicate: (T) -> Boolean): Int {\n var index = 0\n for (item in this) {\n if (predicate(item))\n return index\n index++\n }\n return -1\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the collection does not contain such element.\n */\npublic inline fun Iterable.indexOfLast(predicate: (T) -> Boolean): Int {\n var lastIndex = -1\n var index = 0\n for (item in this) {\n checkIndexOverflow(index)\n if (predicate(item))\n lastIndex = index\n index++\n }\n return lastIndex\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the list does not contain such element.\n */\npublic inline fun List.indexOfLast(predicate: (T) -> Boolean): Int {\n val iterator = this.listIterator(size)\n while (iterator.hasPrevious()) {\n if (predicate(iterator.previous())) {\n return iterator.nextIndex()\n }\n }\n return -1\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the collection is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun Iterable.last(): T {\n when (this) {\n is List -> return this.last()\n else -> {\n val iterator = iterator()\n if (!iterator.hasNext())\n throw NoSuchElementException(\"Collection is empty.\")\n var last = iterator.next()\n while (iterator.hasNext())\n last = iterator.next()\n return last\n }\n }\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the list is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun List.last(): T {\n if (isEmpty())\n throw NoSuchElementException(\"List is empty.\")\n return this[lastIndex]\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun Iterable.last(predicate: (T) -> Boolean): T {\n var last: T? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n last = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Collection contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return last as T\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun List.last(predicate: (T) -> Boolean): T {\n val iterator = this.listIterator(size)\n while (iterator.hasPrevious()) {\n val element = iterator.previous()\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"List contains no element matching the predicate.\")\n}\n\n/**\n * Returns last index of [element], or -1 if the collection does not contain element.\n */\npublic fun <@kotlin.internal.OnlyInputTypes T> Iterable.lastIndexOf(element: T): Int {\n if (this is List) return this.lastIndexOf(element)\n var lastIndex = -1\n var index = 0\n for (item in this) {\n checkIndexOverflow(index)\n if (element == item)\n lastIndex = index\n index++\n }\n return lastIndex\n}\n\n/**\n * Returns last index of [element], or -1 if the list does not contain element.\n */\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\") // false warning, extension takes precedence in some cases\npublic fun <@kotlin.internal.OnlyInputTypes T> List.lastIndexOf(element: T): Int {\n return lastIndexOf(element)\n}\n\n/**\n * Returns the last element, or `null` if the collection is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun Iterable.lastOrNull(): T? {\n when (this) {\n is List -> return if (isEmpty()) null else this[size - 1]\n else -> {\n val iterator = iterator()\n if (!iterator.hasNext())\n return null\n var last = iterator.next()\n while (iterator.hasNext())\n last = iterator.next()\n return last\n }\n }\n}\n\n/**\n * Returns the last element, or `null` if the list is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun List.lastOrNull(): T? {\n return if (isEmpty()) null else this[size - 1]\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun Iterable.lastOrNull(predicate: (T) -> Boolean): T? {\n var last: T? = null\n for (element in this) {\n if (predicate(element)) {\n last = element\n }\n }\n return last\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun List.lastOrNull(predicate: (T) -> Boolean): T? {\n val iterator = this.listIterator(size)\n while (iterator.hasPrevious()) {\n val element = iterator.previous()\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns a random element from this collection.\n * \n * @throws NoSuchElementException if this collection is empty.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun Collection.random(): T {\n return random(Random)\n}\n\n/**\n * Returns a random element from this collection using the specified source of randomness.\n * \n * @throws NoSuchElementException if this collection is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun Collection.random(random: Random): T {\n if (isEmpty())\n throw NoSuchElementException(\"Collection is empty.\")\n return elementAt(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this collection, or `null` if this collection is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun Collection.randomOrNull(): T? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this collection using the specified source of randomness, or `null` if this collection is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun Collection.randomOrNull(random: Random): T? {\n if (isEmpty())\n return null\n return elementAt(random.nextInt(size))\n}\n\n/**\n * Returns the single element, or throws an exception if the collection is empty or has more than one element.\n */\npublic fun Iterable.single(): T {\n when (this) {\n is List -> return this.single()\n else -> {\n val iterator = iterator()\n if (!iterator.hasNext())\n throw NoSuchElementException(\"Collection is empty.\")\n val single = iterator.next()\n if (iterator.hasNext())\n throw IllegalArgumentException(\"Collection has more than one element.\")\n return single\n }\n }\n}\n\n/**\n * Returns the single element, or throws an exception if the list is empty or has more than one element.\n */\npublic fun List.single(): T {\n return when (size) {\n 0 -> throw NoSuchElementException(\"List is empty.\")\n 1 -> this[0]\n else -> throw IllegalArgumentException(\"List has more than one element.\")\n }\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n */\npublic inline fun Iterable.single(predicate: (T) -> Boolean): T {\n var single: T? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Collection contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Collection contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as T\n}\n\n/**\n * Returns single element, or `null` if the collection is empty or has more than one element.\n */\npublic fun Iterable.singleOrNull(): T? {\n when (this) {\n is List -> return if (size == 1) this[0] else null\n else -> {\n val iterator = iterator()\n if (!iterator.hasNext())\n return null\n val single = iterator.next()\n if (iterator.hasNext())\n return null\n return single\n }\n }\n}\n\n/**\n * Returns single element, or `null` if the list is empty or has more than one element.\n */\npublic fun List.singleOrNull(): T? {\n return if (size == 1) this[0] else null\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n */\npublic inline fun Iterable.singleOrNull(predicate: (T) -> Boolean): T? {\n var single: T? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns a list containing all elements except first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun Iterable.drop(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return toList()\n val list: ArrayList\n if (this is Collection<*>) {\n val resultSize = size - n\n if (resultSize <= 0)\n return emptyList()\n if (resultSize == 1)\n return listOf(last())\n list = ArrayList(resultSize)\n if (this is List) {\n if (this is RandomAccess) {\n for (index in n until size)\n list.add(this[index])\n } else {\n for (item in listIterator(n))\n list.add(item)\n }\n return list\n }\n }\n else {\n list = ArrayList()\n }\n var count = 0\n for (item in this) {\n if (count >= n) list.add(item) else ++count\n }\n return list.optimizeReadOnlyList()\n}\n\n/**\n * Returns a list containing all elements except last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun List.dropLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return take((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun List.dropLastWhile(predicate: (T) -> Boolean): List {\n if (!isEmpty()) {\n val iterator = listIterator(size)\n while (iterator.hasPrevious()) {\n if (!predicate(iterator.previous())) {\n return take(iterator.nextIndex() + 1)\n }\n }\n }\n return emptyList()\n}\n\n/**\n * Returns a list containing all elements except first elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic inline fun Iterable.dropWhile(predicate: (T) -> Boolean): List {\n var yielding = false\n val list = ArrayList()\n for (item in this)\n if (yielding)\n list.add(item)\n else if (!predicate(item)) {\n list.add(item)\n yielding = true\n }\n return list\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun Iterable.filter(predicate: (T) -> Boolean): List {\n return filterTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\npublic inline fun Iterable.filterIndexed(predicate: (index: Int, T) -> Boolean): List {\n return filterIndexedTo(ArrayList(), predicate)\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\npublic inline fun > Iterable.filterIndexedTo(destination: C, predicate: (index: Int, T) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Returns a list containing all elements that are instances of specified type parameter R.\n * \n * @sample samples.collections.Collections.Filtering.filterIsInstance\n */\npublic inline fun Iterable<*>.filterIsInstance(): List<@kotlin.internal.NoInfer R> {\n return filterIsInstanceTo(ArrayList())\n}\n\n/**\n * Appends all elements that are instances of specified type parameter R to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterIsInstanceTo\n */\npublic inline fun > Iterable<*>.filterIsInstanceTo(destination: C): C {\n for (element in this) if (element is R) destination.add(element)\n return destination\n}\n\n/**\n * Returns a list containing all elements not matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic inline fun Iterable.filterNot(predicate: (T) -> Boolean): List {\n return filterNotTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing all elements that are not `null`.\n * \n * @sample samples.collections.Collections.Filtering.filterNotNull\n */\npublic fun Iterable.filterNotNull(): List {\n return filterNotNullTo(ArrayList())\n}\n\n/**\n * Appends all elements that are not `null` to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterNotNullTo\n */\npublic fun , T : Any> Iterable.filterNotNullTo(destination: C): C {\n for (element in this) if (element != null) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > Iterable.filterNotTo(destination: C, predicate: (T) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > Iterable.filterTo(destination: C, predicate: (T) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Returns a list containing elements at indices in the specified [indices] range.\n */\npublic fun List.slice(indices: IntRange): List {\n if (indices.isEmpty()) return listOf()\n return this.subList(indices.start, indices.endInclusive + 1).toList()\n}\n\n/**\n * Returns a list containing elements at specified [indices].\n */\npublic fun List.slice(indices: Iterable): List {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return emptyList()\n val list = ArrayList(size)\n for (index in indices) {\n list.add(get(index))\n }\n return list\n}\n\n/**\n * Returns a list containing first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun Iterable.take(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n if (this is Collection) {\n if (n >= size) return toList()\n if (n == 1) return listOf(first())\n }\n var count = 0\n val list = ArrayList(n)\n for (item in this) {\n list.add(item)\n if (++count == n)\n break\n }\n return list.optimizeReadOnlyList()\n}\n\n/**\n * Returns a list containing last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun List.takeLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n val size = size\n if (n >= size) return toList()\n if (n == 1) return listOf(last())\n val list = ArrayList(n)\n if (this is RandomAccess) {\n for (index in size - n until size)\n list.add(this[index])\n } else {\n for (item in listIterator(size - n))\n list.add(item)\n }\n return list\n}\n\n/**\n * Returns a list containing last elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun List.takeLastWhile(predicate: (T) -> Boolean): List {\n if (isEmpty())\n return emptyList()\n val iterator = listIterator(size)\n while (iterator.hasPrevious()) {\n if (!predicate(iterator.previous())) {\n iterator.next()\n val expectedSize = size - iterator.nextIndex()\n if (expectedSize == 0) return emptyList()\n return ArrayList(expectedSize).apply {\n while (iterator.hasNext())\n add(iterator.next())\n }\n }\n }\n return toList()\n}\n\n/**\n * Returns a list containing first elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic inline fun Iterable.takeWhile(predicate: (T) -> Boolean): List {\n val list = ArrayList()\n for (item in this) {\n if (!predicate(item))\n break\n list.add(item)\n }\n return list\n}\n\n/**\n * Reverses elements in the list in-place.\n */\npublic expect fun MutableList.reverse(): Unit\n\n/**\n * Returns a list with elements in reversed order.\n */\npublic fun Iterable.reversed(): List {\n if (this is Collection && size <= 1) return toList()\n val list = toMutableList()\n list.reverse()\n return list\n}\n\n/**\n * Randomly shuffles elements in this list in-place using the specified [random] instance as the source of randomness.\n * \n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.3\")\npublic fun MutableList.shuffle(random: Random): Unit {\n for (i in lastIndex downTo 1) {\n val j = random.nextInt(i + 1)\n this[j] = this.set(i, this[j])\n }\n}\n\n/**\n * Sorts elements in the list in-place according to natural sort order of the value returned by specified [selector] function.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic inline fun > MutableList.sortBy(crossinline selector: (T) -> R?): Unit {\n if (size > 1) sortWith(compareBy(selector))\n}\n\n/**\n * Sorts elements in the list in-place descending according to natural sort order of the value returned by specified [selector] function.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic inline fun > MutableList.sortByDescending(crossinline selector: (T) -> R?): Unit {\n if (size > 1) sortWith(compareByDescending(selector))\n}\n\n/**\n * Sorts elements in the list in-place descending according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic fun > MutableList.sortDescending(): Unit {\n sortWith(reverseOrder())\n}\n\n/**\n * Returns a list of all elements sorted according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic fun > Iterable.sorted(): List {\n if (this is Collection) {\n if (size <= 1) return this.toList()\n @Suppress(\"UNCHECKED_CAST\")\n return (toTypedArray>() as Array).apply { sort() }.asList()\n }\n return toMutableList().apply { sort() }\n}\n\n/**\n * Returns a list of all elements sorted according to natural sort order of the value returned by specified [selector] function.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n * \n * @sample samples.collections.Collections.Sorting.sortedBy\n */\npublic inline fun > Iterable.sortedBy(crossinline selector: (T) -> R?): List {\n return sortedWith(compareBy(selector))\n}\n\n/**\n * Returns a list of all elements sorted descending according to natural sort order of the value returned by specified [selector] function.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic inline fun > Iterable.sortedByDescending(crossinline selector: (T) -> R?): List {\n return sortedWith(compareByDescending(selector))\n}\n\n/**\n * Returns a list of all elements sorted descending according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic fun > Iterable.sortedDescending(): List {\n return sortedWith(reverseOrder())\n}\n\n/**\n * Returns a list of all elements sorted according to the specified [comparator].\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic fun Iterable.sortedWith(comparator: Comparator): List {\n if (this is Collection) {\n if (size <= 1) return this.toList()\n @Suppress(\"UNCHECKED_CAST\")\n return (toTypedArray() as Array).apply { sortWith(comparator) }.asList()\n }\n return toMutableList().apply { sortWith(comparator) }\n}\n\n/**\n * Returns an array of Boolean containing all of the elements of this collection.\n */\npublic fun Collection.toBooleanArray(): BooleanArray {\n val result = BooleanArray(size)\n var index = 0\n for (element in this)\n result[index++] = element\n return result\n}\n\n/**\n * Returns an array of Byte containing all of the elements of this collection.\n */\npublic fun Collection.toByteArray(): ByteArray {\n val result = ByteArray(size)\n var index = 0\n for (element in this)\n result[index++] = element\n return result\n}\n\n/**\n * Returns an array of Char containing all of the elements of this collection.\n */\npublic fun Collection.toCharArray(): CharArray {\n val result = CharArray(size)\n var index = 0\n for (element in this)\n result[index++] = element\n return result\n}\n\n/**\n * Returns an array of Double containing all of the elements of this collection.\n */\npublic fun Collection.toDoubleArray(): DoubleArray {\n val result = DoubleArray(size)\n var index = 0\n for (element in this)\n result[index++] = element\n return result\n}\n\n/**\n * Returns an array of Float containing all of the elements of this collection.\n */\npublic fun Collection.toFloatArray(): FloatArray {\n val result = FloatArray(size)\n var index = 0\n for (element in this)\n result[index++] = element\n return result\n}\n\n/**\n * Returns an array of Int containing all of the elements of this collection.\n */\npublic fun Collection.toIntArray(): IntArray {\n val result = IntArray(size)\n var index = 0\n for (element in this)\n result[index++] = element\n return result\n}\n\n/**\n * Returns an array of Long containing all of the elements of this collection.\n */\npublic fun Collection.toLongArray(): LongArray {\n val result = LongArray(size)\n var index = 0\n for (element in this)\n result[index++] = element\n return result\n}\n\n/**\n * Returns an array of Short containing all of the elements of this collection.\n */\npublic fun Collection.toShortArray(): ShortArray {\n val result = ShortArray(size)\n var index = 0\n for (element in this)\n result[index++] = element\n return result\n}\n\n/**\n * Returns a [Map] containing key-value pairs provided by [transform] function\n * applied to elements of the given collection.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original collection.\n * \n * @sample samples.collections.Collections.Transformations.associate\n */\npublic inline fun Iterable.associate(transform: (T) -> Pair): Map {\n val capacity = mapCapacity(collectionSizeOrDefault(10)).coerceAtLeast(16)\n return associateTo(LinkedHashMap(capacity), transform)\n}\n\n/**\n * Returns a [Map] containing the elements from the given collection indexed by the key\n * returned from [keySelector] function applied to each element.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original collection.\n * \n * @sample samples.collections.Collections.Transformations.associateBy\n */\npublic inline fun Iterable.associateBy(keySelector: (T) -> K): Map {\n val capacity = mapCapacity(collectionSizeOrDefault(10)).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector)\n}\n\n/**\n * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given collection.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original collection.\n * \n * @sample samples.collections.Collections.Transformations.associateByWithValueTransform\n */\npublic inline fun Iterable.associateBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map {\n val capacity = mapCapacity(collectionSizeOrDefault(10)).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector, valueTransform)\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function applied to each element of the given collection\n * and value is the element itself.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Collections.Transformations.associateByTo\n */\npublic inline fun > Iterable.associateByTo(destination: M, keySelector: (T) -> K): M {\n for (element in this) {\n destination.put(keySelector(element), element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function and\n * and value is provided by the [valueTransform] function applied to elements of the given collection.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.collections.Collections.Transformations.associateByToWithValueTransform\n */\npublic inline fun > Iterable.associateByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M {\n for (element in this) {\n destination.put(keySelector(element), valueTransform(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs\n * provided by [transform] function applied to each element of the given collection.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * @sample samples.collections.Collections.Transformations.associateTo\n */\npublic inline fun > Iterable.associateTo(destination: M, transform: (T) -> Pair): M {\n for (element in this) {\n destination += transform(element)\n }\n return destination\n}\n\n/**\n * Returns a [Map] where keys are elements from the given collection and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original collection.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.3\")\npublic inline fun Iterable.associateWith(valueSelector: (K) -> V): Map {\n val result = LinkedHashMap(mapCapacity(collectionSizeOrDefault(10)).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given collection,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.3\")\npublic inline fun > Iterable.associateWithTo(destination: M, valueSelector: (K) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Appends all elements to the given [destination] collection.\n */\npublic fun > Iterable.toCollection(destination: C): C {\n for (item in this) {\n destination.add(item)\n }\n return destination\n}\n\n/**\n * Returns a new [HashSet] of all elements.\n */\npublic fun Iterable.toHashSet(): HashSet {\n return toCollection(HashSet(mapCapacity(collectionSizeOrDefault(12))))\n}\n\n/**\n * Returns a [List] containing all elements.\n */\npublic fun Iterable.toList(): List {\n if (this is Collection) {\n return when (size) {\n 0 -> emptyList()\n 1 -> listOf(if (this is List) get(0) else iterator().next())\n else -> this.toMutableList()\n }\n }\n return this.toMutableList().optimizeReadOnlyList()\n}\n\n/**\n * Returns a new [MutableList] filled with all elements of this collection.\n */\npublic fun Iterable.toMutableList(): MutableList {\n if (this is Collection)\n return this.toMutableList()\n return toCollection(ArrayList())\n}\n\n/**\n * Returns a new [MutableList] filled with all elements of this collection.\n */\npublic fun Collection.toMutableList(): MutableList {\n return ArrayList(this)\n}\n\n/**\n * Returns a [Set] of all elements.\n * \n * The returned set preserves the element iteration order of the original collection.\n */\npublic fun Iterable.toSet(): Set {\n if (this is Collection) {\n return when (size) {\n 0 -> emptySet()\n 1 -> setOf(if (this is List) this[0] else iterator().next())\n else -> toCollection(LinkedHashSet(mapCapacity(size)))\n }\n }\n return toCollection(LinkedHashSet()).optimizeReadOnlySet()\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\npublic inline fun Iterable.flatMap(transform: (T) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original collection.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapSequence\")\npublic inline fun Iterable.flatMap(transform: (T) -> Sequence): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original collection.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterable\")\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.flatMapIndexed(transform: (index: Int, T) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original collection.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedSequence\")\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.flatMapIndexed(transform: (index: Int, T) -> Sequence): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original collection, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterableTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > Iterable.flatMapIndexedTo(destination: C, transform: (index: Int, T) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(checkIndexOverflow(index++), element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original collection, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedSequenceTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > Iterable.flatMapIndexedTo(destination: C, transform: (index: Int, T) -> Sequence): C {\n var index = 0\n for (element in this) {\n val list = transform(checkIndexOverflow(index++), element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination].\n */\npublic inline fun > Iterable.flatMapTo(destination: C, transform: (T) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original collection, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapSequenceTo\")\npublic inline fun > Iterable.flatMapTo(destination: C, transform: (T) -> Sequence): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Groups elements of the original collection by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original collection.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun Iterable.groupBy(keySelector: (T) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original collection\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original collection.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun Iterable.groupBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups elements of the original collection by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun >> Iterable.groupByTo(destination: M, keySelector: (T) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original collection\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun >> Iterable.groupByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Creates a [Grouping] source from a collection to be used later with one of group-and-fold operations\n * using the specified [keySelector] function to extract a key from each element.\n * \n * @sample samples.collections.Grouping.groupingByEachCount\n */\n@SinceKotlin(\"1.1\")\npublic inline fun Iterable.groupingBy(crossinline keySelector: (T) -> K): Grouping {\n return object : Grouping {\n override fun sourceIterator(): Iterator = this@groupingBy.iterator()\n override fun keyOf(element: T): K = keySelector(element)\n }\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element in the original collection.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\npublic inline fun Iterable.map(transform: (T) -> R): List {\n return mapTo(ArrayList(collectionSizeOrDefault(10)), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element and its index in the original collection.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun Iterable.mapIndexed(transform: (index: Int, T) -> R): List {\n return mapIndexedTo(ArrayList(collectionSizeOrDefault(10)), transform)\n}\n\n/**\n * Returns a list containing only the non-null results of applying the given [transform] function\n * to each element and its index in the original collection.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun Iterable.mapIndexedNotNull(transform: (index: Int, T) -> R?): List {\n return mapIndexedNotNullTo(ArrayList(), transform)\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original collection\n * and appends only the non-null results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun > Iterable.mapIndexedNotNullTo(destination: C, transform: (index: Int, T) -> R?): C {\n forEachIndexed { index, element -> transform(index, element)?.let { destination.add(it) } }\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original collection\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\npublic inline fun > Iterable.mapIndexedTo(destination: C, transform: (index: Int, T) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(checkIndexOverflow(index++), item))\n return destination\n}\n\n/**\n * Returns a list containing only the non-null results of applying the given [transform] function\n * to each element in the original collection.\n * \n * @sample samples.collections.Collections.Transformations.mapNotNull\n */\npublic inline fun Iterable.mapNotNull(transform: (T) -> R?): List {\n return mapNotNullTo(ArrayList(), transform)\n}\n\n/**\n * Applies the given [transform] function to each element in the original collection\n * and appends only the non-null results to the given [destination].\n */\npublic inline fun > Iterable.mapNotNullTo(destination: C, transform: (T) -> R?): C {\n forEach { element -> transform(element)?.let { destination.add(it) } }\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original collection\n * and appends the results to the given [destination].\n */\npublic inline fun > Iterable.mapTo(destination: C, transform: (T) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each element of the original collection\n * into an [IndexedValue] containing the index of that element and the element itself.\n */\npublic fun Iterable.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns a list containing only distinct elements from the given collection.\n * \n * Among equal elements of the given collection, only the first one will be present in the resulting list.\n * The elements in the resulting list are in the same order as they were in the source collection.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic fun Iterable.distinct(): List {\n return this.toMutableSet().toList()\n}\n\n/**\n * Returns a list containing only elements from the given collection\n * having distinct keys returned by the given [selector] function.\n * \n * Among elements of the given collection with equal keys, only the first one will be present in the resulting list.\n * The elements in the resulting list are in the same order as they were in the source collection.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic inline fun Iterable.distinctBy(selector: (T) -> K): List {\n val set = HashSet()\n val list = ArrayList()\n for (e in this) {\n val key = selector(e)\n if (set.add(key))\n list.add(e)\n }\n return list\n}\n\n/**\n * Returns a set containing all elements that are contained by both this collection and the specified collection.\n * \n * The returned set preserves the element iteration order of the original collection.\n * \n * To get a set containing all elements that are contained at least in one of these collections use [union].\n */\npublic infix fun Iterable.intersect(other: Iterable): Set {\n val set = this.toMutableSet()\n set.retainAll(other)\n return set\n}\n\n/**\n * Returns a set containing all elements that are contained by this collection and not contained by the specified collection.\n * \n * The returned set preserves the element iteration order of the original collection.\n */\npublic infix fun Iterable.subtract(other: Iterable): Set {\n val set = this.toMutableSet()\n set.removeAll(other)\n return set\n}\n\n/**\n * Returns a new [MutableSet] containing all distinct elements from the given collection.\n * \n * The returned set preserves the element iteration order of the original collection.\n */\npublic fun Iterable.toMutableSet(): MutableSet {\n return when (this) {\n is Collection -> LinkedHashSet(this)\n else -> toCollection(LinkedHashSet())\n }\n}\n\n/**\n * Returns a set containing all distinct elements from both collections.\n * \n * The returned set preserves the element iteration order of the original collection.\n * Those elements of the [other] collection that are unique are iterated in the end\n * in the order of the [other] collection.\n * \n * To get a set containing all elements that are contained in both collections use [intersect].\n */\npublic infix fun Iterable.union(other: Iterable): Set {\n val set = this.toMutableSet()\n set.addAll(other)\n return set\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\npublic inline fun Iterable.all(predicate: (T) -> Boolean): Boolean {\n if (this is Collection && isEmpty()) return true\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if collection has at least one element.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\npublic fun Iterable.any(): Boolean {\n if (this is Collection) return !isEmpty()\n return iterator().hasNext()\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\npublic inline fun Iterable.any(predicate: (T) -> Boolean): Boolean {\n if (this is Collection && isEmpty()) return false\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns the number of elements in this collection.\n */\npublic fun Iterable.count(): Int {\n if (this is Collection) return size\n var count = 0\n for (element in this) checkCountOverflow(++count)\n return count\n}\n\n/**\n * Returns the number of elements in this collection.\n */\n@kotlin.internal.InlineOnly\npublic inline fun Collection.count(): Int {\n return size\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n */\npublic inline fun Iterable.count(predicate: (T) -> Boolean): Int {\n if (this is Collection && isEmpty()) return 0\n var count = 0\n for (element in this) if (predicate(element)) checkCountOverflow(++count)\n return count\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the collection is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n */\npublic inline fun Iterable.fold(initial: R, operation: (acc: R, T) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original collection.\n * \n * Returns the specified [initial] value if the collection is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n */\npublic inline fun Iterable.foldIndexed(initial: R, operation: (index: Int, acc: R, T) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(checkIndexOverflow(index++), accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns the specified [initial] value if the list is empty.\n * \n * @param [operation] function that takes an element and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun List.foldRight(initial: R, operation: (T, acc: R) -> R): R {\n var accumulator = initial\n if (!isEmpty()) {\n val iterator = listIterator(size)\n while (iterator.hasPrevious()) {\n accumulator = operation(iterator.previous(), accumulator)\n }\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element with its index in the original list and current accumulator value.\n * \n * Returns the specified [initial] value if the list is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself\n * and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun List.foldRightIndexed(initial: R, operation: (index: Int, T, acc: R) -> R): R {\n var accumulator = initial\n if (!isEmpty()) {\n val iterator = listIterator(size)\n while (iterator.hasPrevious()) {\n val index = iterator.previousIndex()\n accumulator = operation(index, iterator.previous(), accumulator)\n }\n }\n return accumulator\n}\n\n/**\n * Performs the given [action] on each element.\n */\n@kotlin.internal.HidesMembers\npublic inline fun Iterable.forEach(action: (T) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\npublic inline fun Iterable.forEachIndexed(action: (index: Int, T) -> Unit): Unit {\n var index = 0\n for (item in this) action(checkIndexOverflow(index++), item)\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.1\")\npublic fun Iterable.max(): Double? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.1\")\npublic fun Iterable.max(): Float? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun > Iterable.max(): T? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > Iterable.maxBy(selector: (T) -> R): T? {\n return maxByOrNull(selector)\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > Iterable.maxByOrNull(selector: (T) -> R): T? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var maxElem = iterator.next()\n if (!iterator.hasNext()) return maxElem\n var maxValue = selector(maxElem)\n do {\n val e = iterator.next()\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n } while (iterator.hasNext())\n return maxElem\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the collection.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the collection is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.maxOf(selector: (T) -> Double): Double {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the collection.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the collection is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.maxOf(selector: (T) -> Float): Float {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the collection.\n * \n * @throws NoSuchElementException if the collection is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Iterable.maxOf(selector: (T) -> R): R {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the collection or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.maxOfOrNull(selector: (T) -> Double): Double? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the collection or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.maxOfOrNull(selector: (T) -> Float): Float? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the collection or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Iterable.maxOfOrNull(selector: (T) -> R): R? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the collection.\n * \n * @throws NoSuchElementException if the collection is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.maxOfWith(comparator: Comparator, selector: (T) -> R): R {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the collection or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.maxOfWithOrNull(comparator: Comparator, selector: (T) -> R): R? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic fun Iterable.maxOrNull(): Double? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var max = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n max = maxOf(max, e)\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic fun Iterable.maxOrNull(): Float? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var max = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n max = maxOf(max, e)\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun > Iterable.maxOrNull(): T? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var max = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n if (max < e) max = e\n }\n return max\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun Iterable.maxWith(comparator: Comparator): T? {\n return maxWithOrNull(comparator)\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun Iterable.maxWithOrNull(comparator: Comparator): T? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var max = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.1\")\npublic fun Iterable.min(): Double? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.1\")\npublic fun Iterable.min(): Float? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun > Iterable.min(): T? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > Iterable.minBy(selector: (T) -> R): T? {\n return minByOrNull(selector)\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > Iterable.minByOrNull(selector: (T) -> R): T? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var minElem = iterator.next()\n if (!iterator.hasNext()) return minElem\n var minValue = selector(minElem)\n do {\n val e = iterator.next()\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n } while (iterator.hasNext())\n return minElem\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the collection.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the collection is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.minOf(selector: (T) -> Double): Double {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the collection.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the collection is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.minOf(selector: (T) -> Float): Float {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the collection.\n * \n * @throws NoSuchElementException if the collection is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Iterable.minOf(selector: (T) -> R): R {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the collection or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.minOfOrNull(selector: (T) -> Double): Double? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the collection or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.minOfOrNull(selector: (T) -> Float): Float? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the collection or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Iterable.minOfOrNull(selector: (T) -> R): R? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the collection.\n * \n * @throws NoSuchElementException if the collection is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.minOfWith(comparator: Comparator, selector: (T) -> R): R {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the collection or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.minOfWithOrNull(comparator: Comparator, selector: (T) -> R): R? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic fun Iterable.minOrNull(): Double? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var min = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n min = minOf(min, e)\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic fun Iterable.minOrNull(): Float? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var min = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n min = minOf(min, e)\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun > Iterable.minOrNull(): T? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var min = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n if (min > e) min = e\n }\n return min\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun Iterable.minWith(comparator: Comparator): T? {\n return minWithOrNull(comparator)\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\npublic fun Iterable.minWithOrNull(comparator: Comparator): T? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var min = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns `true` if the collection has no elements.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\npublic fun Iterable.none(): Boolean {\n if (this is Collection) return isEmpty()\n return !iterator().hasNext()\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\npublic inline fun Iterable.none(predicate: (T) -> Boolean): Boolean {\n if (this is Collection && isEmpty()) return true\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Performs the given [action] on each element and returns the collection itself afterwards.\n */\n@SinceKotlin(\"1.1\")\npublic inline fun > C.onEach(action: (T) -> Unit): C {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element,\n * and returns the collection itself afterwards.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > C.onEachIndexed(action: (index: Int, T) -> Unit): C {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this collection is empty. If the collection can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun Iterable.reduce(operation: (acc: S, T) -> S): S {\n val iterator = this.iterator()\n if (!iterator.hasNext()) throw UnsupportedOperationException(\"Empty collection can't be reduced.\")\n var accumulator: S = iterator.next()\n while (iterator.hasNext()) {\n accumulator = operation(accumulator, iterator.next())\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original collection.\n * \n * Throws an exception if this collection is empty. If the collection can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun Iterable.reduceIndexed(operation: (index: Int, acc: S, T) -> S): S {\n val iterator = this.iterator()\n if (!iterator.hasNext()) throw UnsupportedOperationException(\"Empty collection can't be reduced.\")\n var index = 1\n var accumulator: S = iterator.next()\n while (iterator.hasNext()) {\n accumulator = operation(checkIndexOverflow(index++), accumulator, iterator.next())\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original collection.\n * \n * Returns `null` if the collection is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun Iterable.reduceIndexedOrNull(operation: (index: Int, acc: S, T) -> S): S? {\n val iterator = this.iterator()\n if (!iterator.hasNext()) return null\n var index = 1\n var accumulator: S = iterator.next()\n while (iterator.hasNext()) {\n accumulator = operation(checkIndexOverflow(index++), accumulator, iterator.next())\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the collection is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun Iterable.reduceOrNull(operation: (acc: S, T) -> S): S? {\n val iterator = this.iterator()\n if (!iterator.hasNext()) return null\n var accumulator: S = iterator.next()\n while (iterator.hasNext()) {\n accumulator = operation(accumulator, iterator.next())\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Throws an exception if this list is empty. If the list can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun List.reduceRight(operation: (T, acc: S) -> S): S {\n val iterator = listIterator(size)\n if (!iterator.hasPrevious())\n throw UnsupportedOperationException(\"Empty list can't be reduced.\")\n var accumulator: S = iterator.previous()\n while (iterator.hasPrevious()) {\n accumulator = operation(iterator.previous(), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original list and current accumulator value.\n * \n * Throws an exception if this list is empty. If the list can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun List.reduceRightIndexed(operation: (index: Int, T, acc: S) -> S): S {\n val iterator = listIterator(size)\n if (!iterator.hasPrevious())\n throw UnsupportedOperationException(\"Empty list can't be reduced.\")\n var accumulator: S = iterator.previous()\n while (iterator.hasPrevious()) {\n val index = iterator.previousIndex()\n accumulator = operation(index, iterator.previous(), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original list and current accumulator value.\n * \n * Returns `null` if the list is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun List.reduceRightIndexedOrNull(operation: (index: Int, T, acc: S) -> S): S? {\n val iterator = listIterator(size)\n if (!iterator.hasPrevious())\n return null\n var accumulator: S = iterator.previous()\n while (iterator.hasPrevious()) {\n val index = iterator.previousIndex()\n accumulator = operation(index, iterator.previous(), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns `null` if the list is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun List.reduceRightOrNull(operation: (T, acc: S) -> S): S? {\n val iterator = listIterator(size)\n if (!iterator.hasPrevious())\n return null\n var accumulator: S = iterator.previous()\n while (iterator.hasPrevious()) {\n accumulator = operation(iterator.previous(), accumulator)\n }\n return accumulator\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\npublic inline fun Iterable.runningFold(initial: R, operation: (acc: R, T) -> R): List {\n val estimatedSize = collectionSizeOrDefault(9)\n if (estimatedSize == 0) return listOf(initial)\n val result = ArrayList(estimatedSize + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original collection and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\npublic inline fun Iterable.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, T) -> R): List {\n val estimatedSize = collectionSizeOrDefault(9)\n if (estimatedSize == 0) return listOf(initial)\n val result = ArrayList(estimatedSize + 1).apply { add(initial) }\n var index = 0\n var accumulator = initial\n for (element in this) {\n accumulator = operation(index++, accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this collection.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and the element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun Iterable.runningReduce(operation: (acc: S, T) -> S): List {\n val iterator = this.iterator()\n if (!iterator.hasNext()) return emptyList()\n var accumulator: S = iterator.next()\n val result = ArrayList(collectionSizeOrDefault(10)).apply { add(accumulator) }\n while (iterator.hasNext()) {\n accumulator = operation(accumulator, iterator.next())\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original collection and current accumulator value that starts with the first element of this collection.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\npublic inline fun Iterable.runningReduceIndexed(operation: (index: Int, acc: S, T) -> S): List {\n val iterator = this.iterator()\n if (!iterator.hasNext()) return emptyList()\n var accumulator: S = iterator.next()\n val result = ArrayList(collectionSizeOrDefault(10)).apply { add(accumulator) }\n var index = 1\n while (iterator.hasNext()) {\n accumulator = operation(index++, accumulator, iterator.next())\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun Iterable.scan(initial: R, operation: (acc: R, T) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original collection and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun Iterable.scanIndexed(initial: R, operation: (index: Int, acc: R, T) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\npublic inline fun Iterable.scanReduce(operation: (acc: S, T) -> S): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\npublic inline fun Iterable.scanReduceIndexed(operation: (index: Int, acc: S, T) -> S): List {\n return runningReduceIndexed(operation)\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the collection.\n */\npublic inline fun Iterable.sumBy(selector: (T) -> Int): Int {\n var sum: Int = 0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the collection.\n */\npublic inline fun Iterable.sumByDouble(selector: (T) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the collection.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.sumOf(selector: (T) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the collection.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.sumOf(selector: (T) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the collection.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.sumOf(selector: (T) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the collection.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.sumOf(selector: (T) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the collection.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.sumOf(selector: (T) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns an original collection containing all the non-`null` elements, throwing an [IllegalArgumentException] if there are any `null` elements.\n */\npublic fun Iterable.requireNoNulls(): Iterable {\n for (element in this) {\n if (element == null) {\n throw IllegalArgumentException(\"null element found in $this.\")\n }\n }\n @Suppress(\"UNCHECKED_CAST\")\n return this as Iterable\n}\n\n/**\n * Returns an original collection containing all the non-`null` elements, throwing an [IllegalArgumentException] if there are any `null` elements.\n */\npublic fun List.requireNoNulls(): List {\n for (element in this) {\n if (element == null) {\n throw IllegalArgumentException(\"null element found in $this.\")\n }\n }\n @Suppress(\"UNCHECKED_CAST\")\n return this as List\n}\n\n/**\n * Splits this collection into a list of lists each not exceeding the given [size].\n * \n * The last list in the resulting list may have fewer elements than the given [size].\n * \n * @param size the number of elements to take in each list, must be positive and can be greater than the number of elements in this collection.\n * \n * @sample samples.collections.Collections.Transformations.chunked\n */\n@SinceKotlin(\"1.2\")\npublic fun Iterable.chunked(size: Int): List> {\n return windowed(size, size, partialWindows = true)\n}\n\n/**\n * Splits this collection into several lists each not exceeding the given [size]\n * and applies the given [transform] function to an each.\n * \n * @return list of results of the [transform] applied to an each list.\n * \n * Note that the list passed to the [transform] function is ephemeral and is valid only inside that function.\n * You should not store it or allow it to escape in some way, unless you made a snapshot of it.\n * The last list may have fewer elements than the given [size].\n * \n * @param size the number of elements to take in each list, must be positive and can be greater than the number of elements in this collection.\n * \n * @sample samples.text.Strings.chunkedTransform\n */\n@SinceKotlin(\"1.2\")\npublic fun Iterable.chunked(size: Int, transform: (List) -> R): List {\n return windowed(size, size, partialWindows = true, transform = transform)\n}\n\n/**\n * Returns a list containing all elements of the original collection without the first occurrence of the given [element].\n */\npublic operator fun Iterable.minus(element: T): List {\n val result = ArrayList(collectionSizeOrDefault(10))\n var removed = false\n return this.filterTo(result) { if (!removed && it == element) { removed = true; false } else true }\n}\n\n/**\n * Returns a list containing all elements of the original collection except the elements contained in the given [elements] array.\n * \n * The [elements] array may be converted to a [HashSet] to speed up the operation, thus the elements are required to have\n * a correct and stable implementation of `hashCode()` that doesn't change between successive invocations.\n */\npublic operator fun Iterable.minus(elements: Array): List {\n if (elements.isEmpty()) return this.toList()\n val other = elements.toHashSet()\n return this.filterNot { it in other }\n}\n\n/**\n * Returns a list containing all elements of the original collection except the elements contained in the given [elements] collection.\n * \n * The [elements] collection may be converted to a [HashSet] to speed up the operation, thus the elements are required to have\n * a correct and stable implementation of `hashCode()` that doesn't change between successive invocations.\n */\npublic operator fun Iterable.minus(elements: Iterable): List {\n val other = elements.convertToSetForSetOperationWith(this)\n if (other.isEmpty())\n return this.toList()\n return this.filterNot { it in other }\n}\n\n/**\n * Returns a list containing all elements of the original collection except the elements contained in the given [elements] sequence.\n * \n * The [elements] sequence may be converted to a [HashSet] to speed up the operation, thus the elements are required to have\n * a correct and stable implementation of `hashCode()` that doesn't change between successive invocations.\n */\npublic operator fun Iterable.minus(elements: Sequence): List {\n val other = elements.toHashSet()\n if (other.isEmpty())\n return this.toList()\n return this.filterNot { it in other }\n}\n\n/**\n * Returns a list containing all elements of the original collection without the first occurrence of the given [element].\n */\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.minusElement(element: T): List {\n return minus(element)\n}\n\n/**\n * Splits the original collection into pair of lists,\n * where *first* list contains elements for which [predicate] yielded `true`,\n * while *second* list contains elements for which [predicate] yielded `false`.\n * \n * @sample samples.collections.Iterables.Operations.partition\n */\npublic inline fun Iterable.partition(predicate: (T) -> Boolean): Pair, List> {\n val first = ArrayList()\n val second = ArrayList()\n for (element in this) {\n if (predicate(element)) {\n first.add(element)\n } else {\n second.add(element)\n }\n }\n return Pair(first, second)\n}\n\n/**\n * Returns a list containing all elements of the original collection and then the given [element].\n */\npublic operator fun Iterable.plus(element: T): List {\n if (this is Collection) return this.plus(element)\n val result = ArrayList()\n result.addAll(this)\n result.add(element)\n return result\n}\n\n/**\n * Returns a list containing all elements of the original collection and then the given [element].\n */\npublic operator fun Collection.plus(element: T): List {\n val result = ArrayList(size + 1)\n result.addAll(this)\n result.add(element)\n return result\n}\n\n/**\n * Returns a list containing all elements of the original collection and then all elements of the given [elements] array.\n */\npublic operator fun Iterable.plus(elements: Array): List {\n if (this is Collection) return this.plus(elements)\n val result = ArrayList()\n result.addAll(this)\n result.addAll(elements)\n return result\n}\n\n/**\n * Returns a list containing all elements of the original collection and then all elements of the given [elements] array.\n */\npublic operator fun Collection.plus(elements: Array): List {\n val result = ArrayList(this.size + elements.size)\n result.addAll(this)\n result.addAll(elements)\n return result\n}\n\n/**\n * Returns a list containing all elements of the original collection and then all elements of the given [elements] collection.\n */\npublic operator fun Iterable.plus(elements: Iterable): List {\n if (this is Collection) return this.plus(elements)\n val result = ArrayList()\n result.addAll(this)\n result.addAll(elements)\n return result\n}\n\n/**\n * Returns a list containing all elements of the original collection and then all elements of the given [elements] collection.\n */\npublic operator fun Collection.plus(elements: Iterable): List {\n if (elements is Collection) {\n val result = ArrayList(this.size + elements.size)\n result.addAll(this)\n result.addAll(elements)\n return result\n } else {\n val result = ArrayList(this)\n result.addAll(elements)\n return result\n }\n}\n\n/**\n * Returns a list containing all elements of the original collection and then all elements of the given [elements] sequence.\n */\npublic operator fun Iterable.plus(elements: Sequence): List {\n val result = ArrayList()\n result.addAll(this)\n result.addAll(elements)\n return result\n}\n\n/**\n * Returns a list containing all elements of the original collection and then all elements of the given [elements] sequence.\n */\npublic operator fun Collection.plus(elements: Sequence): List {\n val result = ArrayList(this.size + 10)\n result.addAll(this)\n result.addAll(elements)\n return result\n}\n\n/**\n * Returns a list containing all elements of the original collection and then the given [element].\n */\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.plusElement(element: T): List {\n return plus(element)\n}\n\n/**\n * Returns a list containing all elements of the original collection and then the given [element].\n */\n@kotlin.internal.InlineOnly\npublic inline fun Collection.plusElement(element: T): List {\n return plus(element)\n}\n\n/**\n * Returns a list of snapshots of the window of the given [size]\n * sliding along this collection with the given [step], where each\n * snapshot is a list.\n * \n * Several last lists may have fewer elements than the given [size].\n * \n * Both [size] and [step] must be positive and can be greater than the number of elements in this collection.\n * @param size the number of elements to take in each window\n * @param step the number of elements to move the window forward by on an each step, by default 1\n * @param partialWindows controls whether or not to keep partial windows in the end if any,\n * by default `false` which means partial windows won't be preserved\n * \n * @sample samples.collections.Sequences.Transformations.takeWindows\n */\n@SinceKotlin(\"1.2\")\npublic fun Iterable.windowed(size: Int, step: Int = 1, partialWindows: Boolean = false): List> {\n checkWindowSizeStep(size, step)\n if (this is RandomAccess && this is List) {\n val thisSize = this.size\n val resultCapacity = thisSize / step + if (thisSize % step == 0) 0 else 1\n val result = ArrayList>(resultCapacity)\n var index = 0\n while (index in 0 until thisSize) {\n val windowSize = size.coerceAtMost(thisSize - index)\n if (windowSize < size && !partialWindows) break\n result.add(List(windowSize) { this[it + index] })\n index += step\n }\n return result\n }\n val result = ArrayList>()\n windowedIterator(iterator(), size, step, partialWindows, reuseBuffer = false).forEach {\n result.add(it)\n }\n return result\n}\n\n/**\n * Returns a list of results of applying the given [transform] function to\n * an each list representing a view over the window of the given [size]\n * sliding along this collection with the given [step].\n * \n * Note that the list passed to the [transform] function is ephemeral and is valid only inside that function.\n * You should not store it or allow it to escape in some way, unless you made a snapshot of it.\n * Several last lists may have fewer elements than the given [size].\n * \n * Both [size] and [step] must be positive and can be greater than the number of elements in this collection.\n * @param size the number of elements to take in each window\n * @param step the number of elements to move the window forward by on an each step, by default 1\n * @param partialWindows controls whether or not to keep partial windows in the end if any,\n * by default `false` which means partial windows won't be preserved\n * \n * @sample samples.collections.Sequences.Transformations.averageWindows\n */\n@SinceKotlin(\"1.2\")\npublic fun Iterable.windowed(size: Int, step: Int = 1, partialWindows: Boolean = false, transform: (List) -> R): List {\n checkWindowSizeStep(size, step)\n if (this is RandomAccess && this is List) {\n val thisSize = this.size\n val resultCapacity = thisSize / step + if (thisSize % step == 0) 0 else 1\n val result = ArrayList(resultCapacity)\n val window = MovingSubList(this)\n var index = 0\n while (index in 0 until thisSize) {\n val windowSize = size.coerceAtMost(thisSize - index)\n if (!partialWindows && windowSize < size) break\n window.move(index, index + windowSize)\n result.add(transform(window))\n index += step\n }\n return result\n }\n val result = ArrayList()\n windowedIterator(iterator(), size, step, partialWindows, reuseBuffer = true).forEach {\n result.add(transform(it))\n }\n return result\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun Iterable.zip(other: Array): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of values built from the elements of `this` collection and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun Iterable.zip(other: Array, transform: (a: T, b: R) -> V): List {\n val arraySize = other.size\n val list = ArrayList(minOf(collectionSizeOrDefault(10), arraySize))\n var i = 0\n for (element in this) {\n if (i >= arraySize) break\n list.add(transform(element, other[i++]))\n }\n return list\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and [other] collection with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\npublic infix fun Iterable.zip(other: Iterable): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of values built from the elements of `this` collection and the [other] collection with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\npublic inline fun Iterable.zip(other: Iterable, transform: (a: T, b: R) -> V): List {\n val first = iterator()\n val second = other.iterator()\n val list = ArrayList(minOf(collectionSizeOrDefault(10), other.collectionSizeOrDefault(10)))\n while (first.hasNext() && second.hasNext()) {\n list.add(transform(first.next(), second.next()))\n }\n return list\n}\n\n/**\n * Returns a list of pairs of each two adjacent elements in this collection.\n * \n * The returned list is empty if this collection contains less than two elements.\n * \n * @sample samples.collections.Collections.Transformations.zipWithNext\n */\n@SinceKotlin(\"1.2\")\npublic fun Iterable.zipWithNext(): List> {\n return zipWithNext { a, b -> a to b }\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to an each pair of two adjacent elements in this collection.\n * \n * The returned list is empty if this collection contains less than two elements.\n * \n * @sample samples.collections.Collections.Transformations.zipWithNextToFindDeltas\n */\n@SinceKotlin(\"1.2\")\npublic inline fun Iterable.zipWithNext(transform: (a: T, b: T) -> R): List {\n val iterator = iterator()\n if (!iterator.hasNext()) return emptyList()\n val result = mutableListOf()\n var current = iterator.next()\n while (iterator.hasNext()) {\n val next = iterator.next()\n result.add(transform(current, next))\n current = next\n }\n return result\n}\n\n/**\n * Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinTo\n */\npublic fun Iterable.joinTo(buffer: A, separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((T) -> CharSequence)? = null): A {\n buffer.append(prefix)\n var count = 0\n for (element in this) {\n if (++count > 1) buffer.append(separator)\n if (limit < 0 || count <= limit) {\n buffer.appendElement(element, transform)\n } else break\n }\n if (limit >= 0 && count > limit) buffer.append(truncated)\n buffer.append(postfix)\n return buffer\n}\n\n/**\n * Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n * \n * @sample samples.collections.Collections.Transformations.joinToString\n */\npublic fun Iterable.joinToString(separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((T) -> CharSequence)? = null): String {\n return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()\n}\n\n/**\n * Returns this collection as an [Iterable].\n */\n@kotlin.internal.InlineOnly\npublic inline fun Iterable.asIterable(): Iterable {\n return this\n}\n\n/**\n * Creates a [Sequence] instance that wraps the original collection returning its elements when being iterated.\n * \n * @sample samples.collections.Sequences.Building.sequenceFromCollection\n */\npublic fun Iterable.asSequence(): Sequence {\n return Sequence { this.iterator() }\n}\n\n/**\n * Returns an average value of elements in the collection.\n */\n@kotlin.jvm.JvmName(\"averageOfByte\")\npublic fun Iterable.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n checkCountOverflow(++count)\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the collection.\n */\n@kotlin.jvm.JvmName(\"averageOfShort\")\npublic fun Iterable.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n checkCountOverflow(++count)\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the collection.\n */\n@kotlin.jvm.JvmName(\"averageOfInt\")\npublic fun Iterable.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n checkCountOverflow(++count)\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the collection.\n */\n@kotlin.jvm.JvmName(\"averageOfLong\")\npublic fun Iterable.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n checkCountOverflow(++count)\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the collection.\n */\n@kotlin.jvm.JvmName(\"averageOfFloat\")\npublic fun Iterable.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n checkCountOverflow(++count)\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the collection.\n */\n@kotlin.jvm.JvmName(\"averageOfDouble\")\npublic fun Iterable.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n checkCountOverflow(++count)\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns the sum of all elements in the collection.\n */\n@kotlin.jvm.JvmName(\"sumOfByte\")\npublic fun Iterable.sum(): Int {\n var sum: Int = 0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the collection.\n */\n@kotlin.jvm.JvmName(\"sumOfShort\")\npublic fun Iterable.sum(): Int {\n var sum: Int = 0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the collection.\n */\n@kotlin.jvm.JvmName(\"sumOfInt\")\npublic fun Iterable.sum(): Int {\n var sum: Int = 0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the collection.\n */\n@kotlin.jvm.JvmName(\"sumOfLong\")\npublic fun Iterable.sum(): Long {\n var sum: Long = 0L\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the collection.\n */\n@kotlin.jvm.JvmName(\"sumOfFloat\")\npublic fun Iterable.sum(): Float {\n var sum: Float = 0.0f\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the collection.\n */\n@kotlin.jvm.JvmName(\"sumOfDouble\")\npublic fun Iterable.sum(): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"PreconditionsKt\")\n\npackage kotlin\n\nimport kotlin.contracts.contract\n\n/**\n * Throws an [IllegalArgumentException] if the [value] is false.\n *\n * @sample samples.misc.Preconditions.failRequireWithLazyMessage\n */\n@kotlin.internal.InlineOnly\npublic inline fun require(value: Boolean): Unit {\n contract {\n returns() implies value\n }\n require(value) { \"Failed requirement.\" }\n}\n\n/**\n * Throws an [IllegalArgumentException] with the result of calling [lazyMessage] if the [value] is false.\n *\n * @sample samples.misc.Preconditions.failRequireWithLazyMessage\n */\n@kotlin.internal.InlineOnly\npublic inline fun require(value: Boolean, lazyMessage: () -> Any): Unit {\n contract {\n returns() implies value\n }\n if (!value) {\n val message = lazyMessage()\n throw IllegalArgumentException(message.toString())\n }\n}\n\n/**\n * Throws an [IllegalArgumentException] if the [value] is null. Otherwise returns the not null value.\n */\n@kotlin.internal.InlineOnly\npublic inline fun requireNotNull(value: T?): T {\n contract {\n returns() implies (value != null)\n }\n return requireNotNull(value) { \"Required value was null.\" }\n}\n\n/**\n * Throws an [IllegalArgumentException] with the result of calling [lazyMessage] if the [value] is null. Otherwise\n * returns the not null value.\n *\n * @sample samples.misc.Preconditions.failRequireWithLazyMessage\n */\n@kotlin.internal.InlineOnly\npublic inline fun requireNotNull(value: T?, lazyMessage: () -> Any): T {\n contract {\n returns() implies (value != null)\n }\n\n if (value == null) {\n val message = lazyMessage()\n throw IllegalArgumentException(message.toString())\n } else {\n return value\n }\n}\n\n/**\n * Throws an [IllegalStateException] if the [value] is false.\n *\n * @sample samples.misc.Preconditions.failCheckWithLazyMessage\n */\n@kotlin.internal.InlineOnly\npublic inline fun check(value: Boolean): Unit {\n contract {\n returns() implies value\n }\n check(value) { \"Check failed.\" }\n}\n\n/**\n * Throws an [IllegalStateException] with the result of calling [lazyMessage] if the [value] is false.\n *\n * @sample samples.misc.Preconditions.failCheckWithLazyMessage\n */\n@kotlin.internal.InlineOnly\npublic inline fun check(value: Boolean, lazyMessage: () -> Any): Unit {\n contract {\n returns() implies value\n }\n if (!value) {\n val message = lazyMessage()\n throw IllegalStateException(message.toString())\n }\n}\n\n/**\n * Throws an [IllegalStateException] if the [value] is null. Otherwise\n * returns the not null value.\n *\n * @sample samples.misc.Preconditions.failCheckWithLazyMessage\n */\n@kotlin.internal.InlineOnly\npublic inline fun checkNotNull(value: T?): T {\n contract {\n returns() implies (value != null)\n }\n return checkNotNull(value) { \"Required value was null.\" }\n}\n\n/**\n * Throws an [IllegalStateException] with the result of calling [lazyMessage] if the [value] is null. Otherwise\n * returns the not null value.\n *\n * @sample samples.misc.Preconditions.failCheckWithLazyMessage\n */\n@kotlin.internal.InlineOnly\npublic inline fun checkNotNull(value: T?, lazyMessage: () -> Any): T {\n contract {\n returns() implies (value != null)\n }\n\n if (value == null) {\n val message = lazyMessage()\n throw IllegalStateException(message.toString())\n } else {\n return value\n }\n}\n\n\n/**\n * Throws an [IllegalStateException] with the given [message].\n *\n * @sample samples.misc.Preconditions.failWithError\n */\n@kotlin.internal.InlineOnly\npublic inline fun error(message: Any): Nothing = throw IllegalStateException(message.toString())\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.collections\n\nimport kotlin.comparisons.naturalOrder\nimport kotlin.random.Random\n\n/** Returns the array if it's not `null`, or an empty array otherwise. */\n@kotlin.internal.InlineOnly\npublic actual inline fun Array?.orEmpty(): Array = this ?: emptyArray()\n\n@kotlin.internal.InlineOnly\npublic actual inline fun Collection.toTypedArray(): Array = copyToArray(this)\n\n@JsName(\"copyToArray\")\n@PublishedApi\ninternal fun copyToArray(collection: Collection): Array {\n return if (collection.asDynamic().toArray !== undefined)\n collection.asDynamic().toArray().unsafeCast>()\n else\n copyToArrayImpl(collection).unsafeCast>()\n}\n\n@JsName(\"copyToArrayImpl\")\ninternal actual fun copyToArrayImpl(collection: Collection<*>): Array {\n val array = emptyArray()\n val iterator = collection.iterator()\n while (iterator.hasNext())\n array.asDynamic().push(iterator.next())\n return array\n}\n\n@JsName(\"copyToExistingArrayImpl\")\ninternal actual fun copyToArrayImpl(collection: Collection<*>, array: Array): Array {\n if (array.size < collection.size)\n return copyToArrayImpl(collection).unsafeCast>()\n\n val iterator = collection.iterator()\n var index = 0\n while (iterator.hasNext()) {\n array[index++] = iterator.next().unsafeCast()\n }\n if (index < array.size) {\n array[index] = null.unsafeCast()\n }\n return array\n}\n\n\n/**\n * Returns an immutable list containing only the specified object [element].\n */\npublic fun listOf(element: T): List = arrayListOf(element)\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\ninternal actual inline fun buildListInternal(builderAction: MutableList.() -> Unit): List {\n return ArrayList().apply(builderAction).build()\n}\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\ninternal actual inline fun buildListInternal(capacity: Int, builderAction: MutableList.() -> Unit): List {\n checkBuilderCapacity(capacity)\n return ArrayList(capacity).apply(builderAction).build()\n}\n\n\n/**\n * Returns an immutable set containing only the specified object [element].\n */\npublic fun setOf(element: T): Set = hashSetOf(element)\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\ninternal actual inline fun buildSetInternal(builderAction: MutableSet.() -> Unit): Set {\n return LinkedHashSet().apply(builderAction).build()\n}\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\ninternal actual inline fun buildSetInternal(capacity: Int, builderAction: MutableSet.() -> Unit): Set {\n return LinkedHashSet(capacity).apply(builderAction).build()\n}\n\n\n/**\n * Returns an immutable map, mapping only the specified key to the\n * specified value.\n */\npublic fun mapOf(pair: Pair): Map = hashMapOf(pair)\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\ninternal actual inline fun buildMapInternal(builderAction: MutableMap.() -> Unit): Map {\n return LinkedHashMap().apply(builderAction).build()\n}\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\ninternal actual inline fun buildMapInternal(capacity: Int, builderAction: MutableMap.() -> Unit): Map {\n return LinkedHashMap(capacity).apply(builderAction).build()\n}\n\n\n/**\n * Fills the list with the provided [value].\n *\n * Each element in the list gets replaced with the [value].\n */\n@SinceKotlin(\"1.2\")\npublic actual fun MutableList.fill(value: T): Unit {\n for (index in 0..lastIndex) {\n this[index] = value\n }\n}\n\n/**\n * Randomly shuffles elements in this list.\n *\n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.2\")\npublic actual fun MutableList.shuffle(): Unit = shuffle(Random)\n\n/**\n * Returns a new list with the elements of this list randomly shuffled.\n */\n@SinceKotlin(\"1.2\")\npublic actual fun Iterable.shuffled(): List = toMutableList().apply { shuffle() }\n\n/**\n * Sorts elements in the list in-place according to their natural sort order.\n *\n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic actual fun > MutableList.sort(): Unit {\n collectionsSort(this, naturalOrder())\n}\n\n/**\n * Sorts elements in the list in-place according to the order specified with [comparator].\n *\n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic actual fun MutableList.sortWith(comparator: Comparator): Unit {\n collectionsSort(this, comparator)\n}\n\nprivate fun collectionsSort(list: MutableList, comparator: Comparator) {\n if (list.size <= 1) return\n\n val array = copyToArray(list)\n sortArrayWith(array, comparator)\n\n for (i in 0 until array.size) {\n list[i] = array[i]\n }\n}\n\ninternal actual fun arrayOfNulls(reference: Array, size: Int): Array {\n return arrayOfNulls(size).unsafeCast>()\n}\n\n@SinceKotlin(\"1.3\")\n@PublishedApi\n@JsName(\"arrayCopy\")\ninternal fun arrayCopy(source: Array, destination: Array, destinationOffset: Int, startIndex: Int, endIndex: Int) {\n AbstractList.checkRangeIndexes(startIndex, endIndex, source.size)\n val rangeSize = endIndex - startIndex\n AbstractList.checkRangeIndexes(destinationOffset, destinationOffset + rangeSize, destination.size)\n\n if (js(\"ArrayBuffer\").isView(destination) && js(\"ArrayBuffer\").isView(source)) {\n val subrange = source.asDynamic().subarray(startIndex, endIndex)\n destination.asDynamic().set(subrange, destinationOffset)\n } else {\n if (source !== destination || destinationOffset <= startIndex) {\n for (index in 0 until rangeSize) {\n destination[destinationOffset + index] = source[startIndex + index]\n }\n } else {\n for (index in rangeSize - 1 downTo 0) {\n destination[destinationOffset + index] = source[startIndex + index]\n }\n }\n }\n}\n\n// no singleton map implementation in js, return map as is\n@Suppress(\"NOTHING_TO_INLINE\")\ninternal actual inline fun Map.toSingletonMapOrSelf(): Map = this\n\n@Suppress(\"NOTHING_TO_INLINE\")\ninternal actual inline fun Map.toSingletonMap(): Map = this.toMutableMap()\n\n\n@Suppress(\"NOTHING_TO_INLINE\")\ninternal actual inline fun Array.copyToArrayOfAny(isVarargs: Boolean): Array =\n if (isVarargs)\n // no need to copy vararg array in JS\n this\n else\n this.copyOf()\n\n\n\n@PublishedApi\ninternal actual fun checkIndexOverflow(index: Int): Int {\n if (index < 0) {\n throwIndexOverflow()\n }\n return index\n}\n\n@PublishedApi\ninternal actual fun checkCountOverflow(count: Int): Int {\n if (count < 0) {\n throwCountOverflow()\n }\n return count\n}\n\n\n/**\n * JS map and set implementations do not make use of capacities or load factors.\n */\n@PublishedApi\ninternal actual fun mapCapacity(expectedSize: Int) = expectedSize\n\n/**\n * Checks a collection builder function capacity argument.\n * In JS no validation is made in Map/Set constructor yet.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@PublishedApi\ninternal fun checkBuilderCapacity(capacity: Int) {\n require(capacity >= 0) { \"capacity must be non-negative.\" }\n}","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"StandardKt\")\npackage kotlin\n\nimport kotlin.contracts.*\n\n/**\n * An exception is thrown to indicate that a method body remains to be implemented.\n */\npublic class NotImplementedError(message: String = \"An operation is not implemented.\") : Error(message)\n\n/**\n * Always throws [NotImplementedError] stating that operation is not implemented.\n */\n\n@kotlin.internal.InlineOnly\npublic inline fun TODO(): Nothing = throw NotImplementedError()\n\n/**\n * Always throws [NotImplementedError] stating that operation is not implemented.\n *\n * @param reason a string explaining why the implementation is missing.\n */\n@kotlin.internal.InlineOnly\npublic inline fun TODO(reason: String): Nothing = throw NotImplementedError(\"An operation is not implemented: $reason\")\n\n\n\n/**\n * Calls the specified function [block] and returns its result.\n *\n * For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#run).\n */\n@kotlin.internal.InlineOnly\npublic inline fun run(block: () -> R): R {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n return block()\n}\n\n/**\n * Calls the specified function [block] with `this` value as its receiver and returns its result.\n *\n * For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#run).\n */\n@kotlin.internal.InlineOnly\npublic inline fun T.run(block: T.() -> R): R {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n return block()\n}\n\n/**\n * Calls the specified function [block] with the given [receiver] as its receiver and returns its result.\n *\n * For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#with).\n */\n@kotlin.internal.InlineOnly\npublic inline fun with(receiver: T, block: T.() -> R): R {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n return receiver.block()\n}\n\n/**\n * Calls the specified function [block] with `this` value as its receiver and returns `this` value.\n *\n * For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#apply).\n */\n@kotlin.internal.InlineOnly\npublic inline fun T.apply(block: T.() -> Unit): T {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n block()\n return this\n}\n\n/**\n * Calls the specified function [block] with `this` value as its argument and returns `this` value.\n *\n * For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#also).\n */\n@kotlin.internal.InlineOnly\n@SinceKotlin(\"1.1\")\npublic inline fun T.also(block: (T) -> Unit): T {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n block(this)\n return this\n}\n\n/**\n * Calls the specified function [block] with `this` value as its argument and returns its result.\n *\n * For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#let).\n */\n@kotlin.internal.InlineOnly\npublic inline fun T.let(block: (T) -> R): R {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n return block(this)\n}\n\n/**\n * Returns `this` value if it satisfies the given [predicate] or `null`, if it doesn't.\n *\n * For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#takeif-and-takeunless).\n */\n@kotlin.internal.InlineOnly\n@SinceKotlin(\"1.1\")\npublic inline fun T.takeIf(predicate: (T) -> Boolean): T? {\n contract {\n callsInPlace(predicate, InvocationKind.EXACTLY_ONCE)\n }\n return if (predicate(this)) this else null\n}\n\n/**\n * Returns `this` value if it _does not_ satisfy the given [predicate] or `null`, if it does.\n *\n * For detailed usage information see the documentation for [scope functions](https://kotlinlang.org/docs/reference/scope-functions.html#takeif-and-takeunless).\n */\n@kotlin.internal.InlineOnly\n@SinceKotlin(\"1.1\")\npublic inline fun T.takeUnless(predicate: (T) -> Boolean): T? {\n contract {\n callsInPlace(predicate, InvocationKind.EXACTLY_ONCE)\n }\n return if (!predicate(this)) this else null\n}\n\n/**\n * Executes the given function [action] specified number of [times].\n *\n * A zero-based index of current iteration is passed as a parameter to [action].\n *\n * @sample samples.misc.ControlFlow.repeat\n */\n@kotlin.internal.InlineOnly\npublic inline fun repeat(times: Int, action: (Int) -> Unit) {\n contract { callsInPlace(action) }\n\n for (index in 0 until times) {\n action(index)\n }\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"CollectionsKt\")\n\npackage kotlin.collections\n\n/**\n * Given an [iterator] function constructs an [Iterable] instance that returns values through the [Iterator]\n * provided by that function.\n * @sample samples.collections.Iterables.Building.iterable\n */\n@kotlin.internal.InlineOnly\npublic inline fun Iterable(crossinline iterator: () -> Iterator): Iterable = object : Iterable {\n override fun iterator(): Iterator = iterator()\n}\n\n/**\n * A wrapper over another [Iterable] (or any other object that can produce an [Iterator]) that returns\n * an indexing iterator.\n */\ninternal class IndexingIterable(private val iteratorFactory: () -> Iterator) : Iterable> {\n override fun iterator(): Iterator> = IndexingIterator(iteratorFactory())\n}\n\n\n/**\n * Returns the size of this iterable if it is known, or `null` otherwise.\n */\n@PublishedApi\ninternal fun Iterable.collectionSizeOrNull(): Int? = if (this is Collection<*>) this.size else null\n\n/**\n * Returns the size of this iterable if it is known, or the specified [default] value otherwise.\n */\n@PublishedApi\ninternal fun Iterable.collectionSizeOrDefault(default: Int): Int = if (this is Collection<*>) this.size else default\n\n/** Returns true when it's safe to convert this collection to a set without changing contains method behavior. */\nprivate fun Collection.safeToConvertToSet() = size > 2 && this is ArrayList\n\n/** Converts this collection to a set, when it's worth so and it doesn't change contains method behavior. */\ninternal fun Iterable.convertToSetForSetOperationWith(source: Iterable): Collection =\n when (this) {\n is Set -> this\n is Collection ->\n when {\n source is Collection && source.size < 2 -> this\n else -> if (this.safeToConvertToSet()) toHashSet() else this\n }\n else -> toHashSet()\n }\n\n/** Converts this collection to a set, when it's worth so and it doesn't change contains method behavior. */\ninternal fun Iterable.convertToSetForSetOperation(): Collection =\n when (this) {\n is Set -> this\n is Collection -> if (this.safeToConvertToSet()) toHashSet() else this\n else -> toHashSet()\n }\n\n\n/**\n * Returns a single list of all elements from all collections in the given collection.\n * @sample samples.collections.Iterables.Operations.flattenIterable\n */\npublic fun Iterable>.flatten(): List {\n val result = ArrayList()\n for (element in this) {\n result.addAll(element)\n }\n return result\n}\n\n/**\n * Returns a pair of lists, where\n * *first* list is built from the first values of each pair from this collection,\n * *second* list is built from the second values of each pair from this collection.\n * @sample samples.collections.Iterables.Operations.unzipIterable\n */\npublic fun Iterable>.unzip(): Pair, List> {\n val expectedSize = collectionSizeOrDefault(10)\n val listT = ArrayList(expectedSize)\n val listR = ArrayList(expectedSize)\n for (pair in this) {\n listT.add(pair.first)\n listR.add(pair.second)\n }\n return listT to listR\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"SequencesKt\")\n\npackage kotlin.sequences\n\n//\n// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt\n// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib\n//\n\nimport kotlin.random.*\n\n/**\n * Returns `true` if [element] is found in the sequence.\n *\n * The operation is _terminal_.\n */\npublic operator fun <@kotlin.internal.OnlyInputTypes T> Sequence.contains(element: T): Boolean {\n return indexOf(element) >= 0\n}\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this sequence.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic fun Sequence.elementAt(index: Int): T {\n return elementAtOrElse(index) { throw IndexOutOfBoundsException(\"Sequence doesn't contain element at index $index.\") }\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this sequence.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\npublic fun Sequence.elementAtOrElse(index: Int, defaultValue: (Int) -> T): T {\n if (index < 0)\n return defaultValue(index)\n val iterator = iterator()\n var count = 0\n while (iterator.hasNext()) {\n val element = iterator.next()\n if (index == count++)\n return element\n }\n return defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this sequence.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\npublic fun Sequence.elementAtOrNull(index: Int): T? {\n if (index < 0)\n return null\n val iterator = iterator()\n var count = 0\n while (iterator.hasNext()) {\n val element = iterator.next()\n if (index == count++)\n return element\n }\n return null\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.find(predicate: (T) -> Boolean): T? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.findLast(predicate: (T) -> Boolean): T? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the sequence is empty.\n *\n * The operation is _terminal_.\n */\npublic fun Sequence.first(): T {\n val iterator = iterator()\n if (!iterator.hasNext())\n throw NoSuchElementException(\"Sequence is empty.\")\n return iterator.next()\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n *\n * The operation is _terminal_.\n */\npublic inline fun Sequence.first(predicate: (T) -> Boolean): T {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Sequence contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element, or `null` if the sequence is empty.\n *\n * The operation is _terminal_.\n */\npublic fun Sequence.firstOrNull(): T? {\n val iterator = iterator()\n if (!iterator.hasNext())\n return null\n return iterator.next()\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n *\n * The operation is _terminal_.\n */\npublic inline fun Sequence.firstOrNull(predicate: (T) -> Boolean): T? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns first index of [element], or -1 if the sequence does not contain element.\n *\n * The operation is _terminal_.\n */\npublic fun <@kotlin.internal.OnlyInputTypes T> Sequence.indexOf(element: T): Int {\n var index = 0\n for (item in this) {\n checkIndexOverflow(index)\n if (element == item)\n return index\n index++\n }\n return -1\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the sequence does not contain such element.\n *\n * The operation is _terminal_.\n */\npublic inline fun Sequence.indexOfFirst(predicate: (T) -> Boolean): Int {\n var index = 0\n for (item in this) {\n checkIndexOverflow(index)\n if (predicate(item))\n return index\n index++\n }\n return -1\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the sequence does not contain such element.\n *\n * The operation is _terminal_.\n */\npublic inline fun Sequence.indexOfLast(predicate: (T) -> Boolean): Int {\n var lastIndex = -1\n var index = 0\n for (item in this) {\n checkIndexOverflow(index)\n if (predicate(item))\n lastIndex = index\n index++\n }\n return lastIndex\n}\n\n/**\n * Returns the last element.\n *\n * The operation is _terminal_.\n * \n * @throws NoSuchElementException if the sequence is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun Sequence.last(): T {\n val iterator = iterator()\n if (!iterator.hasNext())\n throw NoSuchElementException(\"Sequence is empty.\")\n var last = iterator.next()\n while (iterator.hasNext())\n last = iterator.next()\n return last\n}\n\n/**\n * Returns the last element matching the given [predicate].\n *\n * The operation is _terminal_.\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun Sequence.last(predicate: (T) -> Boolean): T {\n var last: T? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n last = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Sequence contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return last as T\n}\n\n/**\n * Returns last index of [element], or -1 if the sequence does not contain element.\n *\n * The operation is _terminal_.\n */\npublic fun <@kotlin.internal.OnlyInputTypes T> Sequence.lastIndexOf(element: T): Int {\n var lastIndex = -1\n var index = 0\n for (item in this) {\n checkIndexOverflow(index)\n if (element == item)\n lastIndex = index\n index++\n }\n return lastIndex\n}\n\n/**\n * Returns the last element, or `null` if the sequence is empty.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic fun Sequence.lastOrNull(): T? {\n val iterator = iterator()\n if (!iterator.hasNext())\n return null\n var last = iterator.next()\n while (iterator.hasNext())\n last = iterator.next()\n return last\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Elements.last\n */\npublic inline fun Sequence.lastOrNull(predicate: (T) -> Boolean): T? {\n var last: T? = null\n for (element in this) {\n if (predicate(element)) {\n last = element\n }\n }\n return last\n}\n\n/**\n * Returns the single element, or throws an exception if the sequence is empty or has more than one element.\n *\n * The operation is _terminal_.\n */\npublic fun Sequence.single(): T {\n val iterator = iterator()\n if (!iterator.hasNext())\n throw NoSuchElementException(\"Sequence is empty.\")\n val single = iterator.next()\n if (iterator.hasNext())\n throw IllegalArgumentException(\"Sequence has more than one element.\")\n return single\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n *\n * The operation is _terminal_.\n */\npublic inline fun Sequence.single(predicate: (T) -> Boolean): T {\n var single: T? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Sequence contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Sequence contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as T\n}\n\n/**\n * Returns single element, or `null` if the sequence is empty or has more than one element.\n *\n * The operation is _terminal_.\n */\npublic fun Sequence.singleOrNull(): T? {\n val iterator = iterator()\n if (!iterator.hasNext())\n return null\n val single = iterator.next()\n if (iterator.hasNext())\n return null\n return single\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n *\n * The operation is _terminal_.\n */\npublic inline fun Sequence.singleOrNull(predicate: (T) -> Boolean): T? {\n var single: T? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns a sequence containing all elements except first [n] elements.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun Sequence.drop(n: Int): Sequence {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return when {\n n == 0 -> this\n this is DropTakeSequence -> this.drop(n)\n else -> DropSequence(this, n)\n }\n}\n\n/**\n * Returns a sequence containing all elements except first elements that satisfy the given [predicate].\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\npublic fun Sequence.dropWhile(predicate: (T) -> Boolean): Sequence {\n return DropWhileSequence(this, predicate)\n}\n\n/**\n * Returns a sequence containing only elements matching the given [predicate].\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic fun Sequence.filter(predicate: (T) -> Boolean): Sequence {\n return FilteringSequence(this, true, predicate)\n}\n\n/**\n * Returns a sequence containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\npublic fun Sequence.filterIndexed(predicate: (index: Int, T) -> Boolean): Sequence {\n // TODO: Rewrite with generalized MapFilterIndexingSequence\n return TransformingSequence(FilteringSequence(IndexingSequence(this), true, { predicate(it.index, it.value) }), { it.value })\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\npublic inline fun > Sequence.filterIndexedTo(destination: C, predicate: (index: Int, T) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Returns a sequence containing all elements that are instances of specified type parameter R.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Filtering.filterIsInstance\n */\npublic inline fun Sequence<*>.filterIsInstance(): Sequence<@kotlin.internal.NoInfer R> {\n @Suppress(\"UNCHECKED_CAST\")\n return filter { it is R } as Sequence\n}\n\n/**\n * Appends all elements that are instances of specified type parameter R to the given [destination].\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Filtering.filterIsInstanceTo\n */\npublic inline fun > Sequence<*>.filterIsInstanceTo(destination: C): C {\n for (element in this) if (element is R) destination.add(element)\n return destination\n}\n\n/**\n * Returns a sequence containing all elements not matching the given [predicate].\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\npublic fun Sequence.filterNot(predicate: (T) -> Boolean): Sequence {\n return FilteringSequence(this, false, predicate)\n}\n\n/**\n * Returns a sequence containing all elements that are not `null`.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Filtering.filterNotNull\n */\npublic fun Sequence.filterNotNull(): Sequence {\n @Suppress(\"UNCHECKED_CAST\")\n return filterNot { it == null } as Sequence\n}\n\n/**\n * Appends all elements that are not `null` to the given [destination].\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Filtering.filterNotNullTo\n */\npublic fun , T : Any> Sequence.filterNotNullTo(destination: C): C {\n for (element in this) if (element != null) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > Sequence.filterNotTo(destination: C, predicate: (T) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun > Sequence.filterTo(destination: C, predicate: (T) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Returns a sequence containing first [n] elements.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun Sequence.take(n: Int): Sequence {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return when {\n n == 0 -> emptySequence()\n this is DropTakeSequence -> this.take(n)\n else -> TakeSequence(this, n)\n }\n}\n\n/**\n * Returns a sequence containing first elements satisfying the given [predicate].\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\npublic fun Sequence.takeWhile(predicate: (T) -> Boolean): Sequence {\n return TakeWhileSequence(this, predicate)\n}\n\n/**\n * Returns a sequence that yields elements of this sequence sorted according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n *\n * The operation is _intermediate_ and _stateful_.\n */\npublic fun > Sequence.sorted(): Sequence {\n return object : Sequence {\n override fun iterator(): Iterator {\n val sortedList = this@sorted.toMutableList()\n sortedList.sort()\n return sortedList.iterator()\n }\n }\n}\n\n/**\n * Returns a sequence that yields elements of this sequence sorted according to natural sort order of the value returned by specified [selector] function.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n *\n * The operation is _intermediate_ and _stateful_.\n * \n * @sample samples.collections.Collections.Sorting.sortedBy\n */\npublic inline fun > Sequence.sortedBy(crossinline selector: (T) -> R?): Sequence {\n return sortedWith(compareBy(selector))\n}\n\n/**\n * Returns a sequence that yields elements of this sequence sorted descending according to natural sort order of the value returned by specified [selector] function.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n *\n * The operation is _intermediate_ and _stateful_.\n */\npublic inline fun > Sequence.sortedByDescending(crossinline selector: (T) -> R?): Sequence {\n return sortedWith(compareByDescending(selector))\n}\n\n/**\n * Returns a sequence that yields elements of this sequence sorted descending according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n *\n * The operation is _intermediate_ and _stateful_.\n */\npublic fun > Sequence.sortedDescending(): Sequence {\n return sortedWith(reverseOrder())\n}\n\n/**\n * Returns a sequence that yields elements of this sequence sorted according to the specified [comparator].\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n *\n * The operation is _intermediate_ and _stateful_.\n */\npublic fun Sequence.sortedWith(comparator: Comparator): Sequence {\n return object : Sequence {\n override fun iterator(): Iterator {\n val sortedList = this@sortedWith.toMutableList()\n sortedList.sortWith(comparator)\n return sortedList.iterator()\n }\n }\n}\n\n/**\n * Returns a [Map] containing key-value pairs provided by [transform] function\n * applied to elements of the given sequence.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original sequence.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Transformations.associate\n */\npublic inline fun Sequence.associate(transform: (T) -> Pair): Map {\n return associateTo(LinkedHashMap(), transform)\n}\n\n/**\n * Returns a [Map] containing the elements from the given sequence indexed by the key\n * returned from [keySelector] function applied to each element.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original sequence.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Transformations.associateBy\n */\npublic inline fun Sequence.associateBy(keySelector: (T) -> K): Map {\n return associateByTo(LinkedHashMap(), keySelector)\n}\n\n/**\n * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to elements of the given sequence.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original sequence.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Transformations.associateByWithValueTransform\n */\npublic inline fun Sequence.associateBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map {\n return associateByTo(LinkedHashMap(), keySelector, valueTransform)\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function applied to each element of the given sequence\n * and value is the element itself.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Transformations.associateByTo\n */\npublic inline fun > Sequence.associateByTo(destination: M, keySelector: (T) -> K): M {\n for (element in this) {\n destination.put(keySelector(element), element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function and\n * and value is provided by the [valueTransform] function applied to elements of the given sequence.\n * \n * If any two elements would have the same key returned by [keySelector] the last one gets added to the map.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Transformations.associateByToWithValueTransform\n */\npublic inline fun > Sequence.associateByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M {\n for (element in this) {\n destination.put(keySelector(element), valueTransform(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs\n * provided by [transform] function applied to each element of the given sequence.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Transformations.associateTo\n */\npublic inline fun > Sequence.associateTo(destination: M, transform: (T) -> Pair): M {\n for (element in this) {\n destination += transform(element)\n }\n return destination\n}\n\n/**\n * Returns a [Map] where keys are elements from the given sequence and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original sequence.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.3\")\npublic inline fun Sequence.associateWith(valueSelector: (K) -> V): Map {\n val result = LinkedHashMap()\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given sequence,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.3\")\npublic inline fun > Sequence.associateWithTo(destination: M, valueSelector: (K) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Appends all elements to the given [destination] collection.\n *\n * The operation is _terminal_.\n */\npublic fun > Sequence.toCollection(destination: C): C {\n for (item in this) {\n destination.add(item)\n }\n return destination\n}\n\n/**\n * Returns a new [HashSet] of all elements.\n *\n * The operation is _terminal_.\n */\npublic fun Sequence.toHashSet(): HashSet {\n return toCollection(HashSet())\n}\n\n/**\n * Returns a [List] containing all elements.\n *\n * The operation is _terminal_.\n */\npublic fun Sequence.toList(): List {\n return this.toMutableList().optimizeReadOnlyList()\n}\n\n/**\n * Returns a new [MutableList] filled with all elements of this sequence.\n *\n * The operation is _terminal_.\n */\npublic fun Sequence.toMutableList(): MutableList {\n return toCollection(ArrayList())\n}\n\n/**\n * Returns a [Set] of all elements.\n * \n * The returned set preserves the element iteration order of the original sequence.\n *\n * The operation is _terminal_.\n */\npublic fun Sequence.toSet(): Set {\n return toCollection(LinkedHashSet()).optimizeReadOnlySet()\n}\n\n/**\n * Returns a single sequence of all elements from results of [transform] function being invoked on each element of original sequence.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIterable\")\npublic fun Sequence.flatMap(transform: (T) -> Iterable): Sequence {\n return FlatteningSequence(this, transform, Iterable::iterator)\n}\n\n/**\n * Returns a single sequence of all elements from results of [transform] function being invoked on each element of original sequence.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\npublic fun Sequence.flatMap(transform: (T) -> Sequence): Sequence {\n return FlatteningSequence(this, transform, Sequence::iterator)\n}\n\n/**\n * Returns a single sequence of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original sequence.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterable\")\npublic fun Sequence.flatMapIndexed(transform: (index: Int, T) -> Iterable): Sequence {\n return flatMapIndexed(this, transform, Iterable::iterator)\n}\n\n/**\n * Returns a single sequence of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original sequence.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedSequence\")\npublic fun Sequence.flatMapIndexed(transform: (index: Int, T) -> Sequence): Sequence {\n return flatMapIndexed(this, transform, Sequence::iterator)\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original sequence, to the given [destination].\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterableTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > Sequence.flatMapIndexedTo(destination: C, transform: (index: Int, T) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(checkIndexOverflow(index++), element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original sequence, to the given [destination].\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedSequenceTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > Sequence.flatMapIndexedTo(destination: C, transform: (index: Int, T) -> Sequence): C {\n var index = 0\n for (element in this) {\n val list = transform(checkIndexOverflow(index++), element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original sequence, to the given [destination].\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIterableTo\")\npublic inline fun > Sequence.flatMapTo(destination: C, transform: (T) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original sequence, to the given [destination].\n *\n * The operation is _terminal_.\n */\npublic inline fun > Sequence.flatMapTo(destination: C, transform: (T) -> Sequence): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Groups elements of the original sequence by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original sequence.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun Sequence.groupBy(keySelector: (T) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original sequence\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original sequence.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun Sequence.groupBy(keySelector: (T) -> K, valueTransform: (T) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups elements of the original sequence by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun >> Sequence.groupByTo(destination: M, keySelector: (T) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original sequence\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun >> Sequence.groupByTo(destination: M, keySelector: (T) -> K, valueTransform: (T) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Creates a [Grouping] source from a sequence to be used later with one of group-and-fold operations\n * using the specified [keySelector] function to extract a key from each element.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Grouping.groupingByEachCount\n */\n@SinceKotlin(\"1.1\")\npublic inline fun Sequence.groupingBy(crossinline keySelector: (T) -> K): Grouping {\n return object : Grouping {\n override fun sourceIterator(): Iterator = this@groupingBy.iterator()\n override fun keyOf(element: T): K = keySelector(element)\n }\n}\n\n/**\n * Returns a sequence containing the results of applying the given [transform] function\n * to each element in the original sequence.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\npublic fun Sequence.map(transform: (T) -> R): Sequence {\n return TransformingSequence(this, transform)\n}\n\n/**\n * Returns a sequence containing the results of applying the given [transform] function\n * to each element and its index in the original sequence.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n *\n * The operation is _intermediate_ and _stateless_.\n */\npublic fun Sequence.mapIndexed(transform: (index: Int, T) -> R): Sequence {\n return TransformingIndexedSequence(this, transform)\n}\n\n/**\n * Returns a sequence containing only the non-null results of applying the given [transform] function\n * to each element and its index in the original sequence.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n *\n * The operation is _intermediate_ and _stateless_.\n */\npublic fun Sequence.mapIndexedNotNull(transform: (index: Int, T) -> R?): Sequence {\n return TransformingIndexedSequence(this, transform).filterNotNull()\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original sequence\n * and appends only the non-null results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n *\n * The operation is _terminal_.\n */\npublic inline fun > Sequence.mapIndexedNotNullTo(destination: C, transform: (index: Int, T) -> R?): C {\n forEachIndexed { index, element -> transform(index, element)?.let { destination.add(it) } }\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original sequence\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n *\n * The operation is _terminal_.\n */\npublic inline fun > Sequence.mapIndexedTo(destination: C, transform: (index: Int, T) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(checkIndexOverflow(index++), item))\n return destination\n}\n\n/**\n * Returns a sequence containing only the non-null results of applying the given [transform] function\n * to each element in the original sequence.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Transformations.mapNotNull\n */\npublic fun Sequence.mapNotNull(transform: (T) -> R?): Sequence {\n return TransformingSequence(this, transform).filterNotNull()\n}\n\n/**\n * Applies the given [transform] function to each element in the original sequence\n * and appends only the non-null results to the given [destination].\n *\n * The operation is _terminal_.\n */\npublic inline fun > Sequence.mapNotNullTo(destination: C, transform: (T) -> R?): C {\n forEach { element -> transform(element)?.let { destination.add(it) } }\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original sequence\n * and appends the results to the given [destination].\n *\n * The operation is _terminal_.\n */\npublic inline fun > Sequence.mapTo(destination: C, transform: (T) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Returns a sequence that wraps each element of the original sequence\n * into an [IndexedValue] containing the index of that element and the element itself.\n *\n * The operation is _intermediate_ and _stateless_.\n */\npublic fun Sequence.withIndex(): Sequence> {\n return IndexingSequence(this)\n}\n\n/**\n * Returns a sequence containing only distinct elements from the given sequence.\n * \n * Among equal elements of the given sequence, only the first one will be present in the resulting sequence.\n * The elements in the resulting sequence are in the same order as they were in the source sequence.\n *\n * The operation is _intermediate_ and _stateful_.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic fun Sequence.distinct(): Sequence {\n return this.distinctBy { it }\n}\n\n/**\n * Returns a sequence containing only elements from the given sequence\n * having distinct keys returned by the given [selector] function.\n * \n * Among elements of the given sequence with equal keys, only the first one will be present in the resulting sequence.\n * The elements in the resulting sequence are in the same order as they were in the source sequence.\n *\n * The operation is _intermediate_ and _stateful_.\n * \n * @sample samples.collections.Collections.Transformations.distinctAndDistinctBy\n */\npublic fun Sequence.distinctBy(selector: (T) -> K): Sequence {\n return DistinctSequence(this, selector)\n}\n\n/**\n * Returns a new [MutableSet] containing all distinct elements from the given sequence.\n * \n * The returned set preserves the element iteration order of the original sequence.\n *\n * The operation is _terminal_.\n */\npublic fun Sequence.toMutableSet(): MutableSet {\n val set = LinkedHashSet()\n for (item in this) set.add(item)\n return set\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\npublic inline fun Sequence.all(predicate: (T) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if sequence has at least one element.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\npublic fun Sequence.any(): Boolean {\n return iterator().hasNext()\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\npublic inline fun Sequence.any(predicate: (T) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns the number of elements in this sequence.\n *\n * The operation is _terminal_.\n */\npublic fun Sequence.count(): Int {\n var count = 0\n for (element in this) checkCountOverflow(++count)\n return count\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n *\n * The operation is _terminal_.\n */\npublic inline fun Sequence.count(predicate: (T) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) checkCountOverflow(++count)\n return count\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the sequence is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n *\n * The operation is _terminal_.\n */\npublic inline fun Sequence.fold(initial: R, operation: (acc: R, T) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original sequence.\n * \n * Returns the specified [initial] value if the sequence is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n *\n * The operation is _terminal_.\n */\npublic inline fun Sequence.foldIndexed(initial: R, operation: (index: Int, acc: R, T) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(checkIndexOverflow(index++), accumulator, element)\n return accumulator\n}\n\n/**\n * Performs the given [action] on each element.\n *\n * The operation is _terminal_.\n */\npublic inline fun Sequence.forEach(action: (T) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n *\n * The operation is _terminal_.\n */\npublic inline fun Sequence.forEachIndexed(action: (index: Int, T) -> Unit): Unit {\n var index = 0\n for (item in this) action(checkIndexOverflow(index++), item)\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.1\")\npublic fun Sequence.max(): Double? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.1\")\npublic fun Sequence.max(): Float? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun > Sequence.max(): T? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > Sequence.maxBy(selector: (T) -> R): T? {\n return maxByOrNull(selector)\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > Sequence.maxByOrNull(selector: (T) -> R): T? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var maxElem = iterator.next()\n if (!iterator.hasNext()) return maxElem\n var maxValue = selector(maxElem)\n do {\n val e = iterator.next()\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n } while (iterator.hasNext())\n return maxElem\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the sequence.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the sequence is empty.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.maxOf(selector: (T) -> Double): Double {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the sequence.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the sequence is empty.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.maxOf(selector: (T) -> Float): Float {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the sequence.\n * \n * @throws NoSuchElementException if the sequence is empty.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Sequence.maxOf(selector: (T) -> R): R {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the sequence or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.maxOfOrNull(selector: (T) -> Double): Double? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the sequence or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.maxOfOrNull(selector: (T) -> Float): Float? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the sequence or `null` if there are no elements.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Sequence.maxOfOrNull(selector: (T) -> R): R? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the sequence.\n * \n * @throws NoSuchElementException if the sequence is empty.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.maxOfWith(comparator: Comparator, selector: (T) -> R): R {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the sequence or `null` if there are no elements.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.maxOfWithOrNull(comparator: Comparator, selector: (T) -> R): R? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var maxValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\npublic fun Sequence.maxOrNull(): Double? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var max = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n max = maxOf(max, e)\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\npublic fun Sequence.maxOrNull(): Float? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var max = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n max = maxOf(max, e)\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\npublic fun > Sequence.maxOrNull(): T? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var max = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n if (max < e) max = e\n }\n return max\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun Sequence.maxWith(comparator: Comparator): T? {\n return maxWithOrNull(comparator)\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\npublic fun Sequence.maxWithOrNull(comparator: Comparator): T? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var max = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.1\")\npublic fun Sequence.min(): Double? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.1\")\npublic fun Sequence.min(): Float? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun > Sequence.min(): T? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > Sequence.minBy(selector: (T) -> R): T? {\n return minByOrNull(selector)\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > Sequence.minByOrNull(selector: (T) -> R): T? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var minElem = iterator.next()\n if (!iterator.hasNext()) return minElem\n var minValue = selector(minElem)\n do {\n val e = iterator.next()\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n } while (iterator.hasNext())\n return minElem\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the sequence.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the sequence is empty.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.minOf(selector: (T) -> Double): Double {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the sequence.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the sequence is empty.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.minOf(selector: (T) -> Float): Float {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the sequence.\n * \n * @throws NoSuchElementException if the sequence is empty.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Sequence.minOf(selector: (T) -> R): R {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the sequence or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.minOfOrNull(selector: (T) -> Double): Double? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the sequence or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.minOfOrNull(selector: (T) -> Float): Float? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the sequence or `null` if there are no elements.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Sequence.minOfOrNull(selector: (T) -> R): R? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the sequence.\n * \n * @throws NoSuchElementException if the sequence is empty.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.minOfWith(comparator: Comparator, selector: (T) -> R): R {\n val iterator = iterator()\n if (!iterator.hasNext()) throw NoSuchElementException()\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the sequence or `null` if there are no elements.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.minOfWithOrNull(comparator: Comparator, selector: (T) -> R): R? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var minValue = selector(iterator.next())\n while (iterator.hasNext()) {\n val v = selector(iterator.next())\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\npublic fun Sequence.minOrNull(): Double? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var min = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n min = minOf(min, e)\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n * \n * If any of elements is `NaN` returns `NaN`.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\npublic fun Sequence.minOrNull(): Float? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var min = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n min = minOf(min, e)\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\npublic fun > Sequence.minOrNull(): T? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var min = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n if (min > e) min = e\n }\n return min\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun Sequence.minWith(comparator: Comparator): T? {\n return minWithOrNull(comparator)\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\npublic fun Sequence.minWithOrNull(comparator: Comparator): T? {\n val iterator = iterator()\n if (!iterator.hasNext()) return null\n var min = iterator.next()\n while (iterator.hasNext()) {\n val e = iterator.next()\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns `true` if the sequence has no elements.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\npublic fun Sequence.none(): Boolean {\n return !iterator().hasNext()\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\npublic inline fun Sequence.none(predicate: (T) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Returns a sequence which performs the given [action] on each element of the original sequence as they pass through it.\n *\n * The operation is _intermediate_ and _stateless_.\n */\n@SinceKotlin(\"1.1\")\npublic fun Sequence.onEach(action: (T) -> Unit): Sequence {\n return map {\n action(it)\n it\n }\n}\n\n/**\n * Returns a sequence which performs the given [action] on each element of the original sequence as they pass through it.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n *\n * The operation is _intermediate_ and _stateless_.\n */\n@SinceKotlin(\"1.4\")\npublic fun Sequence.onEachIndexed(action: (index: Int, T) -> Unit): Sequence {\n return mapIndexed { index, element ->\n action(index, element)\n element\n }\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this sequence is empty. If the sequence can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun Sequence.reduce(operation: (acc: S, T) -> S): S {\n val iterator = this.iterator()\n if (!iterator.hasNext()) throw UnsupportedOperationException(\"Empty sequence can't be reduced.\")\n var accumulator: S = iterator.next()\n while (iterator.hasNext()) {\n accumulator = operation(accumulator, iterator.next())\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original sequence.\n * \n * Throws an exception if this sequence is empty. If the sequence can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun Sequence.reduceIndexed(operation: (index: Int, acc: S, T) -> S): S {\n val iterator = this.iterator()\n if (!iterator.hasNext()) throw UnsupportedOperationException(\"Empty sequence can't be reduced.\")\n var index = 1\n var accumulator: S = iterator.next()\n while (iterator.hasNext()) {\n accumulator = operation(checkIndexOverflow(index++), accumulator, iterator.next())\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original sequence.\n * \n * Returns `null` if the sequence is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun Sequence.reduceIndexedOrNull(operation: (index: Int, acc: S, T) -> S): S? {\n val iterator = this.iterator()\n if (!iterator.hasNext()) return null\n var index = 1\n var accumulator: S = iterator.next()\n while (iterator.hasNext()) {\n accumulator = operation(checkIndexOverflow(index++), accumulator, iterator.next())\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the sequence is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun Sequence.reduceOrNull(operation: (acc: S, T) -> S): S? {\n val iterator = this.iterator()\n if (!iterator.hasNext()) return null\n var accumulator: S = iterator.next()\n while (iterator.hasNext()) {\n accumulator = operation(accumulator, iterator.next())\n }\n return accumulator\n}\n\n/**\n * Returns a sequence containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting sequence.\n * The [initial] value should also be immutable (or should not be mutated)\n * as it may be passed to [operation] function later because of sequence's lazy nature.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\npublic fun Sequence.runningFold(initial: R, operation: (acc: R, T) -> R): Sequence {\n return sequence {\n yield(initial)\n var accumulator = initial\n for (element in this@runningFold) {\n accumulator = operation(accumulator, element)\n yield(accumulator)\n }\n }\n}\n\n/**\n * Returns a sequence containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original sequence and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting sequence.\n * The [initial] value should also be immutable (or should not be mutated)\n * as it may be passed to [operation] function later because of sequence's lazy nature.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\npublic fun Sequence.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, T) -> R): Sequence {\n return sequence {\n yield(initial)\n var index = 0\n var accumulator = initial\n for (element in this@runningFoldIndexed) {\n accumulator = operation(checkIndexOverflow(index++), accumulator, element)\n yield(accumulator)\n }\n }\n}\n\n/**\n * Returns a sequence containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this sequence.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting sequence.\n * \n * @param [operation] function that takes current accumulator value and the element, and calculates the next accumulator value.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun Sequence.runningReduce(operation: (acc: S, T) -> S): Sequence {\n return sequence {\n val iterator = iterator()\n if (iterator.hasNext()) {\n var accumulator: S = iterator.next()\n yield(accumulator)\n while (iterator.hasNext()) {\n accumulator = operation(accumulator, iterator.next())\n yield(accumulator)\n }\n }\n }\n}\n\n/**\n * Returns a sequence containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original sequence and current accumulator value that starts with the first element of this sequence.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting sequence.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\npublic fun Sequence.runningReduceIndexed(operation: (index: Int, acc: S, T) -> S): Sequence {\n return sequence {\n val iterator = iterator()\n if (iterator.hasNext()) {\n var accumulator: S = iterator.next()\n yield(accumulator)\n var index = 1\n while (iterator.hasNext()) {\n accumulator = operation(checkIndexOverflow(index++), accumulator, iterator.next())\n yield(accumulator)\n }\n }\n }\n}\n\n/**\n * Returns a sequence containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting sequence.\n * The [initial] value should also be immutable (or should not be mutated)\n * as it may be passed to [operation] function later because of sequence's lazy nature.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun Sequence.scan(initial: R, operation: (acc: R, T) -> R): Sequence {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a sequence containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original sequence and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting sequence.\n * The [initial] value should also be immutable (or should not be mutated)\n * as it may be passed to [operation] function later because of sequence's lazy nature.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun Sequence.scanIndexed(initial: R, operation: (index: Int, acc: R, T) -> R): Sequence {\n return runningFoldIndexed(initial, operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\npublic fun Sequence.scanReduce(operation: (acc: S, T) -> S): Sequence {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\npublic fun Sequence.scanReduceIndexed(operation: (index: Int, acc: S, T) -> S): Sequence {\n return runningReduceIndexed(operation)\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the sequence.\n *\n * The operation is _terminal_.\n */\npublic inline fun Sequence.sumBy(selector: (T) -> Int): Int {\n var sum: Int = 0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the sequence.\n *\n * The operation is _terminal_.\n */\npublic inline fun Sequence.sumByDouble(selector: (T) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the sequence.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.sumOf(selector: (T) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the sequence.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.sumOf(selector: (T) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the sequence.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.sumOf(selector: (T) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the sequence.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.sumOf(selector: (T) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the sequence.\n *\n * The operation is _terminal_.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.sumOf(selector: (T) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns an original collection containing all the non-`null` elements, throwing an [IllegalArgumentException] if there are any `null` elements.\n *\n * The operation is _intermediate_ and _stateless_.\n */\npublic fun Sequence.requireNoNulls(): Sequence {\n return map { it ?: throw IllegalArgumentException(\"null element found in $this.\") }\n}\n\n/**\n * Splits this sequence into a sequence of lists each not exceeding the given [size].\n * \n * The last list in the resulting sequence may have fewer elements than the given [size].\n * \n * @param size the number of elements to take in each list, must be positive and can be greater than the number of elements in this sequence.\n *\n * The operation is _intermediate_ and _stateful_.\n * \n * @sample samples.collections.Collections.Transformations.chunked\n */\n@SinceKotlin(\"1.2\")\npublic fun Sequence.chunked(size: Int): Sequence> {\n return windowed(size, size, partialWindows = true)\n}\n\n/**\n * Splits this sequence into several lists each not exceeding the given [size]\n * and applies the given [transform] function to an each.\n * \n * @return sequence of results of the [transform] applied to an each list.\n * \n * Note that the list passed to the [transform] function is ephemeral and is valid only inside that function.\n * You should not store it or allow it to escape in some way, unless you made a snapshot of it.\n * The last list may have fewer elements than the given [size].\n * \n * @param size the number of elements to take in each list, must be positive and can be greater than the number of elements in this sequence.\n *\n * The operation is _intermediate_ and _stateful_.\n * \n * @sample samples.text.Strings.chunkedTransform\n */\n@SinceKotlin(\"1.2\")\npublic fun Sequence.chunked(size: Int, transform: (List) -> R): Sequence {\n return windowed(size, size, partialWindows = true, transform = transform)\n}\n\n/**\n * Returns a sequence containing all elements of the original sequence without the first occurrence of the given [element].\n *\n * The operation is _intermediate_ and _stateless_.\n */\npublic operator fun Sequence.minus(element: T): Sequence {\n return object: Sequence {\n override fun iterator(): Iterator {\n var removed = false\n return this@minus.filter { if (!removed && it == element) { removed = true; false } else true }.iterator()\n }\n }\n}\n\n/**\n * Returns a sequence containing all elements of original sequence except the elements contained in the given [elements] array.\n * \n * Note that the source sequence and the array being subtracted are iterated only when an `iterator` is requested from\n * the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.\n * \n * The [elements] array may be converted to a [HashSet] to speed up the operation, thus the elements are required to have\n * a correct and stable implementation of `hashCode()` that doesn't change between successive invocations.\n *\n * The operation is _intermediate_ and _stateful_.\n */\npublic operator fun Sequence.minus(elements: Array): Sequence {\n if (elements.isEmpty()) return this\n return object: Sequence {\n override fun iterator(): Iterator {\n val other = elements.toHashSet()\n return this@minus.filterNot { it in other }.iterator()\n }\n }\n}\n\n/**\n * Returns a sequence containing all elements of original sequence except the elements contained in the given [elements] collection.\n * \n * Note that the source sequence and the collection being subtracted are iterated only when an `iterator` is requested from\n * the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.\n * \n * The [elements] collection may be converted to a [HashSet] to speed up the operation, thus the elements are required to have\n * a correct and stable implementation of `hashCode()` that doesn't change between successive invocations.\n *\n * The operation is _intermediate_ and _stateful_.\n */\npublic operator fun Sequence.minus(elements: Iterable): Sequence {\n return object: Sequence {\n override fun iterator(): Iterator {\n val other = elements.convertToSetForSetOperation()\n if (other.isEmpty())\n return this@minus.iterator()\n else\n return this@minus.filterNot { it in other }.iterator()\n }\n }\n}\n\n/**\n * Returns a sequence containing all elements of original sequence except the elements contained in the given [elements] sequence.\n * \n * Note that the source sequence and the sequence being subtracted are iterated only when an `iterator` is requested from\n * the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.\n * \n * The operation is _intermediate_ for this sequence and _terminal_ and _stateful_ for the [elements] sequence.\n * \n * The [elements] sequence may be converted to a [HashSet] to speed up the operation, thus the elements are required to have\n * a correct and stable implementation of `hashCode()` that doesn't change between successive invocations.\n */\npublic operator fun Sequence.minus(elements: Sequence): Sequence {\n return object: Sequence {\n override fun iterator(): Iterator {\n val other = elements.toHashSet()\n if (other.isEmpty())\n return this@minus.iterator()\n else\n return this@minus.filterNot { it in other }.iterator()\n }\n }\n}\n\n/**\n * Returns a sequence containing all elements of the original sequence without the first occurrence of the given [element].\n *\n * The operation is _intermediate_ and _stateless_.\n */\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.minusElement(element: T): Sequence {\n return minus(element)\n}\n\n/**\n * Splits the original sequence into pair of lists,\n * where *first* list contains elements for which [predicate] yielded `true`,\n * while *second* list contains elements for which [predicate] yielded `false`.\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Sequences.Transformations.partition\n */\npublic inline fun Sequence.partition(predicate: (T) -> Boolean): Pair, List> {\n val first = ArrayList()\n val second = ArrayList()\n for (element in this) {\n if (predicate(element)) {\n first.add(element)\n } else {\n second.add(element)\n }\n }\n return Pair(first, second)\n}\n\n/**\n * Returns a sequence containing all elements of the original sequence and then the given [element].\n *\n * The operation is _intermediate_ and _stateless_.\n */\npublic operator fun Sequence.plus(element: T): Sequence {\n return sequenceOf(this, sequenceOf(element)).flatten()\n}\n\n/**\n * Returns a sequence containing all elements of original sequence and then all elements of the given [elements] array.\n * \n * Note that the source sequence and the array being added are iterated only when an `iterator` is requested from\n * the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.\n *\n * The operation is _intermediate_ and _stateless_.\n */\npublic operator fun Sequence.plus(elements: Array): Sequence {\n return this.plus(elements.asList())\n}\n\n/**\n * Returns a sequence containing all elements of original sequence and then all elements of the given [elements] collection.\n * \n * Note that the source sequence and the collection being added are iterated only when an `iterator` is requested from\n * the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.\n *\n * The operation is _intermediate_ and _stateless_.\n */\npublic operator fun Sequence.plus(elements: Iterable): Sequence {\n return sequenceOf(this, elements.asSequence()).flatten()\n}\n\n/**\n * Returns a sequence containing all elements of original sequence and then all elements of the given [elements] sequence.\n * \n * Note that the source sequence and the sequence being added are iterated only when an `iterator` is requested from\n * the resulting sequence. Changing any of them between successive calls to `iterator` may affect the result.\n *\n * The operation is _intermediate_ and _stateless_.\n */\npublic operator fun Sequence.plus(elements: Sequence): Sequence {\n return sequenceOf(this, elements).flatten()\n}\n\n/**\n * Returns a sequence containing all elements of the original sequence and then the given [element].\n *\n * The operation is _intermediate_ and _stateless_.\n */\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.plusElement(element: T): Sequence {\n return plus(element)\n}\n\n/**\n * Returns a sequence of snapshots of the window of the given [size]\n * sliding along this sequence with the given [step], where each\n * snapshot is a list.\n * \n * Several last lists may have fewer elements than the given [size].\n * \n * Both [size] and [step] must be positive and can be greater than the number of elements in this sequence.\n * @param size the number of elements to take in each window\n * @param step the number of elements to move the window forward by on an each step, by default 1\n * @param partialWindows controls whether or not to keep partial windows in the end if any,\n * by default `false` which means partial windows won't be preserved\n * \n * @sample samples.collections.Sequences.Transformations.takeWindows\n */\n@SinceKotlin(\"1.2\")\npublic fun Sequence.windowed(size: Int, step: Int = 1, partialWindows: Boolean = false): Sequence> {\n return windowedSequence(size, step, partialWindows, reuseBuffer = false)\n}\n\n/**\n * Returns a sequence of results of applying the given [transform] function to\n * an each list representing a view over the window of the given [size]\n * sliding along this sequence with the given [step].\n * \n * Note that the list passed to the [transform] function is ephemeral and is valid only inside that function.\n * You should not store it or allow it to escape in some way, unless you made a snapshot of it.\n * Several last lists may have fewer elements than the given [size].\n * \n * Both [size] and [step] must be positive and can be greater than the number of elements in this sequence.\n * @param size the number of elements to take in each window\n * @param step the number of elements to move the window forward by on an each step, by default 1\n * @param partialWindows controls whether or not to keep partial windows in the end if any,\n * by default `false` which means partial windows won't be preserved\n * \n * @sample samples.collections.Sequences.Transformations.averageWindows\n */\n@SinceKotlin(\"1.2\")\npublic fun Sequence.windowed(size: Int, step: Int = 1, partialWindows: Boolean = false, transform: (List) -> R): Sequence {\n return windowedSequence(size, step, partialWindows, reuseBuffer = true).map(transform)\n}\n\n/**\n * Returns a sequence of values built from the elements of `this` sequence and the [other] sequence with the same index.\n * The resulting sequence ends as soon as the shortest input sequence ends.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Sequences.Transformations.zip\n */\npublic infix fun Sequence.zip(other: Sequence): Sequence> {\n return MergingSequence(this, other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a sequence of values built from the elements of `this` sequence and the [other] sequence with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The resulting sequence ends as soon as the shortest input sequence ends.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Sequences.Transformations.zipWithTransform\n */\npublic fun Sequence.zip(other: Sequence, transform: (a: T, b: R) -> V): Sequence {\n return MergingSequence(this, other, transform)\n}\n\n/**\n * Returns a sequence of pairs of each two adjacent elements in this sequence.\n * \n * The returned sequence is empty if this sequence contains less than two elements.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Transformations.zipWithNext\n */\n@SinceKotlin(\"1.2\")\npublic fun Sequence.zipWithNext(): Sequence> {\n return zipWithNext { a, b -> a to b }\n}\n\n/**\n * Returns a sequence containing the results of applying the given [transform] function\n * to an each pair of two adjacent elements in this sequence.\n * \n * The returned sequence is empty if this sequence contains less than two elements.\n *\n * The operation is _intermediate_ and _stateless_.\n * \n * @sample samples.collections.Collections.Transformations.zipWithNextToFindDeltas\n */\n@SinceKotlin(\"1.2\")\npublic fun Sequence.zipWithNext(transform: (a: T, b: T) -> R): Sequence {\n return sequence result@ {\n val iterator = iterator()\n if (!iterator.hasNext()) return@result\n var current = iterator.next()\n while (iterator.hasNext()) {\n val next = iterator.next()\n yield(transform(current, next))\n current = next\n }\n }\n}\n\n/**\n * Appends the string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Transformations.joinTo\n */\npublic fun Sequence.joinTo(buffer: A, separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((T) -> CharSequence)? = null): A {\n buffer.append(prefix)\n var count = 0\n for (element in this) {\n if (++count > 1) buffer.append(separator)\n if (limit < 0 || count <= limit) {\n buffer.appendElement(element, transform)\n } else break\n }\n if (limit >= 0 && count > limit) buffer.append(truncated)\n buffer.append(postfix)\n return buffer\n}\n\n/**\n * Creates a string from all the elements separated using [separator] and using the given [prefix] and [postfix] if supplied.\n * \n * If the collection could be huge, you can specify a non-negative value of [limit], in which case only the first [limit]\n * elements will be appended, followed by the [truncated] string (which defaults to \"...\").\n *\n * The operation is _terminal_.\n * \n * @sample samples.collections.Collections.Transformations.joinToString\n */\npublic fun Sequence.joinToString(separator: CharSequence = \", \", prefix: CharSequence = \"\", postfix: CharSequence = \"\", limit: Int = -1, truncated: CharSequence = \"...\", transform: ((T) -> CharSequence)? = null): String {\n return joinTo(StringBuilder(), separator, prefix, postfix, limit, truncated, transform).toString()\n}\n\n/**\n * Creates an [Iterable] instance that wraps the original sequence returning its elements when being iterated.\n */\npublic fun Sequence.asIterable(): Iterable {\n return Iterable { this.iterator() }\n}\n\n/**\n * Returns this sequence as a [Sequence].\n */\n@kotlin.internal.InlineOnly\npublic inline fun Sequence.asSequence(): Sequence {\n return this\n}\n\n/**\n * Returns an average value of elements in the sequence.\n *\n * The operation is _terminal_.\n */\n@kotlin.jvm.JvmName(\"averageOfByte\")\npublic fun Sequence.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n checkCountOverflow(++count)\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the sequence.\n *\n * The operation is _terminal_.\n */\n@kotlin.jvm.JvmName(\"averageOfShort\")\npublic fun Sequence.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n checkCountOverflow(++count)\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the sequence.\n *\n * The operation is _terminal_.\n */\n@kotlin.jvm.JvmName(\"averageOfInt\")\npublic fun Sequence.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n checkCountOverflow(++count)\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the sequence.\n *\n * The operation is _terminal_.\n */\n@kotlin.jvm.JvmName(\"averageOfLong\")\npublic fun Sequence.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n checkCountOverflow(++count)\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the sequence.\n *\n * The operation is _terminal_.\n */\n@kotlin.jvm.JvmName(\"averageOfFloat\")\npublic fun Sequence.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n checkCountOverflow(++count)\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns an average value of elements in the sequence.\n *\n * The operation is _terminal_.\n */\n@kotlin.jvm.JvmName(\"averageOfDouble\")\npublic fun Sequence.average(): Double {\n var sum: Double = 0.0\n var count: Int = 0\n for (element in this) {\n sum += element\n checkCountOverflow(++count)\n }\n return if (count == 0) Double.NaN else sum / count\n}\n\n/**\n * Returns the sum of all elements in the sequence.\n *\n * The operation is _terminal_.\n */\n@kotlin.jvm.JvmName(\"sumOfByte\")\npublic fun Sequence.sum(): Int {\n var sum: Int = 0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the sequence.\n *\n * The operation is _terminal_.\n */\n@kotlin.jvm.JvmName(\"sumOfShort\")\npublic fun Sequence.sum(): Int {\n var sum: Int = 0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the sequence.\n *\n * The operation is _terminal_.\n */\n@kotlin.jvm.JvmName(\"sumOfInt\")\npublic fun Sequence.sum(): Int {\n var sum: Int = 0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the sequence.\n *\n * The operation is _terminal_.\n */\n@kotlin.jvm.JvmName(\"sumOfLong\")\npublic fun Sequence.sum(): Long {\n var sum: Long = 0L\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the sequence.\n *\n * The operation is _terminal_.\n */\n@kotlin.jvm.JvmName(\"sumOfFloat\")\npublic fun Sequence.sum(): Float {\n var sum: Float = 0.0f\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the sequence.\n *\n * The operation is _terminal_.\n */\n@kotlin.jvm.JvmName(\"sumOfDouble\")\npublic fun Sequence.sum(): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"StringsKt\")\n\npackage kotlin.text\n\n//\n// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt\n// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib\n//\n\nimport kotlin.random.*\n\n/**\n * Returns a character at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this char sequence.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic expect fun CharSequence.elementAt(index: Int): Char\n\n/**\n * Returns a character at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this char sequence.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.elementAtOrElse(index: Int, defaultValue: (Int) -> Char): Char {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns a character at the given [index] or `null` if the [index] is out of bounds of this char sequence.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.elementAtOrNull(index: Int): Char? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns the first character matching the given [predicate], or `null` if no such character was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.find(predicate: (Char) -> Boolean): Char? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the last character matching the given [predicate], or `null` if no such character was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.findLast(predicate: (Char) -> Boolean): Char? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns first character.\n * @throws [NoSuchElementException] if the char sequence is empty.\n */\npublic fun CharSequence.first(): Char {\n if (isEmpty())\n throw NoSuchElementException(\"Char sequence is empty.\")\n return this[0]\n}\n\n/**\n * Returns the first character matching the given [predicate].\n * @throws [NoSuchElementException] if no such character is found.\n */\npublic inline fun CharSequence.first(predicate: (Char) -> Boolean): Char {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Char sequence contains no character matching the predicate.\")\n}\n\n/**\n * Returns the first character, or `null` if the char sequence is empty.\n */\npublic fun CharSequence.firstOrNull(): Char? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first character matching the given [predicate], or `null` if character was not found.\n */\npublic inline fun CharSequence.firstOrNull(predicate: (Char) -> Boolean): Char? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns a character at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this char sequence.\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.getOrElse(index: Int, defaultValue: (Int) -> Char): Char {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns a character at the given [index] or `null` if the [index] is out of bounds of this char sequence.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\npublic fun CharSequence.getOrNull(index: Int): Char? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns index of the first character matching the given [predicate], or -1 if the char sequence does not contain such character.\n */\npublic inline fun CharSequence.indexOfFirst(predicate: (Char) -> Boolean): Int {\n for (index in indices) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns index of the last character matching the given [predicate], or -1 if the char sequence does not contain such character.\n */\npublic inline fun CharSequence.indexOfLast(predicate: (Char) -> Boolean): Int {\n for (index in indices.reversed()) {\n if (predicate(this[index])) {\n return index\n }\n }\n return -1\n}\n\n/**\n * Returns the last character.\n * \n * @throws NoSuchElementException if the char sequence is empty.\n * \n * @sample samples.text.Strings.last\n */\npublic fun CharSequence.last(): Char {\n if (isEmpty())\n throw NoSuchElementException(\"Char sequence is empty.\")\n return this[lastIndex]\n}\n\n/**\n * Returns the last character matching the given [predicate].\n * \n * @throws NoSuchElementException if no such character is found.\n * \n * @sample samples.text.Strings.last\n */\npublic inline fun CharSequence.last(predicate: (Char) -> Boolean): Char {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"Char sequence contains no character matching the predicate.\")\n}\n\n/**\n * Returns the last character, or `null` if the char sequence is empty.\n * \n * @sample samples.text.Strings.last\n */\npublic fun CharSequence.lastOrNull(): Char? {\n return if (isEmpty()) null else this[length - 1]\n}\n\n/**\n * Returns the last character matching the given [predicate], or `null` if no such character was found.\n * \n * @sample samples.text.Strings.last\n */\npublic inline fun CharSequence.lastOrNull(predicate: (Char) -> Boolean): Char? {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns a random character from this char sequence.\n * \n * @throws NoSuchElementException if this char sequence is empty.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.random(): Char {\n return random(Random)\n}\n\n/**\n * Returns a random character from this char sequence using the specified source of randomness.\n * \n * @throws NoSuchElementException if this char sequence is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun CharSequence.random(random: Random): Char {\n if (isEmpty())\n throw NoSuchElementException(\"Char sequence is empty.\")\n return get(random.nextInt(length))\n}\n\n/**\n * Returns a random character from this char sequence, or `null` if this char sequence is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.randomOrNull(): Char? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random character from this char sequence using the specified source of randomness, or `null` if this char sequence is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun CharSequence.randomOrNull(random: Random): Char? {\n if (isEmpty())\n return null\n return get(random.nextInt(length))\n}\n\n/**\n * Returns the single character, or throws an exception if the char sequence is empty or has more than one character.\n */\npublic fun CharSequence.single(): Char {\n return when (length) {\n 0 -> throw NoSuchElementException(\"Char sequence is empty.\")\n 1 -> this[0]\n else -> throw IllegalArgumentException(\"Char sequence has more than one element.\")\n }\n}\n\n/**\n * Returns the single character matching the given [predicate], or throws exception if there is no or more than one matching character.\n */\npublic inline fun CharSequence.single(predicate: (Char) -> Boolean): Char {\n var single: Char? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Char sequence contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Char sequence contains no character matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as Char\n}\n\n/**\n * Returns single character, or `null` if the char sequence is empty or has more than one character.\n */\npublic fun CharSequence.singleOrNull(): Char? {\n return if (length == 1) this[0] else null\n}\n\n/**\n * Returns the single character matching the given [predicate], or `null` if character was not found or more than one character was found.\n */\npublic inline fun CharSequence.singleOrNull(predicate: (Char) -> Boolean): Char? {\n var single: Char? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns a subsequence of this char sequence with the first [n] characters removed.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.text.Strings.drop\n */\npublic fun CharSequence.drop(n: Int): CharSequence {\n require(n >= 0) { \"Requested character count $n is less than zero.\" }\n return subSequence(n.coerceAtMost(length), length)\n}\n\n/**\n * Returns a string with the first [n] characters removed.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.text.Strings.drop\n */\npublic fun String.drop(n: Int): String {\n require(n >= 0) { \"Requested character count $n is less than zero.\" }\n return substring(n.coerceAtMost(length))\n}\n\n/**\n * Returns a subsequence of this char sequence with the last [n] characters removed.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.text.Strings.drop\n */\npublic fun CharSequence.dropLast(n: Int): CharSequence {\n require(n >= 0) { \"Requested character count $n is less than zero.\" }\n return take((length - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a string with the last [n] characters removed.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.text.Strings.drop\n */\npublic fun String.dropLast(n: Int): String {\n require(n >= 0) { \"Requested character count $n is less than zero.\" }\n return take((length - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a subsequence of this char sequence containing all characters except last characters that satisfy the given [predicate].\n * \n * @sample samples.text.Strings.drop\n */\npublic inline fun CharSequence.dropLastWhile(predicate: (Char) -> Boolean): CharSequence {\n for (index in lastIndex downTo 0)\n if (!predicate(this[index]))\n return subSequence(0, index + 1)\n return \"\"\n}\n\n/**\n * Returns a string containing all characters except last characters that satisfy the given [predicate].\n * \n * @sample samples.text.Strings.drop\n */\npublic inline fun String.dropLastWhile(predicate: (Char) -> Boolean): String {\n for (index in lastIndex downTo 0)\n if (!predicate(this[index]))\n return substring(0, index + 1)\n return \"\"\n}\n\n/**\n * Returns a subsequence of this char sequence containing all characters except first characters that satisfy the given [predicate].\n * \n * @sample samples.text.Strings.drop\n */\npublic inline fun CharSequence.dropWhile(predicate: (Char) -> Boolean): CharSequence {\n for (index in this.indices)\n if (!predicate(this[index]))\n return subSequence(index, length)\n return \"\"\n}\n\n/**\n * Returns a string containing all characters except first characters that satisfy the given [predicate].\n * \n * @sample samples.text.Strings.drop\n */\npublic inline fun String.dropWhile(predicate: (Char) -> Boolean): String {\n for (index in this.indices)\n if (!predicate(this[index]))\n return substring(index)\n return \"\"\n}\n\n/**\n * Returns a char sequence containing only those characters from the original char sequence that match the given [predicate].\n * \n * @sample samples.text.Strings.filter\n */\npublic inline fun CharSequence.filter(predicate: (Char) -> Boolean): CharSequence {\n return filterTo(StringBuilder(), predicate)\n}\n\n/**\n * Returns a string containing only those characters from the original string that match the given [predicate].\n * \n * @sample samples.text.Strings.filter\n */\npublic inline fun String.filter(predicate: (Char) -> Boolean): String {\n return filterTo(StringBuilder(), predicate).toString()\n}\n\n/**\n * Returns a char sequence containing only those characters from the original char sequence that match the given [predicate].\n * @param [predicate] function that takes the index of a character and the character itself\n * and returns the result of predicate evaluation on the character.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\npublic inline fun CharSequence.filterIndexed(predicate: (index: Int, Char) -> Boolean): CharSequence {\n return filterIndexedTo(StringBuilder(), predicate)\n}\n\n/**\n * Returns a string containing only those characters from the original string that match the given [predicate].\n * @param [predicate] function that takes the index of a character and the character itself\n * and returns the result of predicate evaluation on the character.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\npublic inline fun String.filterIndexed(predicate: (index: Int, Char) -> Boolean): String {\n return filterIndexedTo(StringBuilder(), predicate).toString()\n}\n\n/**\n * Appends all characters matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of a character and the character itself\n * and returns the result of predicate evaluation on the character.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\npublic inline fun CharSequence.filterIndexedTo(destination: C, predicate: (index: Int, Char) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.append(element)\n }\n return destination\n}\n\n/**\n * Returns a char sequence containing only those characters from the original char sequence that do not match the given [predicate].\n * \n * @sample samples.text.Strings.filterNot\n */\npublic inline fun CharSequence.filterNot(predicate: (Char) -> Boolean): CharSequence {\n return filterNotTo(StringBuilder(), predicate)\n}\n\n/**\n * Returns a string containing only those characters from the original string that do not match the given [predicate].\n * \n * @sample samples.text.Strings.filterNot\n */\npublic inline fun String.filterNot(predicate: (Char) -> Boolean): String {\n return filterNotTo(StringBuilder(), predicate).toString()\n}\n\n/**\n * Appends all characters not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun CharSequence.filterNotTo(destination: C, predicate: (Char) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.append(element)\n return destination\n}\n\n/**\n * Appends all characters matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\npublic inline fun CharSequence.filterTo(destination: C, predicate: (Char) -> Boolean): C {\n for (index in 0 until length) {\n val element = get(index)\n if (predicate(element)) destination.append(element)\n }\n return destination\n}\n\n/**\n * Returns a char sequence containing characters of the original char sequence at the specified range of [indices].\n */\npublic fun CharSequence.slice(indices: IntRange): CharSequence {\n if (indices.isEmpty()) return \"\"\n return subSequence(indices)\n}\n\n/**\n * Returns a string containing characters of the original string at the specified range of [indices].\n */\npublic fun String.slice(indices: IntRange): String {\n if (indices.isEmpty()) return \"\"\n return substring(indices)\n}\n\n/**\n * Returns a char sequence containing characters of the original char sequence at specified [indices].\n */\npublic fun CharSequence.slice(indices: Iterable): CharSequence {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return \"\"\n val result = StringBuilder(size)\n for (i in indices) {\n result.append(get(i))\n }\n return result\n}\n\n/**\n * Returns a string containing characters of the original string at specified [indices].\n */\n@kotlin.internal.InlineOnly\npublic inline fun String.slice(indices: Iterable): String {\n return (this as CharSequence).slice(indices).toString()\n}\n\n/**\n * Returns a subsequence of this char sequence containing the first [n] characters from this char sequence, or the entire char sequence if this char sequence is shorter.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.text.Strings.take\n */\npublic fun CharSequence.take(n: Int): CharSequence {\n require(n >= 0) { \"Requested character count $n is less than zero.\" }\n return subSequence(0, n.coerceAtMost(length))\n}\n\n/**\n * Returns a string containing the first [n] characters from this string, or the entire string if this string is shorter.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.text.Strings.take\n */\npublic fun String.take(n: Int): String {\n require(n >= 0) { \"Requested character count $n is less than zero.\" }\n return substring(0, n.coerceAtMost(length))\n}\n\n/**\n * Returns a subsequence of this char sequence containing the last [n] characters from this char sequence, or the entire char sequence if this char sequence is shorter.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.text.Strings.take\n */\npublic fun CharSequence.takeLast(n: Int): CharSequence {\n require(n >= 0) { \"Requested character count $n is less than zero.\" }\n val length = length\n return subSequence(length - n.coerceAtMost(length), length)\n}\n\n/**\n * Returns a string containing the last [n] characters from this string, or the entire string if this string is shorter.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.text.Strings.take\n */\npublic fun String.takeLast(n: Int): String {\n require(n >= 0) { \"Requested character count $n is less than zero.\" }\n val length = length\n return substring(length - n.coerceAtMost(length))\n}\n\n/**\n * Returns a subsequence of this char sequence containing last characters that satisfy the given [predicate].\n * \n * @sample samples.text.Strings.take\n */\npublic inline fun CharSequence.takeLastWhile(predicate: (Char) -> Boolean): CharSequence {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return subSequence(index + 1, length)\n }\n }\n return subSequence(0, length)\n}\n\n/**\n * Returns a string containing last characters that satisfy the given [predicate].\n * \n * @sample samples.text.Strings.take\n */\npublic inline fun String.takeLastWhile(predicate: (Char) -> Boolean): String {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return substring(index + 1)\n }\n }\n return this\n}\n\n/**\n * Returns a subsequence of this char sequence containing the first characters that satisfy the given [predicate].\n * \n * @sample samples.text.Strings.take\n */\npublic inline fun CharSequence.takeWhile(predicate: (Char) -> Boolean): CharSequence {\n for (index in 0 until length)\n if (!predicate(get(index))) {\n return subSequence(0, index)\n }\n return subSequence(0, length)\n}\n\n/**\n * Returns a string containing the first characters that satisfy the given [predicate].\n * \n * @sample samples.text.Strings.take\n */\npublic inline fun String.takeWhile(predicate: (Char) -> Boolean): String {\n for (index in 0 until length)\n if (!predicate(get(index))) {\n return substring(0, index)\n }\n return this\n}\n\n/**\n * Returns a char sequence with characters in reversed order.\n */\npublic fun CharSequence.reversed(): CharSequence {\n return StringBuilder(this).reverse()\n}\n\n/**\n * Returns a string with characters in reversed order.\n */\n@kotlin.internal.InlineOnly\npublic inline fun String.reversed(): String {\n return (this as CharSequence).reversed().toString()\n}\n\n/**\n * Returns a [Map] containing key-value pairs provided by [transform] function\n * applied to characters of the given char sequence.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original char sequence.\n * \n * @sample samples.text.Strings.associate\n */\npublic inline fun CharSequence.associate(transform: (Char) -> Pair): Map {\n val capacity = mapCapacity(length).coerceAtLeast(16)\n return associateTo(LinkedHashMap(capacity), transform)\n}\n\n/**\n * Returns a [Map] containing the characters from the given char sequence indexed by the key\n * returned from [keySelector] function applied to each character.\n * \n * If any two characters would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original char sequence.\n * \n * @sample samples.text.Strings.associateBy\n */\npublic inline fun CharSequence.associateBy(keySelector: (Char) -> K): Map {\n val capacity = mapCapacity(length).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector)\n}\n\n/**\n * Returns a [Map] containing the values provided by [valueTransform] and indexed by [keySelector] functions applied to characters of the given char sequence.\n * \n * If any two characters would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original char sequence.\n * \n * @sample samples.text.Strings.associateByWithValueTransform\n */\npublic inline fun CharSequence.associateBy(keySelector: (Char) -> K, valueTransform: (Char) -> V): Map {\n val capacity = mapCapacity(length).coerceAtLeast(16)\n return associateByTo(LinkedHashMap(capacity), keySelector, valueTransform)\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function applied to each character of the given char sequence\n * and value is the character itself.\n * \n * If any two characters would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.text.Strings.associateByTo\n */\npublic inline fun > CharSequence.associateByTo(destination: M, keySelector: (Char) -> K): M {\n for (element in this) {\n destination.put(keySelector(element), element)\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs,\n * where key is provided by the [keySelector] function and\n * and value is provided by the [valueTransform] function applied to characters of the given char sequence.\n * \n * If any two characters would have the same key returned by [keySelector] the last one gets added to the map.\n * \n * @sample samples.text.Strings.associateByToWithValueTransform\n */\npublic inline fun > CharSequence.associateByTo(destination: M, keySelector: (Char) -> K, valueTransform: (Char) -> V): M {\n for (element in this) {\n destination.put(keySelector(element), valueTransform(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs\n * provided by [transform] function applied to each character of the given char sequence.\n * \n * If any of two pairs would have the same key the last one gets added to the map.\n * \n * @sample samples.text.Strings.associateTo\n */\npublic inline fun > CharSequence.associateTo(destination: M, transform: (Char) -> Pair): M {\n for (element in this) {\n destination += transform(element)\n }\n return destination\n}\n\n/**\n * Returns a [Map] where keys are characters from the given char sequence and values are\n * produced by the [valueSelector] function applied to each character.\n * \n * If any two characters are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original char sequence.\n * \n * @sample samples.text.Strings.associateWith\n */\n@SinceKotlin(\"1.3\")\npublic inline fun CharSequence.associateWith(valueSelector: (Char) -> V): Map {\n val result = LinkedHashMap(mapCapacity(length.coerceAtMost(128)).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each character of the given char sequence,\n * where key is the character itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two characters are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.text.Strings.associateWithTo\n */\n@SinceKotlin(\"1.3\")\npublic inline fun > CharSequence.associateWithTo(destination: M, valueSelector: (Char) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Appends all characters to the given [destination] collection.\n */\npublic fun > CharSequence.toCollection(destination: C): C {\n for (item in this) {\n destination.add(item)\n }\n return destination\n}\n\n/**\n * Returns a new [HashSet] of all characters.\n */\npublic fun CharSequence.toHashSet(): HashSet {\n return toCollection(HashSet(mapCapacity(length.coerceAtMost(128))))\n}\n\n/**\n * Returns a [List] containing all characters.\n */\npublic fun CharSequence.toList(): List {\n return when (length) {\n 0 -> emptyList()\n 1 -> listOf(this[0])\n else -> this.toMutableList()\n }\n}\n\n/**\n * Returns a new [MutableList] filled with all characters of this char sequence.\n */\npublic fun CharSequence.toMutableList(): MutableList {\n return toCollection(ArrayList(length))\n}\n\n/**\n * Returns a [Set] of all characters.\n * \n * The returned set preserves the element iteration order of the original char sequence.\n */\npublic fun CharSequence.toSet(): Set {\n return when (length) {\n 0 -> emptySet()\n 1 -> setOf(this[0])\n else -> toCollection(LinkedHashSet(mapCapacity(length.coerceAtMost(128))))\n }\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each character of original char sequence.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\npublic inline fun CharSequence.flatMap(transform: (Char) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each character\n * and its index in the original char sequence.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterable\")\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.flatMapIndexed(transform: (index: Int, Char) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each character\n * and its index in the original char sequence, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapIndexedIterableTo\")\n@kotlin.internal.InlineOnly\npublic inline fun > CharSequence.flatMapIndexedTo(destination: C, transform: (index: Int, Char) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each character of original char sequence, to the given [destination].\n */\npublic inline fun > CharSequence.flatMapTo(destination: C, transform: (Char) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Groups characters of the original char sequence by the key returned by the given [keySelector] function\n * applied to each character and returns a map where each group key is associated with a list of corresponding characters.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original char sequence.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun CharSequence.groupBy(keySelector: (Char) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each character of the original char sequence\n * by the key returned by the given [keySelector] function applied to the character\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original char sequence.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun CharSequence.groupBy(keySelector: (Char) -> K, valueTransform: (Char) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups characters of the original char sequence by the key returned by the given [keySelector] function\n * applied to each character and puts to the [destination] map each group key associated with a list of corresponding characters.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\npublic inline fun >> CharSequence.groupByTo(destination: M, keySelector: (Char) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each character of the original char sequence\n * by the key returned by the given [keySelector] function applied to the character\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\npublic inline fun >> CharSequence.groupByTo(destination: M, keySelector: (Char) -> K, valueTransform: (Char) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Creates a [Grouping] source from a char sequence to be used later with one of group-and-fold operations\n * using the specified [keySelector] function to extract a key from each character.\n * \n * @sample samples.collections.Grouping.groupingByEachCount\n */\n@SinceKotlin(\"1.1\")\npublic inline fun CharSequence.groupingBy(crossinline keySelector: (Char) -> K): Grouping {\n return object : Grouping {\n override fun sourceIterator(): Iterator = this@groupingBy.iterator()\n override fun keyOf(element: Char): K = keySelector(element)\n }\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each character in the original char sequence.\n * \n * @sample samples.text.Strings.map\n */\npublic inline fun CharSequence.map(transform: (Char) -> R): List {\n return mapTo(ArrayList(length), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each character and its index in the original char sequence.\n * @param [transform] function that takes the index of a character and the character itself\n * and returns the result of the transform applied to the character.\n */\npublic inline fun CharSequence.mapIndexed(transform: (index: Int, Char) -> R): List {\n return mapIndexedTo(ArrayList(length), transform)\n}\n\n/**\n * Returns a list containing only the non-null results of applying the given [transform] function\n * to each character and its index in the original char sequence.\n * @param [transform] function that takes the index of a character and the character itself\n * and returns the result of the transform applied to the character.\n */\npublic inline fun CharSequence.mapIndexedNotNull(transform: (index: Int, Char) -> R?): List {\n return mapIndexedNotNullTo(ArrayList(), transform)\n}\n\n/**\n * Applies the given [transform] function to each character and its index in the original char sequence\n * and appends only the non-null results to the given [destination].\n * @param [transform] function that takes the index of a character and the character itself\n * and returns the result of the transform applied to the character.\n */\npublic inline fun > CharSequence.mapIndexedNotNullTo(destination: C, transform: (index: Int, Char) -> R?): C {\n forEachIndexed { index, element -> transform(index, element)?.let { destination.add(it) } }\n return destination\n}\n\n/**\n * Applies the given [transform] function to each character and its index in the original char sequence\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of a character and the character itself\n * and returns the result of the transform applied to the character.\n */\npublic inline fun > CharSequence.mapIndexedTo(destination: C, transform: (index: Int, Char) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(index++, item))\n return destination\n}\n\n/**\n * Returns a list containing only the non-null results of applying the given [transform] function\n * to each character in the original char sequence.\n * \n * @sample samples.collections.Collections.Transformations.mapNotNull\n */\npublic inline fun CharSequence.mapNotNull(transform: (Char) -> R?): List {\n return mapNotNullTo(ArrayList(), transform)\n}\n\n/**\n * Applies the given [transform] function to each character in the original char sequence\n * and appends only the non-null results to the given [destination].\n */\npublic inline fun > CharSequence.mapNotNullTo(destination: C, transform: (Char) -> R?): C {\n forEach { element -> transform(element)?.let { destination.add(it) } }\n return destination\n}\n\n/**\n * Applies the given [transform] function to each character of the original char sequence\n * and appends the results to the given [destination].\n */\npublic inline fun > CharSequence.mapTo(destination: C, transform: (Char) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each character of the original char sequence\n * into an [IndexedValue] containing the index of that character and the character itself.\n */\npublic fun CharSequence.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns `true` if all characters match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\npublic inline fun CharSequence.all(predicate: (Char) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if char sequence has at least one character.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\npublic fun CharSequence.any(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if at least one character matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\npublic inline fun CharSequence.any(predicate: (Char) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns the length of this char sequence.\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.count(): Int {\n return length\n}\n\n/**\n * Returns the number of characters matching the given [predicate].\n */\npublic inline fun CharSequence.count(predicate: (Char) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each character.\n * \n * Returns the specified [initial] value if the char sequence is empty.\n * \n * @param [operation] function that takes current accumulator value and a character, and calculates the next accumulator value.\n */\npublic inline fun CharSequence.fold(initial: R, operation: (acc: R, Char) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each character with its index in the original char sequence.\n * \n * Returns the specified [initial] value if the char sequence is empty.\n * \n * @param [operation] function that takes the index of a character, current accumulator value\n * and the character itself, and calculates the next accumulator value.\n */\npublic inline fun CharSequence.foldIndexed(initial: R, operation: (index: Int, acc: R, Char) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(index++, accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each character and current accumulator value.\n * \n * Returns the specified [initial] value if the char sequence is empty.\n * \n * @param [operation] function that takes a character and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun CharSequence.foldRight(initial: R, operation: (Char, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each character with its index in the original char sequence and current accumulator value.\n * \n * Returns the specified [initial] value if the char sequence is empty.\n * \n * @param [operation] function that takes the index of a character, the character itself\n * and current accumulator value, and calculates the next accumulator value.\n */\npublic inline fun CharSequence.foldRightIndexed(initial: R, operation: (index: Int, Char, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Performs the given [action] on each character.\n */\npublic inline fun CharSequence.forEach(action: (Char) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each character, providing sequential index with the character.\n * @param [action] function that takes the index of a character and the character itself\n * and performs the action on the character.\n */\npublic inline fun CharSequence.forEachIndexed(action: (index: Int, Char) -> Unit): Unit {\n var index = 0\n for (item in this) action(index++, item)\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun CharSequence.max(): Char? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > CharSequence.maxBy(selector: (Char) -> R): Char? {\n return maxByOrNull(selector)\n}\n\n/**\n * Returns the first character yielding the largest value of the given function or `null` if there are no characters.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > CharSequence.maxByOrNull(selector: (Char) -> R): Char? {\n if (isEmpty()) return null\n var maxElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return maxElem\n var maxValue = selector(maxElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n }\n return maxElem\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each character in the char sequence.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the char sequence is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.maxOf(selector: (Char) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each character in the char sequence.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the char sequence is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.maxOf(selector: (Char) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each character in the char sequence.\n * \n * @throws NoSuchElementException if the char sequence is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > CharSequence.maxOf(selector: (Char) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each character in the char sequence or `null` if there are no characters.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.maxOfOrNull(selector: (Char) -> Double): Double? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each character in the char sequence or `null` if there are no characters.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.maxOfOrNull(selector: (Char) -> Float): Float? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each character in the char sequence or `null` if there are no characters.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > CharSequence.maxOfOrNull(selector: (Char) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each character in the char sequence.\n * \n * @throws NoSuchElementException if the char sequence is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.maxOfWith(comparator: Comparator, selector: (Char) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each character in the char sequence or `null` if there are no characters.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.maxOfWithOrNull(comparator: Comparator, selector: (Char) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest character or `null` if there are no characters.\n */\n@SinceKotlin(\"1.4\")\npublic fun CharSequence.maxOrNull(): Char? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (max < e) max = e\n }\n return max\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun CharSequence.maxWith(comparator: Comparator): Char? {\n return maxWithOrNull(comparator)\n}\n\n/**\n * Returns the first character having the largest value according to the provided [comparator] or `null` if there are no characters.\n */\n@SinceKotlin(\"1.4\")\npublic fun CharSequence.maxWithOrNull(comparator: Comparator): Char? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun CharSequence.min(): Char? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > CharSequence.minBy(selector: (Char) -> R): Char? {\n return minByOrNull(selector)\n}\n\n/**\n * Returns the first character yielding the smallest value of the given function or `null` if there are no characters.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > CharSequence.minByOrNull(selector: (Char) -> R): Char? {\n if (isEmpty()) return null\n var minElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return minElem\n var minValue = selector(minElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n }\n return minElem\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each character in the char sequence.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the char sequence is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.minOf(selector: (Char) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each character in the char sequence.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the char sequence is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.minOf(selector: (Char) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each character in the char sequence.\n * \n * @throws NoSuchElementException if the char sequence is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > CharSequence.minOf(selector: (Char) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each character in the char sequence or `null` if there are no characters.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.minOfOrNull(selector: (Char) -> Double): Double? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each character in the char sequence or `null` if there are no characters.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.minOfOrNull(selector: (Char) -> Float): Float? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each character in the char sequence or `null` if there are no characters.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > CharSequence.minOfOrNull(selector: (Char) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each character in the char sequence.\n * \n * @throws NoSuchElementException if the char sequence is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.minOfWith(comparator: Comparator, selector: (Char) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each character in the char sequence or `null` if there are no characters.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.minOfWithOrNull(comparator: Comparator, selector: (Char) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest character or `null` if there are no characters.\n */\n@SinceKotlin(\"1.4\")\npublic fun CharSequence.minOrNull(): Char? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (min > e) min = e\n }\n return min\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun CharSequence.minWith(comparator: Comparator): Char? {\n return minWithOrNull(comparator)\n}\n\n/**\n * Returns the first character having the smallest value according to the provided [comparator] or `null` if there are no characters.\n */\n@SinceKotlin(\"1.4\")\npublic fun CharSequence.minWithOrNull(comparator: Comparator): Char? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns `true` if the char sequence has no characters.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\npublic fun CharSequence.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if no characters match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\npublic inline fun CharSequence.none(predicate: (Char) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Performs the given [action] on each character and returns the char sequence itself afterwards.\n */\n@SinceKotlin(\"1.1\")\npublic inline fun S.onEach(action: (Char) -> Unit): S {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each character, providing sequential index with the character,\n * and returns the char sequence itself afterwards.\n * @param [action] function that takes the index of a character and the character itself\n * and performs the action on the character.\n */\n@SinceKotlin(\"1.4\")\npublic inline fun S.onEachIndexed(action: (index: Int, Char) -> Unit): S {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Accumulates value starting with the first character and applying [operation] from left to right\n * to current accumulator value and each character.\n * \n * Throws an exception if this char sequence is empty. If the char sequence can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and a character,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun CharSequence.reduce(operation: (acc: Char, Char) -> Char): Char {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty char sequence can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first character and applying [operation] from left to right\n * to current accumulator value and each character with its index in the original char sequence.\n * \n * Throws an exception if this char sequence is empty. If the char sequence can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of a character, current accumulator value and the character itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\npublic inline fun CharSequence.reduceIndexed(operation: (index: Int, acc: Char, Char) -> Char): Char {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty char sequence can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first character and applying [operation] from left to right\n * to current accumulator value and each character with its index in the original char sequence.\n * \n * Returns `null` if the char sequence is empty.\n * \n * @param [operation] function that takes the index of a character, current accumulator value and the character itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun CharSequence.reduceIndexedOrNull(operation: (index: Int, acc: Char, Char) -> Char): Char? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first character and applying [operation] from left to right\n * to current accumulator value and each character.\n * \n * Returns `null` if the char sequence is empty.\n * \n * @param [operation] function that takes current accumulator value and a character,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun CharSequence.reduceOrNull(operation: (acc: Char, Char) -> Char): Char? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last character and applying [operation] from right to left\n * to each character and current accumulator value.\n * \n * Throws an exception if this char sequence is empty. If the char sequence can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes a character and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun CharSequence.reduceRight(operation: (Char, acc: Char) -> Char): Char {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty char sequence can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last character and applying [operation] from right to left\n * to each character with its index in the original char sequence and current accumulator value.\n * \n * Throws an exception if this char sequence is empty. If the char sequence can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of a character, the character itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\npublic inline fun CharSequence.reduceRightIndexed(operation: (index: Int, Char, acc: Char) -> Char): Char {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty char sequence can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last character and applying [operation] from right to left\n * to each character with its index in the original char sequence and current accumulator value.\n * \n * Returns `null` if the char sequence is empty.\n * \n * @param [operation] function that takes the index of a character, the character itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\npublic inline fun CharSequence.reduceRightIndexedOrNull(operation: (index: Int, Char, acc: Char) -> Char): Char? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last character and applying [operation] from right to left\n * to each character and current accumulator value.\n * \n * Returns `null` if the char sequence is empty.\n * \n * @param [operation] function that takes a character and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun CharSequence.reduceRightOrNull(operation: (Char, acc: Char) -> Char): Char? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each character and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and a character, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\npublic inline fun CharSequence.runningFold(initial: R, operation: (acc: R, Char) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(length + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each character, its index in the original char sequence and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of a character, current accumulator value\n * and the character itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\npublic inline fun CharSequence.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, Char) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(length + 1).apply { add(initial) }\n var accumulator = initial\n for (index in indices) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each character and current accumulator value that starts with the first character of this char sequence.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and a character, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\npublic inline fun CharSequence.runningReduce(operation: (acc: Char, Char) -> Char): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(length).apply { add(accumulator) }\n for (index in 1 until length) {\n accumulator = operation(accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each character, its index in the original char sequence and current accumulator value that starts with the first character of this char sequence.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of a character, current accumulator value\n * and the character itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\npublic inline fun CharSequence.runningReduceIndexed(operation: (index: Int, acc: Char, Char) -> Char): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(length).apply { add(accumulator) }\n for (index in 1 until length) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each character and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and a character, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun CharSequence.scan(initial: R, operation: (acc: R, Char) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each character, its index in the original char sequence and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of a character, current accumulator value\n * and the character itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic inline fun CharSequence.scanIndexed(initial: R, operation: (index: Int, acc: R, Char) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\npublic inline fun CharSequence.scanReduce(operation: (acc: Char, Char) -> Char): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\npublic inline fun CharSequence.scanReduceIndexed(operation: (index: Int, acc: Char, Char) -> Char): List {\n return runningReduceIndexed(operation)\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each character in the char sequence.\n */\npublic inline fun CharSequence.sumBy(selector: (Char) -> Int): Int {\n var sum: Int = 0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each character in the char sequence.\n */\npublic inline fun CharSequence.sumByDouble(selector: (Char) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each character in the char sequence.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.sumOf(selector: (Char) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each character in the char sequence.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.sumOf(selector: (Char) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each character in the char sequence.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.sumOf(selector: (Char) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each character in the char sequence.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.sumOf(selector: (Char) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each character in the char sequence.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.sumOf(selector: (Char) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Splits this char sequence into a list of strings each not exceeding the given [size].\n * \n * The last string in the resulting list may have fewer characters than the given [size].\n * \n * @param size the number of elements to take in each string, must be positive and can be greater than the number of elements in this char sequence.\n * \n * @sample samples.text.Strings.chunked\n */\n@SinceKotlin(\"1.2\")\npublic fun CharSequence.chunked(size: Int): List {\n return windowed(size, size, partialWindows = true)\n}\n\n/**\n * Splits this char sequence into several char sequences each not exceeding the given [size]\n * and applies the given [transform] function to an each.\n * \n * @return list of results of the [transform] applied to an each char sequence.\n * \n * Note that the char sequence passed to the [transform] function is ephemeral and is valid only inside that function.\n * You should not store it or allow it to escape in some way, unless you made a snapshot of it.\n * The last char sequence may have fewer characters than the given [size].\n * \n * @param size the number of elements to take in each char sequence, must be positive and can be greater than the number of elements in this char sequence.\n * \n * @sample samples.text.Strings.chunkedTransform\n */\n@SinceKotlin(\"1.2\")\npublic fun CharSequence.chunked(size: Int, transform: (CharSequence) -> R): List {\n return windowed(size, size, partialWindows = true, transform = transform)\n}\n\n/**\n * Splits this char sequence into a sequence of strings each not exceeding the given [size].\n * \n * The last string in the resulting sequence may have fewer characters than the given [size].\n * \n * @param size the number of elements to take in each string, must be positive and can be greater than the number of elements in this char sequence.\n * \n * @sample samples.collections.Collections.Transformations.chunked\n */\n@SinceKotlin(\"1.2\")\npublic fun CharSequence.chunkedSequence(size: Int): Sequence {\n return chunkedSequence(size) { it.toString() }\n}\n\n/**\n * Splits this char sequence into several char sequences each not exceeding the given [size]\n * and applies the given [transform] function to an each.\n * \n * @return sequence of results of the [transform] applied to an each char sequence.\n * \n * Note that the char sequence passed to the [transform] function is ephemeral and is valid only inside that function.\n * You should not store it or allow it to escape in some way, unless you made a snapshot of it.\n * The last char sequence may have fewer characters than the given [size].\n * \n * @param size the number of elements to take in each char sequence, must be positive and can be greater than the number of elements in this char sequence.\n * \n * @sample samples.text.Strings.chunkedTransformToSequence\n */\n@SinceKotlin(\"1.2\")\npublic fun CharSequence.chunkedSequence(size: Int, transform: (CharSequence) -> R): Sequence {\n return windowedSequence(size, size, partialWindows = true, transform = transform)\n}\n\n/**\n * Splits the original char sequence into pair of char sequences,\n * where *first* char sequence contains characters for which [predicate] yielded `true`,\n * while *second* char sequence contains characters for which [predicate] yielded `false`.\n * \n * @sample samples.text.Strings.partition\n */\npublic inline fun CharSequence.partition(predicate: (Char) -> Boolean): Pair {\n val first = StringBuilder()\n val second = StringBuilder()\n for (element in this) {\n if (predicate(element)) {\n first.append(element)\n } else {\n second.append(element)\n }\n }\n return Pair(first, second)\n}\n\n/**\n * Splits the original string into pair of strings,\n * where *first* string contains characters for which [predicate] yielded `true`,\n * while *second* string contains characters for which [predicate] yielded `false`.\n * \n * @sample samples.text.Strings.partition\n */\npublic inline fun String.partition(predicate: (Char) -> Boolean): Pair {\n val first = StringBuilder()\n val second = StringBuilder()\n for (element in this) {\n if (predicate(element)) {\n first.append(element)\n } else {\n second.append(element)\n }\n }\n return Pair(first.toString(), second.toString())\n}\n\n/**\n * Returns a list of snapshots of the window of the given [size]\n * sliding along this char sequence with the given [step], where each\n * snapshot is a string.\n * \n * Several last strings may have fewer characters than the given [size].\n * \n * Both [size] and [step] must be positive and can be greater than the number of elements in this char sequence.\n * @param size the number of elements to take in each window\n * @param step the number of elements to move the window forward by on an each step, by default 1\n * @param partialWindows controls whether or not to keep partial windows in the end if any,\n * by default `false` which means partial windows won't be preserved\n * \n * @sample samples.collections.Sequences.Transformations.takeWindows\n */\n@SinceKotlin(\"1.2\")\npublic fun CharSequence.windowed(size: Int, step: Int = 1, partialWindows: Boolean = false): List {\n return windowed(size, step, partialWindows) { it.toString() }\n}\n\n/**\n * Returns a list of results of applying the given [transform] function to\n * an each char sequence representing a view over the window of the given [size]\n * sliding along this char sequence with the given [step].\n * \n * Note that the char sequence passed to the [transform] function is ephemeral and is valid only inside that function.\n * You should not store it or allow it to escape in some way, unless you made a snapshot of it.\n * Several last char sequences may have fewer characters than the given [size].\n * \n * Both [size] and [step] must be positive and can be greater than the number of elements in this char sequence.\n * @param size the number of elements to take in each window\n * @param step the number of elements to move the window forward by on an each step, by default 1\n * @param partialWindows controls whether or not to keep partial windows in the end if any,\n * by default `false` which means partial windows won't be preserved\n * \n * @sample samples.collections.Sequences.Transformations.averageWindows\n */\n@SinceKotlin(\"1.2\")\npublic fun CharSequence.windowed(size: Int, step: Int = 1, partialWindows: Boolean = false, transform: (CharSequence) -> R): List {\n checkWindowSizeStep(size, step)\n val thisSize = this.length\n val resultCapacity = thisSize / step + if (thisSize % step == 0) 0 else 1\n val result = ArrayList(resultCapacity)\n var index = 0\n while (index in 0 until thisSize) {\n val end = index + size\n val coercedEnd = if (end < 0 || end > thisSize) { if (partialWindows) thisSize else break } else end\n result.add(transform(subSequence(index, coercedEnd)))\n index += step\n }\n return result\n}\n\n/**\n * Returns a sequence of snapshots of the window of the given [size]\n * sliding along this char sequence with the given [step], where each\n * snapshot is a string.\n * \n * Several last strings may have fewer characters than the given [size].\n * \n * Both [size] and [step] must be positive and can be greater than the number of elements in this char sequence.\n * @param size the number of elements to take in each window\n * @param step the number of elements to move the window forward by on an each step, by default 1\n * @param partialWindows controls whether or not to keep partial windows in the end if any,\n * by default `false` which means partial windows won't be preserved\n * \n * @sample samples.collections.Sequences.Transformations.takeWindows\n */\n@SinceKotlin(\"1.2\")\npublic fun CharSequence.windowedSequence(size: Int, step: Int = 1, partialWindows: Boolean = false): Sequence {\n return windowedSequence(size, step, partialWindows) { it.toString() }\n}\n\n/**\n * Returns a sequence of results of applying the given [transform] function to\n * an each char sequence representing a view over the window of the given [size]\n * sliding along this char sequence with the given [step].\n * \n * Note that the char sequence passed to the [transform] function is ephemeral and is valid only inside that function.\n * You should not store it or allow it to escape in some way, unless you made a snapshot of it.\n * Several last char sequences may have fewer characters than the given [size].\n * \n * Both [size] and [step] must be positive and can be greater than the number of elements in this char sequence.\n * @param size the number of elements to take in each window\n * @param step the number of elements to move the window forward by on an each step, by default 1\n * @param partialWindows controls whether or not to keep partial windows in the end if any,\n * by default `false` which means partial windows won't be preserved\n * \n * @sample samples.collections.Sequences.Transformations.averageWindows\n */\n@SinceKotlin(\"1.2\")\npublic fun CharSequence.windowedSequence(size: Int, step: Int = 1, partialWindows: Boolean = false, transform: (CharSequence) -> R): Sequence {\n checkWindowSizeStep(size, step)\n val windows = (if (partialWindows) indices else 0 until length - size + 1) step step\n return windows.asSequence().map { index ->\n val end = index + size\n val coercedEnd = if (end < 0 || end > length) length else end\n transform(subSequence(index, coercedEnd))\n }\n}\n\n/**\n * Returns a list of pairs built from the characters of `this` and the [other] char sequences with the same index\n * The returned list has length of the shortest char sequence.\n * \n * @sample samples.text.Strings.zip\n */\npublic infix fun CharSequence.zip(other: CharSequence): List> {\n return zip(other) { c1, c2 -> c1 to c2 }\n}\n\n/**\n * Returns a list of values built from the characters of `this` and the [other] char sequences with the same index\n * using the provided [transform] function applied to each pair of characters.\n * The returned list has length of the shortest char sequence.\n * \n * @sample samples.text.Strings.zipWithTransform\n */\npublic inline fun CharSequence.zip(other: CharSequence, transform: (a: Char, b: Char) -> V): List {\n val length = minOf(this.length, other.length)\n val list = ArrayList(length)\n for (i in 0 until length) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of pairs of each two adjacent characters in this char sequence.\n * \n * The returned list is empty if this char sequence contains less than two characters.\n * \n * @sample samples.collections.Collections.Transformations.zipWithNext\n */\n@SinceKotlin(\"1.2\")\npublic fun CharSequence.zipWithNext(): List> {\n return zipWithNext { a, b -> a to b }\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to an each pair of two adjacent characters in this char sequence.\n * \n * The returned list is empty if this char sequence contains less than two characters.\n * \n * @sample samples.collections.Collections.Transformations.zipWithNextToFindDeltas\n */\n@SinceKotlin(\"1.2\")\npublic inline fun CharSequence.zipWithNext(transform: (a: Char, b: Char) -> R): List {\n val size = length - 1\n if (size < 1) return emptyList()\n val result = ArrayList(size)\n for (index in 0 until size) {\n result.add(transform(this[index], this[index + 1]))\n }\n return result\n}\n\n/**\n * Creates an [Iterable] instance that wraps the original char sequence returning its characters when being iterated.\n */\npublic fun CharSequence.asIterable(): Iterable {\n if (this is String && isEmpty()) return emptyList()\n return Iterable { this.iterator() }\n}\n\n/**\n * Creates a [Sequence] instance that wraps the original char sequence returning its characters when being iterated.\n */\npublic fun CharSequence.asSequence(): Sequence {\n if (this is String && isEmpty()) return emptySequence()\n return Sequence { this.iterator() }\n}\n\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.text\n\nimport kotlin.js.RegExp\n\n/**\n * Converts the characters in the specified array to a string.\n */\n@SinceKotlin(\"1.2\")\n@Deprecated(\"Use CharArray.concatToString() instead\", ReplaceWith(\"chars.concatToString()\"))\npublic actual fun String(chars: CharArray): String {\n var result = \"\"\n for (char in chars) {\n result += char\n }\n return result\n}\n\n/**\n * Converts the characters from a portion of the specified array to a string.\n *\n * @throws IndexOutOfBoundsException if either [offset] or [length] are less than zero\n * or `offset + length` is out of [chars] array bounds.\n */\n@SinceKotlin(\"1.2\")\n@Deprecated(\"Use CharArray.concatToString(startIndex, endIndex) instead\", ReplaceWith(\"chars.concatToString(offset, offset + length)\"))\npublic actual fun String(chars: CharArray, offset: Int, length: Int): String {\n if (offset < 0 || length < 0 || chars.size - offset < length)\n throw IndexOutOfBoundsException(\"size: ${chars.size}; offset: $offset; length: $length\")\n var result = \"\"\n for (index in offset until offset + length) {\n result += chars[index]\n }\n return result\n}\n\n/**\n * Concatenates characters in this [CharArray] into a String.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic actual fun CharArray.concatToString(): String {\n var result = \"\"\n for (char in this) {\n result += char\n }\n return result\n}\n\n/**\n * Concatenates characters in this [CharArray] or its subrange into a String.\n *\n * @param startIndex the beginning (inclusive) of the subrange of characters, 0 by default.\n * @param endIndex the end (exclusive) of the subrange of characters, size of this array by default.\n *\n * @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [startIndex] is greater than [endIndex].\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun CharArray.concatToString(startIndex: Int = 0, endIndex: Int = this.size): String {\n AbstractList.checkBoundsIndexes(startIndex, endIndex, this.size)\n var result = \"\"\n for (index in startIndex until endIndex) {\n result += this[index]\n }\n return result\n}\n\n/**\n * Returns a [CharArray] containing characters of this string.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic actual fun String.toCharArray(): CharArray {\n return CharArray(length) { get(it) }\n}\n\n/**\n * Returns a [CharArray] containing characters of this string or its substring.\n *\n * @param startIndex the beginning (inclusive) of the substring, 0 by default.\n * @param endIndex the end (exclusive) of the substring, length of this string by default.\n *\n * @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the length of this string.\n * @throws IllegalArgumentException if [startIndex] is greater than [endIndex].\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun String.toCharArray(startIndex: Int = 0, endIndex: Int = this.length): CharArray {\n AbstractList.checkBoundsIndexes(startIndex, endIndex, length)\n return CharArray(endIndex - startIndex) { get(startIndex + it) }\n}\n\n/**\n * Decodes a string from the bytes in UTF-8 encoding in this array.\n *\n * Malformed byte sequences are replaced by the replacement char `\\uFFFD`.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic actual fun ByteArray.decodeToString(): String {\n return decodeUtf8(this, 0, size, false)\n}\n\n/**\n * Decodes a string from the bytes in UTF-8 encoding in this array or its subrange.\n *\n * @param startIndex the beginning (inclusive) of the subrange to decode, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to decode, size of this array by default.\n * @param throwOnInvalidSequence specifies whether to throw an exception on malformed byte sequence or replace it by the replacement char `\\uFFFD`.\n *\n * @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [startIndex] is greater than [endIndex].\n * @throws CharacterCodingException if the byte array contains malformed UTF-8 byte sequence and [throwOnInvalidSequence] is true.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun ByteArray.decodeToString(\n startIndex: Int = 0,\n endIndex: Int = this.size,\n throwOnInvalidSequence: Boolean = false\n): String {\n AbstractList.checkBoundsIndexes(startIndex, endIndex, this.size)\n return decodeUtf8(this, startIndex, endIndex, throwOnInvalidSequence)\n}\n\n/**\n * Encodes this string to an array of bytes in UTF-8 encoding.\n *\n * Any malformed char sequence is replaced by the replacement byte sequence.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic actual fun String.encodeToByteArray(): ByteArray {\n return encodeUtf8(this, 0, length, false)\n}\n\n/**\n * Encodes this string or its substring to an array of bytes in UTF-8 encoding.\n *\n * @param startIndex the beginning (inclusive) of the substring to encode, 0 by default.\n * @param endIndex the end (exclusive) of the substring to encode, length of this string by default.\n * @param throwOnInvalidSequence specifies whether to throw an exception on malformed char sequence or replace.\n *\n * @throws IndexOutOfBoundsException if [startIndex] is less than zero or [endIndex] is greater than the length of this string.\n * @throws IllegalArgumentException if [startIndex] is greater than [endIndex].\n * @throws CharacterCodingException if this string contains malformed char sequence and [throwOnInvalidSequence] is true.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun String.encodeToByteArray(\n startIndex: Int = 0,\n endIndex: Int = this.length,\n throwOnInvalidSequence: Boolean = false\n): ByteArray {\n AbstractList.checkBoundsIndexes(startIndex, endIndex, length)\n return encodeUtf8(this, startIndex, endIndex, throwOnInvalidSequence)\n}\n\n/**\n * Returns a copy of this string converted to upper case using the rules of the default locale.\n */\n@kotlin.internal.InlineOnly\npublic actual inline fun String.toUpperCase(): String = asDynamic().toUpperCase()\n\n/**\n * Returns a copy of this string converted to upper case using Unicode mapping rules of the invariant locale.\n *\n * This function supports one-to-many and many-to-one character mapping,\n * thus the length of the returned string can be different from the length of the original string.\n *\n * @sample samples.text.Strings.uppercase\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic actual inline fun String.uppercase(): String = asDynamic().toUpperCase()\n\n/**\n * Returns a copy of this string converted to lower case using the rules of the default locale.\n */\n@kotlin.internal.InlineOnly\npublic actual inline fun String.toLowerCase(): String = asDynamic().toLowerCase()\n\n/**\n * Returns a copy of this string converted to lower case using Unicode mapping rules of the invariant locale.\n *\n * This function supports one-to-many and many-to-one character mapping,\n * thus the length of the returned string can be different from the length of the original string.\n *\n * @sample samples.text.Strings.lowercase\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic actual inline fun String.lowercase(): String = asDynamic().toLowerCase()\n\n@kotlin.internal.InlineOnly\ninternal actual inline fun String.nativeIndexOf(str: String, fromIndex: Int): Int = asDynamic().indexOf(str, fromIndex)\n\n@kotlin.internal.InlineOnly\ninternal actual inline fun String.nativeLastIndexOf(str: String, fromIndex: Int): Int = asDynamic().lastIndexOf(str, fromIndex)\n\n@kotlin.internal.InlineOnly\ninternal inline fun String.nativeStartsWith(s: String, position: Int): Boolean = asDynamic().startsWith(s, position)\n\n@kotlin.internal.InlineOnly\ninternal inline fun String.nativeEndsWith(s: String): Boolean = asDynamic().endsWith(s)\n\n@kotlin.internal.InlineOnly\npublic actual inline fun String.substring(startIndex: Int): String = asDynamic().substring(startIndex)\n\n@kotlin.internal.InlineOnly\npublic actual inline fun String.substring(startIndex: Int, endIndex: Int): String = asDynamic().substring(startIndex, endIndex)\n\n@kotlin.internal.InlineOnly\npublic inline fun String.concat(str: String): String = asDynamic().concat(str)\n\n@kotlin.internal.InlineOnly\npublic inline fun String.match(regex: String): Array? = asDynamic().match(regex)\n\n//native public fun String.trim(): String\n//TODO: String.replace to implement effective trimLeading and trimTrailing\n\n@kotlin.internal.InlineOnly\ninternal inline fun String.nativeReplace(pattern: RegExp, replacement: String): String = asDynamic().replace(pattern, replacement)\n\n@OptIn(ExperimentalStdlibApi::class)\n@SinceKotlin(\"1.2\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun String.compareTo(other: String, ignoreCase: Boolean = false): Int {\n if (ignoreCase) {\n val n1 = this.length\n val n2 = other.length\n val min = minOf(n1, n2)\n if (min == 0) return n1 - n2\n var start = 0\n while (true) {\n val end = minOf(start + 16, min)\n var s1 = this.substring(start, end)\n var s2 = other.substring(start, end)\n if (s1 != s2) {\n s1 = s1.uppercase()\n s2 = s2.uppercase()\n if (s1 != s2) {\n s1 = s1.lowercase()\n s2 = s2.lowercase()\n if (s1 != s2) {\n return s1.compareTo(s2)\n }\n }\n }\n if (end == min) break\n start = end\n }\n return n1 - n2\n } else {\n return compareTo(other)\n }\n}\n\n\nprivate val STRING_CASE_INSENSITIVE_ORDER = Comparator { a, b -> a.compareTo(b, ignoreCase = true) }\n\n@SinceKotlin(\"1.2\")\npublic actual val String.Companion.CASE_INSENSITIVE_ORDER: Comparator\n get() = STRING_CASE_INSENSITIVE_ORDER\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// Auto-generated file. DO NOT EDIT!\n\npackage kotlin.collections\n\n/** An iterator over a sequence of values of type `Byte`. */\npublic abstract class ByteIterator : Iterator {\n override final fun next() = nextByte()\n\n /** Returns the next value in the sequence without boxing. */\n public abstract fun nextByte(): Byte\n}\n\n/** An iterator over a sequence of values of type `Char`. */\npublic abstract class CharIterator : Iterator {\n override final fun next() = nextChar()\n\n /** Returns the next value in the sequence without boxing. */\n public abstract fun nextChar(): Char\n}\n\n/** An iterator over a sequence of values of type `Short`. */\npublic abstract class ShortIterator : Iterator {\n override final fun next() = nextShort()\n\n /** Returns the next value in the sequence without boxing. */\n public abstract fun nextShort(): Short\n}\n\n/** An iterator over a sequence of values of type `Int`. */\npublic abstract class IntIterator : Iterator {\n override final fun next() = nextInt()\n\n /** Returns the next value in the sequence without boxing. */\n public abstract fun nextInt(): Int\n}\n\n/** An iterator over a sequence of values of type `Long`. */\npublic abstract class LongIterator : Iterator {\n override final fun next() = nextLong()\n\n /** Returns the next value in the sequence without boxing. */\n public abstract fun nextLong(): Long\n}\n\n/** An iterator over a sequence of values of type `Float`. */\npublic abstract class FloatIterator : Iterator {\n override final fun next() = nextFloat()\n\n /** Returns the next value in the sequence without boxing. */\n public abstract fun nextFloat(): Float\n}\n\n/** An iterator over a sequence of values of type `Double`. */\npublic abstract class DoubleIterator : Iterator {\n override final fun next() = nextDouble()\n\n /** Returns the next value in the sequence without boxing. */\n public abstract fun nextDouble(): Double\n}\n\n/** An iterator over a sequence of values of type `Boolean`. */\npublic abstract class BooleanIterator : Iterator {\n override final fun next() = nextBoolean()\n\n /** Returns the next value in the sequence without boxing. */\n public abstract fun nextBoolean(): Boolean\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// Auto-generated file. DO NOT EDIT!\n\npackage kotlin.ranges\n\n/**\n * An iterator over a progression of values of type `Char`.\n * @property step the number by which the value is incremented on each step.\n */\ninternal class CharProgressionIterator(first: Char, last: Char, val step: Int) : CharIterator() {\n private val finalElement = last.toInt()\n private var hasNext: Boolean = if (step > 0) first <= last else first >= last\n private var next = if (hasNext) first.toInt() else finalElement\n\n override fun hasNext(): Boolean = hasNext\n\n override fun nextChar(): Char {\n val value = next\n if (value == finalElement) {\n if (!hasNext) throw kotlin.NoSuchElementException()\n hasNext = false\n }\n else {\n next += step\n }\n return value.toChar()\n }\n}\n\n/**\n * An iterator over a progression of values of type `Int`.\n * @property step the number by which the value is incremented on each step.\n */\ninternal class IntProgressionIterator(first: Int, last: Int, val step: Int) : IntIterator() {\n private val finalElement = last\n private var hasNext: Boolean = if (step > 0) first <= last else first >= last\n private var next = if (hasNext) first else finalElement\n\n override fun hasNext(): Boolean = hasNext\n\n override fun nextInt(): Int {\n val value = next\n if (value == finalElement) {\n if (!hasNext) throw kotlin.NoSuchElementException()\n hasNext = false\n }\n else {\n next += step\n }\n return value\n }\n}\n\n/**\n * An iterator over a progression of values of type `Long`.\n * @property step the number by which the value is incremented on each step.\n */\ninternal class LongProgressionIterator(first: Long, last: Long, val step: Long) : LongIterator() {\n private val finalElement = last\n private var hasNext: Boolean = if (step > 0) first <= last else first >= last\n private var next = if (hasNext) first else finalElement\n\n override fun hasNext(): Boolean = hasNext\n\n override fun nextLong(): Long {\n val value = next\n if (value == finalElement) {\n if (!hasNext) throw kotlin.NoSuchElementException()\n hasNext = false\n }\n else {\n next += step\n }\n return value\n }\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// Auto-generated file. DO NOT EDIT!\n\npackage kotlin.ranges\n\nimport kotlin.internal.getProgressionLastElement\n\n/**\n * A progression of values of type `Char`.\n */\npublic open class CharProgression\n internal constructor\n (\n start: Char,\n endInclusive: Char,\n step: Int\n ) : Iterable {\n init {\n if (step == 0) throw kotlin.IllegalArgumentException(\"Step must be non-zero.\")\n if (step == Int.MIN_VALUE) throw kotlin.IllegalArgumentException(\"Step must be greater than Int.MIN_VALUE to avoid overflow on negation.\")\n }\n\n /**\n * The first element in the progression.\n */\n public val first: Char = start\n\n /**\n * The last element in the progression.\n */\n public val last: Char = getProgressionLastElement(start.toInt(), endInclusive.toInt(), step).toChar()\n\n /**\n * The step of the progression.\n */\n public val step: Int = step\n\n override fun iterator(): CharIterator = CharProgressionIterator(first, last, step)\n\n /** Checks if the progression is empty. */\n public open fun isEmpty(): Boolean = if (step > 0) first > last else first < last\n\n override fun equals(other: Any?): Boolean =\n other is CharProgression && (isEmpty() && other.isEmpty() ||\n first == other.first && last == other.last && step == other.step)\n\n override fun hashCode(): Int =\n if (isEmpty()) -1 else (31 * (31 * first.toInt() + last.toInt()) + step)\n\n override fun toString(): String = if (step > 0) \"$first..$last step $step\" else \"$first downTo $last step ${-step}\"\n\n companion object {\n /**\n * Creates CharProgression within the specified bounds of a closed range.\n\n * The progression starts with the [rangeStart] value and goes toward the [rangeEnd] value not excluding it, with the specified [step].\n * In order to go backwards the [step] must be negative.\n *\n * [step] must be greater than `Int.MIN_VALUE` and not equal to zero.\n */\n public fun fromClosedRange(rangeStart: Char, rangeEnd: Char, step: Int): CharProgression = CharProgression(rangeStart, rangeEnd, step)\n }\n}\n\n/**\n * A progression of values of type `Int`.\n */\npublic open class IntProgression\n internal constructor\n (\n start: Int,\n endInclusive: Int,\n step: Int\n ) : Iterable {\n init {\n if (step == 0) throw kotlin.IllegalArgumentException(\"Step must be non-zero.\")\n if (step == Int.MIN_VALUE) throw kotlin.IllegalArgumentException(\"Step must be greater than Int.MIN_VALUE to avoid overflow on negation.\")\n }\n\n /**\n * The first element in the progression.\n */\n public val first: Int = start\n\n /**\n * The last element in the progression.\n */\n public val last: Int = getProgressionLastElement(start.toInt(), endInclusive.toInt(), step).toInt()\n\n /**\n * The step of the progression.\n */\n public val step: Int = step\n\n override fun iterator(): IntIterator = IntProgressionIterator(first, last, step)\n\n /** Checks if the progression is empty. */\n public open fun isEmpty(): Boolean = if (step > 0) first > last else first < last\n\n override fun equals(other: Any?): Boolean =\n other is IntProgression && (isEmpty() && other.isEmpty() ||\n first == other.first && last == other.last && step == other.step)\n\n override fun hashCode(): Int =\n if (isEmpty()) -1 else (31 * (31 * first + last) + step)\n\n override fun toString(): String = if (step > 0) \"$first..$last step $step\" else \"$first downTo $last step ${-step}\"\n\n companion object {\n /**\n * Creates IntProgression within the specified bounds of a closed range.\n\n * The progression starts with the [rangeStart] value and goes toward the [rangeEnd] value not excluding it, with the specified [step].\n * In order to go backwards the [step] must be negative.\n *\n * [step] must be greater than `Int.MIN_VALUE` and not equal to zero.\n */\n public fun fromClosedRange(rangeStart: Int, rangeEnd: Int, step: Int): IntProgression = IntProgression(rangeStart, rangeEnd, step)\n }\n}\n\n/**\n * A progression of values of type `Long`.\n */\npublic open class LongProgression\n internal constructor\n (\n start: Long,\n endInclusive: Long,\n step: Long\n ) : Iterable {\n init {\n if (step == 0L) throw kotlin.IllegalArgumentException(\"Step must be non-zero.\")\n if (step == Long.MIN_VALUE) throw kotlin.IllegalArgumentException(\"Step must be greater than Long.MIN_VALUE to avoid overflow on negation.\")\n }\n\n /**\n * The first element in the progression.\n */\n public val first: Long = start\n\n /**\n * The last element in the progression.\n */\n public val last: Long = getProgressionLastElement(start.toLong(), endInclusive.toLong(), step).toLong()\n\n /**\n * The step of the progression.\n */\n public val step: Long = step\n\n override fun iterator(): LongIterator = LongProgressionIterator(first, last, step)\n\n /** Checks if the progression is empty. */\n public open fun isEmpty(): Boolean = if (step > 0) first > last else first < last\n\n override fun equals(other: Any?): Boolean =\n other is LongProgression && (isEmpty() && other.isEmpty() ||\n first == other.first && last == other.last && step == other.step)\n\n override fun hashCode(): Int =\n if (isEmpty()) -1 else (31 * (31 * (first xor (first ushr 32)) + (last xor (last ushr 32))) + (step xor (step ushr 32))).toInt()\n\n override fun toString(): String = if (step > 0) \"$first..$last step $step\" else \"$first downTo $last step ${-step}\"\n\n companion object {\n /**\n * Creates LongProgression within the specified bounds of a closed range.\n\n * The progression starts with the [rangeStart] value and goes toward the [rangeEnd] value not excluding it, with the specified [step].\n * In order to go backwards the [step] must be negative.\n *\n * [step] must be greater than `Long.MIN_VALUE` and not equal to zero.\n */\n public fun fromClosedRange(rangeStart: Long, rangeEnd: Long, step: Long): LongProgression = LongProgression(rangeStart, rangeEnd, step)\n }\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.collections\n\nimport kotlin.internal.PlatformDependent\n\n/**\n * Classes that inherit from this interface can be represented as a sequence of elements that can\n * be iterated over.\n * @param T the type of element being iterated over. The iterator is covariant in its element type.\n */\npublic interface Iterable {\n /**\n * Returns an iterator over the elements of this object.\n */\n public operator fun iterator(): Iterator\n}\n\n/**\n * Classes that inherit from this interface can be represented as a sequence of elements that can\n * be iterated over and that supports removing elements during iteration.\n * @param T the type of element being iterated over. The mutable iterator is invariant in its element type.\n */\npublic interface MutableIterable : Iterable {\n /**\n * Returns an iterator over the elements of this sequence that supports removing elements during iteration.\n */\n override fun iterator(): MutableIterator\n}\n\n/**\n * A generic collection of elements. Methods in this interface support only read-only access to the collection;\n * read/write access is supported through the [MutableCollection] interface.\n * @param E the type of elements contained in the collection. The collection is covariant in its element type.\n */\npublic interface Collection : Iterable {\n // Query Operations\n /**\n * Returns the size of the collection.\n */\n public val size: Int\n\n /**\n * Returns `true` if the collection is empty (contains no elements), `false` otherwise.\n */\n public fun isEmpty(): Boolean\n\n /**\n * Checks if the specified element is contained in this collection.\n */\n public operator fun contains(element: @UnsafeVariance E): Boolean\n\n override fun iterator(): Iterator\n\n // Bulk Operations\n /**\n * Checks if all elements in the specified collection are contained in this collection.\n */\n public fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean\n}\n\n/**\n * A generic collection of elements that supports adding and removing elements.\n *\n * @param E the type of elements contained in the collection. The mutable collection is invariant in its element type.\n */\npublic interface MutableCollection : Collection, MutableIterable {\n // Query Operations\n override fun iterator(): MutableIterator\n\n // Modification Operations\n /**\n * Adds the specified element to the collection.\n *\n * @return `true` if the element has been added, `false` if the collection does not support duplicates\n * and the element is already contained in the collection.\n */\n public fun add(element: E): Boolean\n\n /**\n * Removes a single instance of the specified element from this\n * collection, if it is present.\n *\n * @return `true` if the element has been successfully removed; `false` if it was not present in the collection.\n */\n public fun remove(element: E): Boolean\n\n // Bulk Modification Operations\n /**\n * Adds all of the elements of the specified collection to this collection.\n *\n * @return `true` if any of the specified elements was added to the collection, `false` if the collection was not modified.\n */\n public fun addAll(elements: Collection): Boolean\n\n /**\n * Removes all of this collection's elements that are also contained in the specified collection.\n *\n * @return `true` if any of the specified elements was removed from the collection, `false` if the collection was not modified.\n */\n public fun removeAll(elements: Collection): Boolean\n\n /**\n * Retains only the elements in this collection that are contained in the specified collection.\n *\n * @return `true` if any element was removed from the collection, `false` if the collection was not modified.\n */\n public fun retainAll(elements: Collection): Boolean\n\n /**\n * Removes all elements from this collection.\n */\n public fun clear(): Unit\n}\n\n/**\n * A generic ordered collection of elements. Methods in this interface support only read-only access to the list;\n * read/write access is supported through the [MutableList] interface.\n * @param E the type of elements contained in the list. The list is covariant in its element type.\n */\npublic interface List : Collection {\n // Query Operations\n\n override val size: Int\n override fun isEmpty(): Boolean\n override fun contains(element: @UnsafeVariance E): Boolean\n override fun iterator(): Iterator\n\n // Bulk Operations\n override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean\n\n // Positional Access Operations\n /**\n * Returns the element at the specified index in the list.\n */\n public operator fun get(index: Int): E\n\n // Search Operations\n /**\n * Returns the index of the first occurrence of the specified element in the list, or -1 if the specified\n * element is not contained in the list.\n */\n public fun indexOf(element: @UnsafeVariance E): Int\n\n /**\n * Returns the index of the last occurrence of the specified element in the list, or -1 if the specified\n * element is not contained in the list.\n */\n public fun lastIndexOf(element: @UnsafeVariance E): Int\n\n // List Iterators\n /**\n * Returns a list iterator over the elements in this list (in proper sequence).\n */\n public fun listIterator(): ListIterator\n\n /**\n * Returns a list iterator over the elements in this list (in proper sequence), starting at the specified [index].\n */\n public fun listIterator(index: Int): ListIterator\n\n // View\n /**\n * Returns a view of the portion of this list between the specified [fromIndex] (inclusive) and [toIndex] (exclusive).\n * The returned list is backed by this list, so non-structural changes in the returned list are reflected in this list, and vice-versa.\n *\n * Structural changes in the base list make the behavior of the view undefined.\n */\n public fun subList(fromIndex: Int, toIndex: Int): List\n}\n\n/**\n * A generic ordered collection of elements that supports adding and removing elements.\n * @param E the type of elements contained in the list. The mutable list is invariant in its element type.\n */\npublic interface MutableList : List, MutableCollection {\n // Modification Operations\n /**\n * Adds the specified element to the end of this list.\n *\n * @return `true` because the list is always modified as the result of this operation.\n */\n override fun add(element: E): Boolean\n\n override fun remove(element: E): Boolean\n\n // Bulk Modification Operations\n /**\n * Adds all of the elements of the specified collection to the end of this list.\n *\n * The elements are appended in the order they appear in the [elements] collection.\n *\n * @return `true` if the list was changed as the result of the operation.\n */\n override fun addAll(elements: Collection): Boolean\n\n /**\n * Inserts all of the elements of the specified collection [elements] into this list at the specified [index].\n *\n * @return `true` if the list was changed as the result of the operation.\n */\n public fun addAll(index: Int, elements: Collection): Boolean\n\n override fun removeAll(elements: Collection): Boolean\n override fun retainAll(elements: Collection): Boolean\n override fun clear(): Unit\n\n // Positional Access Operations\n /**\n * Replaces the element at the specified position in this list with the specified element.\n *\n * @return the element previously at the specified position.\n */\n public operator fun set(index: Int, element: E): E\n\n /**\n * Inserts an element into the list at the specified [index].\n */\n public fun add(index: Int, element: E): Unit\n\n /**\n * Removes an element at the specified [index] from the list.\n *\n * @return the element that has been removed.\n */\n public fun removeAt(index: Int): E\n\n // List Iterators\n override fun listIterator(): MutableListIterator\n\n override fun listIterator(index: Int): MutableListIterator\n\n // View\n override fun subList(fromIndex: Int, toIndex: Int): MutableList\n}\n\n/**\n * A generic unordered collection of elements that does not support duplicate elements.\n * Methods in this interface support only read-only access to the set;\n * read/write access is supported through the [MutableSet] interface.\n * @param E the type of elements contained in the set. The set is covariant in its element type.\n */\npublic interface Set : Collection {\n // Query Operations\n\n override val size: Int\n override fun isEmpty(): Boolean\n override fun contains(element: @UnsafeVariance E): Boolean\n override fun iterator(): Iterator\n\n // Bulk Operations\n override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean\n}\n\n/**\n * A generic unordered collection of elements that does not support duplicate elements, and supports\n * adding and removing elements.\n * @param E the type of elements contained in the set. The mutable set is invariant in its element type.\n */\npublic interface MutableSet : Set, MutableCollection {\n // Query Operations\n override fun iterator(): MutableIterator\n\n // Modification Operations\n\n /**\n * Adds the specified element to the set.\n *\n * @return `true` if the element has been added, `false` if the element is already contained in the set.\n */\n override fun add(element: E): Boolean\n\n override fun remove(element: E): Boolean\n\n // Bulk Modification Operations\n\n override fun addAll(elements: Collection): Boolean\n override fun removeAll(elements: Collection): Boolean\n override fun retainAll(elements: Collection): Boolean\n override fun clear(): Unit\n}\n\n/**\n * A collection that holds pairs of objects (keys and values) and supports efficiently retrieving\n * the value corresponding to each key. Map keys are unique; the map holds only one value for each key.\n * Methods in this interface support only read-only access to the map; read-write access is supported through\n * the [MutableMap] interface.\n * @param K the type of map keys. The map is invariant in its key type, as it\n * can accept key as a parameter (of [containsKey] for example) and return it in [keys] set.\n * @param V the type of map values. The map is covariant in its value type.\n */\npublic interface Map {\n // Query Operations\n /**\n * Returns the number of key/value pairs in the map.\n */\n public val size: Int\n\n /**\n * Returns `true` if the map is empty (contains no elements), `false` otherwise.\n */\n public fun isEmpty(): Boolean\n\n /**\n * Returns `true` if the map contains the specified [key].\n */\n public fun containsKey(key: K): Boolean\n\n /**\n * Returns `true` if the map maps one or more keys to the specified [value].\n */\n public fun containsValue(value: @UnsafeVariance V): Boolean\n\n /**\n * Returns the value corresponding to the given [key], or `null` if such a key is not present in the map.\n */\n public operator fun get(key: K): V?\n\n /**\n * Returns the value corresponding to the given [key], or [defaultValue] if such a key is not present in the map.\n *\n * @since JDK 1.8\n */\n @SinceKotlin(\"1.1\")\n @PlatformDependent\n public fun getOrDefault(key: K, defaultValue: @UnsafeVariance V): V {\n // See default implementation in JDK sources\n throw NotImplementedError()\n }\n\n // Views\n /**\n * Returns a read-only [Set] of all keys in this map.\n */\n public val keys: Set\n\n /**\n * Returns a read-only [Collection] of all values in this map. Note that this collection may contain duplicate values.\n */\n public val values: Collection\n\n /**\n * Returns a read-only [Set] of all key/value pairs in this map.\n */\n public val entries: Set>\n\n /**\n * Represents a key/value pair held by a [Map].\n */\n public interface Entry {\n /**\n * Returns the key of this key/value pair.\n */\n public val key: K\n\n /**\n * Returns the value of this key/value pair.\n */\n public val value: V\n }\n}\n\n/**\n * A modifiable collection that holds pairs of objects (keys and values) and supports efficiently retrieving\n * the value corresponding to each key. Map keys are unique; the map holds only one value for each key.\n * @param K the type of map keys. The map is invariant in its key type.\n * @param V the type of map values. The mutable map is invariant in its value type.\n */\npublic interface MutableMap : Map {\n // Modification Operations\n /**\n * Associates the specified [value] with the specified [key] in the map.\n *\n * @return the previous value associated with the key, or `null` if the key was not present in the map.\n */\n public fun put(key: K, value: V): V?\n\n /**\n * Removes the specified key and its corresponding value from this map.\n *\n * @return the previous value associated with the key, or `null` if the key was not present in the map.\n */\n public fun remove(key: K): V?\n\n /**\n * Removes the entry for the specified key only if it is mapped to the specified value.\n *\n * @return true if entry was removed\n */\n @SinceKotlin(\"1.1\")\n @PlatformDependent\n public fun remove(key: K, value: V): Boolean {\n // See default implementation in JDK sources\n return true\n }\n\n // Bulk Modification Operations\n /**\n * Updates this map with key/value pairs from the specified map [from].\n */\n public fun putAll(from: Map): Unit\n\n /**\n * Removes all elements from this map.\n */\n public fun clear(): Unit\n\n // Views\n /**\n * Returns a [MutableSet] of all keys in this map.\n */\n override val keys: MutableSet\n\n /**\n * Returns a [MutableCollection] of all values in this map. Note that this collection may contain duplicate values.\n */\n override val values: MutableCollection\n\n /**\n * Returns a [MutableSet] of all key/value pairs in this map.\n */\n override val entries: MutableSet>\n\n /**\n * Represents a key/value pair held by a [MutableMap].\n */\n public interface MutableEntry : Map.Entry {\n /**\n * Changes the value associated with the key of this entry.\n *\n * @return the previous value corresponding to the key.\n */\n public fun setValue(newValue: V): V\n }\n}\n","/*\n * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.ranges\n\n/**\n * Represents a range of values (for example, numbers or characters).\n * See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/ranges.html) for more information.\n */\npublic interface ClosedRange> {\n /**\n * The minimum value in the range.\n */\n public val start: T\n\n /**\n * The maximum value in the range (inclusive).\n */\n public val endInclusive: T\n\n /**\n * Checks whether the specified [value] belongs to the range.\n */\n public operator fun contains(value: T): Boolean = value >= start && value <= endInclusive\n\n /**\n * Checks whether the range is empty.\n */\n public fun isEmpty(): Boolean = start > endInclusive\n}\n","/*\n * Copyright 2010-2015 JetBrains s.r.o.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage kotlin\n\n/**\n * The type with only one value: the `Unit` object. This type corresponds to the `void` type in Java.\n */\npublic object Unit {\n override fun toString() = \"kotlin.Unit\"\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.internal\n\n// a mod b (in arithmetical sense)\nprivate fun mod(a: Int, b: Int): Int {\n val mod = a % b\n return if (mod >= 0) mod else mod + b\n}\n\nprivate fun mod(a: Long, b: Long): Long {\n val mod = a % b\n return if (mod >= 0) mod else mod + b\n}\n\n// (a - b) mod c\nprivate fun differenceModulo(a: Int, b: Int, c: Int): Int {\n return mod(mod(a, c) - mod(b, c), c)\n}\n\nprivate fun differenceModulo(a: Long, b: Long, c: Long): Long {\n return mod(mod(a, c) - mod(b, c), c)\n}\n\n/**\n * Calculates the final element of a bounded arithmetic progression, i.e. the last element of the progression which is in the range\n * from [start] to [end] in case of a positive [step], or from [end] to [start] in case of a negative\n * [step].\n *\n * No validation on passed parameters is performed. The given parameters should satisfy the condition:\n *\n * - either `step > 0` and `start <= end`,\n * - or `step < 0` and `start >= end`.\n *\n * @param start first element of the progression\n * @param end ending bound for the progression\n * @param step increment, or difference of successive elements in the progression\n * @return the final element of the progression\n * @suppress\n */\n@PublishedApi\ninternal fun getProgressionLastElement(start: Int, end: Int, step: Int): Int = when {\n step > 0 -> if (start >= end) end else end - differenceModulo(end, start, step)\n step < 0 -> if (start <= end) end else end + differenceModulo(start, end, -step)\n else -> throw kotlin.IllegalArgumentException(\"Step is zero.\")\n}\n\n/**\n * Calculates the final element of a bounded arithmetic progression, i.e. the last element of the progression which is in the range\n * from [start] to [end] in case of a positive [step], or from [end] to [start] in case of a negative\n * [step].\n *\n * No validation on passed parameters is performed. The given parameters should satisfy the condition:\n *\n * - either `step > 0` and `start <= end`,\n * - or `step < 0` and `start >= end`.\n *\n * @param start first element of the progression\n * @param end ending bound for the progression\n * @param step increment, or difference of successive elements in the progression\n * @return the final element of the progression\n * @suppress\n */\n@PublishedApi\ninternal fun getProgressionLastElement(start: Long, end: Long, step: Long): Long = when {\n step > 0 -> if (start >= end) end else end - differenceModulo(end, start, step)\n step < 0 -> if (start <= end) end else end + differenceModulo(start, end, -step)\n else -> throw kotlin.IllegalArgumentException(\"Step is zero.\")\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@JsName(\"arrayIterator\")\ninternal fun arrayIterator(array: dynamic, type: String?) = when (type) {\n null -> {\n val arr: Array = array\n object : Iterator {\n var index = 0\n override fun hasNext() = index < arr.size\n override fun next() = if (index < arr.size) arr[index++] else throw NoSuchElementException(\"$index\")\n }\n }\n \"BooleanArray\" -> booleanArrayIterator(array)\n \"ByteArray\" -> byteArrayIterator(array)\n \"ShortArray\" -> shortArrayIterator(array)\n \"CharArray\" -> charArrayIterator(array)\n \"IntArray\" -> intArrayIterator(array)\n \"LongArray\" -> longArrayIterator(array)\n \"FloatArray\" -> floatArrayIterator(array)\n \"DoubleArray\" -> doubleArrayIterator(array)\n else -> throw IllegalStateException(\"Unsupported type argument for arrayIterator: $type\")\n}\n\n@JsName(\"booleanArrayIterator\")\ninternal fun booleanArrayIterator(array: BooleanArray) = object : BooleanIterator() {\n var index = 0\n override fun hasNext() = index < array.size\n override fun nextBoolean() = if (index < array.size) array[index++] else throw NoSuchElementException(\"$index\")\n}\n\n@JsName(\"byteArrayIterator\")\ninternal fun byteArrayIterator(array: ByteArray) = object : ByteIterator() {\n var index = 0\n override fun hasNext() = index < array.size\n override fun nextByte() = if (index < array.size) array[index++] else throw NoSuchElementException(\"$index\")\n}\n\n@JsName(\"shortArrayIterator\")\ninternal fun shortArrayIterator(array: ShortArray) = object : ShortIterator() {\n var index = 0\n override fun hasNext() = index < array.size\n override fun nextShort() = if (index < array.size) array[index++] else throw NoSuchElementException(\"$index\")\n}\n\n@JsName(\"charArrayIterator\")\ninternal fun charArrayIterator(array: CharArray) = object : CharIterator() {\n var index = 0\n override fun hasNext() = index < array.size\n override fun nextChar() = if (index < array.size) array[index++] else throw NoSuchElementException(\"$index\")\n}\n\n@JsName(\"intArrayIterator\")\ninternal fun intArrayIterator(array: IntArray) = object : IntIterator() {\n var index = 0\n override fun hasNext() = index < array.size\n override fun nextInt() = if (index < array.size) array[index++] else throw NoSuchElementException(\"$index\")\n}\n\n@JsName(\"floatArrayIterator\")\ninternal fun floatArrayIterator(array: FloatArray) = object : FloatIterator() {\n var index = 0\n override fun hasNext() = index < array.size\n override fun nextFloat() = if (index < array.size) array[index++] else throw NoSuchElementException(\"$index\")\n}\n\n@JsName(\"doubleArrayIterator\")\ninternal fun doubleArrayIterator(array: DoubleArray) = object : DoubleIterator() {\n var index = 0\n override fun hasNext() = index < array.size\n override fun nextDouble() = if (index < array.size) array[index++] else throw NoSuchElementException(\"$index\")\n}\n\n@JsName(\"longArrayIterator\")\ninternal fun longArrayIterator(array: LongArray) = object : LongIterator() {\n var index = 0\n override fun hasNext() = index < array.size\n override fun nextLong() = if (index < array.size) array[index++] else throw NoSuchElementException(\"$index\")\n}\n\n@JsName(\"PropertyMetadata\")\ninternal class PropertyMetadata(@JsName(\"callableName\") val name: String)\n\n@JsName(\"noWhenBranchMatched\")\ninternal fun noWhenBranchMatched(): Nothing = throw NoWhenBranchMatchedException()\n\n@JsName(\"subSequence\")\ninternal fun subSequence(c: CharSequence, startIndex: Int, endIndex: Int): CharSequence {\n if (c is String) {\n return c.substring(startIndex, endIndex)\n } else {\n return c.asDynamic().`subSequence_vux9f0$`(startIndex, endIndex)\n }\n}\n\n@JsName(\"captureStack\")\ninternal fun captureStack(@Suppress(\"UNUSED_PARAMETER\") baseClass: JsClass, instance: Throwable) {\n if (js(\"Error\").captureStackTrace) {\n // Using uncropped stack traces due to KT-37563.\n // Precise stack traces are implemented in JS IR compiler and stdlib\n js(\"Error\").captureStackTrace(instance);\n } else {\n instance.asDynamic().stack = js(\"new Error()\").stack;\n }\n}\n\n@JsName(\"newThrowable\")\ninternal fun newThrowable(message: String?, cause: Throwable?): Throwable {\n val throwable = js(\"new Error()\")\n throwable.message = if (jsTypeOf(message) == \"undefined\") {\n if (cause != null) cause.toString() else null\n } else {\n message\n }\n throwable.cause = cause\n throwable.name = \"Throwable\"\n return throwable\n}\n\n@JsName(\"BoxedChar\")\ninternal class BoxedChar(val c: Int) : Comparable {\n override fun equals(other: Any?): Boolean {\n return other is BoxedChar && c == other.c\n }\n\n override fun hashCode(): Int {\n return c\n }\n\n override fun toString(): String {\n return js(\"this.c\").unsafeCast().toString()\n }\n\n override fun compareTo(other: Int): Int {\n return js(\"this.c - other\").unsafeCast()\n }\n\n @JsName(\"valueOf\")\n public fun valueOf(): Int {\n return c\n }\n}\n\n@kotlin.internal.InlineOnly\ninternal inline fun concat(args: Array): T {\n val typed = js(\"Array\")(args.size)\n for (i in args.indices) {\n val arr = args[i]\n if (arr !is Array<*>) {\n typed[i] = js(\"[]\").slice.call(arr)\n } else {\n typed[i] = arr\n }\n }\n return js(\"[]\").concat.apply(js(\"[]\"), typed);\n}\n\n/** Concat regular Array's and TypedArray's into an Array.\n */\n@PublishedApi\n@JsName(\"arrayConcat\")\n@Suppress(\"UNUSED_PARAMETER\")\ninternal fun arrayConcat(a: T, b: T): T {\n return concat(js(\"arguments\"))\n}\n\n/** Concat primitive arrays. Main use: prepare vararg arguments.\n * For compatibility with 1.1.0 the arguments may be a mixture of Array's and TypedArray's.\n *\n * If the first argument is TypedArray (Byte-, Short-, Char-, Int-, Float-, and DoubleArray) returns a TypedArray, otherwise an Array.\n * If the first argument has the $type$ property (Boolean-, Char-, and LongArray) copy its value to result.$type$.\n * If the first argument is a regular Array without the $type$ property default to arrayConcat.\n */\n@PublishedApi\n@JsName(\"primitiveArrayConcat\")\n@Suppress(\"UNUSED_PARAMETER\")\ninternal fun primitiveArrayConcat(a: T, b: T): T {\n val args: Array = js(\"arguments\")\n if (a is Array<*> && a.asDynamic().`$type$` === undefined) {\n return concat(args)\n } else {\n var size = 0\n for (i in args.indices) {\n size += args[i].asDynamic().length as Int\n }\n val result = js(\"new a.constructor(size)\")\n kotlin.copyArrayType(a, result)\n size = 0\n for (i in args.indices) {\n val arr = args[i].asDynamic()\n for (j in 0 until arr.length) {\n result[size++] = arr[j]\n }\n }\n return result\n }\n}\n\n@JsName(\"booleanArrayOf\")\ninternal fun booleanArrayOf() = withType(\"BooleanArray\", js(\"[].slice.call(arguments)\"))\n\n@JsName(\"charArrayOf\") // The arguments have to be slice'd here because of Rhino (see KT-16974)\ninternal fun charArrayOf() = withType(\"CharArray\", js(\"new Uint16Array([].slice.call(arguments))\"))\n\n@JsName(\"longArrayOf\")\ninternal fun longArrayOf() = withType(\"LongArray\", js(\"[].slice.call(arguments)\"))\n\n@JsName(\"withType\")\n@kotlin.internal.InlineOnly\ninternal inline fun withType(type: String, array: dynamic): dynamic {\n array.`$type$` = type\n return array\n}","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.coroutines\n\nimport kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED\n\n@SinceKotlin(\"1.3\")\n@JsName(\"CoroutineImpl\")\ninternal abstract class CoroutineImpl(private val resultContinuation: Continuation) : Continuation {\n protected var state = 0\n protected var exceptionState = 0\n protected var result: Any? = null\n protected var exception: Throwable? = null\n protected var finallyPath: Array? = null\n\n public override val context: CoroutineContext = resultContinuation.context\n\n private var intercepted_: Continuation? = null\n\n public fun intercepted(): Continuation =\n intercepted_\n ?: (context[ContinuationInterceptor]?.interceptContinuation(this) ?: this)\n .also { intercepted_ = it }\n\n override fun resumeWith(result: Result) {\n var current = this\n var currentResult: Any? = result.getOrNull()\n var currentException: Throwable? = result.exceptionOrNull()\n\n // This loop unrolls recursion in current.resumeWith(param) to make saner and shorter stack traces on resume\n while (true) {\n with(current) {\n val completion = resultContinuation\n\n // Set result and exception fields in the current continuation\n if (currentException == null) {\n this.result = currentResult\n } else {\n state = exceptionState\n exception = currentException\n }\n\n try {\n val outcome = doResume()\n if (outcome === COROUTINE_SUSPENDED) return\n currentResult = outcome\n currentException = null\n } catch (exception: dynamic) { // Catch all exceptions\n currentResult = null\n currentException = exception.unsafeCast()\n }\n\n releaseIntercepted() // this state machine instance is terminating\n\n if (completion is CoroutineImpl) {\n // unrolling recursion via loop\n current = completion\n } else {\n // top-level completion reached -- invoke and return\n currentException?.let {\n completion.resumeWithException(it)\n } ?: completion.resume(currentResult)\n return\n }\n }\n }\n }\n\n private fun releaseIntercepted() {\n val intercepted = intercepted_\n if (intercepted != null && intercepted !== this) {\n context[ContinuationInterceptor]!!.releaseInterceptedContinuation(intercepted)\n }\n this.intercepted_ = CompletedContinuation // just in case\n }\n\n protected abstract fun doResume(): Any?\n}\n\ninternal object CompletedContinuation : Continuation {\n override val context: CoroutineContext\n get() = error(\"This continuation is already complete\")\n\n override fun resumeWith(result: Result) {\n error(\"This continuation is already complete\")\n }\n\n override fun toString(): String = \"This continuation is already complete\"\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:Suppress(\"UNCHECKED_CAST\", \"RedundantVisibilityModifier\")\n\npackage kotlin\n\nimport kotlin.contracts.*\nimport kotlin.internal.InlineOnly\nimport kotlin.jvm.JvmField\nimport kotlin.jvm.JvmName\n\n/**\n * A discriminated union that encapsulates a successful outcome with a value of type [T]\n * or a failure with an arbitrary [Throwable] exception.\n */\n@Suppress(\"NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS\")\n@SinceKotlin(\"1.3\")\npublic inline class Result @PublishedApi internal constructor(\n @PublishedApi\n internal val value: Any?\n) : Serializable {\n // discovery\n\n /**\n * Returns `true` if this instance represents a successful outcome.\n * In this case [isFailure] returns `false`.\n */\n public val isSuccess: Boolean get() = value !is Failure\n\n /**\n * Returns `true` if this instance represents a failed outcome.\n * In this case [isSuccess] returns `false`.\n */\n public val isFailure: Boolean get() = value is Failure\n\n // value & exception retrieval\n\n /**\n * Returns the encapsulated value if this instance represents [success][Result.isSuccess] or `null`\n * if it is [failure][Result.isFailure].\n *\n * This function is a shorthand for `getOrElse { null }` (see [getOrElse]) or\n * `fold(onSuccess = { it }, onFailure = { null })` (see [fold]).\n */\n @InlineOnly\n public inline fun getOrNull(): T? =\n when {\n isFailure -> null\n else -> value as T\n }\n\n /**\n * Returns the encapsulated [Throwable] exception if this instance represents [failure][isFailure] or `null`\n * if it is [success][isSuccess].\n *\n * This function is a shorthand for `fold(onSuccess = { null }, onFailure = { it })` (see [fold]).\n */\n public fun exceptionOrNull(): Throwable? =\n when (value) {\n is Failure -> value.exception\n else -> null\n }\n\n /**\n * Returns a string `Success(v)` if this instance represents [success][Result.isSuccess]\n * where `v` is a string representation of the value or a string `Failure(x)` if\n * it is [failure][isFailure] where `x` is a string representation of the exception.\n */\n public override fun toString(): String =\n when (value) {\n is Failure -> value.toString() // \"Failure($exception)\"\n else -> \"Success($value)\"\n }\n\n // companion with constructors\n\n /**\n * Companion object for [Result] class that contains its constructor functions\n * [success] and [failure].\n */\n public companion object {\n /**\n * Returns an instance that encapsulates the given [value] as successful value.\n */\n @Suppress(\"INAPPLICABLE_JVM_NAME\")\n @InlineOnly\n @JvmName(\"success\")\n public inline fun success(value: T): Result =\n Result(value)\n\n /**\n * Returns an instance that encapsulates the given [Throwable] [exception] as failure.\n */\n @Suppress(\"INAPPLICABLE_JVM_NAME\")\n @InlineOnly\n @JvmName(\"failure\")\n public inline fun failure(exception: Throwable): Result =\n Result(createFailure(exception))\n }\n\n internal class Failure(\n @JvmField\n val exception: Throwable\n ) : Serializable {\n override fun equals(other: Any?): Boolean = other is Failure && exception == other.exception\n override fun hashCode(): Int = exception.hashCode()\n override fun toString(): String = \"Failure($exception)\"\n }\n}\n\n/**\n * Creates an instance of internal marker [Result.Failure] class to\n * make sure that this class is not exposed in ABI.\n */\n@PublishedApi\n@SinceKotlin(\"1.3\")\ninternal fun createFailure(exception: Throwable): Any =\n Result.Failure(exception)\n\n/**\n * Throws exception if the result is failure. This internal function minimizes\n * inlined bytecode for [getOrThrow] and makes sure that in the future we can\n * add some exception-augmenting logic here (if needed).\n */\n@PublishedApi\n@SinceKotlin(\"1.3\")\ninternal fun Result<*>.throwOnFailure() {\n if (value is Result.Failure) throw value.exception\n}\n\n/**\n * Calls the specified function [block] and returns its encapsulated result if invocation was successful,\n * catching any [Throwable] exception that was thrown from the [block] function execution and encapsulating it as a failure.\n */\n@InlineOnly\n@SinceKotlin(\"1.3\")\npublic inline fun runCatching(block: () -> R): Result {\n return try {\n Result.success(block())\n } catch (e: Throwable) {\n Result.failure(e)\n }\n}\n\n/**\n * Calls the specified function [block] with `this` value as its receiver and returns its encapsulated result if invocation was successful,\n * catching any [Throwable] exception that was thrown from the [block] function execution and encapsulating it as a failure.\n */\n@InlineOnly\n@SinceKotlin(\"1.3\")\npublic inline fun T.runCatching(block: T.() -> R): Result {\n return try {\n Result.success(block())\n } catch (e: Throwable) {\n Result.failure(e)\n }\n}\n\n// -- extensions ---\n\n/**\n * Returns the encapsulated value if this instance represents [success][Result.isSuccess] or throws the encapsulated [Throwable] exception\n * if it is [failure][Result.isFailure].\n *\n * This function is a shorthand for `getOrElse { throw it }` (see [getOrElse]).\n */\n@InlineOnly\n@SinceKotlin(\"1.3\")\npublic inline fun Result.getOrThrow(): T {\n throwOnFailure()\n return value as T\n}\n\n/**\n * Returns the encapsulated value if this instance represents [success][Result.isSuccess] or the\n * result of [onFailure] function for the encapsulated [Throwable] exception if it is [failure][Result.isFailure].\n *\n * Note, that this function rethrows any [Throwable] exception thrown by [onFailure] function.\n *\n * This function is a shorthand for `fold(onSuccess = { it }, onFailure = onFailure)` (see [fold]).\n */\n@InlineOnly\n@SinceKotlin(\"1.3\")\npublic inline fun Result.getOrElse(onFailure: (exception: Throwable) -> R): R {\n contract {\n callsInPlace(onFailure, InvocationKind.AT_MOST_ONCE)\n }\n return when (val exception = exceptionOrNull()) {\n null -> value as T\n else -> onFailure(exception)\n }\n}\n\n/**\n * Returns the encapsulated value if this instance represents [success][Result.isSuccess] or the\n * [defaultValue] if it is [failure][Result.isFailure].\n *\n * This function is a shorthand for `getOrElse { defaultValue }` (see [getOrElse]).\n */\n@InlineOnly\n@SinceKotlin(\"1.3\")\npublic inline fun Result.getOrDefault(defaultValue: R): R {\n if (isFailure) return defaultValue\n return value as T\n}\n\n/**\n * Returns the result of [onSuccess] for the encapsulated value if this instance represents [success][Result.isSuccess]\n * or the result of [onFailure] function for the encapsulated [Throwable] exception if it is [failure][Result.isFailure].\n *\n * Note, that this function rethrows any [Throwable] exception thrown by [onSuccess] or by [onFailure] function.\n */\n@InlineOnly\n@SinceKotlin(\"1.3\")\npublic inline fun Result.fold(\n onSuccess: (value: T) -> R,\n onFailure: (exception: Throwable) -> R\n): R {\n contract {\n callsInPlace(onSuccess, InvocationKind.AT_MOST_ONCE)\n callsInPlace(onFailure, InvocationKind.AT_MOST_ONCE)\n }\n return when (val exception = exceptionOrNull()) {\n null -> onSuccess(value as T)\n else -> onFailure(exception)\n }\n}\n\n// transformation\n\n/**\n * Returns the encapsulated result of the given [transform] function applied to the encapsulated value\n * if this instance represents [success][Result.isSuccess] or the\n * original encapsulated [Throwable] exception if it is [failure][Result.isFailure].\n *\n * Note, that this function rethrows any [Throwable] exception thrown by [transform] function.\n * See [mapCatching] for an alternative that encapsulates exceptions.\n */\n@InlineOnly\n@SinceKotlin(\"1.3\")\npublic inline fun Result.map(transform: (value: T) -> R): Result {\n contract {\n callsInPlace(transform, InvocationKind.AT_MOST_ONCE)\n }\n return when {\n isSuccess -> Result.success(transform(value as T))\n else -> Result(value)\n }\n}\n\n/**\n * Returns the encapsulated result of the given [transform] function applied to the encapsulated value\n * if this instance represents [success][Result.isSuccess] or the\n * original encapsulated [Throwable] exception if it is [failure][Result.isFailure].\n *\n * This function catches any [Throwable] exception thrown by [transform] function and encapsulates it as a failure.\n * See [map] for an alternative that rethrows exceptions from `transform` function.\n */\n@InlineOnly\n@SinceKotlin(\"1.3\")\npublic inline fun Result.mapCatching(transform: (value: T) -> R): Result {\n return when {\n isSuccess -> runCatching { transform(value as T) }\n else -> Result(value)\n }\n}\n\n/**\n * Returns the encapsulated result of the given [transform] function applied to the encapsulated [Throwable] exception\n * if this instance represents [failure][Result.isFailure] or the\n * original encapsulated value if it is [success][Result.isSuccess].\n *\n * Note, that this function rethrows any [Throwable] exception thrown by [transform] function.\n * See [recoverCatching] for an alternative that encapsulates exceptions.\n */\n@InlineOnly\n@SinceKotlin(\"1.3\")\npublic inline fun Result.recover(transform: (exception: Throwable) -> R): Result {\n contract {\n callsInPlace(transform, InvocationKind.AT_MOST_ONCE)\n }\n return when (val exception = exceptionOrNull()) {\n null -> this\n else -> Result.success(transform(exception))\n }\n}\n\n/**\n * Returns the encapsulated result of the given [transform] function applied to the encapsulated [Throwable] exception\n * if this instance represents [failure][Result.isFailure] or the\n * original encapsulated value if it is [success][Result.isSuccess].\n *\n * This function catches any [Throwable] exception thrown by [transform] function and encapsulates it as a failure.\n * See [recover] for an alternative that rethrows exceptions.\n */\n@InlineOnly\n@SinceKotlin(\"1.3\")\npublic inline fun Result.recoverCatching(transform: (exception: Throwable) -> R): Result {\n return when (val exception = exceptionOrNull()) {\n null -> this\n else -> runCatching { transform(exception) }\n }\n}\n\n// \"peek\" onto value/exception and pipe\n\n/**\n * Performs the given [action] on the encapsulated [Throwable] exception if this instance represents [failure][Result.isFailure].\n * Returns the original `Result` unchanged.\n */\n@InlineOnly\n@SinceKotlin(\"1.3\")\npublic inline fun Result.onFailure(action: (exception: Throwable) -> Unit): Result {\n contract {\n callsInPlace(action, InvocationKind.AT_MOST_ONCE)\n }\n exceptionOrNull()?.let { action(it) }\n return this\n}\n\n/**\n * Performs the given [action] on the encapsulated value if this instance represents [success][Result.isSuccess].\n * Returns the original `Result` unchanged.\n */\n@InlineOnly\n@SinceKotlin(\"1.3\")\npublic inline fun Result.onSuccess(action: (value: T) -> Unit): Result {\n contract {\n callsInPlace(action, InvocationKind.AT_MOST_ONCE)\n }\n if (isSuccess) action(value as T)\n return this\n}\n\n// -------------------\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.coroutines\n\nimport kotlin.contracts.*\nimport kotlin.coroutines.intrinsics.*\nimport kotlin.internal.InlineOnly\n\n/**\n * Interface representing a continuation after a suspension point that returns a value of type `T`.\n */\n@SinceKotlin(\"1.3\")\npublic interface Continuation {\n /**\n * The context of the coroutine that corresponds to this continuation.\n */\n public val context: CoroutineContext\n\n /**\n * Resumes the execution of the corresponding coroutine passing a successful or failed [result] as the\n * return value of the last suspension point.\n */\n public fun resumeWith(result: Result)\n}\n\n/**\n * Classes and interfaces marked with this annotation are restricted when used as receivers for extension\n * `suspend` functions. These `suspend` extensions can only invoke other member or extension `suspend` functions on this particular\n * receiver and are restricted from calling arbitrary suspension functions.\n */\n@SinceKotlin(\"1.3\")\n@Target(AnnotationTarget.CLASS)\n@Retention(AnnotationRetention.BINARY)\npublic annotation class RestrictsSuspension\n\n/**\n * Resumes the execution of the corresponding coroutine passing [value] as the return value of the last suspension point.\n */\n@SinceKotlin(\"1.3\")\n@InlineOnly\npublic inline fun Continuation.resume(value: T): Unit =\n resumeWith(Result.success(value))\n\n/**\n * Resumes the execution of the corresponding coroutine so that the [exception] is re-thrown right after the\n * last suspension point.\n */\n@SinceKotlin(\"1.3\")\n@InlineOnly\npublic inline fun Continuation.resumeWithException(exception: Throwable): Unit =\n resumeWith(Result.failure(exception))\n\n\n/**\n * Creates a [Continuation] instance with the given [context] and implementation of [resumeWith] method.\n */\n@SinceKotlin(\"1.3\")\n@InlineOnly\npublic inline fun Continuation(\n context: CoroutineContext,\n crossinline resumeWith: (Result) -> Unit\n): Continuation =\n object : Continuation {\n override val context: CoroutineContext\n get() = context\n\n override fun resumeWith(result: Result) =\n resumeWith(result)\n }\n\n/**\n * Creates a coroutine without a receiver and with result type [T].\n * This function creates a new, fresh instance of suspendable computation every time it is invoked.\n *\n * To start executing the created coroutine, invoke `resume(Unit)` on the returned [Continuation] instance.\n * The [completion] continuation is invoked when the coroutine completes with a result or an exception.\n * Subsequent invocation of any resume function on the resulting continuation will produce an [IllegalStateException].\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"UNCHECKED_CAST\")\npublic fun (suspend () -> T).createCoroutine(\n completion: Continuation\n): Continuation =\n SafeContinuation(createCoroutineUnintercepted(completion).intercepted(), COROUTINE_SUSPENDED)\n\n/**\n * Creates a coroutine with receiver type [R] and result type [T].\n * This function creates a new, fresh instance of suspendable computation every time it is invoked.\n *\n * To start executing the created coroutine, invoke `resume(Unit)` on the returned [Continuation] instance.\n * The [completion] continuation is invoked when the coroutine completes with a result or an exception.\n * Subsequent invocation of any resume function on the resulting continuation will produce an [IllegalStateException].\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"UNCHECKED_CAST\")\npublic fun (suspend R.() -> T).createCoroutine(\n receiver: R,\n completion: Continuation\n): Continuation =\n SafeContinuation(createCoroutineUnintercepted(receiver, completion).intercepted(), COROUTINE_SUSPENDED)\n\n/**\n * Starts a coroutine without a receiver and with result type [T].\n * This function creates and starts a new, fresh instance of suspendable computation every time it is invoked.\n * The [completion] continuation is invoked when the coroutine completes with a result or an exception.\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"UNCHECKED_CAST\")\npublic fun (suspend () -> T).startCoroutine(\n completion: Continuation\n) {\n createCoroutineUnintercepted(completion).intercepted().resume(Unit)\n}\n\n/**\n * Starts a coroutine with receiver type [R] and result type [T].\n * This function creates and starts a new, fresh instance of suspendable computation every time it is invoked.\n * The [completion] continuation is invoked when the coroutine completes with a result or an exception.\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"UNCHECKED_CAST\")\npublic fun (suspend R.() -> T).startCoroutine(\n receiver: R,\n completion: Continuation\n) {\n createCoroutineUnintercepted(receiver, completion).intercepted().resume(Unit)\n}\n\n/**\n * Obtains the current continuation instance inside suspend functions and suspends\n * the currently running coroutine.\n *\n * In this function both [Continuation.resume] and [Continuation.resumeWithException] can be used either synchronously in\n * the same stack-frame where the suspension function is run or asynchronously later in the same thread or\n * from a different thread of execution. Subsequent invocation of any resume function will produce an [IllegalStateException].\n */\n@SinceKotlin(\"1.3\")\n@InlineOnly\npublic suspend inline fun suspendCoroutine(crossinline block: (Continuation) -> Unit): T {\n contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }\n return suspendCoroutineUninterceptedOrReturn { c: Continuation ->\n val safe = SafeContinuation(c.intercepted())\n block(safe)\n safe.getOrThrow()\n }\n}\n\n/**\n * Returns the context of the current coroutine.\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"WRONG_MODIFIER_TARGET\")\n@InlineOnly\npublic suspend inline val coroutineContext: CoroutineContext\n get() {\n throw NotImplementedError(\"Implemented as intrinsic\")\n }\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.coroutines.intrinsics\n\nimport kotlin.coroutines.*\nimport kotlin.internal.InlineOnly\n\n/**\n * Starts an unintercepted coroutine without a receiver and with result type [T] and executes it until its first suspension.\n * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.\n * In the latter case, the [completion] continuation is invoked when the coroutine completes with a result or an exception.\n *\n * The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might\n * be present in the completion's [CoroutineContext]. It is the invoker's responsibility to ensure that a proper invocation\n * context is established.\n *\n * This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of the suspended\n * coroutine using a reference to the suspending function.\n */\n@SinceKotlin(\"1.3\")\n@InlineOnly\npublic actual inline fun (suspend () -> T).startCoroutineUninterceptedOrReturn(\n completion: Continuation\n): Any? = this.asDynamic()(completion, false)\n\n/**\n * Starts an unintercepted coroutine with receiver type [R] and result type [T] and executes it until its first suspension.\n * Returns the result of the coroutine or throws its exception if it does not suspend or [COROUTINE_SUSPENDED] if it suspends.\n * In the latter case, the [completion] continuation is invoked when the coroutine completes with a result or an exception.\n *\n * The coroutine is started directly in the invoker's thread without going through the [ContinuationInterceptor] that might\n * be present in the completion's [CoroutineContext]. It is the invoker's responsibility to ensure that a proper invocation\n * context is established.\n *\n * This function is designed to be used from inside of [suspendCoroutineUninterceptedOrReturn] to resume the execution of the suspended\n * coroutine using a reference to the suspending function.\n */\n@SinceKotlin(\"1.3\")\n@InlineOnly\npublic actual inline fun (suspend R.() -> T).startCoroutineUninterceptedOrReturn(\n receiver: R,\n completion: Continuation\n): Any? = this.asDynamic()(receiver, completion, false)\n\n@InlineOnly\ninternal actual inline fun (suspend R.(P) -> T).startCoroutineUninterceptedOrReturn(\n receiver: R,\n param: P,\n completion: Continuation\n): Any? = this.asDynamic()(receiver, param, completion, false)\n\n/**\n * Creates unintercepted coroutine without receiver and with result type [T].\n * This function creates a new, fresh instance of suspendable computation every time it is invoked.\n *\n * To start executing the created coroutine, invoke `resume(Unit)` on the returned [Continuation] instance.\n * The [completion] continuation is invoked when coroutine completes with result or exception.\n *\n * This function returns unintercepted continuation.\n * Invocation of `resume(Unit)` starts coroutine immediately in the invoker's call stack without going through the\n * [ContinuationInterceptor] that might be present in the completion's [CoroutineContext].\n * It is the invoker's responsibility to ensure that a proper invocation context is established.\n * Note that [completion] of this function may get invoked in an arbitrary context.\n *\n * [Continuation.intercepted] can be used to acquire the intercepted continuation.\n * Invocation of `resume(Unit)` on intercepted continuation guarantees that execution of\n * both the coroutine and [completion] happens in the invocation context established by\n * [ContinuationInterceptor].\n *\n * Repeated invocation of any resume function on the resulting continuation corrupts the\n * state machine of the coroutine and may result in arbitrary behaviour or exception.\n */\n@SinceKotlin(\"1.3\")\npublic actual fun (suspend () -> T).createCoroutineUnintercepted(\n completion: Continuation\n): Continuation =\n // Kotlin/JS suspend lambdas have an extra parameter `suspended`\n if (this.asDynamic().length == 2) {\n // When `suspended` is true the continuation is created, but not executed\n this.asDynamic()(completion, true)\n } else {\n createCoroutineFromSuspendFunction(completion) {\n this.asDynamic()(completion)\n }\n }\n\n/**\n * Creates unintercepted coroutine with receiver type [R] and result type [T].\n * This function creates a new, fresh instance of suspendable computation every time it is invoked.\n *\n * To start executing the created coroutine, invoke `resume(Unit)` on the returned [Continuation] instance.\n * The [completion] continuation is invoked when coroutine completes with result or exception.\n *\n * This function returns unintercepted continuation.\n * Invocation of `resume(Unit)` starts coroutine immediately in the invoker's call stack without going through the\n * [ContinuationInterceptor] that might be present in the completion's [CoroutineContext].\n * It is the invoker's responsibility to ensure that a proper invocation context is established.\n * Note that [completion] of this function may get invoked in an arbitrary context.\n *\n * [Continuation.intercepted] can be used to acquire the intercepted continuation.\n * Invocation of `resume(Unit)` on intercepted continuation guarantees that execution of\n * both the coroutine and [completion] happens in the invocation context established by\n * [ContinuationInterceptor].\n *\n * Repeated invocation of any resume function on the resulting continuation corrupts the\n * state machine of the coroutine and may result in arbitrary behaviour or exception.\n */\n@SinceKotlin(\"1.3\")\npublic actual fun (suspend R.() -> T).createCoroutineUnintercepted(\n receiver: R,\n completion: Continuation\n): Continuation =\n // Kotlin/JS suspend lambdas have an extra parameter `suspended`\n if (this.asDynamic().length == 3) {\n // When `suspended` is true the continuation is created, but not executed\n this.asDynamic()(receiver, completion, true)\n } else {\n createCoroutineFromSuspendFunction(completion) {\n this.asDynamic()(receiver, completion)\n }\n }\n\n/**\n * Intercepts this continuation with [ContinuationInterceptor].\n *\n * This function shall be used on the immediate result of [createCoroutineUnintercepted] or [suspendCoroutineUninterceptedOrReturn],\n * in which case it checks for [ContinuationInterceptor] in the continuation's [context][Continuation.context],\n * invokes [ContinuationInterceptor.interceptContinuation], caches and returns the result.\n *\n * If this function is invoked on other [Continuation] instances it returns `this` continuation unchanged.\n */\n@SinceKotlin(\"1.3\")\npublic actual fun Continuation.intercepted(): Continuation =\n (this as? CoroutineImpl)?.intercepted() ?: this\n\n\nprivate inline fun createCoroutineFromSuspendFunction(\n completion: Continuation,\n crossinline block: () -> Any?\n): Continuation {\n @Suppress(\"UNCHECKED_CAST\")\n return object : CoroutineImpl(completion as Continuation) {\n override fun doResume(): Any? {\n exception?.let { throw it }\n return block()\n }\n }\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin\n\n// NOTE: Do not author your exceptions as they are written in this file, instead use this template:\n/*\npublic open class MyException : Exception {\n constructor() : super()\n constructor(message: String?) : super(message)\n constructor(message: String?, cause: Throwable?) : super(message, cause)\n constructor(cause: Throwable?) : super(cause)\n}\n*/\n\n\n// TODO: remove primary constructors, make all secondary KT-22055\n\n@Suppress(\"USELESS_ELVIS_RIGHT_IS_NULL\")\npublic actual open class Error actual constructor(message: String?, cause: Throwable?) : Throwable(message, cause ?: null) {\n actual constructor() : this(null, null)\n actual constructor(message: String?) : this(message, null)\n actual constructor(cause: Throwable?) : this(undefined, cause)\n}\n\n@Suppress(\"USELESS_ELVIS_RIGHT_IS_NULL\")\npublic actual open class Exception actual constructor(message: String?, cause: Throwable?) : Throwable(message, cause ?: null) {\n actual constructor() : this(null, null)\n actual constructor(message: String?) : this(message, null)\n actual constructor(cause: Throwable?) : this(undefined, cause)\n}\n\npublic actual open class RuntimeException actual constructor(message: String?, cause: Throwable?) : Exception(message, cause) {\n actual constructor() : this(null, null)\n actual constructor(message: String?) : this(message, null)\n actual constructor(cause: Throwable?) : this(undefined, cause)\n}\n\npublic actual open class IllegalArgumentException actual constructor(message: String?, cause: Throwable?) : RuntimeException(message, cause) {\n actual constructor() : this(null, null)\n actual constructor(message: String?) : this(message, null)\n actual constructor(cause: Throwable?) : this(undefined, cause)\n}\n\npublic actual open class IllegalStateException actual constructor(message: String?, cause: Throwable?) : RuntimeException(message, cause) {\n actual constructor() : this(null, null)\n actual constructor(message: String?) : this(message, null)\n actual constructor(cause: Throwable?) : this(undefined, cause)\n}\n\npublic actual open class IndexOutOfBoundsException actual constructor(message: String?) : RuntimeException(message) {\n actual constructor() : this(null)\n}\n\npublic actual open class ConcurrentModificationException actual constructor(message: String?, cause: Throwable?) : RuntimeException(message, cause) {\n actual constructor() : this(null, null)\n actual constructor(message: String?) : this(message, null)\n actual constructor(cause: Throwable?) : this(undefined, cause)\n}\n\npublic actual open class UnsupportedOperationException actual constructor(message: String?, cause: Throwable?) : RuntimeException(message, cause) {\n actual constructor() : this(null, null)\n actual constructor(message: String?) : this(message, null)\n actual constructor(cause: Throwable?) : this(undefined, cause)\n}\n\n\npublic actual open class NumberFormatException actual constructor(message: String?) : IllegalArgumentException(message) {\n actual constructor() : this(null)\n}\n\n\npublic actual open class NullPointerException actual constructor(message: String?) : RuntimeException(message) {\n actual constructor() : this(null)\n}\n\npublic actual open class ClassCastException actual constructor(message: String?) : RuntimeException(message) {\n actual constructor() : this(null)\n}\n\npublic actual open class AssertionError\n@SinceKotlin(\"1.4\")\nconstructor(message: String?, cause: Throwable?) : Error(message, cause) {\n actual constructor() : this(null)\n constructor(message: String?) : this(message, null)\n actual constructor(message: Any?) : this(message.toString(), message as? Throwable)\n}\n\npublic actual open class NoSuchElementException actual constructor(message: String?) : RuntimeException(message) {\n actual constructor() : this(null)\n}\n\n@SinceKotlin(\"1.3\")\npublic actual open class ArithmeticException actual constructor(message: String?) : RuntimeException(message) {\n actual constructor() : this(null)\n}\n\npublic actual open class NoWhenBranchMatchedException actual constructor(message: String?, cause: Throwable?) : RuntimeException(message, cause) {\n actual constructor() : this(null, null)\n actual constructor(message: String?) : this(message, null)\n actual constructor(cause: Throwable?) : this(undefined, cause)\n}\n\npublic actual open class UninitializedPropertyAccessException actual constructor(message: String?, cause: Throwable?) : RuntimeException(message, cause) {\n actual constructor() : this(null, null)\n actual constructor(message: String?) : this(message, null)\n actual constructor(cause: Throwable?) : this(undefined, cause)\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:Suppress(\"UNUSED_PARAMETER\", \"NOTHING_TO_INLINE\")\n\npackage kotlin\n\n/**\n * Returns an empty array of the specified type [T].\n */\npublic inline fun emptyArray(): Array = js(\"[]\")\n\n@library\npublic fun arrayOf(vararg elements: T): Array = definedExternally\n\n@library\npublic fun doubleArrayOf(vararg elements: Double): DoubleArray = definedExternally\n\n@library\npublic fun floatArrayOf(vararg elements: Float): FloatArray = definedExternally\n\n@library\npublic fun longArrayOf(vararg elements: Long): LongArray = definedExternally\n\n@library\npublic fun intArrayOf(vararg elements: Int): IntArray = definedExternally\n\n@library\npublic fun charArrayOf(vararg elements: Char): CharArray = definedExternally\n\n@library\npublic fun shortArrayOf(vararg elements: Short): ShortArray = definedExternally\n\n@library\npublic fun byteArrayOf(vararg elements: Byte): ByteArray = definedExternally\n\n@library\npublic fun booleanArrayOf(vararg elements: Boolean): BooleanArray = definedExternally\n\n/**\n * Creates a new instance of the [Lazy] that uses the specified initialization function [initializer].\n */\npublic actual fun lazy(initializer: () -> T): Lazy = UnsafeLazyImpl(initializer)\n\n/**\n * Creates a new instance of the [Lazy] that uses the specified initialization function [initializer].\n *\n * The [mode] parameter is ignored. */\npublic actual fun lazy(mode: LazyThreadSafetyMode, initializer: () -> T): Lazy = UnsafeLazyImpl(initializer)\n\n/**\n * Creates a new instance of the [Lazy] that uses the specified initialization function [initializer].\n *\n * The [lock] parameter is ignored.\n */\npublic actual fun lazy(lock: Any?, initializer: () -> T): Lazy = UnsafeLazyImpl(initializer)\n\n\ninternal fun fillFrom(src: dynamic, dst: dynamic): dynamic {\n val srcLen: Int = src.length\n val dstLen: Int = dst.length\n var index: Int = 0\n while (index < srcLen && index < dstLen) dst[index] = src[index++]\n return dst\n}\n\n\ninternal fun arrayCopyResize(source: dynamic, newSize: Int, defaultValue: Any?): dynamic {\n val result = source.slice(0, newSize)\n copyArrayType(source, result)\n var index: Int = source.length\n if (newSize > index) {\n result.length = newSize\n while (index < newSize) result[index++] = defaultValue\n }\n return result\n}\n\ninternal fun arrayPlusCollection(array: dynamic, collection: Collection): dynamic {\n val result = array.slice()\n result.length += collection.size\n copyArrayType(array, result)\n var index: Int = array.length\n for (element in collection) result[index++] = element\n return result\n}\n\ninternal fun fillFromCollection(dst: dynamic, startIndex: Int, collection: Collection): dynamic {\n var index = startIndex\n for (element in collection) dst[index++] = element\n return dst\n}\n\ninternal inline fun copyArrayType(from: dynamic, to: dynamic) {\n if (from.`$type$` !== undefined) {\n to.`$type$` = from.`$type$`\n }\n}\n\ninternal inline fun jsIsType(obj: dynamic, jsClass: dynamic) = js(\"Kotlin\").isType(obj, jsClass)","/*\n * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.text\n\n/**\n * Returns a string representation of this [Long] value in the specified [radix].\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.\n */\n@SinceKotlin(\"1.2\")\npublic actual fun Long.toString(radix: Int): String = asDynamic().toString(checkRadix(radix))","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.collections\n\n//\n// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt\n// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib\n//\n\nimport kotlin.js.*\nimport primitiveArrayConcat\nimport withType\nimport kotlin.ranges.contains\nimport kotlin.ranges.reversed\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic actual fun Array.elementAt(index: Int): T {\n return elementAtOrElse(index) { throw IndexOutOfBoundsException(\"index: $index, size: $size}\") }\n}\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic actual fun ByteArray.elementAt(index: Int): Byte {\n return elementAtOrElse(index) { throw IndexOutOfBoundsException(\"index: $index, size: $size}\") }\n}\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic actual fun ShortArray.elementAt(index: Int): Short {\n return elementAtOrElse(index) { throw IndexOutOfBoundsException(\"index: $index, size: $size}\") }\n}\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic actual fun IntArray.elementAt(index: Int): Int {\n return elementAtOrElse(index) { throw IndexOutOfBoundsException(\"index: $index, size: $size}\") }\n}\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic actual fun LongArray.elementAt(index: Int): Long {\n return elementAtOrElse(index) { throw IndexOutOfBoundsException(\"index: $index, size: $size}\") }\n}\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic actual fun FloatArray.elementAt(index: Int): Float {\n return elementAtOrElse(index) { throw IndexOutOfBoundsException(\"index: $index, size: $size}\") }\n}\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic actual fun DoubleArray.elementAt(index: Int): Double {\n return elementAtOrElse(index) { throw IndexOutOfBoundsException(\"index: $index, size: $size}\") }\n}\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic actual fun BooleanArray.elementAt(index: Int): Boolean {\n return elementAtOrElse(index) { throw IndexOutOfBoundsException(\"index: $index, size: $size}\") }\n}\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\npublic actual fun CharArray.elementAt(index: Int): Char {\n return elementAtOrElse(index) { throw IndexOutOfBoundsException(\"index: $index, size: $size}\") }\n}\n\n/**\n * Returns a [List] that wraps the original array.\n */\npublic actual fun Array.asList(): List {\n return ArrayList(this.unsafeCast>())\n}\n\n/**\n * Returns a [List] that wraps the original array.\n */\n@kotlin.internal.InlineOnly\npublic actual inline fun ByteArray.asList(): List {\n return this.unsafeCast>().asList()\n}\n\n/**\n * Returns a [List] that wraps the original array.\n */\n@kotlin.internal.InlineOnly\npublic actual inline fun ShortArray.asList(): List {\n return this.unsafeCast>().asList()\n}\n\n/**\n * Returns a [List] that wraps the original array.\n */\n@kotlin.internal.InlineOnly\npublic actual inline fun IntArray.asList(): List {\n return this.unsafeCast>().asList()\n}\n\n/**\n * Returns a [List] that wraps the original array.\n */\n@kotlin.internal.InlineOnly\npublic actual inline fun LongArray.asList(): List {\n return this.unsafeCast>().asList()\n}\n\n/**\n * Returns a [List] that wraps the original array.\n */\n@kotlin.internal.InlineOnly\npublic actual inline fun FloatArray.asList(): List {\n return this.unsafeCast>().asList()\n}\n\n/**\n * Returns a [List] that wraps the original array.\n */\n@kotlin.internal.InlineOnly\npublic actual inline fun DoubleArray.asList(): List {\n return this.unsafeCast>().asList()\n}\n\n/**\n * Returns a [List] that wraps the original array.\n */\n@kotlin.internal.InlineOnly\npublic actual inline fun BooleanArray.asList(): List {\n return this.unsafeCast>().asList()\n}\n\n/**\n * Returns a [List] that wraps the original array.\n */\npublic actual fun CharArray.asList(): List {\n return object : AbstractList(), RandomAccess {\n override val size: Int get() = this@asList.size\n override fun isEmpty(): Boolean = this@asList.isEmpty()\n override fun contains(element: Char): Boolean = this@asList.contains(element)\n override fun get(index: Int): Char {\n AbstractList.checkElementIndex(index, size)\n return this@asList[index]\n }\n override fun indexOf(element: Char): Int {\n @Suppress(\"USELESS_CAST\")\n if ((element as Any?) !is Char) return -1\n return this@asList.indexOf(element)\n }\n override fun lastIndexOf(element: Char): Int {\n @Suppress(\"USELESS_CAST\")\n if ((element as Any?) !is Char) return -1\n return this@asList.lastIndexOf(element)\n }\n }\n}\n\n/**\n * Returns `true` if the two specified arrays are *deeply* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * If two corresponding elements are nested arrays, they are also compared deeply.\n * If any of arrays contains itself on any nesting level the behavior is undefined.\n * \n * The elements of other types are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.LowPriorityInOverloadResolution\npublic actual infix fun Array.contentDeepEquals(other: Array): Boolean {\n return this.contentDeepEquals(other)\n}\n\n/**\n * Returns `true` if the two specified arrays are *deeply* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The specified arrays are also considered deeply equal if both are `null`.\n * \n * If two corresponding elements are nested arrays, they are also compared deeply.\n * If any of arrays contains itself on any nesting level the behavior is undefined.\n * \n * The elements of other types are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayDeepEquals\")\npublic actual infix fun Array?.contentDeepEquals(other: Array?): Boolean {\n definedExternally\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n * Nested arrays are treated as lists too.\n * \n * If any of arrays contains itself on any nesting level the behavior is undefined.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.LowPriorityInOverloadResolution\npublic actual fun Array.contentDeepHashCode(): Int {\n return this.contentDeepHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n * Nested arrays are treated as lists too.\n * \n * If any of arrays contains itself on any nesting level the behavior is undefined.\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayDeepHashCode\")\npublic actual fun Array?.contentDeepHashCode(): Int {\n definedExternally\n}\n\n/**\n * Returns a string representation of the contents of this array as if it is a [List].\n * Nested arrays are treated as lists too.\n * \n * If any of arrays contains itself on any nesting level that reference\n * is rendered as `\"[...]\"` to prevent recursion.\n * \n * @sample samples.collections.Arrays.ContentOperations.contentDeepToString\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.LowPriorityInOverloadResolution\npublic actual fun Array.contentDeepToString(): String {\n return this.contentDeepToString()\n}\n\n/**\n * Returns a string representation of the contents of this array as if it is a [List].\n * Nested arrays are treated as lists too.\n * \n * If any of arrays contains itself on any nesting level that reference\n * is rendered as `\"[...]\"` to prevent recursion.\n * \n * @sample samples.collections.Arrays.ContentOperations.contentDeepToString\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayDeepToString\")\npublic actual fun Array?.contentDeepToString(): String {\n definedExternally\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual infix fun Array.contentEquals(other: Array): Boolean {\n return this.contentEquals(other)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual infix fun ByteArray.contentEquals(other: ByteArray): Boolean {\n return this.contentEquals(other)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual infix fun ShortArray.contentEquals(other: ShortArray): Boolean {\n return this.contentEquals(other)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual infix fun IntArray.contentEquals(other: IntArray): Boolean {\n return this.contentEquals(other)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual infix fun LongArray.contentEquals(other: LongArray): Boolean {\n return this.contentEquals(other)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual infix fun FloatArray.contentEquals(other: FloatArray): Boolean {\n return this.contentEquals(other)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual infix fun DoubleArray.contentEquals(other: DoubleArray): Boolean {\n return this.contentEquals(other)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual infix fun BooleanArray.contentEquals(other: BooleanArray): Boolean {\n return this.contentEquals(other)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual infix fun CharArray.contentEquals(other: CharArray): Boolean {\n return this.contentEquals(other)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayEquals\")\npublic actual infix fun Array?.contentEquals(other: Array?): Boolean {\n definedExternally\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayEquals\")\npublic actual infix fun ByteArray?.contentEquals(other: ByteArray?): Boolean {\n definedExternally\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayEquals\")\npublic actual infix fun ShortArray?.contentEquals(other: ShortArray?): Boolean {\n definedExternally\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayEquals\")\npublic actual infix fun IntArray?.contentEquals(other: IntArray?): Boolean {\n definedExternally\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayEquals\")\npublic actual infix fun LongArray?.contentEquals(other: LongArray?): Boolean {\n definedExternally\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayEquals\")\npublic actual infix fun FloatArray?.contentEquals(other: FloatArray?): Boolean {\n definedExternally\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayEquals\")\npublic actual infix fun DoubleArray?.contentEquals(other: DoubleArray?): Boolean {\n definedExternally\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayEquals\")\npublic actual infix fun BooleanArray?.contentEquals(other: BooleanArray?): Boolean {\n definedExternally\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n * \n * The elements are compared for equality with the [equals][Any.equals] function.\n * For floating point numbers it means that `NaN` is equal to itself and `-0.0` is not equal to `0.0`.\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayEquals\")\npublic actual infix fun CharArray?.contentEquals(other: CharArray?): Boolean {\n definedExternally\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun Array.contentHashCode(): Int {\n return this.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun ByteArray.contentHashCode(): Int {\n return this.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun ShortArray.contentHashCode(): Int {\n return this.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun IntArray.contentHashCode(): Int {\n return this.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun LongArray.contentHashCode(): Int {\n return this.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun FloatArray.contentHashCode(): Int {\n return this.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun DoubleArray.contentHashCode(): Int {\n return this.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun BooleanArray.contentHashCode(): Int {\n return this.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun CharArray.contentHashCode(): Int {\n return this.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayHashCode\")\npublic actual fun Array?.contentHashCode(): Int {\n definedExternally\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayHashCode\")\npublic actual fun ByteArray?.contentHashCode(): Int {\n definedExternally\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayHashCode\")\npublic actual fun ShortArray?.contentHashCode(): Int {\n definedExternally\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayHashCode\")\npublic actual fun IntArray?.contentHashCode(): Int {\n definedExternally\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayHashCode\")\npublic actual fun LongArray?.contentHashCode(): Int {\n definedExternally\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayHashCode\")\npublic actual fun FloatArray?.contentHashCode(): Int {\n definedExternally\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayHashCode\")\npublic actual fun DoubleArray?.contentHashCode(): Int {\n definedExternally\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayHashCode\")\npublic actual fun BooleanArray?.contentHashCode(): Int {\n definedExternally\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayHashCode\")\npublic actual fun CharArray?.contentHashCode(): Int {\n definedExternally\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun Array.contentToString(): String {\n return this.contentToString()\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun ByteArray.contentToString(): String {\n return this.contentToString()\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun ShortArray.contentToString(): String {\n return this.contentToString()\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun IntArray.contentToString(): String {\n return this.contentToString()\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun LongArray.contentToString(): String {\n return this.contentToString()\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun FloatArray.contentToString(): String {\n return this.contentToString()\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun DoubleArray.contentToString(): String {\n return this.contentToString()\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun BooleanArray.contentToString(): String {\n return this.contentToString()\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.1\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\npublic actual fun CharArray.contentToString(): String {\n return this.contentToString()\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayToString\")\npublic actual fun Array?.contentToString(): String {\n definedExternally\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayToString\")\npublic actual fun ByteArray?.contentToString(): String {\n definedExternally\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayToString\")\npublic actual fun ShortArray?.contentToString(): String {\n definedExternally\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayToString\")\npublic actual fun IntArray?.contentToString(): String {\n definedExternally\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayToString\")\npublic actual fun LongArray?.contentToString(): String {\n definedExternally\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayToString\")\npublic actual fun FloatArray?.contentToString(): String {\n definedExternally\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayToString\")\npublic actual fun DoubleArray?.contentToString(): String {\n definedExternally\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayToString\")\npublic actual fun BooleanArray?.contentToString(): String {\n definedExternally\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\n@library(\"arrayToString\")\npublic actual fun CharArray?.contentToString(): String {\n definedExternally\n}\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual inline fun Array.copyInto(destination: Array, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): Array {\n arrayCopy(this, destination, destinationOffset, startIndex, endIndex)\n return destination\n}\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual inline fun ByteArray.copyInto(destination: ByteArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): ByteArray {\n arrayCopy(this.unsafeCast>(), destination.unsafeCast>(), destinationOffset, startIndex, endIndex)\n return destination\n}\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual inline fun ShortArray.copyInto(destination: ShortArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): ShortArray {\n arrayCopy(this.unsafeCast>(), destination.unsafeCast>(), destinationOffset, startIndex, endIndex)\n return destination\n}\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual inline fun IntArray.copyInto(destination: IntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): IntArray {\n arrayCopy(this.unsafeCast>(), destination.unsafeCast>(), destinationOffset, startIndex, endIndex)\n return destination\n}\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual inline fun LongArray.copyInto(destination: LongArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): LongArray {\n arrayCopy(this.unsafeCast>(), destination.unsafeCast>(), destinationOffset, startIndex, endIndex)\n return destination\n}\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual inline fun FloatArray.copyInto(destination: FloatArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): FloatArray {\n arrayCopy(this.unsafeCast>(), destination.unsafeCast>(), destinationOffset, startIndex, endIndex)\n return destination\n}\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual inline fun DoubleArray.copyInto(destination: DoubleArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): DoubleArray {\n arrayCopy(this.unsafeCast>(), destination.unsafeCast>(), destinationOffset, startIndex, endIndex)\n return destination\n}\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual inline fun BooleanArray.copyInto(destination: BooleanArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): BooleanArray {\n arrayCopy(this.unsafeCast>(), destination.unsafeCast>(), destinationOffset, startIndex, endIndex)\n return destination\n}\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual inline fun CharArray.copyInto(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): CharArray {\n arrayCopy(this.unsafeCast>(), destination.unsafeCast>(), destinationOffset, startIndex, endIndex)\n return destination\n}\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\n@Suppress(\"ACTUAL_WITHOUT_EXPECT\", \"NOTHING_TO_INLINE\")\npublic actual inline fun Array.copyOf(): Array {\n return this.asDynamic().slice()\n}\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline fun ByteArray.copyOf(): ByteArray {\n return this.asDynamic().slice()\n}\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline fun ShortArray.copyOf(): ShortArray {\n return this.asDynamic().slice()\n}\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline fun IntArray.copyOf(): IntArray {\n return this.asDynamic().slice()\n}\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\npublic actual fun LongArray.copyOf(): LongArray {\n return withType(\"LongArray\", this.asDynamic().slice())\n}\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline fun FloatArray.copyOf(): FloatArray {\n return this.asDynamic().slice()\n}\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline fun DoubleArray.copyOf(): DoubleArray {\n return this.asDynamic().slice()\n}\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\npublic actual fun BooleanArray.copyOf(): BooleanArray {\n return withType(\"BooleanArray\", this.asDynamic().slice())\n}\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\npublic actual fun CharArray.copyOf(): CharArray {\n return withType(\"CharArray\", this.asDynamic().slice())\n}\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic actual fun ByteArray.copyOf(newSize: Int): ByteArray {\n require(newSize >= 0) { \"Invalid new array size: $newSize.\" }\n return fillFrom(this, ByteArray(newSize))\n}\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic actual fun ShortArray.copyOf(newSize: Int): ShortArray {\n require(newSize >= 0) { \"Invalid new array size: $newSize.\" }\n return fillFrom(this, ShortArray(newSize))\n}\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic actual fun IntArray.copyOf(newSize: Int): IntArray {\n require(newSize >= 0) { \"Invalid new array size: $newSize.\" }\n return fillFrom(this, IntArray(newSize))\n}\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic actual fun LongArray.copyOf(newSize: Int): LongArray {\n require(newSize >= 0) { \"Invalid new array size: $newSize.\" }\n return withType(\"LongArray\", arrayCopyResize(this, newSize, 0L))\n}\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic actual fun FloatArray.copyOf(newSize: Int): FloatArray {\n require(newSize >= 0) { \"Invalid new array size: $newSize.\" }\n return fillFrom(this, FloatArray(newSize))\n}\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic actual fun DoubleArray.copyOf(newSize: Int): DoubleArray {\n require(newSize >= 0) { \"Invalid new array size: $newSize.\" }\n return fillFrom(this, DoubleArray(newSize))\n}\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with `false` values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with `false` values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic actual fun BooleanArray.copyOf(newSize: Int): BooleanArray {\n require(newSize >= 0) { \"Invalid new array size: $newSize.\" }\n return withType(\"BooleanArray\", arrayCopyResize(this, newSize, false))\n}\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with null char (`\\u0000`) values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with null char (`\\u0000`) values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizedPrimitiveCopyOf\n */\npublic actual fun CharArray.copyOf(newSize: Int): CharArray {\n require(newSize >= 0) { \"Invalid new array size: $newSize.\" }\n return withType(\"CharArray\", fillFrom(this, CharArray(newSize)))\n}\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with `null` values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with `null` values.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.resizingCopyOf\n */\n@Suppress(\"ACTUAL_WITHOUT_EXPECT\")\npublic actual fun Array.copyOf(newSize: Int): Array {\n require(newSize >= 0) { \"Invalid new array size: $newSize.\" }\n return arrayCopyResize(this, newSize, null)\n}\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@Suppress(\"ACTUAL_WITHOUT_EXPECT\")\npublic actual fun Array.copyOfRange(fromIndex: Int, toIndex: Int): Array {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n return this.asDynamic().slice(fromIndex, toIndex)\n}\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic actual fun ByteArray.copyOfRange(fromIndex: Int, toIndex: Int): ByteArray {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n return this.asDynamic().slice(fromIndex, toIndex)\n}\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic actual fun ShortArray.copyOfRange(fromIndex: Int, toIndex: Int): ShortArray {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n return this.asDynamic().slice(fromIndex, toIndex)\n}\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic actual fun IntArray.copyOfRange(fromIndex: Int, toIndex: Int): IntArray {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n return this.asDynamic().slice(fromIndex, toIndex)\n}\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic actual fun LongArray.copyOfRange(fromIndex: Int, toIndex: Int): LongArray {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n return withType(\"LongArray\", this.asDynamic().slice(fromIndex, toIndex))\n}\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic actual fun FloatArray.copyOfRange(fromIndex: Int, toIndex: Int): FloatArray {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n return this.asDynamic().slice(fromIndex, toIndex)\n}\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic actual fun DoubleArray.copyOfRange(fromIndex: Int, toIndex: Int): DoubleArray {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n return this.asDynamic().slice(fromIndex, toIndex)\n}\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic actual fun BooleanArray.copyOfRange(fromIndex: Int, toIndex: Int): BooleanArray {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n return withType(\"BooleanArray\", this.asDynamic().slice(fromIndex, toIndex))\n}\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\npublic actual fun CharArray.copyOfRange(fromIndex: Int, toIndex: Int): CharArray {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n return withType(\"CharArray\", this.asDynamic().slice(fromIndex, toIndex))\n}\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun Array.fill(element: T, fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n this.asDynamic().fill(element, fromIndex, toIndex);\n}\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun ByteArray.fill(element: Byte, fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n this.asDynamic().fill(element, fromIndex, toIndex);\n}\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun ShortArray.fill(element: Short, fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n this.asDynamic().fill(element, fromIndex, toIndex);\n}\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun IntArray.fill(element: Int, fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n this.asDynamic().fill(element, fromIndex, toIndex);\n}\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun LongArray.fill(element: Long, fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n this.asDynamic().fill(element, fromIndex, toIndex);\n}\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun FloatArray.fill(element: Float, fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n this.asDynamic().fill(element, fromIndex, toIndex);\n}\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun DoubleArray.fill(element: Double, fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n this.asDynamic().fill(element, fromIndex, toIndex);\n}\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun BooleanArray.fill(element: Boolean, fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n this.asDynamic().fill(element, fromIndex, toIndex);\n}\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun CharArray.fill(element: Char, fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n this.asDynamic().fill(element, fromIndex, toIndex);\n}\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@Suppress(\"ACTUAL_WITHOUT_EXPECT\", \"NOTHING_TO_INLINE\")\npublic actual inline operator fun Array.plus(element: T): Array {\n return this.asDynamic().concat(arrayOf(element))\n}\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun ByteArray.plus(element: Byte): ByteArray {\n return plus(byteArrayOf(element))\n}\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun ShortArray.plus(element: Short): ShortArray {\n return plus(shortArrayOf(element))\n}\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun IntArray.plus(element: Int): IntArray {\n return plus(intArrayOf(element))\n}\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun LongArray.plus(element: Long): LongArray {\n return plus(longArrayOf(element))\n}\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun FloatArray.plus(element: Float): FloatArray {\n return plus(floatArrayOf(element))\n}\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun DoubleArray.plus(element: Double): DoubleArray {\n return plus(doubleArrayOf(element))\n}\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun BooleanArray.plus(element: Boolean): BooleanArray {\n return plus(booleanArrayOf(element))\n}\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun CharArray.plus(element: Char): CharArray {\n return plus(charArrayOf(element))\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\n@Suppress(\"ACTUAL_WITHOUT_EXPECT\")\npublic actual operator fun Array.plus(elements: Collection): Array {\n return arrayPlusCollection(this, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic actual operator fun ByteArray.plus(elements: Collection): ByteArray {\n return fillFromCollection(this.copyOf(size + elements.size), this.size, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic actual operator fun ShortArray.plus(elements: Collection): ShortArray {\n return fillFromCollection(this.copyOf(size + elements.size), this.size, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic actual operator fun IntArray.plus(elements: Collection): IntArray {\n return fillFromCollection(this.copyOf(size + elements.size), this.size, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic actual operator fun LongArray.plus(elements: Collection): LongArray {\n return arrayPlusCollection(this, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic actual operator fun FloatArray.plus(elements: Collection): FloatArray {\n return fillFromCollection(this.copyOf(size + elements.size), this.size, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic actual operator fun DoubleArray.plus(elements: Collection): DoubleArray {\n return fillFromCollection(this.copyOf(size + elements.size), this.size, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic actual operator fun BooleanArray.plus(elements: Collection): BooleanArray {\n return arrayPlusCollection(this, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\npublic actual operator fun CharArray.plus(elements: Collection): CharArray {\n return fillFromCollection(this.copyOf(size + elements.size), this.size, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\n@Suppress(\"ACTUAL_WITHOUT_EXPECT\", \"NOTHING_TO_INLINE\")\npublic actual inline operator fun Array.plus(elements: Array): Array {\n return this.asDynamic().concat(elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun ByteArray.plus(elements: ByteArray): ByteArray {\n return primitiveArrayConcat(this, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun ShortArray.plus(elements: ShortArray): ShortArray {\n return primitiveArrayConcat(this, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun IntArray.plus(elements: IntArray): IntArray {\n return primitiveArrayConcat(this, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun LongArray.plus(elements: LongArray): LongArray {\n return primitiveArrayConcat(this, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun FloatArray.plus(elements: FloatArray): FloatArray {\n return primitiveArrayConcat(this, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun DoubleArray.plus(elements: DoubleArray): DoubleArray {\n return primitiveArrayConcat(this, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun BooleanArray.plus(elements: BooleanArray): BooleanArray {\n return primitiveArrayConcat(this, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline operator fun CharArray.plus(elements: CharArray): CharArray {\n return primitiveArrayConcat(this, elements)\n}\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@Suppress(\"ACTUAL_WITHOUT_EXPECT\", \"NOTHING_TO_INLINE\")\npublic actual inline fun Array.plusElement(element: T): Array {\n return this.asDynamic().concat(arrayOf(element))\n}\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\n@library(\"primitiveArraySort\")\npublic actual fun IntArray.sort(): Unit {\n definedExternally\n}\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\npublic actual fun LongArray.sort(): Unit {\n if (size > 1) sort { a: Long, b: Long -> a.compareTo(b) }\n}\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\n@library(\"primitiveArraySort\")\npublic actual fun ByteArray.sort(): Unit {\n definedExternally\n}\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\n@library(\"primitiveArraySort\")\npublic actual fun ShortArray.sort(): Unit {\n definedExternally\n}\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\n@library(\"primitiveArraySort\")\npublic actual fun DoubleArray.sort(): Unit {\n definedExternally\n}\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\n@library(\"primitiveArraySort\")\npublic actual fun FloatArray.sort(): Unit {\n definedExternally\n}\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\n@library(\"primitiveArraySort\")\npublic actual fun CharArray.sort(): Unit {\n definedExternally\n}\n\n/**\n * Sorts the array in-place according to the natural order of its elements.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n * \n * @sample samples.collections.Arrays.Sorting.sortArrayOfComparable\n */\npublic actual fun > Array.sort(): Unit {\n if (size > 1) sortArray(this)\n}\n\n/**\n * Sorts the array in-place according to the order specified by the given [comparison] function.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic fun Array.sort(comparison: (a: T, b: T) -> Int): Unit {\n if (size > 1) sortArrayWith(this, comparison)\n}\n\n/**\n * Sorts a range in the array in-place.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArrayOfComparable\n */\n@SinceKotlin(\"1.4\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun > Array.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n sortArrayWith(this, fromIndex, toIndex, naturalOrder())\n}\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun ByteArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val subarray = this.asDynamic().subarray(fromIndex, toIndex).unsafeCast()\n subarray.sort()\n}\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun ShortArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val subarray = this.asDynamic().subarray(fromIndex, toIndex).unsafeCast()\n subarray.sort()\n}\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun IntArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val subarray = this.asDynamic().subarray(fromIndex, toIndex).unsafeCast()\n subarray.sort()\n}\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun LongArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n sortArrayWith(this.unsafeCast>(), fromIndex, toIndex, naturalOrder())\n}\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun FloatArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val subarray = this.asDynamic().subarray(fromIndex, toIndex).unsafeCast()\n subarray.sort()\n}\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun DoubleArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val subarray = this.asDynamic().subarray(fromIndex, toIndex).unsafeCast()\n subarray.sort()\n}\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun CharArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n val subarray = this.asDynamic().subarray(fromIndex, toIndex).unsafeCast()\n subarray.sort()\n}\n\n/**\n * Sorts the array in-place according to the order specified by the given [comparison] function.\n */\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.sort(noinline comparison: (a: Byte, b: Byte) -> Int): Unit {\n asDynamic().sort(comparison)\n}\n\n/**\n * Sorts the array in-place according to the order specified by the given [comparison] function.\n */\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.sort(noinline comparison: (a: Short, b: Short) -> Int): Unit {\n asDynamic().sort(comparison)\n}\n\n/**\n * Sorts the array in-place according to the order specified by the given [comparison] function.\n */\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.sort(noinline comparison: (a: Int, b: Int) -> Int): Unit {\n asDynamic().sort(comparison)\n}\n\n/**\n * Sorts the array in-place according to the order specified by the given [comparison] function.\n */\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.sort(noinline comparison: (a: Long, b: Long) -> Int): Unit {\n asDynamic().sort(comparison)\n}\n\n/**\n * Sorts the array in-place according to the order specified by the given [comparison] function.\n */\n@kotlin.internal.InlineOnly\npublic inline fun FloatArray.sort(noinline comparison: (a: Float, b: Float) -> Int): Unit {\n asDynamic().sort(comparison)\n}\n\n/**\n * Sorts the array in-place according to the order specified by the given [comparison] function.\n */\n@kotlin.internal.InlineOnly\npublic inline fun DoubleArray.sort(noinline comparison: (a: Double, b: Double) -> Int): Unit {\n asDynamic().sort(comparison)\n}\n\n/**\n * Sorts the array in-place according to the order specified by the given [comparison] function.\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharArray.sort(noinline comparison: (a: Char, b: Char) -> Int): Unit {\n asDynamic().sort(comparison)\n}\n\n/**\n * Sorts the array in-place according to the order specified by the given [comparator].\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\npublic actual fun Array.sortWith(comparator: Comparator): Unit {\n if (size > 1) sortArrayWith(this, comparator)\n}\n\n/**\n * Sorts a range in the array in-place with the given [comparator].\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun Array.sortWith(comparator: Comparator, fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n sortArrayWith(this, fromIndex, toIndex, comparator)\n}\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic actual fun ByteArray.toTypedArray(): Array {\n return js(\"[]\").slice.call(this)\n}\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic actual fun ShortArray.toTypedArray(): Array {\n return js(\"[]\").slice.call(this)\n}\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic actual fun IntArray.toTypedArray(): Array {\n return js(\"[]\").slice.call(this)\n}\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic actual fun LongArray.toTypedArray(): Array {\n return js(\"[]\").slice.call(this)\n}\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic actual fun FloatArray.toTypedArray(): Array {\n return js(\"[]\").slice.call(this)\n}\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic actual fun DoubleArray.toTypedArray(): Array {\n return js(\"[]\").slice.call(this)\n}\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic actual fun BooleanArray.toTypedArray(): Array {\n return js(\"[]\").slice.call(this)\n}\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\npublic actual fun CharArray.toTypedArray(): Array {\n return Array(size) { index -> this[index] }\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.collections\n\n//\n// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt\n// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib\n//\n\nimport kotlin.js.*\nimport kotlin.ranges.contains\nimport kotlin.ranges.reversed\n\n/**\n * Reverses elements in the list in-place.\n */\npublic actual fun MutableList.reverse(): Unit {\n val midPoint = (size / 2) - 1\n if (midPoint < 0) return\n var reverseIndex = lastIndex\n for (index in 0..midPoint) {\n val tmp = this[index]\n this[index] = this[reverseIndex]\n this[reverseIndex] = tmp\n reverseIndex--\n }\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.collections\n\n/**\n * Provides a skeletal implementation of the [MutableCollection] interface.\n *\n * @param E the type of elements contained in the collection. The collection is invariant in its element type.\n */\npublic actual abstract class AbstractMutableCollection protected actual constructor() : AbstractCollection(), MutableCollection {\n\n actual abstract override fun add(element: E): Boolean\n\n actual override fun remove(element: E): Boolean {\n checkIsMutable()\n val iterator = iterator()\n while (iterator.hasNext()) {\n if (iterator.next() == element) {\n iterator.remove()\n return true\n }\n }\n return false\n }\n\n actual override fun addAll(elements: Collection): Boolean {\n checkIsMutable()\n var modified = false\n for (element in elements) {\n if (add(element)) modified = true\n }\n return modified\n }\n\n actual override fun removeAll(elements: Collection): Boolean {\n checkIsMutable()\n return (this as MutableIterable).removeAll { it in elements }\n }\n\n actual override fun retainAll(elements: Collection): Boolean {\n checkIsMutable()\n return (this as MutableIterable).removeAll { it !in elements }\n }\n\n actual override fun clear(): Unit {\n checkIsMutable()\n val iterator = this.iterator()\n while (iterator.hasNext()) {\n iterator.next()\n iterator.remove()\n }\n }\n\n @JsName(\"toJSON\")\n open fun toJSON(): Any = this.toArray()\n\n\n /**\n * This method is called every time when a mutating method is called on this mutable collection.\n * Mutable collections that are built (frozen) must throw `UnsupportedOperationException`.\n */\n internal open fun checkIsMutable(): Unit { }\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n/*\n * Based on GWT AbstractList\n * Copyright 2007 Google Inc.\n*/\n\n\npackage kotlin.collections\n\n/**\n * Provides a skeletal implementation of the [MutableList] interface.\n *\n * @param E the type of elements contained in the list. The list is invariant in its element type.\n */\npublic actual abstract class AbstractMutableList protected actual constructor() : AbstractMutableCollection(), MutableList {\n protected var modCount: Int = 0\n\n abstract override fun add(index: Int, element: E): Unit\n abstract override fun removeAt(index: Int): E\n abstract override fun set(index: Int, element: E): E\n\n /**\n * Adds the specified element to the end of this list.\n *\n * @return `true` because the list is always modified as the result of this operation.\n */\n actual override fun add(element: E): Boolean {\n checkIsMutable()\n add(size, element)\n return true\n }\n\n actual override fun addAll(index: Int, elements: Collection): Boolean {\n checkIsMutable()\n var _index = index\n var changed = false\n for (e in elements) {\n add(_index++, e)\n changed = true\n }\n return changed\n }\n\n actual override fun clear() {\n checkIsMutable()\n removeRange(0, size)\n }\n\n actual override fun removeAll(elements: Collection): Boolean {\n checkIsMutable()\n return removeAll { it in elements }\n }\n\n actual override fun retainAll(elements: Collection): Boolean {\n checkIsMutable()\n return removeAll { it !in elements }\n }\n\n\n actual override fun iterator(): MutableIterator = IteratorImpl()\n\n actual override fun contains(element: E): Boolean = indexOf(element) >= 0\n\n actual override fun indexOf(element: E): Int {\n for (index in 0..lastIndex) {\n if (get(index) == element) {\n return index\n }\n }\n return -1\n }\n\n actual override fun lastIndexOf(element: E): Int {\n for (index in lastIndex downTo 0) {\n if (get(index) == element) {\n return index\n }\n }\n return -1\n }\n\n actual override fun listIterator(): MutableListIterator = listIterator(0)\n actual override fun listIterator(index: Int): MutableListIterator = ListIteratorImpl(index)\n\n\n actual override fun subList(fromIndex: Int, toIndex: Int): MutableList = SubList(this, fromIndex, toIndex)\n\n /**\n * Removes the range of elements from this list starting from [fromIndex] and ending with but not including [toIndex].\n */\n protected open fun removeRange(fromIndex: Int, toIndex: Int) {\n val iterator = listIterator(fromIndex)\n repeat(toIndex - fromIndex) {\n iterator.next()\n iterator.remove()\n }\n }\n\n /**\n * Compares this list with another list instance with the ordered structural equality.\n *\n * @return true, if [other] instance is a [List] of the same size, which contains the same elements in the same order.\n */\n override fun equals(other: Any?): Boolean {\n if (other === this) return true\n if (other !is List<*>) return false\n\n return AbstractList.orderedEquals(this, other)\n }\n\n /**\n * Returns the hash code value for this list.\n */\n override fun hashCode(): Int = AbstractList.orderedHashCode(this)\n\n\n private open inner class IteratorImpl : MutableIterator {\n /** the index of the item that will be returned on the next call to [next]`()` */\n protected var index = 0\n /** the index of the item that was returned on the previous call to [next]`()`\n * or [ListIterator.previous]`()` (for `ListIterator`),\n * -1 if no such item exists\n */\n protected var last = -1\n\n override fun hasNext(): Boolean = index < size\n\n override fun next(): E {\n if (!hasNext()) throw NoSuchElementException()\n last = index++\n return get(last)\n }\n\n override fun remove() {\n check(last != -1) { \"Call next() or previous() before removing element from the iterator.\" }\n\n removeAt(last)\n index = last\n last = -1\n }\n }\n\n /**\n * Implementation of `MutableListIterator` for abstract lists.\n */\n private inner class ListIteratorImpl(index: Int) : IteratorImpl(), MutableListIterator {\n\n init {\n AbstractList.checkPositionIndex(index, this@AbstractMutableList.size)\n this.index = index\n }\n\n override fun hasPrevious(): Boolean = index > 0\n\n override fun nextIndex(): Int = index\n\n override fun previous(): E {\n if (!hasPrevious()) throw NoSuchElementException()\n\n last = --index\n return get(last)\n }\n\n override fun previousIndex(): Int = index - 1\n\n override fun add(element: E) {\n add(index, element)\n index++\n last = -1\n }\n\n override fun set(element: E) {\n check(last != -1) { \"Call next() or previous() before updating element value with the iterator.\" }\n set(last, element)\n }\n }\n\n private class SubList(private val list: AbstractMutableList, private val fromIndex: Int, toIndex: Int) : AbstractMutableList(), RandomAccess {\n private var _size: Int = 0\n\n init {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, list.size)\n this._size = toIndex - fromIndex\n }\n\n override fun add(index: Int, element: E) {\n AbstractList.checkPositionIndex(index, _size)\n\n list.add(fromIndex + index, element)\n _size++\n }\n\n override fun get(index: Int): E {\n AbstractList.checkElementIndex(index, _size)\n\n return list[fromIndex + index]\n }\n\n override fun removeAt(index: Int): E {\n AbstractList.checkElementIndex(index, _size)\n\n val result = list.removeAt(fromIndex + index)\n _size--\n return result\n }\n\n override fun set(index: Int, element: E): E {\n AbstractList.checkElementIndex(index, _size)\n\n return list.set(fromIndex + index, element)\n }\n\n override val size: Int get() = _size\n\n internal override fun checkIsMutable(): Unit = list.checkIsMutable()\n }\n\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n/*\n * Based on GWT AbstractMap\n * Copyright 2007 Google Inc.\n */\n\npackage kotlin.collections\n\n/**\n * Provides a skeletal implementation of the [MutableMap] interface.\n *\n * The implementor is required to implement [entries] property, which should return mutable set of map entries, and [put] function.\n *\n * @param K the type of map keys. The map is invariant in its key type.\n * @param V the type of map values. The map is invariant in its value type.\n */\npublic actual abstract class AbstractMutableMap protected actual constructor() : AbstractMap(), MutableMap {\n\n /**\n * A mutable [Map.Entry] shared by several [Map] implementations.\n */\n internal open class SimpleEntry(override val key: K, value: V) : MutableMap.MutableEntry {\n constructor(entry: Map.Entry) : this(entry.key, entry.value)\n\n private var _value = value\n\n override val value: V get() = _value\n\n override fun setValue(newValue: V): V {\n // Should check if the map containing this entry is mutable.\n // However, to not increase entry memory footprint it might be worthwhile not to check it here and\n // force subclasses that implement `build()` (freezing) operation to implement their own `MutableEntry`.\n// this@AbstractMutableMap.checkIsMutable()\n val oldValue = this._value\n this._value = newValue\n return oldValue\n }\n\n override fun hashCode(): Int = entryHashCode(this)\n override fun toString(): String = entryToString(this)\n override fun equals(other: Any?): Boolean = entryEquals(this, other)\n\n }\n\n // intermediate abstract class to workaround KT-43321\n internal abstract class AbstractEntrySet, K, V> : AbstractMutableSet() {\n final override fun contains(element: E): Boolean = containsEntry(element)\n abstract fun containsEntry(element: Map.Entry): Boolean\n }\n\n actual override fun clear() {\n entries.clear()\n }\n\n private var _keys: MutableSet? = null\n actual override val keys: MutableSet\n get() {\n if (_keys == null) {\n _keys = object : AbstractMutableSet() {\n override fun add(element: K): Boolean = throw UnsupportedOperationException(\"Add is not supported on keys\")\n override fun clear() {\n this@AbstractMutableMap.clear()\n }\n\n override operator fun contains(element: K): Boolean = containsKey(element)\n\n override operator fun iterator(): MutableIterator {\n val entryIterator = entries.iterator()\n return object : MutableIterator {\n override fun hasNext(): Boolean = entryIterator.hasNext()\n override fun next(): K = entryIterator.next().key\n override fun remove() = entryIterator.remove()\n }\n }\n\n override fun remove(element: K): Boolean {\n checkIsMutable()\n if (containsKey(element)) {\n this@AbstractMutableMap.remove(element)\n return true\n }\n return false\n }\n\n override val size: Int get() = this@AbstractMutableMap.size\n\n override fun checkIsMutable(): Unit = this@AbstractMutableMap.checkIsMutable()\n }\n }\n return _keys!!\n }\n\n actual abstract override fun put(key: K, value: V): V?\n\n actual override fun putAll(from: Map) {\n checkIsMutable()\n for ((key, value) in from) {\n put(key, value)\n }\n }\n\n private var _values: MutableCollection? = null\n actual override val values: MutableCollection\n get() {\n if (_values == null) {\n _values = object : AbstractMutableCollection() {\n override fun add(element: V): Boolean = throw UnsupportedOperationException(\"Add is not supported on values\")\n override fun clear() = this@AbstractMutableMap.clear()\n\n override operator fun contains(element: V): Boolean = containsValue(element)\n\n override operator fun iterator(): MutableIterator {\n val entryIterator = entries.iterator()\n return object : MutableIterator {\n override fun hasNext(): Boolean = entryIterator.hasNext()\n override fun next(): V = entryIterator.next().value\n override fun remove() = entryIterator.remove()\n }\n }\n\n override val size: Int get() = this@AbstractMutableMap.size\n\n // TODO: should we implement them this way? Currently it's unspecified in JVM\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (other !is Collection<*>) return false\n return AbstractList.orderedEquals(this, other)\n }\n\n override fun hashCode(): Int = AbstractList.orderedHashCode(this)\n\n override fun checkIsMutable(): Unit = this@AbstractMutableMap.checkIsMutable()\n }\n }\n return _values!!\n }\n\n actual override fun remove(key: K): V? {\n checkIsMutable()\n val iter = entries.iterator()\n while (iter.hasNext()) {\n val entry = iter.next()\n val k = entry.key\n if (key == k) {\n val value = entry.value\n iter.remove()\n return value\n }\n }\n return null\n }\n\n\n /**\n * This method is called every time when a mutating method is called on this mutable map.\n * Mutable maps that are built (frozen) must throw `UnsupportedOperationException`.\n */\n internal open fun checkIsMutable(): Unit {}\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\npackage kotlin.collections\n\n/**\n * Provides a skeletal implementation of the [MutableSet] interface.\n *\n * @param E the type of elements contained in the set. The set is invariant in its element type.\n */\npublic actual abstract class AbstractMutableSet protected actual constructor() : AbstractMutableCollection(), MutableSet {\n\n /**\n * Compares this set with another set instance with the unordered structural equality.\n *\n * @return `true`, if [other] instance is a [Set] of the same size, all elements of which are contained in this set.\n */\n override fun equals(other: Any?): Boolean {\n if (other === this) return true\n if (other !is Set<*>) return false\n return AbstractSet.setEquals(this, other)\n }\n\n /**\n * Returns the hash code value for this set.\n */\n override fun hashCode(): Int = AbstractSet.unorderedHashCode(this)\n\n}","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.collections\n\n/**\n * Provides a [MutableList] implementation, which uses a resizable array as its backing storage.\n *\n * This implementation doesn't provide a way to manage capacity, as backing JS array is resizeable itself.\n * There is no speed advantage to pre-allocating array sizes in JavaScript, so this implementation does not include any of the\n * capacity and \"growth increment\" concepts.\n */\npublic actual open class ArrayList internal constructor(private var array: Array) : AbstractMutableList(), MutableList, RandomAccess {\n private var isReadOnly: Boolean = false\n\n /**\n * Creates an empty [ArrayList].\n */\n public actual constructor() : this(emptyArray()) {}\n\n /**\n * Creates an empty [ArrayList].\n * @param initialCapacity initial capacity (ignored)\n */\n @Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\n public actual constructor(initialCapacity: Int = 0) : this(emptyArray()) {}\n\n /**\n * Creates an [ArrayList] filled from the [elements] collection.\n */\n public actual constructor(elements: Collection) : this(elements.toTypedArray()) {}\n\n @PublishedApi\n internal fun build(): List {\n checkIsMutable()\n isReadOnly = true\n return this\n }\n\n /** Does nothing in this ArrayList implementation. */\n public actual fun trimToSize() {}\n\n /** Does nothing in this ArrayList implementation. */\n public actual fun ensureCapacity(minCapacity: Int) {}\n\n actual override val size: Int get() = array.size\n @Suppress(\"UNCHECKED_CAST\")\n actual override fun get(index: Int): E = array[rangeCheck(index)] as E\n actual override fun set(index: Int, element: E): E {\n checkIsMutable()\n rangeCheck(index)\n @Suppress(\"UNCHECKED_CAST\")\n return array[index].apply { array[index] = element } as E\n }\n\n actual override fun add(element: E): Boolean {\n checkIsMutable()\n array.asDynamic().push(element)\n modCount++\n return true\n }\n\n actual override fun add(index: Int, element: E): Unit {\n checkIsMutable()\n array.asDynamic().splice(insertionRangeCheck(index), 0, element)\n modCount++\n }\n\n actual override fun addAll(elements: Collection): Boolean {\n checkIsMutable()\n if (elements.isEmpty()) return false\n\n array += elements.toTypedArray()\n modCount++\n return true\n }\n\n actual override fun addAll(index: Int, elements: Collection): Boolean {\n checkIsMutable()\n insertionRangeCheck(index)\n\n if (index == size) return addAll(elements)\n if (elements.isEmpty()) return false\n when (index) {\n size -> return addAll(elements)\n 0 -> array = elements.toTypedArray() + array\n else -> array = array.copyOfRange(0, index).asDynamic().concat(elements.toTypedArray(), array.copyOfRange(index, size))\n }\n\n modCount++\n return true\n }\n\n actual override fun removeAt(index: Int): E {\n checkIsMutable()\n rangeCheck(index)\n modCount++\n return if (index == lastIndex)\n array.asDynamic().pop()\n else\n array.asDynamic().splice(index, 1)[0]\n }\n\n actual override fun remove(element: E): Boolean {\n checkIsMutable()\n for (index in array.indices) {\n if (array[index] == element) {\n array.asDynamic().splice(index, 1)\n modCount++\n return true\n }\n }\n return false\n }\n\n override fun removeRange(fromIndex: Int, toIndex: Int) {\n checkIsMutable()\n modCount++\n array.asDynamic().splice(fromIndex, toIndex - fromIndex)\n }\n\n actual override fun clear() {\n checkIsMutable()\n array = emptyArray()\n modCount++\n }\n\n\n actual override fun indexOf(element: E): Int = array.indexOf(element)\n\n actual override fun lastIndexOf(element: E): Int = array.lastIndexOf(element)\n\n override fun toString() = arrayToString(array)\n override fun toArray(): Array = js(\"[]\").slice.call(array)\n\n\n internal override fun checkIsMutable() {\n if (isReadOnly) throw UnsupportedOperationException()\n }\n\n private fun rangeCheck(index: Int) = index.apply {\n AbstractList.checkElementIndex(index, size)\n }\n\n private fun insertionRangeCheck(index: Int) = index.apply {\n AbstractList.checkPositionIndex(index, size)\n }\n}","/*\n * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.collections\n\ninternal fun sortArrayWith(array: Array, comparison: (T, T) -> Int) {\n if (getStableSortingIsSupported()) {\n array.asDynamic().sort(comparison)\n } else {\n mergeSort(array.unsafeCast>(), 0, array.lastIndex, Comparator(comparison))\n }\n}\n\ninternal fun sortArrayWith(array: Array, comparator: Comparator) {\n if (getStableSortingIsSupported()) {\n val comparison = { a: T, b: T -> comparator.compare(a, b) }\n array.asDynamic().sort(comparison)\n } else {\n mergeSort(array.unsafeCast>(), 0, array.lastIndex, comparator)\n }\n}\n\ninternal fun sortArrayWith(array: Array, fromIndex: Int, toIndex: Int, comparator: Comparator) {\n if (fromIndex < toIndex - 1) {\n mergeSort(array.unsafeCast>(), fromIndex, toIndex - 1, comparator)\n }\n}\n\ninternal fun > sortArray(array: Array) {\n if (getStableSortingIsSupported()) {\n val comparison = { a: T, b: T -> a.compareTo(b) }\n array.asDynamic().sort(comparison)\n } else {\n mergeSort(array.unsafeCast>(), 0, array.lastIndex, naturalOrder())\n }\n}\n\nprivate var _stableSortingIsSupported: Boolean? = null\nprivate fun getStableSortingIsSupported(): Boolean {\n _stableSortingIsSupported?.let { return it }\n _stableSortingIsSupported = false\n\n val array = js(\"[]\").unsafeCast>()\n // known implementations may use stable sort for arrays of up to 512 elements\n // so we create slightly more elements to test stability\n for (index in 0 until 600) array.asDynamic().push(index)\n val comparison = { a: Int, b: Int -> (a and 3) - (b and 3) }\n array.asDynamic().sort(comparison)\n for (index in 1 until array.size) {\n val a = array[index - 1]\n val b = array[index]\n if ((a and 3) == (b and 3) && a >= b) return false\n }\n _stableSortingIsSupported = true\n return true\n}\n\n\nprivate fun mergeSort(array: Array, start: Int, endInclusive: Int, comparator: Comparator) {\n val buffer = arrayOfNulls(array.size).unsafeCast>()\n val result = mergeSort(array, buffer, start, endInclusive, comparator)\n if (result !== array) {\n for (i in start..endInclusive) array[i] = result[i]\n }\n}\n\n// Both start and end are inclusive indices.\nprivate fun mergeSort(array: Array, buffer: Array, start: Int, end: Int, comparator: Comparator): Array {\n if (start == end) {\n return array\n }\n\n val median = (start + end) / 2\n val left = mergeSort(array, buffer, start, median, comparator)\n val right = mergeSort(array, buffer, median + 1, end, comparator)\n\n val target = if (left === buffer) array else buffer\n\n // Merge.\n var leftIndex = start\n var rightIndex = median + 1\n for (i in start..end) {\n when {\n leftIndex <= median && rightIndex <= end -> {\n val leftValue = left[leftIndex]\n val rightValue = right[rightIndex]\n\n if (comparator.compare(leftValue, rightValue) <= 0) {\n target[i] = leftValue\n leftIndex++\n } else {\n target[i] = rightValue\n rightIndex++\n }\n }\n leftIndex <= median -> {\n target[i] = left[leftIndex]\n leftIndex++\n }\n else /* rightIndex <= end */ -> {\n target[i] = right[rightIndex]\n rightIndex++\n Unit // TODO: Fix KT-31506\n }\n }\n }\n\n return target\n}","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.collections\n\ninternal interface EqualityComparator {\n /**\n * Subclasses must override to return a value indicating\n * whether or not two keys or values are equal.\n */\n abstract fun equals(value1: Any?, value2: Any?): Boolean\n\n /**\n * Subclasses must override to return the hash code of a given key.\n */\n abstract fun getHashCode(value: Any?): Int\n\n\n object HashCode : EqualityComparator {\n override fun equals(value1: Any?, value2: Any?): Boolean = value1 == value2\n\n override fun getHashCode(value: Any?): Int = value?.hashCode() ?: 0\n }\n}","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin\n\n\npublic actual fun interface Comparator {\n @JsName(\"compare\")\n public actual fun compare(a: T, b: T): Int\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n/*\n * Based on GWT AbstractHashMap\n * Copyright 2008 Google Inc.\n */\n\npackage kotlin.collections\n\nimport kotlin.collections.MutableMap.MutableEntry\n\n/**\n * Hash table based implementation of the [MutableMap] interface.\n *\n * This implementation makes no guarantees regarding the order of enumeration of [keys], [values] and [entries] collections.\n */\n// Classes that extend HashMap and implement `build()` (freezing) operation\n// have to make sure mutating methods check `checkIsMutable`.\npublic actual open class HashMap : AbstractMutableMap, MutableMap {\n\n private inner class EntrySet : AbstractEntrySet, K, V>() {\n\n override fun add(element: MutableEntry): Boolean = throw UnsupportedOperationException(\"Add is not supported on entries\")\n override fun clear() {\n this@HashMap.clear()\n }\n\n override fun containsEntry(element: Map.Entry): Boolean = this@HashMap.containsEntry(element)\n\n override operator fun iterator(): MutableIterator> = internalMap.iterator()\n\n override fun remove(element: MutableEntry): Boolean {\n if (contains(element)) {\n this@HashMap.remove(element.key)\n return true\n }\n return false\n }\n\n override val size: Int get() = this@HashMap.size\n }\n\n\n /**\n * Internal implementation of the map: either string-based or hashcode-based.\n */\n private val internalMap: InternalMap\n\n private val equality: EqualityComparator\n\n internal constructor(internalMap: InternalMap) : super() {\n this.internalMap = internalMap\n this.equality = internalMap.equality\n }\n\n /**\n * Constructs an empty [HashMap] instance.\n */\n actual constructor() : this(InternalHashCodeMap(EqualityComparator.HashCode))\n\n /**\n * Constructs an empty [HashMap] instance.\n *\n * @param initialCapacity the initial capacity (ignored)\n * @param loadFactor the load factor (ignored)\n *\n * @throws IllegalArgumentException if the initial capacity or load factor are negative\n */\n @Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\n actual constructor(initialCapacity: Int, loadFactor: Float = 0.0f) : this() {\n // This implementation of HashMap has no need of load factors or capacities.\n require(initialCapacity >= 0) { \"Negative initial capacity: $initialCapacity\" }\n require(loadFactor >= 0) { \"Non-positive load factor: $loadFactor\" }\n }\n\n actual constructor(initialCapacity: Int) : this(initialCapacity, 0.0f)\n\n\n /**\n * Constructs an instance of [HashMap] filled with the contents of the specified [original] map.\n */\n actual constructor(original: Map) : this() {\n this.putAll(original)\n }\n\n actual override fun clear() {\n internalMap.clear()\n// structureChanged(this)\n }\n\n actual override fun containsKey(key: K): Boolean = internalMap.contains(key)\n\n actual override fun containsValue(value: V): Boolean = internalMap.any { equality.equals(it.value, value) }\n\n private var _entries: MutableSet>? = null\n actual override val entries: MutableSet>\n get() {\n if (_entries == null) {\n _entries = createEntrySet()\n }\n return _entries!!\n }\n\n protected open fun createEntrySet(): MutableSet> = EntrySet()\n\n actual override operator fun get(key: K): V? = internalMap.get(key)\n\n actual override fun put(key: K, value: V): V? = internalMap.put(key, value)\n\n actual override fun remove(key: K): V? = internalMap.remove(key)\n\n actual override val size: Int get() = internalMap.size\n\n}\n\n/**\n * Constructs the specialized implementation of [HashMap] with [String] keys, which stores the keys as properties of\n * JS object without hashing them.\n */\npublic fun stringMapOf(vararg pairs: Pair): HashMap {\n return HashMap(InternalStringMap(EqualityComparator.HashCode)).apply { putAll(pairs) }\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n/*\n * Based on GWT HashSet\n * Copyright 2008 Google Inc.\n */\n\npackage kotlin.collections\n\n/**\n * The implementation of the [MutableSet] interface, backed by a [HashMap] instance.\n */\n// Classes that extend HashSet and implement `build()` (freezing) operation\n// have to make sure mutating methods check `checkIsMutable`.\npublic actual open class HashSet : AbstractMutableSet, MutableSet {\n\n internal val map: HashMap\n\n /**\n * Constructs a new empty [HashSet].\n */\n actual constructor() {\n map = HashMap()\n }\n\n /**\n * Constructs a new [HashSet] filled with the elements of the specified collection.\n */\n actual constructor(elements: Collection) {\n map = HashMap(elements.size)\n addAll(elements)\n }\n\n /**\n * Constructs a new empty [HashSet].\n *\n * @param initialCapacity the initial capacity (ignored)\n * @param loadFactor the load factor (ignored)\n *\n * @throws IllegalArgumentException if the initial capacity or load factor are negative\n */\n @Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\n actual constructor(initialCapacity: Int, loadFactor: Float = 0.0f) {\n map = HashMap(initialCapacity, loadFactor)\n }\n\n actual constructor(initialCapacity: Int) : this(initialCapacity, 0.0f)\n\n /**\n * Protected constructor to specify the underlying map. This is used by\n * LinkedHashSet.\n\n * @param map underlying map to use.\n */\n internal constructor(map: HashMap) {\n this.map = map\n }\n\n actual override fun add(element: E): Boolean {\n val old = map.put(element, this)\n return old == null\n }\n\n actual override fun clear() {\n map.clear()\n }\n\n// public override fun clone(): Any {\n// return HashSet(this)\n// }\n\n actual override operator fun contains(element: E): Boolean = map.containsKey(element)\n\n actual override fun isEmpty(): Boolean = map.isEmpty()\n\n actual override fun iterator(): MutableIterator = map.keys.iterator()\n\n actual override fun remove(element: E): Boolean = map.remove(element) != null\n\n actual override val size: Int get() = map.size\n\n}\n\n/**\n * Creates a new instance of the specialized implementation of [HashSet] with the specified [String] elements,\n * which elements the keys as properties of JS object without hashing them.\n */\npublic fun stringSetOf(vararg elements: String): HashSet {\n return HashSet(stringMapOf()).apply { addAll(elements) }\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n/*\n * Based on GWT InternalHashCodeMap\n * Copyright 2008 Google Inc.\n */\n\npackage kotlin.collections\n\nimport kotlin.collections.MutableMap.MutableEntry\nimport kotlin.collections.AbstractMutableMap.SimpleEntry\n\n/**\n * A simple wrapper around JavaScriptObject to provide [java.util.Map]-like semantics for any\n * key type.\n *\n *\n * Implementation notes:\n *\n *\n * A key's hashCode is the index in backingMap which should contain that key. Since several keys may\n * have the same hash, each value in hashCodeMap is actually an array containing all entries whose\n * keys share the same hash.\n */\ninternal class InternalHashCodeMap(override val equality: EqualityComparator) : InternalMap {\n\n private var backingMap: dynamic = createJsMap()\n override var size: Int = 0\n private set\n\n override fun put(key: K, value: V): V? {\n val hashCode = equality.getHashCode(key)\n val chainOrEntry = getChainOrEntryOrNull(hashCode)\n if (chainOrEntry == null) {\n // This is a new chain, put it to the map.\n backingMap[hashCode] = SimpleEntry(key, value)\n } else {\n if (chainOrEntry !is Array<*>) {\n // It is an entry\n val entry: SimpleEntry = chainOrEntry\n if (equality.equals(entry.key, key)) {\n return entry.setValue(value)\n } else {\n backingMap[hashCode] = arrayOf(entry, SimpleEntry(key, value))\n size++\n return null\n }\n } else {\n // Chain already exists, perhaps key also exists.\n val chain: Array> = chainOrEntry\n val entry = chain.findEntryInChain(key)\n if (entry != null) {\n return entry.setValue(value)\n }\n chain.asDynamic().push(SimpleEntry(key, value))\n }\n }\n size++\n// structureChanged(host)\n return null\n }\n\n override fun remove(key: K): V? {\n val hashCode = equality.getHashCode(key)\n val chainOrEntry = getChainOrEntryOrNull(hashCode) ?: return null\n if (chainOrEntry !is Array<*>) {\n val entry: MutableEntry = chainOrEntry\n if (equality.equals(entry.key, key)) {\n jsDeleteProperty(backingMap, hashCode)\n size--\n return entry.value\n } else {\n return null\n }\n } else {\n val chain: Array> = chainOrEntry\n for (index in chain.indices) {\n val entry = chain[index]\n if (equality.equals(key, entry.key)) {\n if (chain.size == 1) {\n chain.asDynamic().length = 0\n // remove the whole array\n jsDeleteProperty(backingMap, hashCode)\n } else {\n // splice out the entry we're removing\n chain.asDynamic().splice(index, 1)\n }\n size--\n// structureChanged(host)\n return entry.value\n }\n }\n }\n return null\n }\n\n override fun clear() {\n backingMap = createJsMap()\n size = 0\n }\n\n override fun contains(key: K): Boolean = getEntry(key) != null\n\n override fun get(key: K): V? = getEntry(key)?.value\n\n private fun getEntry(key: K): MutableEntry? {\n val chainOrEntry = getChainOrEntryOrNull(equality.getHashCode(key)) ?: return null\n if (chainOrEntry !is Array<*>) {\n val entry: MutableEntry = chainOrEntry\n if (equality.equals(entry.key, key)) {\n return entry\n } else {\n return null\n }\n } else {\n val chain: Array> = chainOrEntry\n return chain.findEntryInChain(key)\n }\n }\n\n private fun Array>.findEntryInChain(key: K): MutableEntry? =\n firstOrNull { entry -> equality.equals(entry.key, key) }\n\n override fun iterator(): MutableIterator> {\n\n return object : MutableIterator> {\n var state = -1 // -1 not ready, 0 - ready, 1 - done\n\n val keys: Array = js(\"Object\").keys(backingMap)\n var keyIndex = -1\n\n var chainOrEntry: dynamic = null\n var isChain = false\n var itemIndex = -1\n var lastEntry: MutableEntry? = null\n\n private fun computeNext(): Int {\n if (chainOrEntry != null && isChain) {\n val chainSize: Int = chainOrEntry.unsafeCast>>().size\n if (++itemIndex < chainSize)\n return 0\n }\n\n if (++keyIndex < keys.size) {\n chainOrEntry = backingMap[keys[keyIndex]]\n isChain = chainOrEntry is Array<*>\n itemIndex = 0\n return 0\n } else {\n chainOrEntry = null\n return 1\n }\n }\n\n override fun hasNext(): Boolean {\n if (state == -1)\n state = computeNext()\n return state == 0\n }\n\n override fun next(): MutableEntry {\n if (!hasNext()) throw NoSuchElementException()\n val lastEntry = if (isChain) {\n chainOrEntry.unsafeCast>>()[itemIndex]\n } else {\n chainOrEntry.unsafeCast>()\n }\n this.lastEntry = lastEntry\n state = -1\n return lastEntry\n }\n\n override fun remove() {\n checkNotNull(lastEntry)\n this@InternalHashCodeMap.remove(lastEntry!!.key)\n lastEntry = null\n // the chain being iterated just got modified by InternalHashCodeMap.remove\n itemIndex--\n }\n }\n }\n\n private fun getChainOrEntryOrNull(hashCode: Int): dynamic {\n val chainOrEntry = backingMap[hashCode]\n return if (chainOrEntry === undefined) null else chainOrEntry\n }\n\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n/*\n * Based on GWT InternalStringMap\n * Copyright 2008 Google Inc.\n */\npackage kotlin.collections\n\nimport kotlin.collections.MutableMap.MutableEntry\n\n/**\n * A simple wrapper around JavaScript Map for key type is string.\n *\n * Though this map is instantiated only with K=String, the K type is not fixed to String statically,\n * because we want to have it erased to Any? in order not to generate type-safe override bridges for\n * [get], [contains], [remove] etc, if they ever are generated.\n */\ninternal class InternalStringMap(override val equality: EqualityComparator) : InternalMap {\n\n private var backingMap: dynamic = createJsMap()\n override var size: Int = 0\n private set\n\n// /**\n// * A mod count to track 'value' replacements in map to ensure that the 'value' that we have in the\n// * iterator entry is guaranteed to be still correct.\n// * This is to optimize for the common scenario where the values are not modified during\n// * iterations where the entries are never stale.\n// */\n// private var valueMod: Int = 0\n\n override operator fun contains(key: K): Boolean {\n if (key !is String) return false\n return backingMap[key] !== undefined\n }\n\n override operator fun get(key: K): V? {\n if (key !is String) return null\n val value = backingMap[key]\n return if (value !== undefined) value.unsafeCast() else null\n }\n\n\n override fun put(key: K, value: V): V? {\n require(key is String)\n val oldValue = backingMap[key]\n backingMap[key] = value\n\n if (oldValue === undefined) {\n size++\n// structureChanged(host)\n return null\n } else {\n// valueMod++\n return oldValue.unsafeCast()\n }\n }\n\n override fun remove(key: K): V? {\n if (key !is String) return null\n val value = backingMap[key]\n if (value !== undefined) {\n jsDeleteProperty(backingMap, key)\n size--\n// structureChanged(host)\n return value.unsafeCast()\n } else {\n// valueMod++\n return null\n }\n }\n\n\n override fun clear() {\n backingMap = createJsMap()\n size = 0\n }\n\n\n override fun iterator(): MutableIterator> {\n return object : MutableIterator> {\n private val keys: Array = js(\"Object\").keys(backingMap)\n private val iterator = keys.iterator()\n private var lastKey: String? = null\n\n override fun hasNext(): Boolean = iterator.hasNext()\n\n override fun next(): MutableEntry {\n val key = iterator.next()\n lastKey = key\n @Suppress(\"UNCHECKED_CAST\")\n return newMapEntry(key as K)\n }\n\n override fun remove() {\n @Suppress(\"UNCHECKED_CAST\")\n this@InternalStringMap.remove(checkNotNull(lastKey) as K)\n }\n }\n }\n\n private fun newMapEntry(key: K): MutableEntry = object : MutableEntry {\n override val key: K get() = key\n override val value: V get() = this@InternalStringMap[key].unsafeCast()\n\n override fun setValue(newValue: V): V = this@InternalStringMap.put(key, newValue).unsafeCast()\n\n override fun hashCode(): Int = AbstractMap.entryHashCode(this)\n override fun toString(): String = AbstractMap.entryToString(this)\n override fun equals(other: Any?): Boolean = AbstractMap.entryEquals(this, other)\n }\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n/*\n * Based on GWT LinkedHashMap\n * Copyright 2008 Google Inc.\n */\npackage kotlin.collections\n\nimport kotlin.collections.MutableMap.MutableEntry\n\n/**\n * Hash table based implementation of the [MutableMap] interface, which additionally preserves the insertion order\n * of entries during the iteration.\n *\n * The insertion order is preserved by maintaining a doubly-linked list of all of its entries.\n */\npublic actual open class LinkedHashMap : HashMap, MutableMap {\n\n /**\n * The entry we use includes next/prev pointers for a doubly-linked circular\n * list with a head node. This reduces the special cases we have to deal with\n * in the list operations.\n\n * Note that we duplicate the key from the underlying hash map so we can find\n * the eldest entry. The alternative would have been to modify HashMap so more\n * of the code was directly usable here, but this would have added some\n * overhead to HashMap, or to reimplement most of the HashMap code here with\n * small modifications. Paying a small storage cost only if you use\n * LinkedHashMap and minimizing code size seemed like a better tradeoff\n */\n private inner class ChainEntry(key: K, value: V) : AbstractMutableMap.SimpleEntry(key, value) {\n internal var next: ChainEntry? = null\n internal var prev: ChainEntry? = null\n\n override fun setValue(newValue: V): V {\n this@LinkedHashMap.checkIsMutable()\n return super.setValue(newValue)\n }\n }\n\n private inner class EntrySet : AbstractEntrySet, K, V>() {\n\n private inner class EntryIterator : MutableIterator> {\n // The last entry that was returned from this iterator.\n private var last: ChainEntry? = null\n\n // The next entry to return from this iterator.\n private var next: ChainEntry? = null\n\n init {\n next = head\n// recordLastKnownStructure(map, this)\n }\n\n override fun hasNext(): Boolean {\n return next !== null\n }\n\n override fun next(): MutableEntry {\n// checkStructuralChange(map, this)\n if (!hasNext()) throw NoSuchElementException()\n\n val current = next!!\n last = current\n next = current.next.takeIf { it !== head }\n return current\n }\n\n override fun remove() {\n check(last != null)\n this@EntrySet.checkIsMutable()\n// checkStructuralChange(map, this)\n\n last!!.remove()\n map.remove(last!!.key)\n// recordLastKnownStructure(map, this)\n last = null\n }\n }\n\n override fun add(element: MutableEntry): Boolean = throw UnsupportedOperationException(\"Add is not supported on entries\")\n override fun clear() {\n this@LinkedHashMap.clear()\n }\n\n override fun containsEntry(element: Map.Entry): Boolean = this@LinkedHashMap.containsEntry(element)\n\n override operator fun iterator(): MutableIterator> = EntryIterator()\n\n override fun remove(element: MutableEntry): Boolean {\n checkIsMutable()\n if (contains(element)) {\n this@LinkedHashMap.remove(element.key)\n return true\n }\n return false\n }\n\n override val size: Int get() = this@LinkedHashMap.size\n\n override fun checkIsMutable(): Unit = this@LinkedHashMap.checkIsMutable()\n }\n\n\n /*\n * The head of the insert order chain, which is a doubly-linked circular\n * list.\n *\n * The most recently inserted node is at the end of the chain, ie.\n * chain.prev.\n */\n private var head: ChainEntry? = null\n\n /**\n * Add this node to the end of the chain.\n */\n private fun ChainEntry.addToEnd() {\n // This entry is not in the list.\n check(next == null && prev == null)\n\n val _head = head\n if (_head == null) {\n head = this\n next = this\n prev = this\n } else {\n // Chain is valid.\n val _tail = checkNotNull(_head.prev)\n // Update me.\n prev = _tail\n next = _head\n // Update my new siblings: current head and old tail\n _head.prev = this\n _tail.next = this\n }\n }\n\n /**\n * Remove this node from the chain it is a part of.\n */\n private fun ChainEntry.remove() {\n if (this.next === this) {\n // if this is single element, remove head\n head = null\n } else {\n if (head === this) {\n // if this is first element, move head to next\n head = next\n }\n next!!.prev = prev\n prev!!.next = next\n }\n next = null\n prev = null\n }\n\n /*\n * The hashmap that keeps track of our entries and the chain. Note that we\n * duplicate the key here to eliminate changes to HashMap and minimize the\n * code here, at the expense of additional space.\n */\n private val map: HashMap>\n\n private var isReadOnly: Boolean = false\n\n /**\n * Constructs an empty [LinkedHashMap] instance.\n */\n actual constructor() : super() {\n map = HashMap>()\n }\n\n internal constructor(backingMap: HashMap) : super() {\n @Suppress(\"UNCHECKED_CAST\") // expected to work due to erasure\n map = backingMap as HashMap>\n }\n\n /**\n * Constructs an empty [LinkedHashMap] instance.\n *\n * @param initialCapacity the initial capacity (ignored)\n * @param loadFactor the load factor (ignored)\n *\n * @throws IllegalArgumentException if the initial capacity or load factor are negative\n */\n @Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\n actual constructor(initialCapacity: Int, loadFactor: Float = 0.0f) : super(initialCapacity, loadFactor) {\n map = HashMap>()\n }\n\n actual constructor(initialCapacity: Int) : this(initialCapacity, 0.0f)\n\n /**\n * Constructs an instance of [LinkedHashMap] filled with the contents of the specified [original] map.\n */\n actual constructor(original: Map) {\n map = HashMap>()\n this.putAll(original)\n }\n\n @PublishedApi\n internal fun build(): Map {\n checkIsMutable()\n isReadOnly = true\n return this\n }\n\n actual override fun clear() {\n checkIsMutable()\n map.clear()\n head = null\n }\n\n\n// override fun clone(): Any {\n// return LinkedHashMap(this)\n// }\n\n\n actual override fun containsKey(key: K): Boolean = map.containsKey(key)\n\n actual override fun containsValue(value: V): Boolean {\n var node: ChainEntry = head ?: return false\n do {\n if (node.value == value) {\n return true\n }\n node = node.next!!\n } while (node !== head)\n return false\n }\n\n\n override fun createEntrySet(): MutableSet> = EntrySet()\n\n actual override operator fun get(key: K): V? = map.get(key)?.value\n\n actual override fun put(key: K, value: V): V? {\n checkIsMutable()\n\n val old = map.get(key)\n if (old == null) {\n val newEntry = ChainEntry(key, value)\n map.put(key, newEntry)\n newEntry.addToEnd()\n return null\n } else {\n return old.setValue(value)\n }\n }\n\n actual override fun remove(key: K): V? {\n checkIsMutable()\n\n val entry = map.remove(key)\n if (entry != null) {\n entry.remove()\n return entry.value\n }\n return null\n }\n\n actual override val size: Int get() = map.size\n\n internal override fun checkIsMutable() {\n if (isReadOnly) throw UnsupportedOperationException()\n }\n}\n\n/**\n * Constructs the specialized implementation of [LinkedHashMap] with [String] keys, which stores the keys as properties of\n * JS object without hashing them.\n */\npublic fun linkedStringMapOf(vararg pairs: Pair): LinkedHashMap {\n return LinkedHashMap(stringMapOf()).apply { putAll(pairs) }\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n/*\n * Based on GWT LinkedHashSet\n * Copyright 2008 Google Inc.\n */\n\npackage kotlin.collections\n\n/**\n * The implementation of the [MutableSet] interface, backed by a [LinkedHashMap] instance.\n *\n * This implementation preserves the insertion order of elements during the iteration.\n */\npublic actual open class LinkedHashSet : HashSet, MutableSet {\n\n internal constructor(map: LinkedHashMap) : super(map)\n\n /**\n * Constructs a new empty [LinkedHashSet].\n */\n actual constructor() : super(LinkedHashMap())\n\n /**\n * Constructs a new [LinkedHashSet] filled with the elements of the specified collection.\n */\n actual constructor(elements: Collection) : super(LinkedHashMap()) {\n addAll(elements)\n }\n\n /**\n * Constructs a new empty [LinkedHashSet].\n *\n * @param initialCapacity the initial capacity (ignored)\n * @param loadFactor the load factor (ignored)\n *\n * @throws IllegalArgumentException if the initial capacity or load factor are negative\n */\n @Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\n actual constructor(initialCapacity: Int, loadFactor: Float = 0.0f) : super(LinkedHashMap(initialCapacity, loadFactor))\n\n actual constructor(initialCapacity: Int) : this(initialCapacity, 0.0f)\n\n @PublishedApi\n internal fun build(): Set {\n (map as LinkedHashMap).build()\n return this\n }\n\n internal override fun checkIsMutable(): Unit = map.checkIsMutable()\n\n// public override fun clone(): Any {\n// return LinkedHashSet(this)\n// }\n\n}\n\n/**\n * Creates a new instance of the specialized implementation of [LinkedHashSet] with the specified [String] elements,\n * which elements the keys as properties of JS object without hashing them.\n */\npublic fun linkedStringSetOf(vararg elements: String): LinkedHashSet {\n return LinkedHashSet(linkedStringMapOf()).apply { addAll(elements) }\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.io\n\ninternal abstract class BaseOutput {\n open fun println() {\n print(\"\\n\")\n }\n\n open fun println(message: Any?) {\n print(message)\n println()\n }\n\n abstract fun print(message: Any?)\n\n open fun flush() {}\n}\n\n/** JsName used to make the declaration available outside of module to test it */\n@JsName(\"NodeJsOutput\")\ninternal class NodeJsOutput(val outputStream: dynamic) : BaseOutput() {\n override fun print(message: Any?) {\n // TODO: Using local variable because of bug in block decomposition lowering in IR backend\n val messageString = String(message)\n outputStream.write(messageString)\n }\n}\n\n/** JsName used to make the declaration available outside of module to test it */\n@JsName(\"OutputToConsoleLog\")\ninternal class OutputToConsoleLog : BaseOutput() {\n override fun print(message: Any?) {\n console.log(message)\n }\n\n override fun println(message: Any?) {\n console.log(message)\n }\n\n override fun println() {\n console.log(\"\")\n }\n}\n\n/** JsName used to make the declaration available outside of module to test it and use at try.kotl.in */\n@JsName(\"BufferedOutput\")\ninternal open class BufferedOutput : BaseOutput() {\n var buffer = \"\"\n\n override fun print(message: Any?) {\n buffer += String(message)\n }\n\n override fun flush() {\n buffer = \"\"\n }\n}\n\n/** JsName used to make the declaration available outside of module to test it */\n@JsName(\"BufferedOutputToConsoleLog\")\ninternal class BufferedOutputToConsoleLog : BufferedOutput() {\n override fun print(message: Any?) {\n var s = String(message)\n val i = s.nativeLastIndexOf(\"\\n\", 0)\n if (i >= 0) {\n buffer += s.substring(0, i)\n flush()\n s = s.substring(i + 1)\n }\n buffer += s\n }\n\n override fun flush() {\n console.log(buffer)\n buffer = \"\"\n }\n}\n\n/** JsName used to make the declaration available outside of module to test it and use at try.kotl.in */\n@JsName(\"output\")\ninternal var output = run {\n val isNode: Boolean = js(\"typeof process !== 'undefined' && process.versions && !!process.versions.node\")\n if (isNode) NodeJsOutput(js(\"process.stdout\")) else BufferedOutputToConsoleLog()\n}\n\n@kotlin.internal.InlineOnly\nprivate inline fun String(value: Any?): String = js(\"String\")(value)\n\n/** Prints the line separator to the standard output stream. */\npublic actual fun println() {\n output.println()\n}\n\n/** Prints the given [message] and the line separator to the standard output stream. */\npublic actual fun println(message: Any?) {\n output.println(message)\n}\n\n/** Prints the given [message] to the standard output stream. */\npublic actual fun print(message: Any?) {\n output.print(message)\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.coroutines\n\nimport kotlin.coroutines.intrinsics.CoroutineSingletons.*\nimport kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\ninternal actual class SafeContinuation\ninternal actual constructor(\n private val delegate: Continuation,\n initialResult: Any?\n) : Continuation {\n @PublishedApi\n internal actual constructor(delegate: Continuation) : this(delegate, UNDECIDED)\n\n public actual override val context: CoroutineContext\n get() = delegate.context\n\n private var result: Any? = initialResult\n\n public actual override fun resumeWith(result: Result) {\n val cur = this.result\n when {\n cur === UNDECIDED -> {\n this.result = result.value\n }\n cur === COROUTINE_SUSPENDED -> {\n this.result = RESUMED\n delegate.resumeWith(result)\n }\n else -> throw IllegalStateException(\"Already resumed\")\n }\n }\n\n @PublishedApi\n internal actual fun getOrThrow(): Any? {\n if (result === UNDECIDED) {\n result = COROUTINE_SUSPENDED\n return COROUTINE_SUSPENDED\n }\n val result = this.result\n return when {\n result === RESUMED -> COROUTINE_SUSPENDED // already called continuation, indicate COROUTINE_SUSPENDED upstream\n result is Result.Failure -> throw result.exception\n else -> result // either COROUTINE_SUSPENDED or data\n }\n }\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// a package is omitted to get declarations directly under the module\n\n@JsName(\"throwNPE\")\ninternal fun throwNPE(message: String) {\n throw NullPointerException(message)\n}\n\n@JsName(\"throwCCE\")\ninternal fun throwCCE() {\n throw ClassCastException(\"Illegal cast\")\n}\n\n@JsName(\"throwISE\")\ninternal fun throwISE(message: String) {\n throw IllegalStateException(message)\n}\n\n@JsName(\"throwUPAE\")\ninternal fun throwUPAE(propertyName: String) {\n throw UninitializedPropertyAccessException(\"lateinit property ${propertyName} has not been initialized\")\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.js\n\n/**\n * An interface for indexing access to a collection of key-value pairs, where type of key is [String] and type of value is [Any?][Any].\n */\npublic external interface Json {\n /**\n * Calls to the function will be translated to indexing operation (square brackets) on the receiver with [propertyName] as the argument.\n *\n * E.g. for next code:\n * ```kotlin\n * fun test(j: Json, p: String) = j[\"prop\"] + j.get(p)\n * ```\n *\n * will be generated:\n * ```js\n * function test(j, p) {\n * return j[\"prop\"] + j[p];\n * }\n * ```\n */\n operator fun get(propertyName: String): Any?\n\n /**\n * Calls of the function will be translated to an assignment of [value] to the receiver indexed (with square brackets/index operation) with [propertyName].\n *\n * E.g. for the following code:\n * ```kotlin\n * fun test(j: Json, p: String, newValue: Any) {\n * j[\"prop\"] = 1\n * j.set(p, newValue)\n * }\n * ```\n *\n * will be generated:\n * ```js\n * function test(j, p, newValue) {\n * j[\"prop\"] = 1;\n * j[p] = newValue;\n * }\n * }\n * ```\n */\n operator fun set(propertyName: String, value: Any?): Unit\n}\n\n/**\n * Returns a simple JavaScript object (as [Json]) using provided key-value pairs as names and values of its properties.\n */\npublic fun json(vararg pairs: Pair): Json {\n val res: dynamic = js(\"({})\")\n for ((name, value) in pairs) {\n res[name] = value\n }\n return res\n}\n\n/**\n * Adds key-value pairs from [other] to [this].\n * Returns the original receiver.\n */\npublic fun Json.add(other: Json): Json {\n val keys: Array = js(\"Object\").keys(other)\n for (key in keys) {\n if (other.asDynamic().hasOwnProperty(key)) {\n this[key] = other[key];\n }\n }\n return this\n}\n\n/**\n * Exposes the JavaScript [JSON object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON) to Kotlin.\n */\n@Suppress(\"NOT_DOCUMENTED\")\npublic external object JSON {\n public fun stringify(o: Any?): String\n public fun stringify(o: Any?, replacer: ((key: String, value: Any?) -> Any?)): String\n public fun stringify(o: Any?, replacer: ((key: String, value: Any?) -> Any?)? = definedExternally, space: Int): String\n public fun stringify(o: Any?, replacer: ((key: String, value: Any?) -> Any?)? = definedExternally, space: String): String\n public fun stringify(o: Any?, replacer: Array): String\n public fun stringify(o: Any?, replacer: Array, space: Int): String\n public fun stringify(o: Any?, replacer: Array, space: String): String\n\n public fun parse(text: String): T\n public fun parse(text: String, reviver: ((key: String, value: Any?) -> Any?)): T\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n@file:Suppress(\"DEPRECATION_ERROR\")\npackage kotlin.math\n\n\nimport kotlin.internal.InlineOnly\nimport kotlin.js.Math as nativeMath\n\n\n// region ================ Double Math ========================================\n\n/** Computes the sine of the angle [x] given in radians.\n *\n * Special cases:\n * - `sin(NaN|+Inf|-Inf)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun sin(x: Double): Double = nativeMath.sin(x)\n\n/** Computes the cosine of the angle [x] given in radians.\n *\n * Special cases:\n * - `cos(NaN|+Inf|-Inf)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun cos(x: Double): Double = nativeMath.cos(x)\n\n/** Computes the tangent of the angle [x] given in radians.\n *\n * Special cases:\n * - `tan(NaN|+Inf|-Inf)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun tan(x: Double): Double = nativeMath.tan(x)\n\n/**\n * Computes the arc sine of the value [x];\n * the returned value is an angle in the range from `-PI/2` to `PI/2` radians.\n *\n * Special cases:\n * - `asin(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun asin(x: Double): Double = nativeMath.asin(x)\n\n/**\n * Computes the arc cosine of the value [x];\n * the returned value is an angle in the range from `0.0` to `PI` radians.\n *\n * Special cases:\n * - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun acos(x: Double): Double = nativeMath.acos(x)\n\n/**\n * Computes the arc tangent of the value [x];\n * the returned value is an angle in the range from `-PI/2` to `PI/2` radians.\n *\n * Special cases:\n * - `atan(NaN)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun atan(x: Double): Double = nativeMath.atan(x)\n\n/**\n * Returns the angle `theta` of the polar coordinates `(r, theta)` that correspond\n * to the rectangular coordinates `(x, y)` by computing the arc tangent of the value [y] / [x];\n * the returned value is an angle in the range from `-PI` to `PI` radians.\n *\n * Special cases:\n * - `atan2(0.0, 0.0)` is `0.0`\n * - `atan2(0.0, x)` is `0.0` for `x > 0` and `PI` for `x < 0`\n * - `atan2(-0.0, x)` is `-0.0` for 'x > 0` and `-PI` for `x < 0`\n * - `atan2(y, +Inf)` is `0.0` for `0 < y < +Inf` and `-0.0` for '-Inf < y < 0`\n * - `atan2(y, -Inf)` is `PI` for `0 < y < +Inf` and `-PI` for `-Inf < y < 0`\n * - `atan2(y, 0.0)` is `PI/2` for `y > 0` and `-PI/2` for `y < 0`\n * - `atan2(+Inf, x)` is `PI/2` for finite `x`y\n * - `atan2(-Inf, x)` is `-PI/2` for finite `x`\n * - `atan2(NaN, x)` and `atan2(y, NaN)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun atan2(y: Double, x: Double): Double = nativeMath.atan2(y, x)\n\n/**\n * Computes the hyperbolic sine of the value [x].\n *\n * Special cases:\n * - `sinh(NaN)` is `NaN`\n * - `sinh(+Inf)` is `+Inf`\n * - `sinh(-Inf)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun sinh(x: Double): Double = nativeMath.sinh(x)\n\n/**\n * Computes the hyperbolic cosine of the value [x].\n *\n * Special cases:\n * - `cosh(NaN)` is `NaN`\n * - `cosh(+Inf|-Inf)` is `+Inf`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun cosh(x: Double): Double = nativeMath.cosh(x)\n\n/**\n * Computes the hyperbolic tangent of the value [x].\n *\n * Special cases:\n * - `tanh(NaN)` is `NaN`\n * - `tanh(+Inf)` is `1.0`\n * - `tanh(-Inf)` is `-1.0`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun tanh(x: Double): Double = nativeMath.tanh(x)\n\n/**\n * Computes the inverse hyperbolic sine of the value [x].\n *\n * The returned value is `y` such that `sinh(y) == x`.\n *\n * Special cases:\n * - `asinh(NaN)` is `NaN`\n * - `asinh(+Inf)` is `+Inf`\n * - `asinh(-Inf)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun asinh(x: Double): Double = nativeMath.asinh(x)\n\n/**\n * Computes the inverse hyperbolic cosine of the value [x].\n *\n * The returned value is positive `y` such that `cosh(y) == x`.\n *\n * Special cases:\n * - `acosh(NaN)` is `NaN`\n * - `acosh(x)` is `NaN` when `x < 1`\n * - `acosh(+Inf)` is `+Inf`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun acosh(x: Double): Double = nativeMath.acosh(x)\n\n/**\n * Computes the inverse hyperbolic tangent of the value [x].\n *\n * The returned value is `y` such that `tanh(y) == x`.\n *\n * Special cases:\n * - `tanh(NaN)` is `NaN`\n * - `tanh(x)` is `NaN` when `x > 1` or `x < -1`\n * - `tanh(1.0)` is `+Inf`\n * - `tanh(-1.0)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun atanh(x: Double): Double = nativeMath.atanh(x)\n\n/**\n * Computes `sqrt(x^2 + y^2)` without intermediate overflow or underflow.\n *\n * Special cases:\n * - returns `+Inf` if any of arguments is infinite\n * - returns `NaN` if any of arguments is `NaN` and the other is not infinite\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun hypot(x: Double, y: Double): Double = nativeMath.hypot(x, y)\n\n/**\n * Computes the positive square root of the value [x].\n *\n * Special cases:\n * - `sqrt(x)` is `NaN` when `x < 0` or `x` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun sqrt(x: Double): Double = nativeMath.sqrt(x)\n\n/**\n * Computes Euler's number `e` raised to the power of the value [x].\n *\n * Special cases:\n * - `exp(NaN)` is `NaN`\n * - `exp(+Inf)` is `+Inf`\n * - `exp(-Inf)` is `0.0`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun exp(x: Double): Double = nativeMath.exp(x)\n\n/**\n * Computes `exp(x) - 1`.\n *\n * This function can be implemented to produce more precise result for [x] near zero.\n *\n * Special cases:\n * - `expm1(NaN)` is `NaN`\n * - `expm1(+Inf)` is `+Inf`\n * - `expm1(-Inf)` is `-1.0`\n *\n * @see [exp] function.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun expm1(x: Double): Double = nativeMath.expm1(x)\n\n/**\n * Computes the logarithm of the value [x] to the given [base].\n *\n * Special cases:\n * - `log(x, b)` is `NaN` if either `x` or `b` are `NaN`\n * - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0`\n * - `log(+Inf, +Inf)` is `NaN`\n * - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1`\n * - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1`\n *\n * See also logarithm functions for common fixed bases: [ln], [log10] and [log2].\n */\n@SinceKotlin(\"1.2\")\npublic actual fun log(x: Double, base: Double): Double {\n if (base <= 0.0 || base == 1.0) return Double.NaN\n return nativeMath.log(x) / nativeMath.log(base)\n}\n\n/**\n * Computes the natural logarithm (base `E`) of the value [x].\n *\n * Special cases:\n * - `ln(NaN)` is `NaN`\n * - `ln(x)` is `NaN` when `x < 0.0`\n * - `ln(+Inf)` is `+Inf`\n * - `ln(0.0)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun ln(x: Double): Double = nativeMath.log(x)\n\n/**\n * Computes the common logarithm (base 10) of the value [x].\n *\n * @see [ln] function for special cases.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun log10(x: Double): Double = nativeMath.log10(x)\n\n/**\n * Computes the binary logarithm (base 2) of the value [x].\n *\n * @see [ln] function for special cases.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun log2(x: Double): Double = nativeMath.log2(x)\n\n/**\n * Computes `ln(x + 1)`.\n *\n * This function can be implemented to produce more precise result for [x] near zero.\n *\n * Special cases:\n * - `ln1p(NaN)` is `NaN`\n * - `ln1p(x)` is `NaN` where `x < -1.0`\n * - `ln1p(-1.0)` is `-Inf`\n * - `ln1p(+Inf)` is `+Inf`\n *\n * @see [ln] function\n * @see [expm1] function\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun ln1p(x: Double): Double = nativeMath.log1p(x)\n\n/**\n * Rounds the given value [x] to an integer towards positive infinity.\n\n * @return the smallest double value that is greater than or equal to the given value [x] and is a mathematical integer.\n *\n * Special cases:\n * - `ceil(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun ceil(x: Double): Double = nativeMath.ceil(x).unsafeCast() // TODO: Remove unsafe cast after removing public js.math\n\n/**\n * Rounds the given value [x] to an integer towards negative infinity.\n\n * @return the largest double value that is smaller than or equal to the given value [x] and is a mathematical integer.\n *\n * Special cases:\n * - `floor(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun floor(x: Double): Double = nativeMath.floor(x).unsafeCast()\n\n/**\n * Rounds the given value [x] to an integer towards zero.\n *\n * @return the value [x] having its fractional part truncated.\n *\n * Special cases:\n * - `truncate(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun truncate(x: Double): Double = nativeMath.trunc(x)\n\n/**\n * Rounds the given value [x] towards the closest integer with ties rounded towards even integer.\n *\n * Special cases:\n * - `round(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\npublic actual fun round(x: Double): Double {\n if (x % 0.5 != 0.0) {\n return nativeMath.round(x).unsafeCast()\n }\n val floor = floor(x)\n return if (floor % 2 == 0.0) floor else ceil(x)\n}\n\n/**\n * Returns the absolute value of the given value [x].\n *\n * Special cases:\n * - `abs(NaN)` is `NaN`\n *\n * @see absoluteValue extension property for [Double]\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun abs(x: Double): Double = nativeMath.abs(x)\n\n/**\n * Returns the sign of the given value [x]:\n * - `-1.0` if the value is negative,\n * - zero if the value is zero,\n * - `1.0` if the value is positive\n *\n * Special case:\n * - `sign(NaN)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun sign(x: Double): Double = nativeMath.sign(x)\n\n\n/**\n * Returns the smaller of two values.\n *\n * If either value is `NaN`, then the result is `NaN`.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun min(a: Double, b: Double): Double = nativeMath.min(a, b)\n\n/**\n * Returns the greater of two values.\n *\n * If either value is `NaN`, then the result is `NaN`.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun max(a: Double, b: Double): Double = nativeMath.max(a, b)\n\n// extensions\n\n/**\n * Raises this value to the power [x].\n *\n * Special cases:\n * - `b.pow(0.0)` is `1.0`\n * - `b.pow(1.0) == b`\n * - `b.pow(NaN)` is `NaN`\n * - `NaN.pow(x)` is `NaN` for `x != 0.0`\n * - `b.pow(Inf)` is `NaN` for `abs(b) == 1.0`\n * - `b.pow(x)` is `NaN` for `b < 0` and `x` is finite and not an integer\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun Double.pow(x: Double): Double = nativeMath.pow(this, x)\n\n/**\n * Raises this value to the integer power [n].\n *\n * See the other overload of [pow] for details.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun Double.pow(n: Int): Double = nativeMath.pow(this, n.toDouble())\n\n/**\n * Returns the absolute value of this value.\n *\n * Special cases:\n * - `NaN.absoluteValue` is `NaN`\n *\n * @see abs function\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline val Double.absoluteValue: Double get() = nativeMath.abs(this)\n\n/**\n * Returns the sign of this value:\n * - `-1.0` if the value is negative,\n * - zero if the value is zero,\n * - `1.0` if the value is positive\n *\n * Special case:\n * - `NaN.sign` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline val Double.sign: Double get() = nativeMath.sign(this)\n\n/**\n * Returns this value with the sign bit same as of the [sign] value.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun Double.withSign(sign: Int): Double = this.withSign(sign.toDouble())\n\n/**\n * Returns the ulp (unit in the last place) of this value.\n *\n * An ulp is a positive distance between this value and the next nearest [Double] value larger in magnitude.\n *\n * Special Cases:\n * - `NaN.ulp` is `NaN`\n * - `x.ulp` is `+Inf` when `x` is `+Inf` or `-Inf`\n * - `0.0.ulp` is `Double.MIN_VALUE`\n */\n@SinceKotlin(\"1.2\")\npublic actual val Double.ulp: Double get() = when {\n this < 0 -> (-this).ulp\n this.isNaN() || this == Double.POSITIVE_INFINITY -> this\n this == Double.MAX_VALUE -> this - this.nextDown()\n else -> this.nextUp() - this\n}\n\n/**\n * Returns the [Double] value nearest to this value in direction of positive infinity.\n */\n@SinceKotlin(\"1.2\")\npublic actual fun Double.nextUp(): Double = when {\n this.isNaN() || this == Double.POSITIVE_INFINITY -> this\n this == 0.0 -> Double.MIN_VALUE\n else -> Double.fromBits(this.toRawBits() + if (this > 0) 1 else -1)\n}\n\n/**\n * Returns the [Double] value nearest to this value in direction of negative infinity.\n */\n@SinceKotlin(\"1.2\")\npublic actual fun Double.nextDown(): Double = when {\n this.isNaN() || this == Double.NEGATIVE_INFINITY -> this\n this == 0.0 -> -Double.MIN_VALUE\n else -> Double.fromBits(this.toRawBits() + if (this > 0) -1 else 1)\n}\n\n\n/**\n * Returns the [Double] value nearest to this value in direction from this value towards the value [to].\n *\n * Special cases:\n * - `x.nextTowards(y)` is `NaN` if either `x` or `y` are `NaN`\n * - `x.nextTowards(x) == x`\n *\n */\n@SinceKotlin(\"1.2\")\npublic actual fun Double.nextTowards(to: Double): Double = when {\n this.isNaN() || to.isNaN() -> Double.NaN\n to == this -> to\n to > this -> this.nextUp()\n else /* to < this */ -> this.nextDown()\n}\n\n\n/**\n * Rounds this [Double] value to the nearest integer and converts the result to [Int].\n * Ties are rounded towards positive infinity.\n *\n * Special cases:\n * - `x.roundToInt() == Int.MAX_VALUE` when `x > Int.MAX_VALUE`\n * - `x.roundToInt() == Int.MIN_VALUE` when `x < Int.MIN_VALUE`\n *\n * @throws IllegalArgumentException when this value is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic actual fun Double.roundToInt(): Int = when {\n isNaN() -> throw IllegalArgumentException(\"Cannot round NaN value.\")\n this > Int.MAX_VALUE -> Int.MAX_VALUE\n this < Int.MIN_VALUE -> Int.MIN_VALUE\n else -> nativeMath.round(this).unsafeCast().toInt()\n}\n\n/**\n * Rounds this [Double] value to the nearest integer and converts the result to [Long].\n * Ties are rounded towards positive infinity.\n *\n * Special cases:\n * - `x.roundToLong() == Long.MAX_VALUE` when `x > Long.MAX_VALUE`\n * - `x.roundToLong() == Long.MIN_VALUE` when `x < Long.MIN_VALUE`\n *\n * @throws IllegalArgumentException when this value is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic actual fun Double.roundToLong(): Long = when {\n isNaN() -> throw IllegalArgumentException(\"Cannot round NaN value.\")\n this > Long.MAX_VALUE -> Long.MAX_VALUE\n this < Long.MIN_VALUE -> Long.MIN_VALUE\n else -> nativeMath.round(this).unsafeCast().toLong()\n}\n\n// endregion\n\n\n\n// region ================ Float Math ========================================\n\n/** Computes the sine of the angle [x] given in radians.\n *\n * Special cases:\n * - `sin(NaN|+Inf|-Inf)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun sin(x: Float): Float = nativeMath.sin(x.toDouble()).toFloat()\n\n/** Computes the cosine of the angle [x] given in radians.\n *\n * Special cases:\n * - `cos(NaN|+Inf|-Inf)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun cos(x: Float): Float = nativeMath.cos(x.toDouble()).toFloat()\n\n/** Computes the tangent of the angle [x] given in radians.\n *\n * Special cases:\n * - `tan(NaN|+Inf|-Inf)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun tan(x: Float): Float = nativeMath.tan(x.toDouble()).toFloat()\n\n/**\n * Computes the arc sine of the value [x];\n * the returned value is an angle in the range from `-PI/2` to `PI/2` radians.\n *\n * Special cases:\n * - `asin(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun asin(x: Float): Float = nativeMath.asin(x.toDouble()).toFloat()\n\n/**\n * Computes the arc cosine of the value [x];\n * the returned value is an angle in the range from `0.0` to `PI` radians.\n *\n * Special cases:\n * - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun acos(x: Float): Float = nativeMath.acos(x.toDouble()).toFloat()\n\n/**\n * Computes the arc tangent of the value [x];\n * the returned value is an angle in the range from `-PI/2` to `PI/2` radians.\n *\n * Special cases:\n * - `atan(NaN)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun atan(x: Float): Float = nativeMath.atan(x.toDouble()).toFloat()\n\n/**\n * Returns the angle `theta` of the polar coordinates `(r, theta)` that correspond\n * to the rectangular coordinates `(x, y)` by computing the arc tangent of the value [y] / [x];\n * the returned value is an angle in the range from `-PI` to `PI` radians.\n *\n * Special cases:\n * - `atan2(0.0, 0.0)` is `0.0`\n * - `atan2(0.0, x)` is `0.0` for `x > 0` and `PI` for `x < 0`\n * - `atan2(-0.0, x)` is `-0.0` for 'x > 0` and `-PI` for `x < 0`\n * - `atan2(y, +Inf)` is `0.0` for `0 < y < +Inf` and `-0.0` for '-Inf < y < 0`\n * - `atan2(y, -Inf)` is `PI` for `0 < y < +Inf` and `-PI` for `-Inf < y < 0`\n * - `atan2(y, 0.0)` is `PI/2` for `y > 0` and `-PI/2` for `y < 0`\n * - `atan2(+Inf, x)` is `PI/2` for finite `x`y\n * - `atan2(-Inf, x)` is `-PI/2` for finite `x`\n * - `atan2(NaN, x)` and `atan2(y, NaN)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun atan2(y: Float, x: Float): Float = nativeMath.atan2(y.toDouble(), x.toDouble()).toFloat()\n\n/**\n * Computes the hyperbolic sine of the value [x].\n *\n * Special cases:\n * - `sinh(NaN)` is `NaN`\n * - `sinh(+Inf)` is `+Inf`\n * - `sinh(-Inf)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun sinh(x: Float): Float = nativeMath.sinh(x.toDouble()).toFloat()\n\n/**\n * Computes the hyperbolic cosine of the value [x].\n *\n * Special cases:\n * - `cosh(NaN)` is `NaN`\n * - `cosh(+Inf|-Inf)` is `+Inf`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun cosh(x: Float): Float = nativeMath.cosh(x.toDouble()).toFloat()\n\n/**\n * Computes the hyperbolic tangent of the value [x].\n *\n * Special cases:\n * - `tanh(NaN)` is `NaN`\n * - `tanh(+Inf)` is `1.0`\n * - `tanh(-Inf)` is `-1.0`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun tanh(x: Float): Float = nativeMath.tanh(x.toDouble()).toFloat()\n\n/**\n * Computes the inverse hyperbolic sine of the value [x].\n *\n * The returned value is `y` such that `sinh(y) == x`.\n *\n * Special cases:\n * - `asinh(NaN)` is `NaN`\n * - `asinh(+Inf)` is `+Inf`\n * - `asinh(-Inf)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun asinh(x: Float): Float = nativeMath.asinh(x.toDouble()).toFloat()\n\n/**\n * Computes the inverse hyperbolic cosine of the value [x].\n *\n * The returned value is positive `y` such that `cosh(y) == x`.\n *\n * Special cases:\n * - `acosh(NaN)` is `NaN`\n * - `acosh(x)` is `NaN` when `x < 1`\n * - `acosh(+Inf)` is `+Inf`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun acosh(x: Float): Float = nativeMath.acosh(x.toDouble()).toFloat()\n\n/**\n * Computes the inverse hyperbolic tangent of the value [x].\n *\n * The returned value is `y` such that `tanh(y) == x`.\n *\n * Special cases:\n * - `tanh(NaN)` is `NaN`\n * - `tanh(x)` is `NaN` when `x > 1` or `x < -1`\n * - `tanh(1.0)` is `+Inf`\n * - `tanh(-1.0)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun atanh(x: Float): Float = nativeMath.atanh(x.toDouble()).toFloat()\n\n/**\n * Computes `sqrt(x^2 + y^2)` without intermediate overflow or underflow.\n *\n * Special cases:\n * - returns `+Inf` if any of arguments is infinite\n * - returns `NaN` if any of arguments is `NaN` and the other is not infinite\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun hypot(x: Float, y: Float): Float = nativeMath.hypot(x.toDouble(), y.toDouble()).toFloat()\n\n/**\n * Computes the positive square root of the value [x].\n *\n * Special cases:\n * - `sqrt(x)` is `NaN` when `x < 0` or `x` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun sqrt(x: Float): Float = nativeMath.sqrt(x.toDouble()).toFloat()\n\n/**\n * Computes Euler's number `e` raised to the power of the value [x].\n *\n * Special cases:\n * - `exp(NaN)` is `NaN`\n * - `exp(+Inf)` is `+Inf`\n * - `exp(-Inf)` is `0.0`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun exp(x: Float): Float = nativeMath.exp(x.toDouble()).toFloat()\n\n/**\n * Computes `exp(x) - 1`.\n *\n * This function can be implemented to produce more precise result for [x] near zero.\n *\n * Special cases:\n * - `expm1(NaN)` is `NaN`\n * - `expm1(+Inf)` is `+Inf`\n * - `expm1(-Inf)` is `-1.0`\n *\n * @see [exp] function.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun expm1(x: Float): Float = nativeMath.expm1(x.toDouble()).toFloat()\n\n/**\n * Computes the logarithm of the value [x] to the given [base].\n *\n * Special cases:\n * - `log(x, b)` is `NaN` if either `x` or `b` are `NaN`\n * - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0`\n * - `log(+Inf, +Inf)` is `NaN`\n * - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1`\n * - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1`\n *\n * See also logarithm functions for common fixed bases: [ln], [log10] and [log2].\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun log(x: Float, base: Float): Float = log(x.toDouble(), base.toDouble()).toFloat()\n\n/**\n * Computes the natural logarithm (base `E`) of the value [x].\n *\n * Special cases:\n * - `ln(NaN)` is `NaN`\n * - `ln(x)` is `NaN` when `x < 0.0`\n * - `ln(+Inf)` is `+Inf`\n * - `ln(0.0)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun ln(x: Float): Float = nativeMath.log(x.toDouble()).toFloat()\n\n/**\n * Computes the common logarithm (base 10) of the value [x].\n *\n * @see [ln] function for special cases.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun log10(x: Float): Float = nativeMath.log10(x.toDouble()).toFloat()\n\n/**\n * Computes the binary logarithm (base 2) of the value [x].\n *\n * @see [ln] function for special cases.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun log2(x: Float): Float = nativeMath.log2(x.toDouble()).toFloat()\n\n/**\n * Computes `ln(a + 1)`.\n *\n * This function can be implemented to produce more precise result for [x] near zero.\n *\n * Special cases:\n * - `ln1p(NaN)` is `NaN`\n * - `ln1p(x)` is `NaN` where `x < -1.0`\n * - `ln1p(-1.0)` is `-Inf`\n * - `ln1p(+Inf)` is `+Inf`\n *\n * @see [ln] function\n * @see [expm1] function\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun ln1p(x: Float): Float = nativeMath.log1p(x.toDouble()).toFloat()\n\n/**\n * Rounds the given value [x] to an integer towards positive infinity.\n\n * @return the smallest Float value that is greater than or equal to the given value [x] and is a mathematical integer.\n *\n * Special cases:\n * - `ceil(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun ceil(x: Float): Float = nativeMath.ceil(x.toDouble()).toFloat()\n\n/**\n * Rounds the given value [x] to an integer towards negative infinity.\n\n * @return the largest Float value that is smaller than or equal to the given value [x] and is a mathematical integer.\n *\n * Special cases:\n * - `floor(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun floor(x: Float): Float = nativeMath.floor(x.toDouble()).toFloat()\n\n/**\n * Rounds the given value [x] to an integer towards zero.\n *\n * @return the value [x] having its fractional part truncated.\n *\n * Special cases:\n * - `truncate(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun truncate(x: Float): Float = truncate(x.toDouble()).toFloat()\n\n/**\n * Rounds the given value [x] towards the closest integer with ties rounded towards even integer.\n *\n * Special cases:\n * - `round(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun round(x: Float): Float = round(x.toDouble()).toFloat()\n\n\n/**\n * Returns the absolute value of the given value [x].\n *\n * Special cases:\n * - `abs(NaN)` is `NaN`\n *\n * @see absoluteValue extension property for [Float]\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun abs(x: Float): Float = nativeMath.abs(x.toDouble()).toFloat()\n\n/**\n * Returns the sign of the given value [x]:\n * - `-1.0` if the value is negative,\n * - zero if the value is zero,\n * - `1.0` if the value is positive\n *\n * Special case:\n * - `sign(NaN)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun sign(x: Float): Float = nativeMath.sign(x.toDouble()).toFloat()\n\n\n\n/**\n * Returns the smaller of two values.\n *\n * If either value is `NaN`, then the result is `NaN`.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun min(a: Float, b: Float): Float = nativeMath.min(a, b)\n\n/**\n * Returns the greater of two values.\n *\n * If either value is `NaN`, then the result is `NaN`.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun max(a: Float, b: Float): Float = nativeMath.max(a, b)\n\n// extensions\n\n\n/**\n * Raises this value to the power [x].\n *\n * Special cases:\n * - `b.pow(0.0)` is `1.0`\n * - `b.pow(1.0) == b`\n * - `b.pow(NaN)` is `NaN`\n * - `NaN.pow(x)` is `NaN` for `x != 0.0`\n * - `b.pow(Inf)` is `NaN` for `abs(b) == 1.0`\n * - `b.pow(x)` is `NaN` for `b < 0` and `x` is finite and not an integer\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun Float.pow(x: Float): Float = nativeMath.pow(this.toDouble(), x.toDouble()).toFloat()\n\n/**\n * Raises this value to the integer power [n].\n *\n * See the other overload of [pow] for details.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun Float.pow(n: Int): Float = nativeMath.pow(this.toDouble(), n.toDouble()).toFloat()\n\n/**\n * Returns the absolute value of this value.\n *\n * Special cases:\n * - `NaN.absoluteValue` is `NaN`\n *\n * @see abs function\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline val Float.absoluteValue: Float get() = nativeMath.abs(this.toDouble()).toFloat()\n\n/**\n * Returns the sign of this value:\n * - `-1.0` if the value is negative,\n * - zero if the value is zero,\n * - `1.0` if the value is positive\n *\n * Special case:\n * - `NaN.sign` is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline val Float.sign: Float get() = nativeMath.sign(this.toDouble()).toFloat()\n\n/**\n * Returns this value with the sign bit same as of the [sign] value.\n *\n * If [sign] is `NaN` the sign of the result is undefined.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun Float.withSign(sign: Float): Float = this.toDouble().withSign(sign.toDouble()).toFloat()\n\n/**\n * Returns this value with the sign bit same as of the [sign] value.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun Float.withSign(sign: Int): Float = this.toDouble().withSign(sign.toDouble()).toFloat()\n\n\n/**\n * Rounds this [Float] value to the nearest integer and converts the result to [Int].\n * Ties are rounded towards positive infinity.\n *\n * Special cases:\n * - `x.roundToInt() == Int.MAX_VALUE` when `x > Int.MAX_VALUE`\n * - `x.roundToInt() == Int.MIN_VALUE` when `x < Int.MIN_VALUE`\n *\n * @throws IllegalArgumentException when this value is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun Float.roundToInt(): Int = toDouble().roundToInt()\n\n/**\n * Rounds this [Float] value to the nearest integer and converts the result to [Long].\n * Ties are rounded towards positive infinity.\n *\n * Special cases:\n * - `x.roundToLong() == Long.MAX_VALUE` when `x > Long.MAX_VALUE`\n * - `x.roundToLong() == Long.MIN_VALUE` when `x < Long.MIN_VALUE`\n *\n * @throws IllegalArgumentException when this value is `NaN`\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun Float.roundToLong(): Long = toDouble().roundToLong()\n\n\n// endregion\n\n// region ================ Integer Math ========================================\n\n\n/**\n * Returns the absolute value of the given value [n].\n *\n * Special cases:\n * - `abs(Int.MIN_VALUE)` is `Int.MIN_VALUE` due to an overflow\n *\n * @see absoluteValue extension property for [Int]\n */\n// TODO: remove manual 'or' when KT-19290 is fixed\n@SinceKotlin(\"1.2\")\npublic actual fun abs(n: Int): Int = if (n < 0) (-n or 0) else n\n\n/**\n * Returns the smaller of two values.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun min(a: Int, b: Int): Int = nativeMath.min(a, b)\n\n/**\n * Returns the greater of two values.\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline fun max(a: Int, b: Int): Int = nativeMath.max(a, b)\n\n/**\n * Returns the absolute value of this value.\n *\n * Special cases:\n * - `Int.MIN_VALUE.absoluteValue` is `Int.MIN_VALUE` due to an overflow\n *\n * @see abs function\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline val Int.absoluteValue: Int get() = abs(this)\n\n/**\n * Returns the sign of this value:\n * - `-1` if the value is negative,\n * - `0` if the value is zero,\n * - `1` if the value is positive\n */\n@SinceKotlin(\"1.2\")\npublic actual val Int.sign: Int get() = when {\n this < 0 -> -1\n this > 0 -> 1\n else -> 0\n}\n\n\n\n/**\n * Returns the absolute value of the given value [n].\n *\n * Special cases:\n * - `abs(Long.MIN_VALUE)` is `Long.MIN_VALUE` due to an overflow\n *\n * @see absoluteValue extension property for [Long]\n */\n@SinceKotlin(\"1.2\")\npublic actual fun abs(n: Long): Long = if (n < 0) -n else n\n\n/**\n * Returns the smaller of two values.\n */\n@SinceKotlin(\"1.2\")\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline fun min(a: Long, b: Long): Long = if (a <= b) a else b\n\n/**\n * Returns the greater of two values.\n */\n@SinceKotlin(\"1.2\")\n@Suppress(\"NOTHING_TO_INLINE\")\npublic actual inline fun max(a: Long, b: Long): Long = if (a >= b) a else b\n\n/**\n * Returns the absolute value of this value.\n *\n * Special cases:\n * - `Long.MIN_VALUE.absoluteValue` is `Long.MIN_VALUE` due to an overflow\n *\n * @see abs function\n */\n@SinceKotlin(\"1.2\")\n@InlineOnly\npublic actual inline val Long.absoluteValue: Long get() = abs(this)\n\n/**\n * Returns the sign of this value:\n * - `-1` if the value is negative,\n * - `0` if the value is zero,\n * - `1` if the value is positive\n */\n@SinceKotlin(\"1.2\")\npublic actual val Long.sign: Int get() = when {\n this < 0 -> -1\n this > 0 -> 1\n else -> 0\n}\n\n\n// endregion\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin\n\n\n/**\n * Returns a bit representation of the specified floating-point value as [Long]\n * according to the IEEE 754 floating-point \"double format\" bit layout.\n */\n@SinceKotlin(\"1.2\")\n@library(\"doubleToBits\")\npublic actual fun Double.toBits(): Long = definedExternally\n\n/**\n * Returns a bit representation of the specified floating-point value as [Long]\n * according to the IEEE 754 floating-point \"double format\" bit layout,\n * preserving `NaN` values exact layout.\n */\n@SinceKotlin(\"1.2\")\n@library(\"doubleToRawBits\")\npublic actual fun Double.toRawBits(): Long = definedExternally\n\n/**\n * Returns the [Double] value corresponding to a given bit representation.\n */\n@SinceKotlin(\"1.2\")\n@kotlin.internal.InlineOnly\npublic actual inline fun Double.Companion.fromBits(bits: Long): Double = js(\"Kotlin\").doubleFromBits(bits).unsafeCast()\n\n/**\n * Returns a bit representation of the specified floating-point value as [Int]\n * according to the IEEE 754 floating-point \"single format\" bit layout.\n *\n * Note that in Kotlin/JS [Float] range is wider than \"single format\" bit layout can represent,\n * so some [Float] values may overflow, underflow or loose their accuracy after conversion to bits and back.\n */\n@SinceKotlin(\"1.2\")\n@library(\"floatToBits\")\npublic actual fun Float.toBits(): Int = definedExternally\n\n/**\n * Returns a bit representation of the specified floating-point value as [Int]\n * according to the IEEE 754 floating-point \"single format\" bit layout,\n * preserving `NaN` values exact layout.\n *\n * Note that in Kotlin/JS [Float] range is wider than \"single format\" bit layout can represent,\n * so some [Float] values may overflow, underflow or loose their accuracy after conversion to bits and back.\n */\n@SinceKotlin(\"1.2\")\n@library(\"floatToRawBits\")\npublic actual fun Float.toRawBits(): Int = definedExternally\n\n/**\n * Returns the [Float] value corresponding to a given bit representation.\n */\n@SinceKotlin(\"1.2\")\n@kotlin.internal.InlineOnly\npublic actual inline fun Float.Companion.fromBits(bits: Int): Float = js(\"Kotlin\").floatFromBits(bits).unsafeCast()\n\n\n@Suppress(\"NOTHING_TO_INLINE\")\ninternal inline fun Long(low: Int, high: Int) = js(\"Kotlin\").Long.fromBits(low, high).unsafeCast()\ninternal inline val Long.low: Int get() = this.asDynamic().getLowBits().unsafeCast()\ninternal inline val Long.high: Int get() = this.asDynamic().getHighBits().unsafeCast()\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin\n\n/**\n * Returns `true` if the specified number is a\n * Not-a-Number (NaN) value, `false` otherwise.\n */\npublic actual fun Double.isNaN(): Boolean = this != this\n\n/**\n * Returns `true` if the specified number is a\n * Not-a-Number (NaN) value, `false` otherwise.\n */\npublic actual fun Float.isNaN(): Boolean = this != this\n\n/**\n * Returns `true` if this value is infinitely large in magnitude.\n */\npublic actual fun Double.isInfinite(): Boolean = this == Double.POSITIVE_INFINITY || this == Double.NEGATIVE_INFINITY\n\n/**\n * Returns `true` if this value is infinitely large in magnitude.\n */\npublic actual fun Float.isInfinite(): Boolean = this == Float.POSITIVE_INFINITY || this == Float.NEGATIVE_INFINITY\n\n/**\n * Returns `true` if the argument is a finite floating-point value; returns `false` otherwise (for `NaN` and infinity arguments).\n */\npublic actual fun Double.isFinite(): Boolean = !isInfinite() && !isNaN()\n\n/**\n * Returns `true` if the argument is a finite floating-point value; returns `false` otherwise (for `NaN` and infinity arguments).\n */\npublic actual fun Float.isFinite(): Boolean = !isInfinite() && !isNaN()\n\n\n/**\n * Counts the number of set bits in the binary representation of this [Int] number.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic actual fun Int.countOneBits(): Int {\n // Hacker's Delight 5-1 algorithm\n var v = this\n v = (v and 0x55555555) + (v.ushr(1) and 0x55555555)\n v = (v and 0x33333333) + (v.ushr(2) and 0x33333333)\n v = (v and 0x0F0F0F0F) + (v.ushr(4) and 0x0F0F0F0F)\n v = (v and 0x00FF00FF) + (v.ushr(8) and 0x00FF00FF)\n v = (v and 0x0000FFFF) + (v.ushr(16))\n return v\n}\n\n/**\n * Counts the number of consecutive most significant bits that are zero in the binary representation of this [Int] number.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@Suppress(\"DEPRECATION_ERROR\")\n@kotlin.internal.InlineOnly\npublic actual inline fun Int.countLeadingZeroBits(): Int = kotlin.js.Math.clz32(this)\n\n/**\n * Counts the number of consecutive least significant bits that are zero in the binary representation of this [Int] number.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic actual fun Int.countTrailingZeroBits(): Int =\n // Hacker's Delight 5-4 algorithm for expressing countTrailingZeroBits with countLeadingZeroBits\n Int.SIZE_BITS - (this or -this).inv().countLeadingZeroBits()\n\n/**\n * Returns a number having a single bit set in the position of the most significant set bit of this [Int] number,\n * or zero, if this number is zero.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic actual fun Int.takeHighestOneBit(): Int =\n if (this == 0) 0 else 1.shl(Int.SIZE_BITS - 1 - countLeadingZeroBits())\n\n/**\n * Returns a number having a single bit set in the position of the least significant set bit of this [Int] number,\n * or zero, if this number is zero.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic actual fun Int.takeLowestOneBit(): Int =\n // Hacker's Delight 2-1 algorithm for isolating rightmost 1-bit\n this and -this\n\n/**\n * Rotates the binary representation of this [Int] number left by the specified [bitCount] number of bits.\n * The most significant bits pushed out from the left side reenter the number as the least significant bits on the right side.\n *\n * Rotating the number left by a negative bit count is the same as rotating it right by the negated bit count:\n * `number.rotateLeft(-n) == number.rotateRight(n)`\n *\n * Rotating by a multiple of [Int.SIZE_BITS] (32) returns the same number, or more generally\n * `number.rotateLeft(n) == number.rotateLeft(n % 32)`\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\npublic actual fun Int.rotateLeft(bitCount: Int): Int =\n shl(bitCount) or ushr(Int.SIZE_BITS - bitCount)\n\n\n/**\n * Rotates the binary representation of this [Int] number right by the specified [bitCount] number of bits.\n * The least significant bits pushed out from the right side reenter the number as the most significant bits on the left side.\n *\n * Rotating the number right by a negative bit count is the same as rotating it left by the negated bit count:\n * `number.rotateRight(-n) == number.rotateLeft(n)`\n *\n * Rotating by a multiple of [Int.SIZE_BITS] (32) returns the same number, or more generally\n * `number.rotateRight(n) == number.rotateRight(n % 32)`\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\npublic actual fun Int.rotateRight(bitCount: Int): Int =\n shl(Int.SIZE_BITS - bitCount) or ushr(bitCount)\n\n\n/**\n * Counts the number of set bits in the binary representation of this [Long] number.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic actual fun Long.countOneBits(): Int =\n high.countOneBits() + low.countOneBits()\n\n/**\n * Counts the number of consecutive most significant bits that are zero in the binary representation of this [Long] number.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic actual fun Long.countLeadingZeroBits(): Int =\n when (val high = this.high) {\n 0 -> Int.SIZE_BITS + low.countLeadingZeroBits()\n else -> high.countLeadingZeroBits()\n }\n\n/**\n * Counts the number of consecutive least significant bits that are zero in the binary representation of this [Long] number.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic actual fun Long.countTrailingZeroBits(): Int =\n when (val low = this.low) {\n 0 -> Int.SIZE_BITS + high.countTrailingZeroBits()\n else -> low.countTrailingZeroBits()\n }\n\n/**\n * Returns a number having a single bit set in the position of the most significant set bit of this [Long] number,\n * or zero, if this number is zero.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic actual fun Long.takeHighestOneBit(): Long =\n when (val high = this.high) {\n 0 -> Long(low.takeHighestOneBit(), 0)\n else -> Long(0, high.takeHighestOneBit())\n }\n\n/**\n * Returns a number having a single bit set in the position of the least significant set bit of this [Long] number,\n * or zero, if this number is zero.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic actual fun Long.takeLowestOneBit(): Long =\n when (val low = this.low) {\n 0 -> Long(0, high.takeLowestOneBit())\n else -> Long(low.takeLowestOneBit(), 0)\n }\n\n/**\n * Rotates the binary representation of this [Long] number left by the specified [bitCount] number of bits.\n * The most significant bits pushed out from the left side reenter the number as the least significant bits on the right side.\n *\n * Rotating the number left by a negative bit count is the same as rotating it right by the negated bit count:\n * `number.rotateLeft(-n) == number.rotateRight(n)`\n *\n * Rotating by a multiple of [Long.SIZE_BITS] (64) returns the same number, or more generally\n * `number.rotateLeft(n) == number.rotateLeft(n % 64)`\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\npublic actual fun Long.rotateLeft(bitCount: Int): Long {\n if ((bitCount and 31) != 0) {\n val low = this.low\n val high = this.high\n val newLow = low.shl(bitCount) or high.ushr(-bitCount)\n val newHigh = high.shl(bitCount) or low.ushr(-bitCount)\n return if ((bitCount and 32) == 0) Long(newLow, newHigh) else Long(newHigh, newLow)\n } else {\n return if ((bitCount and 32) == 0) this else Long(high, low)\n }\n}\n\n\n/**\n * Rotates the binary representation of this [Long] number right by the specified [bitCount] number of bits.\n * The least significant bits pushed out from the right side reenter the number as the most significant bits on the left side.\n *\n * Rotating the number right by a negative bit count is the same as rotating it left by the negated bit count:\n * `number.rotateRight(-n) == number.rotateLeft(n)`\n *\n * Rotating by a multiple of [Long.SIZE_BITS] (64) returns the same number, or more generally\n * `number.rotateRight(n) == number.rotateRight(n % 64)`\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic actual inline fun Long.rotateRight(bitCount: Int): Long = rotateLeft(-bitCount)\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.random\n\nimport kotlin.math.pow\n\ninternal actual fun defaultPlatformRandom(): Random =\n Random(js(\"(Math.random() * Math.pow(2, 32)) | 0\").unsafeCast())\n\n\nprivate val INV_2_26: Double = 2.0.pow(-26)\nprivate val INV_2_53: Double = 2.0.pow(-53)\ninternal actual fun doubleFromParts(hi26: Int, low27: Int): Double =\n hi26 * INV_2_26 + low27 * INV_2_53","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.reflect.js.internal\n\nimport kotlin.reflect.*\n\ninternal abstract class KClassImpl(\n internal open val jClass: JsClass\n) : KClass {\n\n override val qualifiedName: String?\n get() = TODO()\n\n override fun equals(other: Any?): Boolean {\n return other is KClassImpl<*> && jClass == other.jClass\n }\n\n // TODO: use FQN\n override fun hashCode(): Int = simpleName?.hashCode() ?: 0\n\n override fun toString(): String {\n // TODO: use FQN\n return \"class $simpleName\"\n }\n}\n\ninternal class SimpleKClassImpl(jClass: JsClass) : KClassImpl(jClass) {\n override val simpleName: String? = jClass.asDynamic().`$metadata$`?.simpleName.unsafeCast()\n\n override fun isInstance(value: Any?): Boolean {\n return jsIsType(value, jClass)\n }\n}\n\ninternal class PrimitiveKClassImpl(\n jClass: JsClass,\n private val givenSimpleName: String,\n private val isInstanceFunction: (Any?) -> Boolean\n) : KClassImpl(jClass) {\n override fun equals(other: Any?): Boolean {\n if (other !is PrimitiveKClassImpl<*>) return false\n return super.equals(other) && givenSimpleName == other.givenSimpleName\n }\n\n override val simpleName: String? get() = givenSimpleName\n\n override fun isInstance(value: Any?): Boolean {\n return isInstanceFunction(value)\n }\n}\n\ninternal object NothingKClassImpl : KClassImpl(js(\"Object\")) {\n override val simpleName: String = \"Nothing\"\n\n override fun isInstance(value: Any?): Boolean = false\n\n override val jClass: JsClass\n get() = throw UnsupportedOperationException(\"There's no native JS class for Nothing type\")\n\n override fun equals(other: Any?): Boolean = other === this\n\n override fun hashCode(): Int = 0\n}\n\ninternal class ErrorKClass : KClass {\n override val simpleName: String? get() = error(\"Unknown simpleName for ErrorKClass\")\n override val qualifiedName: String? get() = error(\"Unknown qualifiedName for ErrorKClass\")\n\n override fun isInstance(value: Any?): Boolean = error(\"Can's check isInstance on ErrorKClass\")\n\n override fun equals(other: Any?): Boolean = other === this\n\n override fun hashCode(): Int = 0\n}","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.collections\n\n/**\n * The common interface of [InternalStringMap] and [InternalHashCodeMap].\n */\ninternal interface InternalMap : MutableIterable> {\n val equality: EqualityComparator\n val size: Int\n operator fun contains(key: K): Boolean\n operator fun get(key: K): V?\n\n fun put(key: K, value: V): V?\n fun remove(key: K): V?\n fun clear(): Unit\n\n fun createJsMap(): dynamic {\n val result = js(\"Object.create(null)\")\n // force to switch object representation to dictionary mode\n result[\"foo\"] = 1\n jsDeleteProperty(result, \"foo\")\n return result\n }\n}\n","/*\n * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license\n * that can be found in the license/LICENSE.txt file.\n */\n\n\n@file:Suppress(\"UNUSED_PARAMETER\")\n\npackage kotlin.js\n\n@kotlin.internal.InlineOnly\ninternal inline fun jsDeleteProperty(obj: Any, property: Any) {\n js(\"delete obj[property]\")\n}\n\n@kotlin.internal.InlineOnly\ninternal inline fun jsBitwiseOr(lhs: Any?, rhs: Any?): Int =\n js(\"lhs | rhs\").unsafeCast()","/*\n * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.reflect.js.internal\n\nimport kotlin.reflect.*\n\ninternal class KTypeImpl(\n override val classifier: KClassifier,\n override val arguments: List,\n override val isMarkedNullable: Boolean\n) : KType {\n override fun equals(other: Any?): Boolean =\n other is KTypeImpl &&\n classifier == other.classifier && arguments == other.arguments && isMarkedNullable == other.isMarkedNullable\n\n override fun hashCode(): Int =\n (classifier.hashCode() * 31 + arguments.hashCode()) * 31 + isMarkedNullable.hashCode()\n\n override fun toString(): String {\n val kClass = (classifier as? KClass<*>)\n val classifierName = when {\n kClass == null -> classifier.toString()\n kClass.simpleName != null -> kClass.simpleName\n else -> \"(non-denotable type)\"\n }\n\n val args =\n if (arguments.isEmpty()) \"\"\n else arguments.joinToString(\", \", \"<\", \">\") { it.asString() }\n val nullable = if (isMarkedNullable) \"?\" else \"\"\n\n return classifierName + args + nullable\n }\n\n // TODO: this should be the implementation of KTypeProjection.toString, see KT-30071\n private fun KTypeProjection.asString(): String {\n if (variance == null) return \"*\"\n return variance.prefixString() + type.toString()\n }\n}\n\ninternal object DynamicKType : KType {\n override val classifier: KClassifier? = null\n override val arguments: List = emptyList()\n override val isMarkedNullable: Boolean = false\n override fun toString(): String = \"dynamic\"\n}\n\ninternal fun KVariance.prefixString() =\n when (this) {\n KVariance.INVARIANT -> \"\"\n KVariance.IN -> \"in \"\n KVariance.OUT -> \"out \"\n }\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.reflect.js.internal\n\nimport kotlin.js.JsClass\n\n@JsName(\"PrimitiveClasses\")\ninternal object PrimitiveClasses {\n @JsName(\"anyClass\")\n val anyClass = PrimitiveKClassImpl(js(\"Object\").unsafeCast>(), \"Any\", { it is Any })\n\n @JsName(\"numberClass\")\n val numberClass = PrimitiveKClassImpl(js(\"Number\").unsafeCast>(), \"Number\", { it is Number })\n\n @JsName(\"nothingClass\")\n val nothingClass = NothingKClassImpl\n\n @JsName(\"booleanClass\")\n val booleanClass = PrimitiveKClassImpl(js(\"Boolean\").unsafeCast>(), \"Boolean\", { it is Boolean })\n\n @JsName(\"byteClass\")\n val byteClass = PrimitiveKClassImpl(js(\"Number\").unsafeCast>(), \"Byte\", { it is Byte })\n\n @JsName(\"shortClass\")\n val shortClass = PrimitiveKClassImpl(js(\"Number\").unsafeCast>(), \"Short\", { it is Short })\n\n @JsName(\"intClass\")\n val intClass = PrimitiveKClassImpl(js(\"Number\").unsafeCast>(), \"Int\", { it is Int })\n\n @JsName(\"floatClass\")\n val floatClass = PrimitiveKClassImpl(js(\"Number\").unsafeCast>(), \"Float\", { it is Float })\n\n @JsName(\"doubleClass\")\n val doubleClass = PrimitiveKClassImpl(js(\"Number\").unsafeCast>(), \"Double\", { it is Double })\n\n @JsName(\"arrayClass\")\n val arrayClass = PrimitiveKClassImpl(js(\"Array\").unsafeCast>>(), \"Array\", { it is Array<*> })\n\n @JsName(\"stringClass\")\n val stringClass = PrimitiveKClassImpl(js(\"String\").unsafeCast>(), \"String\", { it is String })\n\n @JsName(\"throwableClass\")\n val throwableClass = PrimitiveKClassImpl(js(\"Error\").unsafeCast>(), \"Throwable\", { it is Throwable })\n\n @JsName(\"booleanArrayClass\")\n val booleanArrayClass = PrimitiveKClassImpl(js(\"Array\").unsafeCast>(), \"BooleanArray\", { it is BooleanArray })\n\n @JsName(\"charArrayClass\")\n val charArrayClass = PrimitiveKClassImpl(js(\"Uint16Array\").unsafeCast>(), \"CharArray\", { it is CharArray })\n\n @JsName(\"byteArrayClass\")\n val byteArrayClass = PrimitiveKClassImpl(js(\"Int8Array\").unsafeCast>(), \"ByteArray\", { it is ByteArray })\n\n @JsName(\"shortArrayClass\")\n val shortArrayClass = PrimitiveKClassImpl(js(\"Int16Array\").unsafeCast>(), \"ShortArray\", { it is ShortArray })\n\n @JsName(\"intArrayClass\")\n val intArrayClass = PrimitiveKClassImpl(js(\"Int32Array\").unsafeCast>(), \"IntArray\", { it is IntArray })\n\n @JsName(\"longArrayClass\")\n val longArrayClass = PrimitiveKClassImpl(js(\"Array\").unsafeCast>(), \"LongArray\", { it is LongArray })\n\n @JsName(\"floatArrayClass\")\n val floatArrayClass = PrimitiveKClassImpl(js(\"Float32Array\").unsafeCast>(), \"FloatArray\", { it is FloatArray })\n\n @JsName(\"doubleArrayClass\")\n val doubleArrayClass = PrimitiveKClassImpl(js(\"Float64Array\").unsafeCast>(), \"DoubleArray\", { it is DoubleArray })\n\n @JsName(\"functionClass\")\n fun functionClass(arity: Int): KClassImpl {\n return functionClasses.get(arity) ?: run {\n val result = PrimitiveKClassImpl(js(\"Function\").unsafeCast>(), \"Function$arity\",\n { jsTypeOf(it) === \"function\" && it.asDynamic().length === arity })\n functionClasses.asDynamic()[arity] = result\n result\n }\n }\n}\n\nprivate val functionClasses = arrayOfNulls>(0)","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// a package is omitted to get declarations directly under the module\n\nimport kotlin.reflect.*\nimport kotlin.reflect.js.internal.*\n\n@JsName(\"getKClass\")\ninternal fun getKClass(jClass: Any /* JsClass | Array> */): KClass {\n return if (js(\"Array\").isArray(jClass)) {\n getKClassM(jClass.unsafeCast>>())\n } else {\n getKClass1(jClass.unsafeCast>())\n }\n}\n\n@JsName(\"getKClassM\")\ninternal fun getKClassM(jClasses: Array>): KClass = when (jClasses.size) {\n 1 -> getKClass1(jClasses[0])\n 0 -> NothingKClassImpl.unsafeCast>()\n else -> ErrorKClass().unsafeCast>()\n}\n\n@JsName(\"getKClassFromExpression\")\ninternal fun getKClassFromExpression(e: T): KClass =\n when (jsTypeOf(e)) {\n \"string\" -> PrimitiveClasses.stringClass\n \"number\" -> if (jsBitwiseOr(e, 0).asDynamic() === e) PrimitiveClasses.intClass else PrimitiveClasses.doubleClass\n \"boolean\" -> PrimitiveClasses.booleanClass\n \"function\" -> PrimitiveClasses.functionClass(e.asDynamic().length)\n else -> {\n when {\n e is BooleanArray -> PrimitiveClasses.booleanArrayClass\n e is CharArray -> PrimitiveClasses.charArrayClass\n e is ByteArray -> PrimitiveClasses.byteArrayClass\n e is ShortArray -> PrimitiveClasses.shortArrayClass\n e is IntArray -> PrimitiveClasses.intArrayClass\n e is LongArray -> PrimitiveClasses.longArrayClass\n e is FloatArray -> PrimitiveClasses.floatArrayClass\n e is DoubleArray -> PrimitiveClasses.doubleArrayClass\n e is KClass<*> -> KClass::class\n e is Array<*> -> PrimitiveClasses.arrayClass\n else -> {\n val constructor = js(\"Object\").getPrototypeOf(e).constructor\n when {\n constructor === js(\"Object\") -> PrimitiveClasses.anyClass\n constructor === js(\"Error\") -> PrimitiveClasses.throwableClass\n else -> {\n val jsClass: JsClass = constructor\n getKClass1(jsClass)\n }\n }\n }\n }\n }\n }.unsafeCast>()\n\n@JsName(\"getKClass1\")\ninternal fun getKClass1(jClass: JsClass): KClass {\n if (jClass === js(\"String\")) return PrimitiveClasses.stringClass.unsafeCast>()\n\n val metadata = jClass.asDynamic().`$metadata$`\n\n return if (metadata != null) {\n if (metadata.`$kClass$` == null) {\n val kClass = SimpleKClassImpl(jClass)\n metadata.`$kClass$` = kClass\n kClass\n } else {\n metadata.`$kClass$`\n }\n } else {\n SimpleKClassImpl(jClass)\n }\n}","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.js\n\n/**\n * Exposes the JavaScript [RegExp object](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/RegExp) to Kotlin.\n */\n@Suppress(\"NOT_DOCUMENTED\")\npublic external class RegExp(pattern: String, flags: String? = definedExternally) {\n\n public fun test(str: String): Boolean\n\n public fun exec(str: String): RegExpMatch?\n\n public override fun toString(): String\n\n /**\n * The lastIndex is a read/write integer property of regular expressions that specifies the index at which to start the next match.\n */\n public var lastIndex: Int\n\n public val global: Boolean\n public val ignoreCase: Boolean\n public val multiline: Boolean\n}\n\n/**\n * Resets the regular expression so that subsequent [RegExp.test] and [RegExp.exec] calls will match starting with the beginning of the input string.\n */\npublic fun RegExp.reset() {\n lastIndex = 0\n}\n\n// TODO: Inherit from array or introduce asArray() extension\n/**\n * Represents the return value of [RegExp.exec].\n */\n@Suppress(\"NOT_DOCUMENTED\")\npublic external interface RegExpMatch {\n public val index: Int\n public val input: String\n public val length: Int\n}\n\n/**\n * Returns the entire text matched by [RegExp.exec] if the [index] parameter is 0, or the text matched by the capturing parenthesis\n * at the given index.\n */\npublic inline operator fun RegExpMatch.get(index: Int): String? = asDynamic()[index]\n\n/**\n * Converts the result of [RegExp.exec] to an array where the first element contains the entire matched text and each subsequent\n * element is the text matched by each capturing parenthesis.\n */\npublic inline fun RegExpMatch.asArray(): Array = unsafeCast>()\n","/*\n * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.text\n\n/**\n * The exception thrown when a character encoding or decoding error occurs.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic actual open class CharacterCodingException(message: String?) : Exception(message) {\n actual constructor() : this(null)\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.text\n\n/**\n * A mutable sequence of characters.\n *\n * String builder can be used to efficiently perform multiple string manipulation operations.\n */\npublic actual class StringBuilder actual constructor(content: String) : Appendable, CharSequence {\n /**\n * Constructs an empty string builder with the specified initial [capacity].\n *\n * In Kotlin/JS implementation of StringBuilder the initial capacity has no effect on the further performance of operations.\n */\n actual constructor(capacity: Int) : this() {\n }\n\n /** Constructs a string builder that contains the same characters as the specified [content] char sequence. */\n actual constructor(content: CharSequence) : this(content.toString()) {}\n\n /** Constructs an empty string builder. */\n actual constructor() : this(\"\")\n\n private var string: String = if (content !== undefined) content else \"\"\n\n actual override val length: Int\n get() = string.asDynamic().length\n\n actual override fun get(index: Int): Char =\n string.getOrElse(index) { throw IndexOutOfBoundsException(\"index: $index, length: $length}\") }\n\n actual override fun subSequence(startIndex: Int, endIndex: Int): CharSequence = string.substring(startIndex, endIndex)\n\n actual override fun append(value: Char): StringBuilder {\n string += value\n return this\n }\n\n actual override fun append(value: CharSequence?): StringBuilder {\n string += value.toString()\n return this\n }\n\n actual override fun append(value: CharSequence?, startIndex: Int, endIndex: Int): StringBuilder =\n this.appendRange(value ?: \"null\", startIndex, endIndex)\n\n /**\n * Reverses the contents of this string builder and returns this instance.\n *\n * Surrogate pairs included in this string builder are treated as single characters.\n * Therefore, the order of the high-low surrogates is never reversed.\n *\n * Note that the reverse operation may produce new surrogate pairs that were unpaired low-surrogates and high-surrogates before the operation.\n * For example, reversing `\"\\uDC00\\uD800\"` produces `\"\\uD800\\uDC00\"` which is a valid surrogate pair.\n */\n actual fun reverse(): StringBuilder {\n var reversed = \"\"\n var index = string.length - 1\n while (index >= 0) {\n val low = string[index--]\n if (low.isLowSurrogate() && index >= 0) {\n val high = string[index--]\n if (high.isHighSurrogate()) {\n reversed = reversed + high + low\n } else {\n reversed = reversed + low + high\n }\n } else {\n reversed += low\n }\n }\n string = reversed\n return this\n }\n\n /**\n * Appends the string representation of the specified object [value] to this string builder and returns this instance.\n *\n * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,\n * and then that string was appended to this string builder.\n */\n actual fun append(value: Any?): StringBuilder {\n string += value.toString()\n return this\n }\n\n /**\n * Appends the string representation of the specified boolean [value] to this string builder and returns this instance.\n *\n * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,\n * and then that string was appended to this string builder.\n */\n @SinceKotlin(\"1.3\")\n actual fun append(value: Boolean): StringBuilder {\n string += value\n return this\n }\n\n /**\n * Appends characters in the specified character array [value] to this string builder and returns this instance.\n *\n * Characters are appended in order, starting at the index 0.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun append(value: CharArray): StringBuilder {\n @OptIn(ExperimentalStdlibApi::class)\n string += value.concatToString()\n return this\n }\n\n @Deprecated(\"Provided for binary compatibility.\", level = DeprecationLevel.HIDDEN)\n fun append(value: String): StringBuilder = append(value)\n\n /**\n * Appends the specified string [value] to this string builder and returns this instance.\n *\n * If [value] is `null`, then the four characters `\"null\"` are appended.\n */\n @SinceKotlin(\"1.3\")\n actual fun append(value: String?): StringBuilder {\n this.string += value ?: \"null\"\n return this\n }\n\n /**\n * Returns the current capacity of this string builder.\n *\n * The capacity is the maximum length this string builder can have before an allocation occurs.\n *\n * In Kotlin/JS implementation of StringBuilder the value returned from this method may not indicate the actual size of the backing storage.\n */\n @SinceKotlin(\"1.3\")\n// @ExperimentalStdlibApi\n @Deprecated(\"Obtaining StringBuilder capacity is not supported in JS and common code.\", level = DeprecationLevel.ERROR)\n actual fun capacity(): Int = length\n\n /**\n * Ensures that the capacity of this string builder is at least equal to the specified [minimumCapacity].\n *\n * If the current capacity is less than the [minimumCapacity], a new backing storage is allocated with greater capacity.\n * Otherwise, this method takes no action and simply returns.\n *\n * In Kotlin/JS implementation of StringBuilder the size of the backing storage is not extended to comply the given [minimumCapacity],\n * thus calling this method has no effect on the further performance of operations.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun ensureCapacity(minimumCapacity: Int) {\n }\n\n /**\n * Returns the index within this string builder of the first occurrence of the specified [string].\n *\n * Returns `-1` if the specified [string] does not occur in this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun indexOf(string: String): Int = this.string.asDynamic().indexOf(string)\n\n /**\n * Returns the index within this string builder of the first occurrence of the specified [string],\n * starting at the specified [startIndex].\n *\n * Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun indexOf(string: String, startIndex: Int): Int = this.string.asDynamic().indexOf(string, startIndex)\n\n /**\n * Returns the index within this string builder of the last occurrence of the specified [string].\n * The last occurrence of empty string `\"\"` is considered to be at the index equal to `this.length`.\n *\n * Returns `-1` if the specified [string] does not occur in this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun lastIndexOf(string: String): Int = this.string.asDynamic().lastIndexOf(string)\n\n /**\n * Returns the index within this string builder of the last occurrence of the specified [string],\n * starting from the specified [startIndex] toward the beginning.\n *\n * Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun lastIndexOf(string: String, startIndex: Int): Int {\n if (string.isEmpty() && startIndex < 0) return -1\n return this.string.asDynamic().lastIndexOf(string, startIndex)\n }\n\n /**\n * Inserts the string representation of the specified boolean [value] into this string builder at the specified [index] and returns this instance.\n *\n * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,\n * and then that string was inserted into this string builder at the specified [index].\n *\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun insert(index: Int, value: Boolean): StringBuilder {\n AbstractList.checkPositionIndex(index, length)\n\n string = string.substring(0, index) + value + string.substring(index)\n return this\n }\n\n /**\n * Inserts the specified character [value] into this string builder at the specified [index] and returns this instance.\n *\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun insert(index: Int, value: Char): StringBuilder {\n AbstractList.checkPositionIndex(index, length)\n\n string = string.substring(0, index) + value + string.substring(index)\n return this\n }\n\n /**\n * Inserts characters in the specified character array [value] into this string builder at the specified [index] and returns this instance.\n *\n * The inserted characters go in same order as in the [value] character array, starting at [index].\n *\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun insert(index: Int, value: CharArray): StringBuilder {\n AbstractList.checkPositionIndex(index, length)\n\n @OptIn(ExperimentalStdlibApi::class)\n string = string.substring(0, index) + value.concatToString() + string.substring(index)\n return this\n }\n\n /**\n * Inserts characters in the specified character sequence [value] into this string builder at the specified [index] and returns this instance.\n *\n * The inserted characters go in the same order as in the [value] character sequence, starting at [index].\n *\n * @param index the position in this string builder to insert at.\n * @param value the character sequence from which characters are inserted. If [value] is `null`, then the four characters `\"null\"` are inserted.\n *\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun insert(index: Int, value: CharSequence?): StringBuilder {\n AbstractList.checkPositionIndex(index, length)\n\n string = string.substring(0, index) + value.toString() + string.substring(index)\n return this\n }\n\n /**\n * Inserts the string representation of the specified object [value] into this string builder at the specified [index] and returns this instance.\n *\n * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,\n * and then that string was inserted into this string builder at the specified [index].\n *\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun insert(index: Int, value: Any?): StringBuilder {\n AbstractList.checkPositionIndex(index, length)\n\n string = string.substring(0, index) + value.toString() + string.substring(index)\n return this\n }\n\n @Deprecated(\"Provided for binary compatibility.\", level = DeprecationLevel.HIDDEN)\n fun insert(index: Int, value: String): StringBuilder = insert(index, value)\n\n /**\n * Inserts the string [value] into this string builder at the specified [index] and returns this instance.\n *\n * If [value] is `null`, then the four characters `\"null\"` are inserted.\n *\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun insert(index: Int, value: String?): StringBuilder {\n AbstractList.checkPositionIndex(index, length)\n\n val toInsert = value ?: \"null\"\n this.string = this.string.substring(0, index) + toInsert + this.string.substring(index)\n return this\n }\n\n /**\n * Sets the length of this string builder to the specified [newLength].\n *\n * If the [newLength] is less than the current length, it is changed to the specified [newLength].\n * Otherwise, null characters '\\u0000' are appended to this string builder until its length is less than the [newLength].\n *\n * Note that in Kotlin/JS [set] operator function has non-constant execution time complexity.\n * Therefore, increasing length of this string builder and then updating each character by index may slow down your program.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] if [newLength] is less than zero.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun setLength(newLength: Int) {\n if (newLength < 0) {\n throw IllegalArgumentException(\"Negative new length: $newLength.\")\n }\n\n if (newLength <= length) {\n string = string.substring(0, newLength)\n } else {\n for (i in length until newLength) {\n string += '\\u0000'\n }\n }\n }\n\n /**\n * Returns a new [String] that contains characters in this string builder at [startIndex] (inclusive) and up to the [length] (exclusive).\n *\n * @throws IndexOutOfBoundsException if [startIndex] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun substring(startIndex: Int): String {\n AbstractList.checkPositionIndex(startIndex, length)\n\n return string.substring(startIndex)\n }\n\n /**\n * Returns a new [String] that contains characters in this string builder at [startIndex] (inclusive) and up to the [endIndex] (exclusive).\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun substring(startIndex: Int, endIndex: Int): String {\n AbstractList.checkBoundsIndexes(startIndex, endIndex, length)\n\n return string.substring(startIndex, endIndex)\n }\n\n /**\n * Attempts to reduce storage used for this string builder.\n *\n * If the backing storage of this string builder is larger than necessary to hold its current contents,\n * then it may be resized to become more space efficient.\n * Calling this method may, but is not required to, affect the value of the [capacity] property.\n *\n * In Kotlin/JS implementation of StringBuilder the size of the backing storage is always equal to the length of the string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n actual fun trimToSize() {\n }\n\n override fun toString(): String = string\n\n /**\n * Clears the content of this string builder making it empty and returns this instance.\n *\n * @sample samples.text.Strings.clearStringBuilder\n */\n @SinceKotlin(\"1.3\")\n public fun clear(): StringBuilder {\n string = \"\"\n return this\n }\n\n /**\n * Sets the character at the specified [index] to the specified [value].\n *\n * @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n public operator fun set(index: Int, value: Char) {\n AbstractList.checkElementIndex(index, length)\n\n string = string.substring(0, index) + value + string.substring(index + 1)\n }\n\n /**\n * Replaces characters in the specified range of this string builder with characters in the specified string [value] and returns this instance.\n *\n * @param startIndex the beginning (inclusive) of the range to replace.\n * @param endIndex the end (exclusive) of the range to replace.\n * @param value the string to replace with.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] if [startIndex] is less than zero, greater than the length of this string builder, or `startIndex > endIndex`.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n public fun setRange(startIndex: Int, endIndex: Int, value: String): StringBuilder {\n checkReplaceRange(startIndex, endIndex, length)\n\n this.string = this.string.substring(0, startIndex) + value + this.string.substring(endIndex)\n return this\n }\n\n private fun checkReplaceRange(startIndex: Int, endIndex: Int, length: Int) {\n if (startIndex < 0 || startIndex > length) {\n throw IndexOutOfBoundsException(\"startIndex: $startIndex, length: $length\")\n }\n if (startIndex > endIndex) {\n throw IllegalArgumentException(\"startIndex($startIndex) > endIndex($endIndex)\")\n }\n }\n\n /**\n * Removes the character at the specified [index] from this string builder and returns this instance.\n *\n * If the `Char` at the specified [index] is part of a supplementary code point, this method does not remove the entire supplementary character.\n *\n * @param index the index of `Char` to remove.\n *\n * @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n public fun deleteAt(index: Int): StringBuilder {\n AbstractList.checkElementIndex(index, length)\n\n string = string.substring(0, index) + string.substring(index + 1)\n return this\n }\n\n /**\n * Removes characters in the specified range from this string builder and returns this instance.\n *\n * @param startIndex the beginning (inclusive) of the range to remove.\n * @param endIndex the end (exclusive) of the range to remove.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] is out of range of this string builder indices or when `startIndex > endIndex`.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n public fun deleteRange(startIndex: Int, endIndex: Int): StringBuilder {\n checkReplaceRange(startIndex, endIndex, length)\n\n string = string.substring(0, startIndex) + string.substring(endIndex)\n return this\n }\n\n /**\n * Copies characters from this string builder into the [destination] character array.\n *\n * @param destination the array to copy to.\n * @param destinationOffset the position in the array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the range to copy, 0 by default.\n * @param endIndex the end (exclusive) of the range to copy, length of this string builder by default.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n public fun toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length) {\n AbstractList.checkBoundsIndexes(startIndex, endIndex, length)\n AbstractList.checkBoundsIndexes(destinationOffset, destinationOffset + endIndex - startIndex, destination.size)\n\n var dstIndex = destinationOffset\n for (index in startIndex until endIndex) {\n destination[dstIndex++] = string[index]\n }\n }\n\n /**\n * Appends characters in a subarray of the specified character array [value] to this string builder and returns this instance.\n *\n * Characters are appended in order, starting at specified [startIndex].\n *\n * @param value the array from which characters are appended.\n * @param startIndex the beginning (inclusive) of the subarray to append.\n * @param endIndex the end (exclusive) of the subarray to append.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] array indices or when `startIndex > endIndex`.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n public fun appendRange(value: CharArray, startIndex: Int, endIndex: Int): StringBuilder {\n @OptIn(ExperimentalStdlibApi::class)\n string += value.concatToString(startIndex, endIndex)\n return this\n }\n\n /**\n * Appends a subsequence of the specified character sequence [value] to this string builder and returns this instance.\n *\n * @param value the character sequence from which a subsequence is appended.\n * @param startIndex the beginning (inclusive) of the subsequence to append.\n * @param endIndex the end (exclusive) of the subsequence to append.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n public fun appendRange(value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder {\n val stringCsq = value.toString()\n AbstractList.checkBoundsIndexes(startIndex, endIndex, stringCsq.length)\n\n string += stringCsq.substring(startIndex, endIndex)\n return this\n }\n\n /**\n * Inserts characters in a subarray of the specified character array [value] into this string builder at the specified [index] and returns this instance.\n *\n * The inserted characters go in same order as in the [value] array, starting at [index].\n *\n * @param index the position in this string builder to insert at.\n * @param value the array from which characters are inserted.\n * @param startIndex the beginning (inclusive) of the subarray to insert.\n * @param endIndex the end (exclusive) of the subarray to insert.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n public fun insertRange(index: Int, value: CharArray, startIndex: Int, endIndex: Int): StringBuilder {\n AbstractList.checkPositionIndex(index, this.length)\n\n @OptIn(ExperimentalStdlibApi::class)\n string = string.substring(0, index) + value.concatToString(startIndex, endIndex) + string.substring(index)\n return this\n }\n\n /**\n * Inserts characters in a subsequence of the specified character sequence [value] into this string builder at the specified [index] and returns this instance.\n *\n * The inserted characters go in the same order as in the [value] character sequence, starting at [index].\n *\n * @param index the position in this string builder to insert at.\n * @param value the character sequence from which a subsequence is inserted.\n * @param startIndex the beginning (inclusive) of the subsequence to insert.\n * @param endIndex the end (exclusive) of the subsequence to insert.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n public fun insertRange(index: Int, value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder {\n AbstractList.checkPositionIndex(index, length)\n\n val stringCsq = value.toString()\n AbstractList.checkBoundsIndexes(startIndex, endIndex, stringCsq.length)\n\n string = string.substring(0, index) + stringCsq.substring(startIndex, endIndex) + string.substring(index)\n return this\n }\n}\n\n\n/**\n * Clears the content of this string builder making it empty and returns this instance.\n *\n * @sample samples.text.Strings.clearStringBuilder\n */\n@SinceKotlin(\"1.3\")\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"NOTHING_TO_INLINE\")\npublic actual inline fun StringBuilder.clear(): StringBuilder = this.clear()\n\n/**\n * Sets the character at the specified [index] to the specified [value].\n *\n * @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"NOTHING_TO_INLINE\")\npublic actual inline operator fun StringBuilder.set(index: Int, value: Char) = this.set(index, value)\n\n/**\n * Replaces characters in the specified range of this string builder with characters in the specified string [value] and returns this instance.\n *\n * @param startIndex the beginning (inclusive) of the range to replace.\n * @param endIndex the end (exclusive) of the range to replace.\n * @param value the string to replace with.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] if [startIndex] is less than zero, greater than the length of this string builder, or `startIndex > endIndex`.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"NOTHING_TO_INLINE\")\npublic actual inline fun StringBuilder.setRange(startIndex: Int, endIndex: Int, value: String): StringBuilder =\n this.setRange(startIndex, endIndex, value)\n\n/**\n * Removes the character at the specified [index] from this string builder and returns this instance.\n *\n * If the `Char` at the specified [index] is part of a supplementary code point, this method does not remove the entire supplementary character.\n *\n * @param index the index of `Char` to remove.\n *\n * @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"NOTHING_TO_INLINE\")\npublic actual inline fun StringBuilder.deleteAt(index: Int): StringBuilder = this.deleteAt(index)\n\n/**\n * Removes characters in the specified range from this string builder and returns this instance.\n *\n * @param startIndex the beginning (inclusive) of the range to remove.\n * @param endIndex the end (exclusive) of the range to remove.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] is out of range of this string builder indices or when `startIndex > endIndex`.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"NOTHING_TO_INLINE\")\npublic actual inline fun StringBuilder.deleteRange(startIndex: Int, endIndex: Int): StringBuilder = this.deleteRange(startIndex, endIndex)\n\n/**\n * Copies characters from this string builder into the [destination] character array.\n *\n * @param destination the array to copy to.\n * @param destinationOffset the position in the array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the range to copy, 0 by default.\n * @param endIndex the end (exclusive) of the range to copy, length of this string builder by default.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"NOTHING_TO_INLINE\", \"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual inline fun StringBuilder.toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length) =\n this.toCharArray(destination, destinationOffset, startIndex, endIndex)\n\n/**\n * Appends characters in a subarray of the specified character array [value] to this string builder and returns this instance.\n *\n * Characters are appended in order, starting at specified [startIndex].\n *\n * @param value the array from which characters are appended.\n * @param startIndex the beginning (inclusive) of the subarray to append.\n * @param endIndex the end (exclusive) of the subarray to append.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] array indices or when `startIndex > endIndex`.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"NOTHING_TO_INLINE\")\npublic actual inline fun StringBuilder.appendRange(value: CharArray, startIndex: Int, endIndex: Int): StringBuilder =\n this.appendRange(value, startIndex, endIndex)\n\n/**\n * Appends a subsequence of the specified character sequence [value] to this string builder and returns this instance.\n *\n * @param value the character sequence from which a subsequence is appended.\n * @param startIndex the beginning (inclusive) of the subsequence to append.\n * @param endIndex the end (exclusive) of the subsequence to append.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"NOTHING_TO_INLINE\")\npublic actual inline fun StringBuilder.appendRange(value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder =\n this.appendRange(value, startIndex, endIndex)\n\n/**\n * Inserts characters in a subarray of the specified character array [value] into this string builder at the specified [index] and returns this instance.\n *\n * The inserted characters go in same order as in the [value] array, starting at [index].\n *\n * @param index the position in this string builder to insert at.\n * @param value the array from which characters are inserted.\n * @param startIndex the beginning (inclusive) of the subarray to insert.\n * @param endIndex the end (exclusive) of the subarray to insert.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"NOTHING_TO_INLINE\")\npublic actual inline fun StringBuilder.insertRange(index: Int, value: CharArray, startIndex: Int, endIndex: Int): StringBuilder =\n this.insertRange(index, value, startIndex, endIndex)\n\n/**\n * Inserts characters in a subsequence of the specified character sequence [value] into this string builder at the specified [index] and returns this instance.\n *\n * The inserted characters go in the same order as in the [value] character sequence, starting at [index].\n *\n * @param index the position in this string builder to insert at.\n * @param value the character sequence from which a subsequence is inserted.\n * @param startIndex the beginning (inclusive) of the subsequence to insert.\n * @param endIndex the end (exclusive) of the subsequence to insert.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"NOTHING_TO_INLINE\")\npublic actual inline fun StringBuilder.insertRange(index: Int, value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder =\n this.insertRange(index, value, startIndex, endIndex)\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.text\n\n// actually \\s is enough to match all whitespace, but \\xA0 added because of different regexp behavior of Rhino used in Selenium tests\npublic actual fun Char.isWhitespace(): Boolean = toString().matches(\"[\\\\s\\\\xA0]\")\n\n/**\n * Converts this character to lower case using Unicode mapping rules of the invariant locale.\n */\n@OptIn(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic actual inline fun Char.toLowerCase(): Char = lowercaseChar()\n\n/**\n * Converts this character to lower case using Unicode mapping rules of the invariant locale.\n *\n * This function performs one-to-one character mapping.\n * To support one-to-many character mapping use the [lowercase] function.\n * If this character has no mapping equivalent, the character itself is returned.\n *\n * @sample samples.text.Chars.lowercase\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic actual inline fun Char.lowercaseChar(): Char = toString().asDynamic().toLowerCase().charCodeAt(0).unsafeCast().toChar()\n\n/**\n * Converts this character to lower case using Unicode mapping rules of the invariant locale.\n *\n * This function supports one-to-many character mapping, thus the length of the returned string can be greater than one.\n * For example, `'\\u0130'.lowercase()` returns `\"\\u0069\\u0307\"`,\n * where `'\\u0130'` is the LATIN CAPITAL LETTER I WITH DOT ABOVE character (`İ`).\n * If this character has no lower case mapping, the result of `toString()` of this char is returned.\n *\n * @sample samples.text.Chars.lowercase\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic actual inline fun Char.lowercase(): String = toString().asDynamic().toLowerCase() as String\n\n/**\n * Converts this character to upper case using Unicode mapping rules of the invariant locale.\n */\n@OptIn(ExperimentalStdlibApi::class)\n@kotlin.internal.InlineOnly\npublic actual inline fun Char.toUpperCase(): Char = uppercaseChar()\n\n/**\n * Converts this character to upper case using Unicode mapping rules of the invariant locale.\n *\n * This function performs one-to-one character mapping.\n * To support one-to-many character mapping use the [uppercase] function.\n * If this character has no mapping equivalent, the character itself is returned.\n *\n * @sample samples.text.Chars.uppercase\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\npublic actual fun Char.uppercaseChar(): Char {\n val uppercase = uppercase()\n return if (uppercase.length > 1) this else uppercase[0]\n}\n\n/**\n * Converts this character to upper case using Unicode mapping rules of the invariant locale.\n *\n * This function supports one-to-many character mapping, thus the length of the returned string can be greater than one.\n * For example, `'\\uFB00'.uppercase()` returns `\"\\u0046\\u0046\"`,\n * where `'\\uFB00'` is the LATIN SMALL LIGATURE FF character (`ff`).\n * If this character has no upper case mapping, the result of `toString()` of this char is returned.\n *\n * @sample samples.text.Chars.uppercase\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\n@kotlin.internal.InlineOnly\npublic actual inline fun Char.uppercase(): String = toString().asDynamic().toUpperCase() as String\n\n/**\n * Returns `true` if this character is a Unicode high-surrogate code unit (also known as leading-surrogate code unit).\n */\npublic actual fun Char.isHighSurrogate(): Boolean = this in Char.MIN_HIGH_SURROGATE..Char.MAX_HIGH_SURROGATE\n\n/**\n * Returns `true` if this character is a Unicode low-surrogate code unit (also known as trailing-surrogate code unit).\n */\npublic actual fun Char.isLowSurrogate(): Boolean = this in Char.MIN_LOW_SURROGATE..Char.MAX_LOW_SURROGATE\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.text\n\n\n/**\n * Returns `true` if the content of this string is equal to the word \"true\", ignoring case, and `false` otherwise.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\n@kotlin.internal.InlineOnly\npublic actual inline fun String.toBoolean(): Boolean = this.toBoolean()\n\n/**\n * Returns `true` if this string is not `null` and its content is equal to the word \"true\", ignoring case, and `false` otherwise.\n */\n@OptIn(ExperimentalStdlibApi::class)\n@SinceKotlin(\"1.4\")\npublic actual fun String?.toBoolean(): Boolean = this != null && this.lowercase() == \"true\"\n\n/**\n * Parses the string as a signed [Byte] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n */\npublic actual fun String.toByte(): Byte = toByteOrNull() ?: numberFormatError(this)\n\n/**\n * Parses the string as a signed [Byte] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\npublic actual fun String.toByte(radix: Int): Byte = toByteOrNull(radix) ?: numberFormatError(this)\n\n\n/**\n * Parses the string as a [Short] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n */\npublic actual fun String.toShort(): Short = toShortOrNull() ?: numberFormatError(this)\n\n/**\n * Parses the string as a [Short] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\npublic actual fun String.toShort(radix: Int): Short = toShortOrNull(radix) ?: numberFormatError(this)\n\n/**\n * Parses the string as an [Int] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n */\npublic actual fun String.toInt(): Int = toIntOrNull() ?: numberFormatError(this)\n\n/**\n * Parses the string as an [Int] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\npublic actual fun String.toInt(radix: Int): Int = toIntOrNull(radix) ?: numberFormatError(this)\n\n/**\n * Parses the string as a [Long] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n */\npublic actual fun String.toLong(): Long = toLongOrNull() ?: numberFormatError(this)\n\n/**\n * Parses the string as a [Long] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\npublic actual fun String.toLong(radix: Int): Long = toLongOrNull(radix) ?: numberFormatError(this)\n\n/**\n * Parses the string as a [Double] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n */\npublic actual fun String.toDouble(): Double = (+(this.asDynamic())).unsafeCast().also {\n if (it.isNaN() && !this.isNaN() || it == 0.0 && this.isBlank())\n numberFormatError(this)\n}\n\n/**\n * Parses the string as a [Float] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n */\n@kotlin.internal.InlineOnly\npublic actual inline fun String.toFloat(): Float = toDouble().unsafeCast()\n\n/**\n * Parses the string as a [Double] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n */\npublic actual fun String.toDoubleOrNull(): Double? = (+(this.asDynamic())).unsafeCast().takeIf {\n !(it.isNaN() && !this.isNaN() || it == 0.0 && this.isBlank())\n}\n\n/**\n * Parses the string as a [Float] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n */\n@kotlin.internal.InlineOnly\npublic actual inline fun String.toFloatOrNull(): Float? = toDoubleOrNull().unsafeCast()\n\n/**\n * Returns a string representation of this [Byte] value in the specified [radix].\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.\n */\n@SinceKotlin(\"1.2\")\n@kotlin.internal.InlineOnly\npublic actual inline fun Byte.toString(radix: Int): String = this.toInt().toString(radix)\n\n/**\n * Returns a string representation of this [Short] value in the specified [radix].\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.\n */\n@SinceKotlin(\"1.2\")\n@kotlin.internal.InlineOnly\npublic actual inline fun Short.toString(radix: Int): String = this.toInt().toString(radix)\n\n/**\n * Returns a string representation of this [Int] value in the specified [radix].\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.\n */\n@SinceKotlin(\"1.2\")\npublic actual fun Int.toString(radix: Int): String = asDynamic().toString(checkRadix(radix))\n\n@OptIn(ExperimentalStdlibApi::class)\nprivate fun String.isNaN(): Boolean = when (this.lowercase()) {\n \"nan\", \"+nan\", \"-nan\" -> true\n else -> false\n}\n\n/**\n * Checks whether the given [radix] is valid radix for string to number and number to string conversion.\n */\n@PublishedApi\ninternal actual fun checkRadix(radix: Int): Int {\n if (radix !in 2..36) {\n throw IllegalArgumentException(\"radix $radix was not in valid range 2..36\")\n }\n return radix\n}\n\ninternal actual fun digitOf(char: Char, radix: Int): Int = when {\n char >= '0' && char <= '9' -> char - '0'\n char >= 'A' && char <= 'Z' -> char - 'A' + 10\n char >= 'a' && char <= 'z' -> char - 'a' + 10\n else -> -1\n}.let { if (it >= radix) -1 else it }\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.text\n\nimport kotlin.js.RegExp\n\n/**\n * Provides enumeration values to use to set regular expression options.\n */\npublic actual enum class RegexOption(val value: String) {\n /** Enables case-insensitive matching. */\n IGNORE_CASE(\"i\"),\n /** Enables multiline mode.\n *\n * In multiline mode the expressions `^` and `$` match just after or just before,\n * respectively, a line terminator or the end of the input sequence. */\n MULTILINE(\"m\")\n}\n\n\n/**\n * Represents the results from a single capturing group within a [MatchResult] of [Regex].\n *\n * @param value The value of captured group.\n */\npublic actual data class MatchGroup(actual val value: String)\n\n\n/**\n * Represents a compiled regular expression.\n * Provides functions to match strings in text with a pattern, replace the found occurrences and split text around matches.\n *\n * For pattern syntax reference see [MDN RegExp](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Special_characters_meaning_in_regular_expressions)\n * and [http://www.w3schools.com/jsref/jsref_obj_regexp.asp](https://www.w3schools.com/jsref/jsref_obj_regexp.asp).\n *\n * @constructor Creates a regular expression from the specified [pattern] string and the specified set of [options].\n */\npublic actual class Regex actual constructor(pattern: String, options: Set) {\n\n /** Creates a regular expression from the specified [pattern] string and the specified single [option]. */\n public actual constructor(pattern: String, option: RegexOption) : this(pattern, setOf(option))\n\n /** Creates a regular expression from the specified [pattern] string and the default options. */\n public actual constructor(pattern: String) : this(pattern, emptySet())\n\n\n /** The pattern string of this regular expression. */\n public actual val pattern: String = pattern\n /** The set of options that were used to create this regular expression. */\n public actual val options: Set = options.toSet()\n private val nativePattern: RegExp = RegExp(pattern, options.map { it.value }.joinToString(separator = \"\") + \"g\")\n\n /** Indicates whether the regular expression matches the entire [input]. */\n public actual infix fun matches(input: CharSequence): Boolean {\n nativePattern.reset()\n val match = nativePattern.exec(input.toString())\n return match != null && match.index == 0 && nativePattern.lastIndex == input.length\n }\n\n /** Indicates whether the regular expression can find at least one match in the specified [input]. */\n public actual fun containsMatchIn(input: CharSequence): Boolean {\n nativePattern.reset()\n return nativePattern.test(input.toString())\n }\n\n /** Returns the first match of a regular expression in the [input], beginning at the specified [startIndex].\n *\n * @param startIndex An index to start search with, by default 0. Must be not less than zero and not greater than `input.length()`\n * @return An instance of [MatchResult] if match was found or `null` otherwise.\n * @throws IndexOutOfBoundsException if [startIndex] is less than zero or greater than the length of the [input] char sequence.\n */\n @Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\n public actual fun find(input: CharSequence, startIndex: Int = 0): MatchResult? {\n if (startIndex < 0 || startIndex > input.length) {\n throw IndexOutOfBoundsException(\"Start index out of bounds: $startIndex, input length: ${input.length}\")\n }\n return nativePattern.findNext(input.toString(), startIndex)\n }\n\n /**\n * Returns a sequence of all occurrences of a regular expression within the [input] string, beginning at the specified [startIndex].\n *\n * @throws IndexOutOfBoundsException if [startIndex] is less than zero or greater than the length of the [input] char sequence.\n *\n * @sample samples.text.Regexps.findAll\n */\n @Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\n public actual fun findAll(input: CharSequence, startIndex: Int = 0): Sequence {\n if (startIndex < 0 || startIndex > input.length) {\n throw IndexOutOfBoundsException(\"Start index out of bounds: $startIndex, input length: ${input.length}\")\n }\n return generateSequence({ find(input, startIndex) }, { match -> match.next() })\n }\n\n /**\n * Attempts to match the entire [input] CharSequence against the pattern.\n *\n * @return An instance of [MatchResult] if the entire input matches or `null` otherwise.\n */\n public actual fun matchEntire(input: CharSequence): MatchResult? {\n if (pattern.startsWith('^') && pattern.endsWith('$'))\n return find(input)\n else\n return Regex(\"^${pattern.trimStart('^').trimEnd('$')}$\", options).find(input)\n }\n\n /**\n * Replaces all occurrences of this regular expression in the specified [input] string with specified [replacement] expression.\n *\n * @param replacement A replacement expression that can include substitutions. See [String.prototype.replace](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) function docs for details.\n */\n public actual fun replace(input: CharSequence, replacement: String): String = input.toString().nativeReplace(nativePattern, replacement)\n\n /**\n * Replaces all occurrences of this regular expression in the specified [input] string with the result of\n * the given function [transform] that takes [MatchResult] and returns a string to be used as a\n * replacement for that match.\n */\n public actual inline fun replace(input: CharSequence, transform: (MatchResult) -> CharSequence): String {\n var match = find(input)\n if (match == null) return input.toString()\n\n var lastStart = 0\n val length = input.length\n val sb = StringBuilder(length)\n do {\n val foundMatch = match!!\n sb.append(input, lastStart, foundMatch.range.start)\n sb.append(transform(foundMatch))\n lastStart = foundMatch.range.endInclusive + 1\n match = foundMatch.next()\n } while (lastStart < length && match != null)\n\n if (lastStart < length) {\n sb.append(input, lastStart, length)\n }\n\n return sb.toString()\n }\n\n /**\n * Replaces the first occurrence of this regular expression in the specified [input] string with specified [replacement] expression.\n *\n * @param replacement A replacement expression that can include substitutions. See [String.prototype.replace](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace) function docs for details.\n */\n public actual fun replaceFirst(input: CharSequence, replacement: String): String {\n val nonGlobalOptions = options.map { it.value }.joinToString(separator = \"\")\n return input.toString().nativeReplace(RegExp(pattern, nonGlobalOptions), replacement)\n }\n\n /**\n * Splits the [input] CharSequence around matches of this regular expression.\n *\n * @param limit Non-negative value specifying the maximum number of substrings the string can be split to.\n * Zero by default means no limit is set.\n */\n @Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\n public actual fun split(input: CharSequence, limit: Int = 0): List {\n require(limit >= 0) { \"Limit must be non-negative, but was $limit\" }\n val matches = findAll(input).let { if (limit == 0) it else it.take(limit - 1) }\n val result = mutableListOf()\n var lastStart = 0\n\n for (match in matches) {\n result.add(input.subSequence(lastStart, match.range.start).toString())\n lastStart = match.range.endInclusive + 1\n }\n result.add(input.subSequence(lastStart, input.length).toString())\n return result\n }\n\n\n /**\n * Returns the string representation of this regular expression, namely the [pattern] of this regular expression.\n *\n * Note that another regular expression constructed from the same pattern string may have different [options]\n * and may match strings differently.\n */\n public override fun toString(): String = nativePattern.toString()\n\n actual companion object {\n /**\n * Returns a regular expression that matches the specified [literal] string literally.\n * No characters of that string will have special meaning when searching for an occurrence of the regular expression.\n */\n public actual fun fromLiteral(literal: String): Regex = Regex(escape(literal))\n\n /**\n * Returns a regular expression pattern string that matches the specified [literal] string literally.\n * No characters of that string will have special meaning when searching for an occurrence of the regular expression.\n */\n public actual fun escape(literal: String): String = literal.nativeReplace(patternEscape, \"\\\\$&\")\n\n /**\n * Returns a literal replacement expression for the specified [literal] string.\n * No characters of that string will have special meaning when it is used as a replacement string in [Regex.replace] function.\n */\n public actual fun escapeReplacement(literal: String): String = literal.nativeReplace(replacementEscape, \"$$$$\")\n\n private val patternEscape = RegExp(\"\"\"[-\\\\^$*+?.()|[\\]{}]\"\"\", \"g\")\n private val replacementEscape = RegExp(\"\"\"\\$\"\"\", \"g\")\n }\n}\n\n/** Creates a regular expression from the specified [pattern] string and the specified single [option]. */\n@Deprecated(\"Provided for binary compatibility\", level = DeprecationLevel.HIDDEN)\n@JsName(\"Regex_sb3q2\\$\")\npublic fun Regex_0(pattern: String, option: RegexOption): Regex = Regex(pattern, setOf(option))\n\n/** Creates a regular expression from the specified [pattern] string and the default options. */\n@Deprecated(\"Provided for binary compatibility\", level = DeprecationLevel.HIDDEN)\n@JsName(\"Regex_61zpoe\\$\")\npublic fun Regex_1(pattern: String): Regex = Regex(pattern, emptySet())\n\n\n\n\nprivate fun RegExp.findNext(input: String, from: Int): MatchResult? {\n this.lastIndex = from\n val match = exec(input)\n if (match == null) return null\n val range = match.index..lastIndex - 1\n\n return object : MatchResult {\n override val range: IntRange = range\n override val value: String\n get() = match[0]!!\n\n override val groups: MatchGroupCollection = object : MatchGroupCollection, AbstractCollection() {\n override val size: Int get() = match.length\n override fun iterator(): Iterator = indices.asSequence().map { this[it] }.iterator()\n override fun get(index: Int): MatchGroup? = match[index]?.let { MatchGroup(it) }\n }\n\n\n private var groupValues_: List? = null\n\n override val groupValues: List\n get() {\n if (groupValues_ == null) {\n groupValues_ = object : AbstractList() {\n override val size: Int get() = match.length\n override fun get(index: Int): String = match[index] ?: \"\"\n }\n }\n return groupValues_!!\n }\n\n override fun next(): MatchResult? = this@findNext.findNext(input, if (range.isEmpty()) range.start + 1 else range.endInclusive + 1)\n }\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"StringsKt\")\n\npackage kotlin.text\n\nimport kotlin.contracts.contract\nimport kotlin.jvm.JvmName\n\n/**\n * Returns a copy of this string converted to upper case using the rules of the default locale.\n */\npublic expect fun String.toUpperCase(): String\n\n/**\n * Returns a copy of this string converted to upper case using Unicode mapping rules of the invariant locale.\n *\n * This function supports one-to-many and many-to-one character mapping,\n * thus the length of the returned string can be different from the length of the original string.\n *\n * @sample samples.text.Strings.uppercase\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\npublic expect fun String.uppercase(): String\n\n/**\n * Returns a copy of this string converted to lower case using the rules of the default locale.\n */\npublic expect fun String.toLowerCase(): String\n\n/**\n * Returns a copy of this string converted to lower case using Unicode mapping rules of the invariant locale.\n *\n * This function supports one-to-many and many-to-one character mapping,\n * thus the length of the returned string can be different from the length of the original string.\n *\n * @sample samples.text.Strings.lowercase\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\npublic expect fun String.lowercase(): String\n\n/**\n * Returns a copy of this string having its first letter titlecased using the rules of the default locale,\n * or the original string if it's empty or already starts with a title case letter.\n *\n * The title case of a character is usually the same as its upper case with several exceptions.\n * The particular list of characters with the special title case form depends on the underlying platform.\n *\n * @sample samples.text.Strings.capitalize\n */\npublic expect fun String.capitalize(): String\n\n/**\n * Returns a copy of this string having its first letter lowercased using the rules of the default locale,\n * or the original string if it's empty or already starts with a lower case letter.\n *\n * @sample samples.text.Strings.decapitalize\n */\npublic expect fun String.decapitalize(): String\n\n/**\n * Returns a sub sequence of this char sequence having leading and trailing characters matching the [predicate] removed.\n */\npublic inline fun CharSequence.trim(predicate: (Char) -> Boolean): CharSequence {\n var startIndex = 0\n var endIndex = length - 1\n var startFound = false\n\n while (startIndex <= endIndex) {\n val index = if (!startFound) startIndex else endIndex\n val match = predicate(this[index])\n\n if (!startFound) {\n if (!match)\n startFound = true\n else\n startIndex += 1\n } else {\n if (!match)\n break\n else\n endIndex -= 1\n }\n }\n\n return subSequence(startIndex, endIndex + 1)\n}\n\n/**\n * Returns a string having leading and trailing characters matching the [predicate] removed.\n */\npublic inline fun String.trim(predicate: (Char) -> Boolean): String =\n (this as CharSequence).trim(predicate).toString()\n\n/**\n * Returns a sub sequence of this char sequence having leading characters matching the [predicate] removed.\n */\npublic inline fun CharSequence.trimStart(predicate: (Char) -> Boolean): CharSequence {\n for (index in this.indices)\n if (!predicate(this[index]))\n return subSequence(index, length)\n\n return \"\"\n}\n\n/**\n * Returns a string having leading characters matching the [predicate] removed.\n */\npublic inline fun String.trimStart(predicate: (Char) -> Boolean): String =\n (this as CharSequence).trimStart(predicate).toString()\n\n/**\n * Returns a sub sequence of this char sequence having trailing characters matching the [predicate] removed.\n */\npublic inline fun CharSequence.trimEnd(predicate: (Char) -> Boolean): CharSequence {\n for (index in this.indices.reversed())\n if (!predicate(this[index]))\n return subSequence(0, index + 1)\n\n return \"\"\n}\n\n/**\n * Returns a string having trailing characters matching the [predicate] removed.\n */\npublic inline fun String.trimEnd(predicate: (Char) -> Boolean): String =\n (this as CharSequence).trimEnd(predicate).toString()\n\n/**\n * Returns a sub sequence of this char sequence having leading and trailing characters from the [chars] array removed.\n */\npublic fun CharSequence.trim(vararg chars: Char): CharSequence = trim { it in chars }\n\n/**\n * Returns a string having leading and trailing characters from the [chars] array removed.\n */\npublic fun String.trim(vararg chars: Char): String = trim { it in chars }\n\n/**\n * Returns a sub sequence of this char sequence having leading characters from the [chars] array removed.\n */\npublic fun CharSequence.trimStart(vararg chars: Char): CharSequence = trimStart { it in chars }\n\n/**\n * Returns a string having leading characters from the [chars] array removed.\n */\npublic fun String.trimStart(vararg chars: Char): String = trimStart { it in chars }\n\n/**\n * Returns a sub sequence of this char sequence having trailing characters from the [chars] array removed.\n */\npublic fun CharSequence.trimEnd(vararg chars: Char): CharSequence = trimEnd { it in chars }\n\n/**\n * Returns a string having trailing characters from the [chars] array removed.\n */\npublic fun String.trimEnd(vararg chars: Char): String = trimEnd { it in chars }\n\n/**\n * Returns a sub sequence of this char sequence having leading and trailing whitespace removed.\n */\npublic fun CharSequence.trim(): CharSequence = trim(Char::isWhitespace)\n\n/**\n * Returns a string having leading and trailing whitespace removed.\n */\n@kotlin.internal.InlineOnly\npublic inline fun String.trim(): String = (this as CharSequence).trim().toString()\n\n/**\n * Returns a sub sequence of this char sequence having leading whitespace removed.\n */\npublic fun CharSequence.trimStart(): CharSequence = trimStart(Char::isWhitespace)\n\n/**\n * Returns a string having leading whitespace removed.\n */\n@kotlin.internal.InlineOnly\npublic inline fun String.trimStart(): String = (this as CharSequence).trimStart().toString()\n\n/**\n * Returns a sub sequence of this char sequence having trailing whitespace removed.\n */\npublic fun CharSequence.trimEnd(): CharSequence = trimEnd(Char::isWhitespace)\n\n/**\n * Returns a string having trailing whitespace removed.\n */\n@kotlin.internal.InlineOnly\npublic inline fun String.trimEnd(): String = (this as CharSequence).trimEnd().toString()\n\n/**\n * Returns a char sequence with content of this char sequence padded at the beginning\n * to the specified [length] with the specified character or space.\n *\n * @param length the desired string length.\n * @param padChar the character to pad string with, if it has length less than the [length] specified. Space is used by default.\n * @return Returns a char sequence of length at least [length] consisting of `this` char sequence prepended with [padChar] as many times\n * as are necessary to reach that length.\n * @sample samples.text.Strings.padStart\n */\npublic fun CharSequence.padStart(length: Int, padChar: Char = ' '): CharSequence {\n if (length < 0)\n throw IllegalArgumentException(\"Desired length $length is less than zero.\")\n if (length <= this.length)\n return this.subSequence(0, this.length)\n\n val sb = StringBuilder(length)\n for (i in 1..(length - this.length))\n sb.append(padChar)\n sb.append(this)\n return sb\n}\n\n/**\n * Pads the string to the specified [length] at the beginning with the specified character or space.\n *\n * @param length the desired string length.\n * @param padChar the character to pad string with, if it has length less than the [length] specified. Space is used by default.\n * @return Returns a string of length at least [length] consisting of `this` string prepended with [padChar] as many times\n * as are necessary to reach that length.\n * @sample samples.text.Strings.padStart\n */\npublic fun String.padStart(length: Int, padChar: Char = ' '): String =\n (this as CharSequence).padStart(length, padChar).toString()\n\n/**\n * Returns a char sequence with content of this char sequence padded at the end\n * to the specified [length] with the specified character or space.\n *\n * @param length the desired string length.\n * @param padChar the character to pad string with, if it has length less than the [length] specified. Space is used by default.\n * @return Returns a char sequence of length at least [length] consisting of `this` char sequence appended with [padChar] as many times\n * as are necessary to reach that length.\n * @sample samples.text.Strings.padEnd\n */\npublic fun CharSequence.padEnd(length: Int, padChar: Char = ' '): CharSequence {\n if (length < 0)\n throw IllegalArgumentException(\"Desired length $length is less than zero.\")\n if (length <= this.length)\n return this.subSequence(0, this.length)\n\n val sb = StringBuilder(length)\n sb.append(this)\n for (i in 1..(length - this.length))\n sb.append(padChar)\n return sb\n}\n\n/**\n * Pads the string to the specified [length] at the end with the specified character or space.\n *\n * @param length the desired string length.\n * @param padChar the character to pad string with, if it has length less than the [length] specified. Space is used by default.\n * @return Returns a string of length at least [length] consisting of `this` string appended with [padChar] as many times\n * as are necessary to reach that length.\n * @sample samples.text.Strings.padEnd\n */\npublic fun String.padEnd(length: Int, padChar: Char = ' '): String =\n (this as CharSequence).padEnd(length, padChar).toString()\n\n/**\n * Returns `true` if this nullable char sequence is either `null` or empty.\n *\n * @sample samples.text.Strings.stringIsNullOrEmpty\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence?.isNullOrEmpty(): Boolean {\n contract {\n returns(false) implies (this@isNullOrEmpty != null)\n }\n\n return this == null || this.length == 0\n}\n\n/**\n * Returns `true` if this char sequence is empty (contains no characters).\n *\n * @sample samples.text.Strings.stringIsEmpty\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.isEmpty(): Boolean = length == 0\n\n/**\n * Returns `true` if this char sequence is not empty.\n *\n * @sample samples.text.Strings.stringIsNotEmpty\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.isNotEmpty(): Boolean = length > 0\n\n// implemented differently in JVM and JS\n//public fun String.isBlank(): Boolean = length() == 0 || all { it.isWhitespace() }\n\n\n/**\n * Returns `true` if this char sequence is not empty and contains some characters except of whitespace characters.\n *\n * @sample samples.text.Strings.stringIsNotBlank\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.isNotBlank(): Boolean = !isBlank()\n\n/**\n * Returns `true` if this nullable char sequence is either `null` or empty or consists solely of whitespace characters.\n *\n * @sample samples.text.Strings.stringIsNullOrBlank\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence?.isNullOrBlank(): Boolean {\n contract {\n returns(false) implies (this@isNullOrBlank != null)\n }\n\n return this == null || this.isBlank()\n}\n\n/**\n * Iterator for characters of the given char sequence.\n */\npublic operator fun CharSequence.iterator(): CharIterator = object : CharIterator() {\n private var index = 0\n\n public override fun nextChar(): Char = get(index++)\n\n public override fun hasNext(): Boolean = index < length\n}\n\n/** Returns the string if it is not `null`, or the empty string otherwise. */\n@kotlin.internal.InlineOnly\npublic inline fun String?.orEmpty(): String = this ?: \"\"\n\n/**\n * Returns this char sequence if it's not empty\n * or the result of calling [defaultValue] function if the char sequence is empty.\n *\n * @sample samples.text.Strings.stringIfEmpty\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun C.ifEmpty(defaultValue: () -> R): R where C : CharSequence, C : R =\n if (isEmpty()) defaultValue() else this\n\n/**\n * Returns this char sequence if it is not empty and doesn't consist solely of whitespace characters,\n * or the result of calling [defaultValue] function otherwise.\n *\n * @sample samples.text.Strings.stringIfBlank\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline fun C.ifBlank(defaultValue: () -> R): R where C : CharSequence, C : R =\n if (isBlank()) defaultValue() else this\n\n/**\n * Returns the range of valid character indices for this char sequence.\n */\npublic val CharSequence.indices: IntRange\n get() = 0..length - 1\n\n/**\n * Returns the index of the last character in the char sequence or -1 if it is empty.\n */\npublic val CharSequence.lastIndex: Int\n get() = this.length - 1\n\n/**\n * Returns `true` if this CharSequence has Unicode surrogate pair at the specified [index].\n */\npublic fun CharSequence.hasSurrogatePairAt(index: Int): Boolean {\n return index in 0..length - 2\n && this[index].isHighSurrogate()\n && this[index + 1].isLowSurrogate()\n}\n\n/**\n * Returns a substring specified by the given [range] of indices.\n */\npublic fun String.substring(range: IntRange): String = substring(range.start, range.endInclusive + 1)\n\n/**\n * Returns a subsequence of this char sequence specified by the given [range] of indices.\n */\npublic fun CharSequence.subSequence(range: IntRange): CharSequence = subSequence(range.start, range.endInclusive + 1)\n\n/**\n * Returns a subsequence of this char sequence.\n *\n * This extension is chosen only for invocation with old-named parameters.\n * Replace parameter names with the same as those of [CharSequence.subSequence].\n */\n@kotlin.internal.InlineOnly\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\") // false warning\n@Deprecated(\"Use parameters named startIndex and endIndex.\", ReplaceWith(\"subSequence(startIndex = start, endIndex = end)\"))\npublic inline fun String.subSequence(start: Int, end: Int): CharSequence = subSequence(start, end)\n\n/**\n * Returns a substring of chars from a range of this char sequence starting at the [startIndex] and ending right before the [endIndex].\n *\n * @param startIndex the start index (inclusive).\n * @param endIndex the end index (exclusive). If not specified, the length of the char sequence is used.\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.substring(startIndex: Int, endIndex: Int = length): String = subSequence(startIndex, endIndex).toString()\n\n/**\n * Returns a substring of chars at indices from the specified [range] of this char sequence.\n */\npublic fun CharSequence.substring(range: IntRange): String = subSequence(range.start, range.endInclusive + 1).toString()\n\n/**\n * Returns a substring before the first occurrence of [delimiter].\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.substringBefore(delimiter: Char, missingDelimiterValue: String = this): String {\n val index = indexOf(delimiter)\n return if (index == -1) missingDelimiterValue else substring(0, index)\n}\n\n/**\n * Returns a substring before the first occurrence of [delimiter].\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.substringBefore(delimiter: String, missingDelimiterValue: String = this): String {\n val index = indexOf(delimiter)\n return if (index == -1) missingDelimiterValue else substring(0, index)\n}\n\n/**\n * Returns a substring after the first occurrence of [delimiter].\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.substringAfter(delimiter: Char, missingDelimiterValue: String = this): String {\n val index = indexOf(delimiter)\n return if (index == -1) missingDelimiterValue else substring(index + 1, length)\n}\n\n/**\n * Returns a substring after the first occurrence of [delimiter].\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.substringAfter(delimiter: String, missingDelimiterValue: String = this): String {\n val index = indexOf(delimiter)\n return if (index == -1) missingDelimiterValue else substring(index + delimiter.length, length)\n}\n\n/**\n * Returns a substring before the last occurrence of [delimiter].\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.substringBeforeLast(delimiter: Char, missingDelimiterValue: String = this): String {\n val index = lastIndexOf(delimiter)\n return if (index == -1) missingDelimiterValue else substring(0, index)\n}\n\n/**\n * Returns a substring before the last occurrence of [delimiter].\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.substringBeforeLast(delimiter: String, missingDelimiterValue: String = this): String {\n val index = lastIndexOf(delimiter)\n return if (index == -1) missingDelimiterValue else substring(0, index)\n}\n\n/**\n * Returns a substring after the last occurrence of [delimiter].\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.substringAfterLast(delimiter: Char, missingDelimiterValue: String = this): String {\n val index = lastIndexOf(delimiter)\n return if (index == -1) missingDelimiterValue else substring(index + 1, length)\n}\n\n/**\n * Returns a substring after the last occurrence of [delimiter].\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.substringAfterLast(delimiter: String, missingDelimiterValue: String = this): String {\n val index = lastIndexOf(delimiter)\n return if (index == -1) missingDelimiterValue else substring(index + delimiter.length, length)\n}\n\n/**\n * Returns a char sequence with content of this char sequence where its part at the given range\n * is replaced with the [replacement] char sequence.\n * @param startIndex the index of the first character to be replaced.\n * @param endIndex the index of the first character after the replacement to keep in the string.\n */\n@OptIn(ExperimentalStdlibApi::class)\npublic fun CharSequence.replaceRange(startIndex: Int, endIndex: Int, replacement: CharSequence): CharSequence {\n if (endIndex < startIndex)\n throw IndexOutOfBoundsException(\"End index ($endIndex) is less than start index ($startIndex).\")\n val sb = StringBuilder()\n sb.appendRange(this, 0, startIndex)\n sb.append(replacement)\n sb.appendRange(this, endIndex, length)\n return sb\n}\n\n/**\n * Replaces the part of the string at the given range with the [replacement] char sequence.\n * @param startIndex the index of the first character to be replaced.\n * @param endIndex the index of the first character after the replacement to keep in the string.\n */\n@kotlin.internal.InlineOnly\npublic inline fun String.replaceRange(startIndex: Int, endIndex: Int, replacement: CharSequence): String =\n (this as CharSequence).replaceRange(startIndex, endIndex, replacement).toString()\n\n/**\n * Returns a char sequence with content of this char sequence where its part at the given [range]\n * is replaced with the [replacement] char sequence.\n *\n * The end index of the [range] is included in the part to be replaced.\n */\npublic fun CharSequence.replaceRange(range: IntRange, replacement: CharSequence): CharSequence =\n replaceRange(range.start, range.endInclusive + 1, replacement)\n\n/**\n * Replace the part of string at the given [range] with the [replacement] string.\n *\n * The end index of the [range] is included in the part to be replaced.\n */\n@kotlin.internal.InlineOnly\npublic inline fun String.replaceRange(range: IntRange, replacement: CharSequence): String =\n (this as CharSequence).replaceRange(range, replacement).toString()\n\n/**\n * Returns a char sequence with content of this char sequence where its part at the given range is removed.\n *\n * @param startIndex the index of the first character to be removed.\n * @param endIndex the index of the first character after the removed part to keep in the string.\n *\n * [endIndex] is not included in the removed part.\n */\n@OptIn(ExperimentalStdlibApi::class)\npublic fun CharSequence.removeRange(startIndex: Int, endIndex: Int): CharSequence {\n if (endIndex < startIndex)\n throw IndexOutOfBoundsException(\"End index ($endIndex) is less than start index ($startIndex).\")\n\n if (endIndex == startIndex)\n return this.subSequence(0, length)\n\n val sb = StringBuilder(length - (endIndex - startIndex))\n sb.appendRange(this, 0, startIndex)\n sb.appendRange(this, endIndex, length)\n return sb\n}\n\n/**\n * Removes the part of a string at a given range.\n * @param startIndex the index of the first character to be removed.\n * @param endIndex the index of the first character after the removed part to keep in the string.\n *\n * [endIndex] is not included in the removed part.\n */\n@kotlin.internal.InlineOnly\npublic inline fun String.removeRange(startIndex: Int, endIndex: Int): String =\n (this as CharSequence).removeRange(startIndex, endIndex).toString()\n\n/**\n * Returns a char sequence with content of this char sequence where its part at the given [range] is removed.\n *\n * The end index of the [range] is included in the removed part.\n */\npublic fun CharSequence.removeRange(range: IntRange): CharSequence = removeRange(range.start, range.endInclusive + 1)\n\n/**\n * Removes the part of a string at the given [range].\n *\n * The end index of the [range] is included in the removed part.\n */\n@kotlin.internal.InlineOnly\npublic inline fun String.removeRange(range: IntRange): String =\n (this as CharSequence).removeRange(range).toString()\n\n/**\n * If this char sequence starts with the given [prefix], returns a new char sequence\n * with the prefix removed. Otherwise, returns a new char sequence with the same characters.\n */\npublic fun CharSequence.removePrefix(prefix: CharSequence): CharSequence {\n if (startsWith(prefix)) {\n return subSequence(prefix.length, length)\n }\n return subSequence(0, length)\n}\n\n/**\n * If this string starts with the given [prefix], returns a copy of this string\n * with the prefix removed. Otherwise, returns this string.\n */\npublic fun String.removePrefix(prefix: CharSequence): String {\n if (startsWith(prefix)) {\n return substring(prefix.length)\n }\n return this\n}\n\n/**\n * If this char sequence ends with the given [suffix], returns a new char sequence\n * with the suffix removed. Otherwise, returns a new char sequence with the same characters.\n */\npublic fun CharSequence.removeSuffix(suffix: CharSequence): CharSequence {\n if (endsWith(suffix)) {\n return subSequence(0, length - suffix.length)\n }\n return subSequence(0, length)\n}\n\n/**\n * If this string ends with the given [suffix], returns a copy of this string\n * with the suffix removed. Otherwise, returns this string.\n */\npublic fun String.removeSuffix(suffix: CharSequence): String {\n if (endsWith(suffix)) {\n return substring(0, length - suffix.length)\n }\n return this\n}\n\n/**\n * When this char sequence starts with the given [prefix] and ends with the given [suffix],\n * returns a new char sequence having both the given [prefix] and [suffix] removed.\n * Otherwise returns a new char sequence with the same characters.\n */\npublic fun CharSequence.removeSurrounding(prefix: CharSequence, suffix: CharSequence): CharSequence {\n if ((length >= prefix.length + suffix.length) && startsWith(prefix) && endsWith(suffix)) {\n return subSequence(prefix.length, length - suffix.length)\n }\n return subSequence(0, length)\n}\n\n/**\n * Removes from a string both the given [prefix] and [suffix] if and only if\n * it starts with the [prefix] and ends with the [suffix].\n * Otherwise returns this string unchanged.\n */\npublic fun String.removeSurrounding(prefix: CharSequence, suffix: CharSequence): String {\n if ((length >= prefix.length + suffix.length) && startsWith(prefix) && endsWith(suffix)) {\n return substring(prefix.length, length - suffix.length)\n }\n return this\n}\n\n/**\n * When this char sequence starts with and ends with the given [delimiter],\n * returns a new char sequence having this [delimiter] removed both from the start and end.\n * Otherwise returns a new char sequence with the same characters.\n */\npublic fun CharSequence.removeSurrounding(delimiter: CharSequence): CharSequence = removeSurrounding(delimiter, delimiter)\n\n/**\n * Removes the given [delimiter] string from both the start and the end of this string\n * if and only if it starts with and ends with the [delimiter].\n * Otherwise returns this string unchanged.\n */\npublic fun String.removeSurrounding(delimiter: CharSequence): String = removeSurrounding(delimiter, delimiter)\n\n/**\n * Replace part of string before the first occurrence of given delimiter with the [replacement] string.\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.replaceBefore(delimiter: Char, replacement: String, missingDelimiterValue: String = this): String {\n val index = indexOf(delimiter)\n return if (index == -1) missingDelimiterValue else replaceRange(0, index, replacement)\n}\n\n/**\n * Replace part of string before the first occurrence of given delimiter with the [replacement] string.\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.replaceBefore(delimiter: String, replacement: String, missingDelimiterValue: String = this): String {\n val index = indexOf(delimiter)\n return if (index == -1) missingDelimiterValue else replaceRange(0, index, replacement)\n}\n\n/**\n * Replace part of string after the first occurrence of given delimiter with the [replacement] string.\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.replaceAfter(delimiter: Char, replacement: String, missingDelimiterValue: String = this): String {\n val index = indexOf(delimiter)\n return if (index == -1) missingDelimiterValue else replaceRange(index + 1, length, replacement)\n}\n\n/**\n * Replace part of string after the first occurrence of given delimiter with the [replacement] string.\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.replaceAfter(delimiter: String, replacement: String, missingDelimiterValue: String = this): String {\n val index = indexOf(delimiter)\n return if (index == -1) missingDelimiterValue else replaceRange(index + delimiter.length, length, replacement)\n}\n\n/**\n * Replace part of string after the last occurrence of given delimiter with the [replacement] string.\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.replaceAfterLast(delimiter: String, replacement: String, missingDelimiterValue: String = this): String {\n val index = lastIndexOf(delimiter)\n return if (index == -1) missingDelimiterValue else replaceRange(index + delimiter.length, length, replacement)\n}\n\n/**\n * Replace part of string after the last occurrence of given delimiter with the [replacement] string.\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.replaceAfterLast(delimiter: Char, replacement: String, missingDelimiterValue: String = this): String {\n val index = lastIndexOf(delimiter)\n return if (index == -1) missingDelimiterValue else replaceRange(index + 1, length, replacement)\n}\n\n/**\n * Replace part of string before the last occurrence of given delimiter with the [replacement] string.\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.replaceBeforeLast(delimiter: Char, replacement: String, missingDelimiterValue: String = this): String {\n val index = lastIndexOf(delimiter)\n return if (index == -1) missingDelimiterValue else replaceRange(0, index, replacement)\n}\n\n/**\n * Replace part of string before the last occurrence of given delimiter with the [replacement] string.\n * If the string does not contain the delimiter, returns [missingDelimiterValue] which defaults to the original string.\n */\npublic fun String.replaceBeforeLast(delimiter: String, replacement: String, missingDelimiterValue: String = this): String {\n val index = lastIndexOf(delimiter)\n return if (index == -1) missingDelimiterValue else replaceRange(0, index, replacement)\n}\n\n\n// public fun String.replace(oldChar: Char, newChar: Char, ignoreCase: Boolean): String // JVM- and JS-specific\n// public fun String.replace(oldValue: String, newValue: String, ignoreCase: Boolean): String // JVM- and JS-specific\n\n/**\n * Returns a new string obtained by replacing each substring of this char sequence that matches the given regular expression\n * with the given [replacement].\n *\n * The [replacement] can consist of any combination of literal text and $-substitutions. To treat the replacement string\n * literally escape it with the [kotlin.text.Regex.Companion.escapeReplacement] method.\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.replace(regex: Regex, replacement: String): String = regex.replace(this, replacement)\n\n/**\n * Returns a new string obtained by replacing each substring of this char sequence that matches the given regular expression\n * with the result of the given function [transform] that takes [MatchResult] and returns a string to be used as a\n * replacement for that match.\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.replace(regex: Regex, noinline transform: (MatchResult) -> CharSequence): String =\n regex.replace(this, transform)\n\n/**\n * Replaces the first occurrence of the given regular expression [regex] in this char sequence with specified [replacement] expression.\n *\n * @param replacement A replacement expression that can include substitutions. See [Regex.replaceFirst] for details.\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.replaceFirst(regex: Regex, replacement: String): String = regex.replaceFirst(this, replacement)\n\n/**\n * Returns a copy of this string having its first character replaced with the result of the specified [transform],\n * or the original string if it's empty.\n *\n * @param transform function that takes the first character and returns the result of the transform applied to the character.\n *\n * @sample samples.text.Strings.replaceFirstChar\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@JvmName(\"replaceFirstCharWithChar\")\n@kotlin.internal.InlineOnly\npublic inline fun String.replaceFirstChar(transform: (Char) -> Char): String {\n return if (isNotEmpty()) transform(this[0]) + substring(1) else this\n}\n\n/**\n * Returns a copy of this string having its first character replaced with the result of the specified [transform],\n * or the original string if it's empty.\n *\n * @param transform function that takes the first character and returns the result of the transform applied to the character.\n *\n * @sample samples.text.Strings.replaceFirstChar\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@JvmName(\"replaceFirstCharWithCharSequence\")\n@kotlin.internal.InlineOnly\npublic inline fun String.replaceFirstChar(transform: (Char) -> CharSequence): String {\n return if (isNotEmpty()) transform(this[0]).toString() + substring(1) else this\n}\n\n\n/**\n * Returns `true` if this char sequence matches the given regular expression.\n */\n@kotlin.internal.InlineOnly\npublic inline infix fun CharSequence.matches(regex: Regex): Boolean = regex.matches(this)\n\n/**\n * Implementation of [regionMatches] for CharSequences.\n * Invoked when it's already known that arguments are not Strings, so that no additional type checks are performed.\n */\ninternal fun CharSequence.regionMatchesImpl(thisOffset: Int, other: CharSequence, otherOffset: Int, length: Int, ignoreCase: Boolean): Boolean {\n if ((otherOffset < 0) || (thisOffset < 0) || (thisOffset > this.length - length) || (otherOffset > other.length - length)) {\n return false\n }\n\n for (index in 0 until length) {\n if (!this[thisOffset + index].equals(other[otherOffset + index], ignoreCase))\n return false\n }\n return true\n}\n\n/**\n * Returns `true` if this char sequence starts with the specified character.\n */\npublic fun CharSequence.startsWith(char: Char, ignoreCase: Boolean = false): Boolean =\n this.length > 0 && this[0].equals(char, ignoreCase)\n\n/**\n * Returns `true` if this char sequence ends with the specified character.\n */\npublic fun CharSequence.endsWith(char: Char, ignoreCase: Boolean = false): Boolean =\n this.length > 0 && this[lastIndex].equals(char, ignoreCase)\n\n/**\n * Returns `true` if this char sequence starts with the specified prefix.\n */\npublic fun CharSequence.startsWith(prefix: CharSequence, ignoreCase: Boolean = false): Boolean {\n if (!ignoreCase && this is String && prefix is String)\n return this.startsWith(prefix)\n else\n return regionMatchesImpl(0, prefix, 0, prefix.length, ignoreCase)\n}\n\n/**\n * Returns `true` if a substring of this char sequence starting at the specified offset [startIndex] starts with the specified prefix.\n */\npublic fun CharSequence.startsWith(prefix: CharSequence, startIndex: Int, ignoreCase: Boolean = false): Boolean {\n if (!ignoreCase && this is String && prefix is String)\n return this.startsWith(prefix, startIndex)\n else\n return regionMatchesImpl(startIndex, prefix, 0, prefix.length, ignoreCase)\n}\n\n/**\n * Returns `true` if this char sequence ends with the specified suffix.\n */\npublic fun CharSequence.endsWith(suffix: CharSequence, ignoreCase: Boolean = false): Boolean {\n if (!ignoreCase && this is String && suffix is String)\n return this.endsWith(suffix)\n else\n return regionMatchesImpl(length - suffix.length, suffix, 0, suffix.length, ignoreCase)\n}\n\n\n// common prefix and suffix\n\n/**\n * Returns the longest string `prefix` such that this char sequence and [other] char sequence both start with this prefix,\n * taking care not to split surrogate pairs.\n * If this and [other] have no common prefix, returns the empty string.\n\n * @param ignoreCase `true` to ignore character case when matching a character. By default `false`.\n * @sample samples.text.Strings.commonPrefixWith\n */\npublic fun CharSequence.commonPrefixWith(other: CharSequence, ignoreCase: Boolean = false): String {\n val shortestLength = minOf(this.length, other.length)\n\n var i = 0\n while (i < shortestLength && this[i].equals(other[i], ignoreCase = ignoreCase)) {\n i++\n }\n if (this.hasSurrogatePairAt(i - 1) || other.hasSurrogatePairAt(i - 1)) {\n i--\n }\n return subSequence(0, i).toString()\n}\n\n/**\n * Returns the longest string `suffix` such that this char sequence and [other] char sequence both end with this suffix,\n * taking care not to split surrogate pairs.\n * If this and [other] have no common suffix, returns the empty string.\n\n * @param ignoreCase `true` to ignore character case when matching a character. By default `false`.\n * @sample samples.text.Strings.commonSuffixWith\n */\npublic fun CharSequence.commonSuffixWith(other: CharSequence, ignoreCase: Boolean = false): String {\n val thisLength = this.length\n val otherLength = other.length\n val shortestLength = minOf(thisLength, otherLength)\n\n var i = 0\n while (i < shortestLength && this[thisLength - i - 1].equals(other[otherLength - i - 1], ignoreCase = ignoreCase)) {\n i++\n }\n if (this.hasSurrogatePairAt(thisLength - i - 1) || other.hasSurrogatePairAt(otherLength - i - 1)) {\n i--\n }\n return subSequence(thisLength - i, thisLength).toString()\n}\n\n\n// indexOfAny()\n\n/**\n * Finds the index of the first occurrence of any of the specified [chars] in this char sequence,\n * starting from the specified [startIndex] and optionally ignoring the case.\n *\n * @param ignoreCase `true` to ignore character case when matching a character. By default `false`.\n * @return An index of the first occurrence of matched character from [chars] or -1 if none of [chars] are found.\n *\n */\npublic fun CharSequence.indexOfAny(chars: CharArray, startIndex: Int = 0, ignoreCase: Boolean = false): Int {\n if (!ignoreCase && chars.size == 1 && this is String) {\n val char = chars.single()\n return nativeIndexOf(char, startIndex)\n }\n\n for (index in startIndex.coerceAtLeast(0)..lastIndex) {\n val charAtIndex = get(index)\n if (chars.any { it.equals(charAtIndex, ignoreCase) })\n return index\n }\n return -1\n}\n\n/**\n * Finds the index of the last occurrence of any of the specified [chars] in this char sequence,\n * starting from the specified [startIndex] and optionally ignoring the case.\n *\n * @param startIndex The index of character to start searching at. The search proceeds backward toward the beginning of the string.\n * @param ignoreCase `true` to ignore character case when matching a character. By default `false`.\n * @return An index of the last occurrence of matched character from [chars] or -1 if none of [chars] are found.\n *\n */\npublic fun CharSequence.lastIndexOfAny(chars: CharArray, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Int {\n if (!ignoreCase && chars.size == 1 && this is String) {\n val char = chars.single()\n return nativeLastIndexOf(char, startIndex)\n }\n\n\n for (index in startIndex.coerceAtMost(lastIndex) downTo 0) {\n val charAtIndex = get(index)\n if (chars.any { it.equals(charAtIndex, ignoreCase) })\n return index\n }\n\n return -1\n}\n\n\nprivate fun CharSequence.indexOf(other: CharSequence, startIndex: Int, endIndex: Int, ignoreCase: Boolean, last: Boolean = false): Int {\n val indices = if (!last)\n startIndex.coerceAtLeast(0)..endIndex.coerceAtMost(length)\n else\n startIndex.coerceAtMost(lastIndex) downTo endIndex.coerceAtLeast(0)\n\n if (this is String && other is String) { // smart cast\n for (index in indices) {\n if (other.regionMatches(0, this, index, other.length, ignoreCase))\n return index\n }\n } else {\n for (index in indices) {\n if (other.regionMatchesImpl(0, this, index, other.length, ignoreCase))\n return index\n }\n }\n return -1\n}\n\nprivate fun CharSequence.findAnyOf(strings: Collection, startIndex: Int, ignoreCase: Boolean, last: Boolean): Pair? {\n if (!ignoreCase && strings.size == 1) {\n val string = strings.single()\n val index = if (!last) indexOf(string, startIndex) else lastIndexOf(string, startIndex)\n return if (index < 0) null else index to string\n }\n\n val indices = if (!last) startIndex.coerceAtLeast(0)..length else startIndex.coerceAtMost(lastIndex) downTo 0\n\n if (this is String) {\n for (index in indices) {\n val matchingString = strings.firstOrNull { it.regionMatches(0, this, index, it.length, ignoreCase) }\n if (matchingString != null)\n return index to matchingString\n }\n } else {\n for (index in indices) {\n val matchingString = strings.firstOrNull { it.regionMatchesImpl(0, this, index, it.length, ignoreCase) }\n if (matchingString != null)\n return index to matchingString\n }\n }\n\n return null\n}\n\n/**\n * Finds the first occurrence of any of the specified [strings] in this char sequence,\n * starting from the specified [startIndex] and optionally ignoring the case.\n *\n * @param ignoreCase `true` to ignore character case when matching a string. By default `false`.\n * @return A pair of an index of the first occurrence of matched string from [strings] and the string matched\n * or `null` if none of [strings] are found.\n *\n * To avoid ambiguous results when strings in [strings] have characters in common, this method proceeds from\n * the beginning to the end of this string, and finds at each position the first element in [strings]\n * that matches this string at that position.\n */\npublic fun CharSequence.findAnyOf(strings: Collection, startIndex: Int = 0, ignoreCase: Boolean = false): Pair? =\n findAnyOf(strings, startIndex, ignoreCase, last = false)\n\n/**\n * Finds the last occurrence of any of the specified [strings] in this char sequence,\n * starting from the specified [startIndex] and optionally ignoring the case.\n *\n * @param startIndex The index of character to start searching at. The search proceeds backward toward the beginning of the string.\n * @param ignoreCase `true` to ignore character case when matching a string. By default `false`.\n * @return A pair of an index of the last occurrence of matched string from [strings] and the string matched or `null` if none of [strings] are found.\n *\n * To avoid ambiguous results when strings in [strings] have characters in common, this method proceeds from\n * the end toward the beginning of this string, and finds at each position the first element in [strings]\n * that matches this string at that position.\n */\npublic fun CharSequence.findLastAnyOf(strings: Collection, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Pair? =\n findAnyOf(strings, startIndex, ignoreCase, last = true)\n\n/**\n * Finds the index of the first occurrence of any of the specified [strings] in this char sequence,\n * starting from the specified [startIndex] and optionally ignoring the case.\n *\n * @param ignoreCase `true` to ignore character case when matching a string. By default `false`.\n * @return An index of the first occurrence of matched string from [strings] or -1 if none of [strings] are found.\n *\n * To avoid ambiguous results when strings in [strings] have characters in common, this method proceeds from\n * the beginning to the end of this string, and finds at each position the first element in [strings]\n * that matches this string at that position.\n */\npublic fun CharSequence.indexOfAny(strings: Collection, startIndex: Int = 0, ignoreCase: Boolean = false): Int =\n findAnyOf(strings, startIndex, ignoreCase, last = false)?.first ?: -1\n\n/**\n * Finds the index of the last occurrence of any of the specified [strings] in this char sequence,\n * starting from the specified [startIndex] and optionally ignoring the case.\n *\n * @param startIndex The index of character to start searching at. The search proceeds backward toward the beginning of the string.\n * @param ignoreCase `true` to ignore character case when matching a string. By default `false`.\n * @return An index of the last occurrence of matched string from [strings] or -1 if none of [strings] are found.\n *\n * To avoid ambiguous results when strings in [strings] have characters in common, this method proceeds from\n * the end toward the beginning of this string, and finds at each position the first element in [strings]\n * that matches this string at that position.\n */\npublic fun CharSequence.lastIndexOfAny(strings: Collection, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Int =\n findAnyOf(strings, startIndex, ignoreCase, last = true)?.first ?: -1\n\n\n// indexOf\n\n/**\n * Returns the index within this string of the first occurrence of the specified character, starting from the specified [startIndex].\n *\n * @param ignoreCase `true` to ignore character case when matching a character. By default `false`.\n * @return An index of the first occurrence of [char] or -1 if none is found.\n */\npublic fun CharSequence.indexOf(char: Char, startIndex: Int = 0, ignoreCase: Boolean = false): Int {\n return if (ignoreCase || this !is String)\n indexOfAny(charArrayOf(char), startIndex, ignoreCase)\n else\n nativeIndexOf(char, startIndex)\n}\n\n/**\n * Returns the index within this char sequence of the first occurrence of the specified [string],\n * starting from the specified [startIndex].\n *\n * @param ignoreCase `true` to ignore character case when matching a string. By default `false`.\n * @return An index of the first occurrence of [string] or `-1` if none is found.\n * @sample samples.text.Strings.indexOf\n */\npublic fun CharSequence.indexOf(string: String, startIndex: Int = 0, ignoreCase: Boolean = false): Int {\n return if (ignoreCase || this !is String)\n indexOf(string, startIndex, length, ignoreCase)\n else\n nativeIndexOf(string, startIndex)\n}\n\n/**\n * Returns the index within this char sequence of the last occurrence of the specified character,\n * starting from the specified [startIndex].\n *\n * @param startIndex The index of character to start searching at. The search proceeds backward toward the beginning of the string.\n * @param ignoreCase `true` to ignore character case when matching a character. By default `false`.\n * @return An index of the last occurrence of [char] or -1 if none is found.\n */\npublic fun CharSequence.lastIndexOf(char: Char, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Int {\n return if (ignoreCase || this !is String)\n lastIndexOfAny(charArrayOf(char), startIndex, ignoreCase)\n else\n nativeLastIndexOf(char, startIndex)\n}\n\n/**\n * Returns the index within this char sequence of the last occurrence of the specified [string],\n * starting from the specified [startIndex].\n *\n * @param startIndex The index of character to start searching at. The search proceeds backward toward the beginning of the string.\n * @param ignoreCase `true` to ignore character case when matching a string. By default `false`.\n * @return An index of the last occurrence of [string] or -1 if none is found.\n */\npublic fun CharSequence.lastIndexOf(string: String, startIndex: Int = lastIndex, ignoreCase: Boolean = false): Int {\n return if (ignoreCase || this !is String)\n indexOf(string, startIndex, 0, ignoreCase, last = true)\n else\n nativeLastIndexOf(string, startIndex)\n}\n\n/**\n * Returns `true` if this char sequence contains the specified [other] sequence of characters as a substring.\n *\n * @param ignoreCase `true` to ignore character case when comparing strings. By default `false`.\n */\n@Suppress(\"INAPPLICABLE_OPERATOR_MODIFIER\")\npublic operator fun CharSequence.contains(other: CharSequence, ignoreCase: Boolean = false): Boolean =\n if (other is String)\n indexOf(other, ignoreCase = ignoreCase) >= 0\n else\n indexOf(other, 0, length, ignoreCase) >= 0\n\n\n\n/**\n * Returns `true` if this char sequence contains the specified character [char].\n *\n * @param ignoreCase `true` to ignore character case when comparing characters. By default `false`.\n */\n@Suppress(\"INAPPLICABLE_OPERATOR_MODIFIER\")\npublic operator fun CharSequence.contains(char: Char, ignoreCase: Boolean = false): Boolean =\n indexOf(char, ignoreCase = ignoreCase) >= 0\n\n/**\n * Returns `true` if this char sequence contains at least one match of the specified regular expression [regex].\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun CharSequence.contains(regex: Regex): Boolean = regex.containsMatchIn(this)\n\n\n// rangesDelimitedBy\n\n\nprivate class DelimitedRangesSequence(\n private val input: CharSequence,\n private val startIndex: Int,\n private val limit: Int,\n private val getNextMatch: CharSequence.(currentIndex: Int) -> Pair?\n) : Sequence {\n\n override fun iterator(): Iterator = object : Iterator {\n var nextState: Int = -1 // -1 for unknown, 0 for done, 1 for continue\n var currentStartIndex: Int = startIndex.coerceIn(0, input.length)\n var nextSearchIndex: Int = currentStartIndex\n var nextItem: IntRange? = null\n var counter: Int = 0\n\n private fun calcNext() {\n if (nextSearchIndex < 0) {\n nextState = 0\n nextItem = null\n } else {\n if (limit > 0 && ++counter >= limit || nextSearchIndex > input.length) {\n nextItem = currentStartIndex..input.lastIndex\n nextSearchIndex = -1\n } else {\n val match = input.getNextMatch(nextSearchIndex)\n if (match == null) {\n nextItem = currentStartIndex..input.lastIndex\n nextSearchIndex = -1\n } else {\n val (index, length) = match\n nextItem = currentStartIndex until index\n currentStartIndex = index + length\n nextSearchIndex = currentStartIndex + if (length == 0) 1 else 0\n }\n }\n nextState = 1\n }\n }\n\n override fun next(): IntRange {\n if (nextState == -1)\n calcNext()\n if (nextState == 0)\n throw NoSuchElementException()\n val result = nextItem as IntRange\n // Clean next to avoid keeping reference on yielded instance\n nextItem = null\n nextState = -1\n return result\n }\n\n override fun hasNext(): Boolean {\n if (nextState == -1)\n calcNext()\n return nextState == 1\n }\n }\n}\n\n/**\n * Returns a sequence of index ranges of substrings in this char sequence around occurrences of the specified [delimiters].\n *\n * @param delimiters One or more characters to be used as delimiters.\n * @param startIndex The index to start searching delimiters from.\n * No range having its start value less than [startIndex] is returned.\n * [startIndex] is coerced to be non-negative and not greater than length of this string.\n * @param ignoreCase `true` to ignore character case when matching a delimiter. By default `false`.\n * @param limit The maximum number of substrings to return. Zero by default means no limit is set.\n */\nprivate fun CharSequence.rangesDelimitedBy(delimiters: CharArray, startIndex: Int = 0, ignoreCase: Boolean = false, limit: Int = 0): Sequence {\n require(limit >= 0, { \"Limit must be non-negative, but was $limit.\" })\n\n return DelimitedRangesSequence(this, startIndex, limit, { currentIndex ->\n indexOfAny(delimiters, currentIndex, ignoreCase = ignoreCase).let { if (it < 0) null else it to 1 }\n })\n}\n\n\n/**\n * Returns a sequence of index ranges of substrings in this char sequence around occurrences of the specified [delimiters].\n *\n * @param delimiters One or more strings to be used as delimiters.\n * @param startIndex The index to start searching delimiters from.\n * No range having its start value less than [startIndex] is returned.\n * [startIndex] is coerced to be non-negative and not greater than length of this string.\n * @param ignoreCase `true` to ignore character case when matching a delimiter. By default `false`.\n * @param limit The maximum number of substrings to return. Zero by default means no limit is set.\n *\n * To avoid ambiguous results when strings in [delimiters] have characters in common, this method proceeds from\n * the beginning to the end of this string, and finds at each position the first element in [delimiters]\n * that matches this string at that position.\n */\nprivate fun CharSequence.rangesDelimitedBy(delimiters: Array, startIndex: Int = 0, ignoreCase: Boolean = false, limit: Int = 0): Sequence {\n require(limit >= 0, { \"Limit must be non-negative, but was $limit.\" } )\n val delimitersList = delimiters.asList()\n\n return DelimitedRangesSequence(this, startIndex, limit, { currentIndex -> findAnyOf(delimitersList, currentIndex, ignoreCase = ignoreCase, last = false)?.let { it.first to it.second.length } })\n\n}\n\n\n// split\n\n/**\n * Splits this char sequence to a sequence of strings around occurrences of the specified [delimiters].\n *\n * @param delimiters One or more strings to be used as delimiters.\n * @param ignoreCase `true` to ignore character case when matching a delimiter. By default `false`.\n * @param limit The maximum number of substrings to return. Zero by default means no limit is set.\n *\n * To avoid ambiguous results when strings in [delimiters] have characters in common, this method proceeds from\n * the beginning to the end of this string, and finds at each position the first element in [delimiters]\n * that matches this string at that position.\n */\npublic fun CharSequence.splitToSequence(vararg delimiters: String, ignoreCase: Boolean = false, limit: Int = 0): Sequence =\n rangesDelimitedBy(delimiters, ignoreCase = ignoreCase, limit = limit).map { substring(it) }\n\n/**\n * Splits this char sequence to a list of strings around occurrences of the specified [delimiters].\n *\n * @param delimiters One or more strings to be used as delimiters.\n * @param ignoreCase `true` to ignore character case when matching a delimiter. By default `false`.\n * @param limit The maximum number of substrings to return. Zero by default means no limit is set.\n *\n * To avoid ambiguous results when strings in [delimiters] have characters in common, this method proceeds from\n * the beginning to the end of this string, and matches at each position the first element in [delimiters]\n * that is equal to a delimiter in this instance at that position.\n */\npublic fun CharSequence.split(vararg delimiters: String, ignoreCase: Boolean = false, limit: Int = 0): List {\n if (delimiters.size == 1) {\n val delimiter = delimiters[0]\n if (!delimiter.isEmpty()) {\n return split(delimiter, ignoreCase, limit)\n }\n }\n\n return rangesDelimitedBy(delimiters, ignoreCase = ignoreCase, limit = limit).asIterable().map { substring(it) }\n}\n\n/**\n * Splits this char sequence to a sequence of strings around occurrences of the specified [delimiters].\n *\n * @param delimiters One or more characters to be used as delimiters.\n * @param ignoreCase `true` to ignore character case when matching a delimiter. By default `false`.\n * @param limit The maximum number of substrings to return.\n */\npublic fun CharSequence.splitToSequence(vararg delimiters: Char, ignoreCase: Boolean = false, limit: Int = 0): Sequence =\n rangesDelimitedBy(delimiters, ignoreCase = ignoreCase, limit = limit).map { substring(it) }\n\n/**\n * Splits this char sequence to a list of strings around occurrences of the specified [delimiters].\n *\n * @param delimiters One or more characters to be used as delimiters.\n * @param ignoreCase `true` to ignore character case when matching a delimiter. By default `false`.\n * @param limit The maximum number of substrings to return.\n */\npublic fun CharSequence.split(vararg delimiters: Char, ignoreCase: Boolean = false, limit: Int = 0): List {\n if (delimiters.size == 1) {\n return split(delimiters[0].toString(), ignoreCase, limit)\n }\n\n return rangesDelimitedBy(delimiters, ignoreCase = ignoreCase, limit = limit).asIterable().map { substring(it) }\n}\n\n/**\n * Splits this char sequence to a list of strings around occurrences of the specified [delimiter].\n * This is specialized version of split which receives single non-empty delimiter and offers better performance\n *\n * @param delimiter String used as delimiter\n * @param ignoreCase `true` to ignore character case when matching a delimiter. By default `false`.\n * @param limit The maximum number of substrings to return.\n */\nprivate fun CharSequence.split(delimiter: String, ignoreCase: Boolean, limit: Int): List {\n require(limit >= 0, { \"Limit must be non-negative, but was $limit.\" })\n\n var currentOffset = 0\n var nextIndex = indexOf(delimiter, currentOffset, ignoreCase)\n if (nextIndex == -1 || limit == 1) {\n return listOf(this.toString())\n }\n\n val isLimited = limit > 0\n val result = ArrayList(if (isLimited) limit.coerceAtMost(10) else 10)\n do {\n result.add(substring(currentOffset, nextIndex))\n currentOffset = nextIndex + delimiter.length\n // Do not search for next occurrence if we're reaching limit\n if (isLimited && result.size == limit - 1) break\n nextIndex = indexOf(delimiter, currentOffset, ignoreCase)\n } while (nextIndex != -1)\n\n result.add(substring(currentOffset, length))\n return result\n}\n\n/**\n * Splits this char sequence around matches of the given regular expression.\n *\n * @param limit Non-negative value specifying the maximum number of substrings to return.\n * Zero by default means no limit is set.\n */\n@kotlin.internal.InlineOnly\npublic inline fun CharSequence.split(regex: Regex, limit: Int = 0): List = regex.split(this, limit)\n\n/**\n * Splits this char sequence to a sequence of lines delimited by any of the following character sequences: CRLF, LF or CR.\n *\n * The lines returned do not include terminating line separators.\n */\npublic fun CharSequence.lineSequence(): Sequence = splitToSequence(\"\\r\\n\", \"\\n\", \"\\r\")\n\n/**\n * Splits this char sequence to a list of lines delimited by any of the following character sequences: CRLF, LF or CR.\n *\n * The lines returned do not include terminating line separators.\n */\npublic fun CharSequence.lines(): List = lineSequence().toList()\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.comparisons\n\n//\n// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt\n// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib\n//\n\nimport kotlin.js.*\n\n/**\n * Returns the greater of two values.\n * \n * If values are equal, returns the first one.\n */\n@SinceKotlin(\"1.1\")\npublic actual fun > maxOf(a: T, b: T): T {\n return if (a >= b) a else b\n}\n\n/**\n * Returns the greater of two values.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun maxOf(a: Byte, b: Byte): Byte {\n return Math.max(a.toInt(), b.toInt()).unsafeCast()\n}\n\n/**\n * Returns the greater of two values.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun maxOf(a: Short, b: Short): Short {\n return Math.max(a.toInt(), b.toInt()).unsafeCast()\n}\n\n/**\n * Returns the greater of two values.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun maxOf(a: Int, b: Int): Int {\n return Math.max(a, b)\n}\n\n/**\n * Returns the greater of two values.\n */\n@SinceKotlin(\"1.1\")\n@Suppress(\"DEPRECATION_ERROR\", \"NOTHING_TO_INLINE\")\npublic actual inline fun maxOf(a: Long, b: Long): Long {\n return if (a >= b) a else b\n}\n\n/**\n * Returns the greater of two values.\n * \n * If either value is `NaN`, returns `NaN`.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun maxOf(a: Float, b: Float): Float {\n return Math.max(a, b)\n}\n\n/**\n * Returns the greater of two values.\n * \n * If either value is `NaN`, returns `NaN`.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun maxOf(a: Double, b: Double): Double {\n return Math.max(a, b)\n}\n\n/**\n * Returns the greater of three values.\n * \n * If there are multiple equal maximal values, returns the first of them.\n */\n@SinceKotlin(\"1.1\")\npublic actual fun > maxOf(a: T, b: T, c: T): T {\n return maxOf(a, maxOf(b, c))\n}\n\n/**\n * Returns the greater of three values.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun maxOf(a: Byte, b: Byte, c: Byte): Byte {\n return Math.max(a.toInt(), b.toInt(), c.toInt()).unsafeCast()\n}\n\n/**\n * Returns the greater of three values.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun maxOf(a: Short, b: Short, c: Short): Short {\n return Math.max(a.toInt(), b.toInt(), c.toInt()).unsafeCast()\n}\n\n/**\n * Returns the greater of three values.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun maxOf(a: Int, b: Int, c: Int): Int {\n return Math.max(a, b, c)\n}\n\n/**\n * Returns the greater of three values.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic actual inline fun maxOf(a: Long, b: Long, c: Long): Long {\n return maxOf(a, maxOf(b, c))\n}\n\n/**\n * Returns the greater of three values.\n * \n * If any value is `NaN`, returns `NaN`.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun maxOf(a: Float, b: Float, c: Float): Float {\n return Math.max(a, b, c)\n}\n\n/**\n * Returns the greater of three values.\n * \n * If any value is `NaN`, returns `NaN`.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun maxOf(a: Double, b: Double, c: Double): Double {\n return Math.max(a, b, c)\n}\n\n/**\n * Returns the greater of the given values.\n * \n * If there are multiple equal maximal values, returns the first of them.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun > maxOf(a: T, vararg other: T): T {\n var max = a\n for (e in other) max = maxOf(max, e)\n return max\n}\n\n/**\n * Returns the greater of the given values.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun maxOf(a: Byte, vararg other: Byte): Byte {\n var max = a\n for (e in other) max = maxOf(max, e)\n return max\n}\n\n/**\n * Returns the greater of the given values.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun maxOf(a: Short, vararg other: Short): Short {\n var max = a\n for (e in other) max = maxOf(max, e)\n return max\n}\n\n/**\n * Returns the greater of the given values.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun maxOf(a: Int, vararg other: Int): Int {\n var max = a\n for (e in other) max = maxOf(max, e)\n return max\n}\n\n/**\n * Returns the greater of the given values.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun maxOf(a: Long, vararg other: Long): Long {\n var max = a\n for (e in other) max = maxOf(max, e)\n return max\n}\n\n/**\n * Returns the greater of the given values.\n * \n * If any value is `NaN`, returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun maxOf(a: Float, vararg other: Float): Float {\n var max = a\n for (e in other) max = maxOf(max, e)\n return max\n}\n\n/**\n * Returns the greater of the given values.\n * \n * If any value is `NaN`, returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun maxOf(a: Double, vararg other: Double): Double {\n var max = a\n for (e in other) max = maxOf(max, e)\n return max\n}\n\n/**\n * Returns the smaller of two values.\n * \n * If values are equal, returns the first one.\n */\n@SinceKotlin(\"1.1\")\npublic actual fun > minOf(a: T, b: T): T {\n return if (a <= b) a else b\n}\n\n/**\n * Returns the smaller of two values.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun minOf(a: Byte, b: Byte): Byte {\n return Math.min(a.toInt(), b.toInt()).unsafeCast()\n}\n\n/**\n * Returns the smaller of two values.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun minOf(a: Short, b: Short): Short {\n return Math.min(a.toInt(), b.toInt()).unsafeCast()\n}\n\n/**\n * Returns the smaller of two values.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun minOf(a: Int, b: Int): Int {\n return Math.min(a, b)\n}\n\n/**\n * Returns the smaller of two values.\n */\n@SinceKotlin(\"1.1\")\n@Suppress(\"DEPRECATION_ERROR\", \"NOTHING_TO_INLINE\")\npublic actual inline fun minOf(a: Long, b: Long): Long {\n return if (a <= b) a else b\n}\n\n/**\n * Returns the smaller of two values.\n * \n * If either value is `NaN`, returns `NaN`.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun minOf(a: Float, b: Float): Float {\n return Math.min(a, b)\n}\n\n/**\n * Returns the smaller of two values.\n * \n * If either value is `NaN`, returns `NaN`.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun minOf(a: Double, b: Double): Double {\n return Math.min(a, b)\n}\n\n/**\n * Returns the smaller of three values.\n * \n * If there are multiple equal minimal values, returns the first of them.\n */\n@SinceKotlin(\"1.1\")\npublic actual fun > minOf(a: T, b: T, c: T): T {\n return minOf(a, minOf(b, c))\n}\n\n/**\n * Returns the smaller of three values.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun minOf(a: Byte, b: Byte, c: Byte): Byte {\n return Math.min(a.toInt(), b.toInt(), c.toInt()).unsafeCast()\n}\n\n/**\n * Returns the smaller of three values.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun minOf(a: Short, b: Short, c: Short): Short {\n return Math.min(a.toInt(), b.toInt(), c.toInt()).unsafeCast()\n}\n\n/**\n * Returns the smaller of three values.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun minOf(a: Int, b: Int, c: Int): Int {\n return Math.min(a, b, c)\n}\n\n/**\n * Returns the smaller of three values.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic actual inline fun minOf(a: Long, b: Long, c: Long): Long {\n return minOf(a, minOf(b, c))\n}\n\n/**\n * Returns the smaller of three values.\n * \n * If any value is `NaN`, returns `NaN`.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun minOf(a: Float, b: Float, c: Float): Float {\n return Math.min(a, b, c)\n}\n\n/**\n * Returns the smaller of three values.\n * \n * If any value is `NaN`, returns `NaN`.\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\n@Suppress(\"DEPRECATION_ERROR\")\npublic actual inline fun minOf(a: Double, b: Double, c: Double): Double {\n return Math.min(a, b, c)\n}\n\n/**\n * Returns the smaller of the given values.\n * \n * If there are multiple equal minimal values, returns the first of them.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun > minOf(a: T, vararg other: T): T {\n var min = a\n for (e in other) min = minOf(min, e)\n return min\n}\n\n/**\n * Returns the smaller of the given values.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun minOf(a: Byte, vararg other: Byte): Byte {\n var min = a\n for (e in other) min = minOf(min, e)\n return min\n}\n\n/**\n * Returns the smaller of the given values.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun minOf(a: Short, vararg other: Short): Short {\n var min = a\n for (e in other) min = minOf(min, e)\n return min\n}\n\n/**\n * Returns the smaller of the given values.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun minOf(a: Int, vararg other: Int): Int {\n var min = a\n for (e in other) min = minOf(min, e)\n return min\n}\n\n/**\n * Returns the smaller of the given values.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun minOf(a: Long, vararg other: Long): Long {\n var min = a\n for (e in other) min = minOf(min, e)\n return min\n}\n\n/**\n * Returns the smaller of the given values.\n * \n * If any value is `NaN`, returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun minOf(a: Float, vararg other: Float): Float {\n var min = a\n for (e in other) min = minOf(min, e)\n return min\n}\n\n/**\n * Returns the smaller of the given values.\n * \n * If any value is `NaN`, returns `NaN`.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun minOf(a: Double, vararg other: Double): Double {\n var min = a\n for (e in other) min = minOf(min, e)\n return min\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.text\n\nimport kotlin.js.RegExp\n\n@kotlin.internal.InlineOnly\ninternal actual inline fun String.nativeIndexOf(ch: Char, fromIndex: Int): Int = nativeIndexOf(ch.toString(), fromIndex)\n\n@kotlin.internal.InlineOnly\ninternal actual inline fun String.nativeLastIndexOf(ch: Char, fromIndex: Int): Int = nativeLastIndexOf(ch.toString(), fromIndex)\n\n/**\n * Returns `true` if this string starts with the specified prefix.\n */\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun String.startsWith(prefix: String, ignoreCase: Boolean = false): Boolean {\n if (!ignoreCase)\n return nativeStartsWith(prefix, 0)\n else\n return regionMatches(0, prefix, 0, prefix.length, ignoreCase)\n}\n\n/**\n * Returns `true` if a substring of this string starting at the specified offset [startIndex] starts with the specified prefix.\n */\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun String.startsWith(prefix: String, startIndex: Int, ignoreCase: Boolean = false): Boolean {\n if (!ignoreCase)\n return nativeStartsWith(prefix, startIndex)\n else\n return regionMatches(startIndex, prefix, 0, prefix.length, ignoreCase)\n}\n\n/**\n * Returns `true` if this string ends with the specified suffix.\n */\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun String.endsWith(suffix: String, ignoreCase: Boolean = false): Boolean {\n if (!ignoreCase)\n return nativeEndsWith(suffix)\n else\n return regionMatches(length - suffix.length, suffix, 0, suffix.length, ignoreCase)\n}\n\n\npublic fun String.matches(regex: String): Boolean {\n val result = this.match(regex)\n return result != null && result.size != 0\n}\n\npublic actual fun CharSequence.isBlank(): Boolean = length == 0 || (if (this is String) this else this.toString()).matches(\"^[\\\\s\\\\xA0]+$\")\n\n@OptIn(ExperimentalStdlibApi::class)\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun String?.equals(other: String?, ignoreCase: Boolean = false): Boolean =\n if (this == null)\n other == null\n else if (!ignoreCase)\n this == other\n else\n other != null && this.lowercase() == other.lowercase()\n\n\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun CharSequence.regionMatches(thisOffset: Int, other: CharSequence, otherOffset: Int, length: Int, ignoreCase: Boolean = false): Boolean =\n regionMatchesImpl(thisOffset, other, otherOffset, length, ignoreCase)\n\n\n/**\n * Returns a copy of this string having its first letter titlecased using the rules of the default locale,\n * or the original string if it's empty or already starts with a title case letter.\n *\n * The title case of a character is usually the same as its upper case with several exceptions.\n * The particular list of characters with the special title case form depends on the underlying platform.\n *\n * @sample samples.text.Strings.capitalize\n */\npublic actual fun String.capitalize(): String {\n return if (isNotEmpty()) substring(0, 1).toUpperCase() + substring(1) else this\n}\n\n/**\n * Returns a copy of this string having its first letter lowercased using the rules of the default locale,\n * or the original string if it's empty or already starts with a lower case letter.\n *\n * @sample samples.text.Strings.decapitalize\n */\npublic actual fun String.decapitalize(): String {\n return if (isNotEmpty()) substring(0, 1).toLowerCase() + substring(1) else this\n}\n\n/**\n * Returns a string containing this char sequence repeated [n] times.\n * @throws [IllegalArgumentException] when n < 0.\n */\npublic actual fun CharSequence.repeat(n: Int): String {\n require(n >= 0) { \"Count 'n' must be non-negative, but was $n.\" }\n return when (n) {\n 0 -> \"\"\n 1 -> this.toString()\n else -> {\n var result = \"\"\n if (!isEmpty()) {\n var s = this.toString()\n var count = n\n while (true) {\n if ((count and 1) == 1) {\n result += s\n }\n count = count ushr 1\n if (count == 0) {\n break\n }\n s += s\n }\n }\n return result\n }\n }\n}\n\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun String.replace(oldValue: String, newValue: String, ignoreCase: Boolean = false): String =\n nativeReplace(RegExp(Regex.escape(oldValue), if (ignoreCase) \"gi\" else \"g\"), Regex.escapeReplacement(newValue))\n\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun String.replace(oldChar: Char, newChar: Char, ignoreCase: Boolean = false): String =\n nativeReplace(RegExp(Regex.escape(oldChar.toString()), if (ignoreCase) \"gi\" else \"g\"), newChar.toString())\n\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun String.replaceFirst(oldValue: String, newValue: String, ignoreCase: Boolean = false): String =\n nativeReplace(RegExp(Regex.escape(oldValue), if (ignoreCase) \"i\" else \"\"), Regex.escapeReplacement(newValue))\n\n@Suppress(\"ACTUAL_FUNCTION_WITH_DEFAULT_ARGUMENTS\")\npublic actual fun String.replaceFirst(oldChar: Char, newChar: Char, ignoreCase: Boolean = false): String =\n nativeReplace(RegExp(Regex.escape(oldChar.toString()), if (ignoreCase) \"i\" else \"\"), newChar.toString())\n","/*\n * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.text\n\n/** Returns the negative [size] if [throwOnMalformed] is false, throws [CharacterCodingException] otherwise. */\n@OptIn(ExperimentalStdlibApi::class)\nprivate fun malformed(size: Int, index: Int, throwOnMalformed: Boolean): Int {\n if (throwOnMalformed) throw CharacterCodingException(\"Malformed sequence starting at ${index - 1}\")\n return -size\n}\n\n/**\n * Returns code point corresponding to UTF-16 surrogate pair,\n * where the first of the pair is the [high] and the second is in the [string] at the [index].\n * Returns zero if the pair is malformed and [throwOnMalformed] is false.\n *\n * @throws CharacterCodingException if the pair is malformed and [throwOnMalformed] is true.\n */\nprivate fun codePointFromSurrogate(string: String, high: Int, index: Int, endIndex: Int, throwOnMalformed: Boolean): Int {\n if (high !in 0xD800..0xDBFF || index >= endIndex) {\n return malformed(0, index, throwOnMalformed)\n }\n val low = string[index].toInt()\n if (low !in 0xDC00..0xDFFF) {\n return malformed(0, index, throwOnMalformed)\n }\n return 0x10000 + ((high and 0x3FF) shl 10) or (low and 0x3FF)\n}\n\n/**\n * Returns code point corresponding to UTF-8 sequence of two bytes,\n * where the first byte of the sequence is the [byte1] and the second byte is in the [bytes] array at the [index].\n * Returns zero if the sequence is malformed and [throwOnMalformed] is false.\n *\n * @throws CharacterCodingException if the sequence of two bytes is malformed and [throwOnMalformed] is true.\n */\nprivate fun codePointFrom2(bytes: ByteArray, byte1: Int, index: Int, endIndex: Int, throwOnMalformed: Boolean): Int {\n if (byte1 and 0x1E == 0 || index >= endIndex) {\n return malformed(0, index, throwOnMalformed)\n }\n val byte2 = bytes[index].toInt()\n if (byte2 and 0xC0 != 0x80) {\n return malformed(0, index, throwOnMalformed)\n }\n return (byte1 shl 6) xor byte2 xor 0xF80\n}\n\n/**\n * Returns code point corresponding to UTF-8 sequence of three bytes,\n * where the first byte of the sequence is the [byte1] and the others are in the [bytes] array starting from the [index].\n * Returns a non-positive value indicating number of bytes from [bytes] included in malformed sequence\n * if the sequence is malformed and [throwOnMalformed] is false.\n *\n * @throws CharacterCodingException if the sequence of three bytes is malformed and [throwOnMalformed] is true.\n */\nprivate fun codePointFrom3(bytes: ByteArray, byte1: Int, index: Int, endIndex: Int, throwOnMalformed: Boolean): Int {\n if (index >= endIndex) {\n return malformed(0, index, throwOnMalformed)\n }\n\n val byte2 = bytes[index].toInt()\n if (byte1 and 0xF == 0) {\n if (byte2 and 0xE0 != 0xA0) {\n // Non-shortest form\n return malformed(0, index, throwOnMalformed)\n }\n } else if (byte1 and 0xF == 0xD) {\n if (byte2 and 0xE0 != 0x80) {\n // Surrogate code point\n return malformed(0, index, throwOnMalformed)\n }\n } else if (byte2 and 0xC0 != 0x80) {\n return malformed(0, index, throwOnMalformed)\n }\n\n if (index + 1 == endIndex) {\n return malformed(1, index, throwOnMalformed)\n }\n val byte3 = bytes[index + 1].toInt()\n if (byte3 and 0xC0 != 0x80) {\n return malformed(1, index, throwOnMalformed)\n }\n\n return (byte1 shl 12) xor (byte2 shl 6) xor byte3 xor -0x1E080\n}\n\n/**\n * Returns code point corresponding to UTF-8 sequence of four bytes,\n * where the first byte of the sequence is the [byte1] and the others are in the [bytes] array starting from the [index].\n * Returns a non-positive value indicating number of bytes from [bytes] included in malformed sequence\n * if the sequence is malformed and [throwOnMalformed] is false.\n *\n * @throws CharacterCodingException if the sequence of four bytes is malformed and [throwOnMalformed] is true.\n */\nprivate fun codePointFrom4(bytes: ByteArray, byte1: Int, index: Int, endIndex: Int, throwOnMalformed: Boolean): Int {\n if (index >= endIndex) {\n malformed(0, index, throwOnMalformed)\n }\n\n val byte2 = bytes[index].toInt()\n if (byte1 and 0xF == 0x0) {\n if (byte2 and 0xF0 <= 0x80) {\n // Non-shortest form\n return malformed(0, index, throwOnMalformed)\n }\n } else if (byte1 and 0xF == 0x4) {\n if (byte2 and 0xF0 != 0x80) {\n // Out of Unicode code points domain (larger than U+10FFFF)\n return malformed(0, index, throwOnMalformed)\n }\n } else if (byte1 and 0xF > 0x4) {\n return malformed(0, index, throwOnMalformed)\n } else if (byte2 and 0xC0 != 0x80) {\n return malformed(0, index, throwOnMalformed)\n }\n\n if (index + 1 == endIndex) {\n return malformed(1, index, throwOnMalformed)\n }\n val byte3 = bytes[index + 1].toInt()\n if (byte3 and 0xC0 != 0x80) {\n return malformed(1, index, throwOnMalformed)\n }\n\n if (index + 2 == endIndex) {\n return malformed(2, index, throwOnMalformed)\n }\n val byte4 = bytes[index + 2].toInt()\n if (byte4 and 0xC0 != 0x80) {\n return malformed(2, index, throwOnMalformed)\n }\n return (byte1 shl 18) xor (byte2 shl 12) xor (byte3 shl 6) xor byte4 xor 0x381F80\n}\n\n/**\n * Maximum number of bytes needed to encode a single char.\n *\n * Code points in `0..0x7F` are encoded in a single byte.\n * Code points in `0x80..0x7FF` are encoded in two bytes.\n * Code points in `0x800..0xD7FF` or in `0xE000..0xFFFF` are encoded in three bytes.\n * Surrogate code points in `0xD800..0xDFFF` are not Unicode scalar values, therefore aren't encoded.\n * Code points in `0x10000..0x10FFFF` are represented by a pair of surrogate `Char`s and are encoded in four bytes.\n */\nprivate const val MAX_BYTES_PER_CHAR = 3\n\n/**\n * The byte sequence a malformed UTF-16 char sequence is replaced by.\n */\nprivate val REPLACEMENT_BYTE_SEQUENCE: ByteArray = byteArrayOf(0xEF.toByte(), 0xBF.toByte(), 0xBD.toByte())\n\n/**\n * Encodes the [string] using UTF-8 and returns the resulting [ByteArray].\n *\n * @param string the string to encode.\n * @param startIndex the start offset (inclusive) of the substring to encode.\n * @param endIndex the end offset (exclusive) of the substring to encode.\n * @param throwOnMalformed whether to throw on malformed char sequence or replace by the [REPLACEMENT_BYTE_SEQUENCE].\n *\n * @throws CharacterCodingException if the char sequence is malformed and [throwOnMalformed] is true.\n */\ninternal fun encodeUtf8(string: String, startIndex: Int, endIndex: Int, throwOnMalformed: Boolean): ByteArray {\n require(startIndex >= 0 && endIndex <= string.length && startIndex <= endIndex)\n\n val bytes = ByteArray((endIndex - startIndex) * MAX_BYTES_PER_CHAR)\n var byteIndex = 0\n var charIndex = startIndex\n\n while (charIndex < endIndex) {\n val code = string[charIndex++].toInt()\n when {\n code < 0x80 ->\n bytes[byteIndex++] = code.toByte()\n code < 0x800 -> {\n bytes[byteIndex++] = ((code shr 6) or 0xC0).toByte()\n bytes[byteIndex++] = ((code and 0x3F) or 0x80).toByte()\n }\n code < 0xD800 || code >= 0xE000 -> {\n bytes[byteIndex++] = ((code shr 12) or 0xE0).toByte()\n bytes[byteIndex++] = (((code shr 6) and 0x3F) or 0x80).toByte()\n bytes[byteIndex++] = ((code and 0x3F) or 0x80).toByte()\n }\n else -> { // Surrogate char value\n val codePoint = codePointFromSurrogate(string, code, charIndex, endIndex, throwOnMalformed)\n if (codePoint <= 0) {\n bytes[byteIndex++] = REPLACEMENT_BYTE_SEQUENCE[0]\n bytes[byteIndex++] = REPLACEMENT_BYTE_SEQUENCE[1]\n bytes[byteIndex++] = REPLACEMENT_BYTE_SEQUENCE[2]\n } else {\n bytes[byteIndex++] = ((codePoint shr 18) or 0xF0).toByte()\n bytes[byteIndex++] = (((codePoint shr 12) and 0x3F) or 0x80).toByte()\n bytes[byteIndex++] = (((codePoint shr 6) and 0x3F) or 0x80).toByte()\n bytes[byteIndex++] = ((codePoint and 0x3F) or 0x80).toByte()\n charIndex++\n }\n }\n }\n }\n\n return if (bytes.size == byteIndex) bytes else bytes.copyOf(byteIndex)\n}\n\n/**\n * The character a malformed UTF-8 byte sequence is replaced by.\n */\nprivate const val REPLACEMENT_CHAR = '\\uFFFD'\n\n/**\n * Decodes the UTF-8 [bytes] array and returns the resulting [String].\n *\n * @param bytes the byte array to decode.\n * @param startIndex the start offset (inclusive) of the array to be decoded.\n * @param endIndex the end offset (exclusive) of the array to be encoded.\n * @param throwOnMalformed whether to throw on malformed byte sequence or replace by the [REPLACEMENT_CHAR].\n *\n * @throws CharacterCodingException if the array is malformed UTF-8 byte sequence and [throwOnMalformed] is true.\n */\ninternal fun decodeUtf8(bytes: ByteArray, startIndex: Int, endIndex: Int, throwOnMalformed: Boolean): String {\n require(startIndex >= 0 && endIndex <= bytes.size && startIndex <= endIndex)\n\n var byteIndex = startIndex\n val stringBuilder = StringBuilder()\n\n while (byteIndex < endIndex) {\n val byte = bytes[byteIndex++].toInt()\n when {\n byte >= 0 ->\n stringBuilder.append(byte.toChar())\n byte shr 5 == -2 -> {\n val code = codePointFrom2(bytes, byte, byteIndex, endIndex, throwOnMalformed)\n if (code <= 0) {\n stringBuilder.append(REPLACEMENT_CHAR)\n byteIndex += -code\n } else {\n stringBuilder.append(code.toChar())\n byteIndex += 1\n }\n }\n byte shr 4 == -2 -> {\n val code = codePointFrom3(bytes, byte, byteIndex, endIndex, throwOnMalformed)\n if (code <= 0) {\n stringBuilder.append(REPLACEMENT_CHAR)\n byteIndex += -code\n } else {\n stringBuilder.append(code.toChar())\n byteIndex += 2\n }\n }\n byte shr 3 == -2 -> {\n val code = codePointFrom4(bytes, byte, byteIndex, endIndex, throwOnMalformed)\n if (code <= 0) {\n stringBuilder.append(REPLACEMENT_CHAR)\n byteIndex += -code\n } else {\n val high = (code - 0x10000) shr 10 or 0xD800\n val low = (code and 0x3FF) or 0xDC00\n stringBuilder.append(high.toChar())\n stringBuilder.append(low.toChar())\n byteIndex += 3\n }\n }\n else -> {\n malformed(0, byteIndex, throwOnMalformed)\n stringBuilder.append(REPLACEMENT_CHAR)\n }\n }\n }\n\n return stringBuilder.toString()\n}","/*\n * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.time\n\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic actual enum class DurationUnit(internal val scale: Double) {\n /**\n * Time unit representing one nanosecond, which is 1/1000 of a microsecond.\n */\n NANOSECONDS(1e0),\n /**\n * Time unit representing one microsecond, which is 1/1000 of a millisecond.\n */\n MICROSECONDS(1e3),\n /**\n * Time unit representing one millisecond, which is 1/1000 of a second.\n */\n MILLISECONDS(1e6),\n /**\n * Time unit representing one second.\n */\n SECONDS(1e9),\n /**\n * Time unit representing one minute.\n */\n MINUTES(60e9),\n /**\n * Time unit representing one hour.\n */\n HOURS(3600e9),\n /**\n * Time unit representing one day, which is always equal to 24 hours.\n */\n DAYS(86400e9);\n}\n\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\ninternal actual fun convertDurationUnit(value: Double, sourceUnit: DurationUnit, targetUnit: DurationUnit): Double {\n val sourceCompareTarget = sourceUnit.scale.compareTo(targetUnit.scale)\n return when {\n sourceCompareTarget > 0 -> value * (sourceUnit.scale / targetUnit.scale)\n sourceCompareTarget < 0 -> value / (targetUnit.scale / sourceUnit.scale)\n else -> value\n }\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.time\n\nimport org.w3c.performance.GlobalPerformance\nimport org.w3c.performance.Performance\n\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\ninternal actual object MonotonicTimeSource : TimeSource {\n\n private val actualSource: TimeSource = run {\n val isNode: Boolean = js(\"typeof process !== 'undefined' && process.versions && !!process.versions.node\")\n\n if (isNode)\n HrTimeSource(js(\"process\").unsafeCast())\n else\n js(\"self\").unsafeCast()?.performance?.let(::PerformanceTimeSource)\n ?: DateNowTimeSource\n\n }\n\n override fun markNow(): TimeMark = actualSource.markNow()\n}\n\ninternal external interface Process {\n fun hrtime(time: Array = definedExternally): Array\n}\n\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\ninternal class HrTimeSource(val process: Process) : TimeSource {\n\n override fun markNow(): TimeMark = object : TimeMark() {\n val startedAt = process.hrtime()\n override fun elapsedNow(): Duration =\n process.hrtime(startedAt).let { (seconds, nanos) -> seconds.seconds + nanos.nanoseconds }\n }\n\n override fun toString(): String = \"TimeSource(process.hrtime())\"\n}\n\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\ninternal class PerformanceTimeSource(val performance: Performance) : AbstractDoubleTimeSource(unit = DurationUnit.MILLISECONDS) {\n override fun read(): Double = performance.now()\n override fun toString(): String = \"TimeSource(self.performance.now())\"\n}\n\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\ninternal object DateNowTimeSource : AbstractDoubleTimeSource(unit = DurationUnit.MILLISECONDS) {\n override fun read(): Double = kotlin.js.Date.now()\n override fun toString(): String = \"TimeSource(Date.now())\"\n}","/*\n * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.time\n\nimport kotlin.js.json\nimport kotlin.math.*\n\ninternal actual fun formatToExactDecimals(value: Double, decimals: Int): String {\n val rounded = if (decimals == 0) {\n value\n } else {\n val pow = 10.0.pow(decimals)\n @Suppress(\"DEPRECATION\", \"DEPRECATION_ERROR\")\n kotlin.js.Math.round(abs(value) * pow) / pow * sign(value)\n }\n return rounded.asDynamic().toFixed(decimals).unsafeCast()\n}\n\ninternal actual fun formatUpToDecimals(value: Double, decimals: Int): String {\n return value.asDynamic().toLocaleString(\"en-us\", json(\"maximumFractionDigits\" to decimals)).unsafeCast()\n}\n\ninternal actual fun formatScientific(value: Double): String {\n return value.asDynamic().toExponential(2).unsafeCast()\n}","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlinx.dom\n\nimport org.w3c.dom.*\nimport kotlin.contracts.*\n\n/**\n * Creates a new element with the specified [name].\n *\n * The element is initialized with the specified [init] function.\n */\n@SinceKotlin(\"1.4\")\npublic fun Document.createElement(name: String, init: Element.() -> Unit): Element {\n contract { callsInPlace(init, InvocationKind.EXACTLY_ONCE) }\n return createElement(name).apply(init)\n}\n\n/**\n * Appends a newly created element with the specified [name] to this element.\n *\n * The element is initialized with the specified [init] function.\n */\n@SinceKotlin(\"1.4\")\npublic fun Element.appendElement(name: String, init: Element.() -> Unit): Element {\n contract { callsInPlace(init, InvocationKind.EXACTLY_ONCE) }\n return ownerDocument!!.createElement(name, init).also { appendChild(it) }\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\npackage kotlin.collections\n\nimport kotlin.js.JsName\n\n/**\n * Provides a skeletal implementation of the read-only [Collection] interface.\n *\n * @param E the type of elements contained in the collection. The collection is covariant in its element type.\n */\n@SinceKotlin(\"1.1\")\npublic abstract class AbstractCollection protected constructor() : Collection {\n abstract override val size: Int\n abstract override fun iterator(): Iterator\n\n override fun contains(element: @UnsafeVariance E): Boolean = any { it == element }\n\n override fun containsAll(elements: Collection<@UnsafeVariance E>): Boolean =\n elements.all { contains(it) } // use when js will support bound refs: elements.all(this::contains)\n\n override fun isEmpty(): Boolean = size == 0\n\n override fun toString(): String = joinToString(\", \", \"[\", \"]\") {\n if (it === this) \"(this Collection)\" else it.toString()\n }\n\n /**\n * Returns new array of type `Array` with the elements of this collection.\n */\n @JsName(\"toArray\")\n protected open fun toArray(): Array = copyToArrayImpl(this)\n\n /**\n * Fills the provided [array] or creates new array of the same type\n * and fills it with the elements of this collection.\n */\n protected open fun toArray(array: Array): Array = copyToArrayImpl(this, array)\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n/*\n * Based on GWT AbstractList\n * Copyright 2007 Google Inc.\n*/\n\npackage kotlin.collections\n\n/**\n * Provides a skeletal implementation of the read-only [List] interface.\n *\n * This class is intended to help implementing read-only lists so it doesn't support concurrent modification tracking.\n *\n * @param E the type of elements contained in the list. The list is covariant in its element type.\n */\n@SinceKotlin(\"1.1\")\npublic abstract class AbstractList protected constructor() : AbstractCollection(), List {\n abstract override val size: Int\n abstract override fun get(index: Int): E\n\n override fun iterator(): Iterator = IteratorImpl()\n\n override fun indexOf(element: @UnsafeVariance E): Int = indexOfFirst { it == element }\n\n override fun lastIndexOf(element: @UnsafeVariance E): Int = indexOfLast { it == element }\n\n override fun listIterator(): ListIterator = ListIteratorImpl(0)\n\n override fun listIterator(index: Int): ListIterator = ListIteratorImpl(index)\n\n override fun subList(fromIndex: Int, toIndex: Int): List = SubList(this, fromIndex, toIndex)\n\n private class SubList(private val list: AbstractList, private val fromIndex: Int, toIndex: Int) : AbstractList(), RandomAccess {\n private var _size: Int = 0\n\n init {\n checkRangeIndexes(fromIndex, toIndex, list.size)\n this._size = toIndex - fromIndex\n }\n\n override fun get(index: Int): E {\n checkElementIndex(index, _size)\n\n return list[fromIndex + index]\n }\n\n override val size: Int get() = _size\n }\n\n /**\n * Compares this list with other list instance with the ordered structural equality.\n *\n * @return true, if [other] instance is a [List] of the same size, which contains the same elements in the same order.\n */\n override fun equals(other: Any?): Boolean {\n if (other === this) return true\n if (other !is List<*>) return false\n\n return orderedEquals(this, other)\n }\n\n /**\n * Returns the hash code value for this list.\n */\n override fun hashCode(): Int = orderedHashCode(this)\n\n private open inner class IteratorImpl : Iterator {\n /** the index of the item that will be returned on the next call to [next]`()` */\n protected var index = 0\n\n override fun hasNext(): Boolean = index < size\n\n override fun next(): E {\n if (!hasNext()) throw NoSuchElementException()\n return get(index++)\n }\n }\n\n /**\n * Implementation of [ListIterator] for abstract lists.\n */\n private open inner class ListIteratorImpl(index: Int) : IteratorImpl(), ListIterator {\n\n init {\n checkPositionIndex(index, this@AbstractList.size)\n this.index = index\n }\n\n override fun hasPrevious(): Boolean = index > 0\n\n override fun nextIndex(): Int = index\n\n override fun previous(): E {\n if (!hasPrevious()) throw NoSuchElementException()\n return get(--index)\n }\n\n override fun previousIndex(): Int = index - 1\n }\n\n internal companion object {\n internal fun checkElementIndex(index: Int, size: Int) {\n if (index < 0 || index >= size) {\n throw IndexOutOfBoundsException(\"index: $index, size: $size\")\n }\n }\n\n internal fun checkPositionIndex(index: Int, size: Int) {\n if (index < 0 || index > size) {\n throw IndexOutOfBoundsException(\"index: $index, size: $size\")\n }\n }\n\n internal fun checkRangeIndexes(fromIndex: Int, toIndex: Int, size: Int) {\n if (fromIndex < 0 || toIndex > size) {\n throw IndexOutOfBoundsException(\"fromIndex: $fromIndex, toIndex: $toIndex, size: $size\")\n }\n if (fromIndex > toIndex) {\n throw IllegalArgumentException(\"fromIndex: $fromIndex > toIndex: $toIndex\")\n }\n }\n\n internal fun checkBoundsIndexes(startIndex: Int, endIndex: Int, size: Int) {\n if (startIndex < 0 || endIndex > size) {\n throw IndexOutOfBoundsException(\"startIndex: $startIndex, endIndex: $endIndex, size: $size\")\n }\n if (startIndex > endIndex) {\n throw IllegalArgumentException(\"startIndex: $startIndex > endIndex: $endIndex\")\n }\n }\n\n internal fun orderedHashCode(c: Collection<*>): Int {\n var hashCode = 1\n for (e in c) {\n hashCode = 31 * hashCode + (e?.hashCode() ?: 0)\n }\n return hashCode\n }\n\n internal fun orderedEquals(c: Collection<*>, other: Collection<*>): Boolean {\n if (c.size != other.size) return false\n\n val otherIterator = other.iterator()\n for (elem in c) {\n val elemOther = otherIterator.next()\n if (elem != elemOther) {\n return false\n }\n }\n return true\n }\n }\n}","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n/*\n * Based on GWT AbstractMap\n * Copyright 2007 Google Inc.\n */\n\npackage kotlin.collections\n\n/**\n * Provides a skeletal implementation of the read-only [Map] interface.\n *\n * The implementor is required to implement [entries] property, which should return read-only set of map entries.\n *\n * @param K the type of map keys. The map is invariant in its key type.\n * @param V the type of map values. The map is covariant in its value type.\n */\n@SinceKotlin(\"1.1\")\npublic abstract class AbstractMap protected constructor() : Map {\n\n override fun containsKey(key: K): Boolean {\n return implFindEntry(key) != null\n }\n\n override fun containsValue(value: @UnsafeVariance V): Boolean = entries.any { it.value == value }\n\n internal fun containsEntry(entry: Map.Entry<*, *>?): Boolean {\n // since entry comes from @UnsafeVariance parameters it can be virtually anything\n if (entry !is Map.Entry<*, *>) return false\n val key = entry.key\n val value = entry.value\n val ourValue = get(key)\n\n if (value != ourValue) {\n return false\n }\n\n // Perhaps it was null and we don't contain the key?\n if (ourValue == null && !containsKey(key)) {\n return false\n }\n\n return true\n }\n\n\n /**\n * Compares this map with other instance with the ordered structural equality.\n *\n * @return true, if [other] instance is a [Map] of the same size, all entries of which are contained in the [entries] set of this map.\n */\n override fun equals(other: Any?): Boolean {\n if (other === this) return true\n if (other !is Map<*, *>) return false\n if (size != other.size) return false\n\n return other.entries.all { containsEntry(it) }\n }\n\n override operator fun get(key: K): V? = implFindEntry(key)?.value\n\n\n /**\n * Returns the hash code value for this map.\n *\n * It is the same as the hashCode of [entries] set.\n */\n override fun hashCode(): Int = entries.hashCode()\n\n override fun isEmpty(): Boolean = size == 0\n override val size: Int get() = entries.size\n\n /**\n * Returns a read-only [Set] of all keys in this map.\n *\n * Accessing this property first time creates a keys view from [entries].\n * All subsequent accesses just return the created instance.\n */\n override val keys: Set\n get() {\n if (_keys == null) {\n _keys = object : AbstractSet() {\n override operator fun contains(element: K): Boolean = containsKey(element)\n\n override operator fun iterator(): Iterator {\n val entryIterator = entries.iterator()\n return object : Iterator {\n override fun hasNext(): Boolean = entryIterator.hasNext()\n override fun next(): K = entryIterator.next().key\n }\n }\n\n override val size: Int get() = this@AbstractMap.size\n }\n }\n return _keys!!\n }\n\n @kotlin.jvm.Volatile\n private var _keys: Set? = null\n\n\n override fun toString(): String = entries.joinToString(\", \", \"{\", \"}\") { toString(it) }\n\n private fun toString(entry: Map.Entry): String = toString(entry.key) + \"=\" + toString(entry.value)\n\n private fun toString(o: Any?): String = if (o === this) \"(this Map)\" else o.toString()\n\n /**\n * Returns a read-only [Collection] of all values in this map.\n *\n * Accessing this property first time creates a values view from [entries].\n * All subsequent accesses just return the created instance.\n */\n override val values: Collection\n get() {\n if (_values == null) {\n _values = object : AbstractCollection() {\n override operator fun contains(element: @UnsafeVariance V): Boolean = containsValue(element)\n\n override operator fun iterator(): Iterator {\n val entryIterator = entries.iterator()\n return object : Iterator {\n override fun hasNext(): Boolean = entryIterator.hasNext()\n override fun next(): V = entryIterator.next().value\n }\n }\n\n override val size: Int get() = this@AbstractMap.size\n }\n }\n return _values!!\n }\n\n @kotlin.jvm.Volatile\n private var _values: Collection? = null\n\n private fun implFindEntry(key: K): Map.Entry? = entries.firstOrNull { it.key == key }\n\n internal companion object {\n\n internal fun entryHashCode(e: Map.Entry<*, *>): Int = with(e) { (key?.hashCode() ?: 0) xor (value?.hashCode() ?: 0) }\n internal fun entryToString(e: Map.Entry<*, *>): String = with(e) { \"$key=$value\" }\n internal fun entryEquals(e: Map.Entry<*, *>, other: Any?): Boolean {\n if (other !is Map.Entry<*, *>) return false\n return e.key == other.key && e.value == other.value\n }\n }\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\npackage kotlin.collections\n\n/**\n * Provides a skeletal implementation of the read-only [Set] interface.\n *\n * This class is intended to help implementing read-only sets so it doesn't support concurrent modification tracking.\n *\n * @param E the type of elements contained in the set. The set is covariant in its element type.\n */\n@SinceKotlin(\"1.1\")\npublic abstract class AbstractSet protected constructor() : AbstractCollection(), Set {\n\n /**\n * Compares this set with other set instance with the unordered structural equality.\n *\n * @return true, if [other] instance is a [Set] of the same size, all elements of which are contained in this set.\n */\n override fun equals(other: Any?): Boolean {\n if (other === this) return true\n if (other !is Set<*>) return false\n return setEquals(this, other)\n }\n\n /**\n * Returns the hash code value for this set.\n */\n override fun hashCode(): Int = unorderedHashCode(this)\n\n internal companion object {\n internal fun unorderedHashCode(c: Collection<*>): Int {\n var hashCode = 0\n for (element in c) {\n hashCode += (element?.hashCode() ?: 0)\n }\n return hashCode\n }\n\n internal fun setEquals(c: Set<*>, other: Set<*>): Boolean {\n if (c.size != other.size) return false\n return c.containsAll(other)\n }\n }\n\n}","/*\n * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.collections\n\n/**\n * Resizable-array implementation of the deque data structure.\n *\n * The name deque is short for \"double ended queue\" and is usually pronounced \"deck\".\n *\n * The collection provide methods for convenient access to the both ends.\n * It also implements [MutableList] interface and supports efficient get/set operations by index.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic class ArrayDeque : AbstractMutableList {\n private var head: Int = 0\n private var elementData: Array\n\n override var size: Int = 0\n private set\n\n /**\n * Constructs an empty deque with specified [initialCapacity], or throws [IllegalArgumentException] if [initialCapacity] is negative.\n */\n public constructor(initialCapacity: Int) {\n elementData = when {\n initialCapacity == 0 -> emptyElementData\n initialCapacity > 0 -> arrayOfNulls(initialCapacity)\n else -> throw IllegalArgumentException(\"Illegal Capacity: $initialCapacity\")\n }\n }\n\n /**\n * Constructs an empty deque.\n */\n public constructor() {\n elementData = emptyElementData\n }\n\n /**\n * Constructs a deque that contains the same elements as the specified [elements] collection in the same order.\n */\n public constructor(elements: Collection) {\n elementData = elements.toTypedArray()\n size = elementData.size\n if (elementData.isEmpty()) elementData = emptyElementData\n }\n\n /**\n * Ensures that the capacity of this deque is at least equal to the specified [minCapacity].\n *\n * If the current capacity is less than the [minCapacity], a new backing storage is allocated with greater capacity.\n * Otherwise, this method takes no action and simply returns.\n */\n private fun ensureCapacity(minCapacity: Int) {\n if (minCapacity < 0) throw IllegalStateException(\"Deque is too big.\") // overflow\n if (minCapacity <= elementData.size) return\n if (elementData === emptyElementData) {\n elementData = arrayOfNulls(minCapacity.coerceAtLeast(defaultMinCapacity))\n return\n }\n\n val newCapacity = newCapacity(elementData.size, minCapacity)\n copyElements(newCapacity)\n }\n\n /**\n * Creates a new array with the specified [newCapacity] size and copies elements in the [elementData] array to it.\n */\n private fun copyElements(newCapacity: Int) {\n val newElements = arrayOfNulls(newCapacity)\n elementData.copyInto(newElements, 0, head, elementData.size)\n elementData.copyInto(newElements, elementData.size - head, 0, head)\n head = 0\n elementData = newElements\n }\n\n @kotlin.internal.InlineOnly\n private inline fun internalGet(internalIndex: Int): E {\n @Suppress(\"UNCHECKED_CAST\")\n return elementData[internalIndex] as E\n }\n\n private fun positiveMod(index: Int): Int = if (index >= elementData.size) index - elementData.size else index\n\n private fun negativeMod(index: Int): Int = if (index < 0) index + elementData.size else index\n\n @kotlin.internal.InlineOnly\n private inline fun internalIndex(index: Int): Int = positiveMod(head + index)\n\n private fun incremented(index: Int): Int = if (index == elementData.lastIndex) 0 else index + 1\n\n private fun decremented(index: Int): Int = if (index == 0) elementData.lastIndex else index - 1\n\n override fun isEmpty(): Boolean = size == 0\n\n /**\n * Returns the first element, or throws [NoSuchElementException] if this deque is empty.\n */\n public fun first(): E = if (isEmpty()) throw NoSuchElementException(\"ArrayDeque is empty.\") else internalGet(head)\n\n /**\n * Returns the first element, or `null` if this deque is empty.\n */\n public fun firstOrNull(): E? = if (isEmpty()) null else internalGet(head)\n\n /**\n * Returns the last element, or throws [NoSuchElementException] if this deque is empty.\n */\n public fun last(): E = if (isEmpty()) throw NoSuchElementException(\"ArrayDeque is empty.\") else internalGet(internalIndex(lastIndex))\n\n /**\n * Returns the last element, or `null` if this deque is empty.\n */\n public fun lastOrNull(): E? = if (isEmpty()) null else internalGet(internalIndex(lastIndex))\n\n /**\n * Prepends the specified [element] to this deque.\n */\n public fun addFirst(element: E) {\n ensureCapacity(size + 1)\n\n head = decremented(head)\n elementData[head] = element\n size += 1\n }\n\n /**\n * Appends the specified [element] to this deque.\n */\n public fun addLast(element: E) {\n ensureCapacity(size + 1)\n\n elementData[internalIndex(size)] = element\n size += 1\n }\n\n /**\n * Removes the first element from this deque and returns that removed element, or throws [NoSuchElementException] if this deque is empty.\n */\n public fun removeFirst(): E {\n if (isEmpty()) throw NoSuchElementException(\"ArrayDeque is empty.\")\n\n val element = internalGet(head)\n elementData[head] = null\n head = incremented(head)\n size -= 1\n return element\n }\n\n /**\n * Removes the first element from this deque and returns that removed element, or returns `null` if this deque is empty.\n */\n public fun removeFirstOrNull(): E? = if (isEmpty()) null else removeFirst()\n\n /**\n * Removes the last element from this deque and returns that removed element, or throws [NoSuchElementException] if this deque is empty.\n */\n public fun removeLast(): E {\n if (isEmpty()) throw NoSuchElementException(\"ArrayDeque is empty.\")\n\n val internalLastIndex = internalIndex(lastIndex)\n val element = internalGet(internalLastIndex)\n elementData[internalLastIndex] = null\n size -= 1\n return element\n }\n\n /**\n * Removes the last element from this deque and returns that removed element, or returns `null` if this deque is empty.\n */\n public fun removeLastOrNull(): E? = if (isEmpty()) null else removeLast()\n\n // MutableList, MutableCollection\n public override fun add(element: E): Boolean {\n addLast(element)\n return true\n }\n\n public override fun add(index: Int, element: E) {\n AbstractList.checkPositionIndex(index, size)\n\n if (index == size) {\n addLast(element)\n return\n } else if (index == 0) {\n addFirst(element)\n return\n }\n\n ensureCapacity(size + 1)\n\n // Elements in circular array lay in 2 ways:\n // 1. `head` is less than `tail`: [#, #, e1, e2, e3, #]\n // 2. `head` is greater than `tail`: [e3, #, #, #, e1, e2]\n // where head is the index of the first element in the circular array,\n // and tail is the index following the last element.\n //\n // At this point the insertion index is not equal to head or tail.\n // Also the circular array can store at least one more element.\n //\n // Depending on where the given element must be inserted the preceding or the succeeding\n // elements will be shifted to make room for the element to be inserted.\n //\n // In case the preceding elements are shifted:\n // * if the insertion index is greater than the head (regardless of circular array form)\n // -> shift the preceding elements\n // * otherwise, the circular array has (2) form and the insertion index is less than tail\n // -> shift all elements in the back of the array\n // -> shift preceding elements in the front of the array\n // In case the succeeding elements are shifted:\n // * if the insertion index is less than the tail (regardless of circular array form)\n // -> shift the succeeding elements\n // * otherwise, the circular array has (2) form and the insertion index is greater than head\n // -> shift all elements in the front of the array\n // -> shift succeeding elements in the back of the array\n\n val internalIndex = internalIndex(index)\n\n if (index < (size + 1) shr 1) {\n // closer to the first element -> shift preceding elements\n val decrementedInternalIndex = decremented(internalIndex)\n val decrementedHead = decremented(head)\n\n if (decrementedInternalIndex >= head) {\n elementData[decrementedHead] = elementData[head] // head can be zero\n elementData.copyInto(elementData, head, head + 1, decrementedInternalIndex + 1)\n } else { // head > tail\n elementData.copyInto(elementData, head - 1, head, elementData.size) // head can't be zero\n elementData[elementData.size - 1] = elementData[0]\n elementData.copyInto(elementData, 0, 1, decrementedInternalIndex + 1)\n }\n\n elementData[decrementedInternalIndex] = element\n head = decrementedHead\n } else {\n // closer to the last element -> shift succeeding elements\n val tail = internalIndex(size)\n\n if (internalIndex < tail) {\n elementData.copyInto(elementData, internalIndex + 1, internalIndex, tail)\n } else { // head > tail\n elementData.copyInto(elementData, 1, 0, tail)\n elementData[0] = elementData[elementData.size - 1]\n elementData.copyInto(elementData, internalIndex + 1, internalIndex, elementData.size - 1)\n }\n\n elementData[internalIndex] = element\n }\n size += 1\n }\n\n private fun copyCollectionElements(internalIndex: Int, elements: Collection) {\n val iterator = elements.iterator()\n\n for (index in internalIndex until elementData.size) {\n if (!iterator.hasNext()) break\n elementData[index] = iterator.next()\n }\n for (index in 0 until head) {\n if (!iterator.hasNext()) break\n elementData[index] = iterator.next()\n }\n\n size += elements.size\n }\n\n public override fun addAll(elements: Collection): Boolean {\n if (elements.isEmpty()) return false\n ensureCapacity(this.size + elements.size)\n copyCollectionElements(internalIndex(size), elements)\n return true\n }\n\n public override fun addAll(index: Int, elements: Collection): Boolean {\n AbstractList.checkPositionIndex(index, size)\n\n if (elements.isEmpty()) {\n return false\n } else if (index == size) {\n return addAll(elements)\n }\n\n ensureCapacity(this.size + elements.size)\n\n val tail = internalIndex(size)\n val internalIndex = internalIndex(index)\n val elementsSize = elements.size\n\n if (index < (size + 1) shr 1) {\n // closer to the first element -> shift preceding elements\n\n var shiftedHead = head - elementsSize\n\n if (internalIndex >= head) {\n if (shiftedHead >= 0) {\n elementData.copyInto(elementData, shiftedHead, head, internalIndex)\n } else { // head < tail, insertion leads to head >= tail\n shiftedHead += elementData.size\n val elementsToShift = internalIndex - head\n val shiftToBack = elementData.size - shiftedHead\n\n if (shiftToBack >= elementsToShift) {\n elementData.copyInto(elementData, shiftedHead, head, internalIndex)\n } else {\n elementData.copyInto(elementData, shiftedHead, head, head + shiftToBack)\n elementData.copyInto(elementData, 0, head + shiftToBack, internalIndex)\n }\n }\n } else { // head > tail, internalIndex < tail\n elementData.copyInto(elementData, shiftedHead, head, elementData.size)\n if (elementsSize >= internalIndex) {\n elementData.copyInto(elementData, elementData.size - elementsSize, 0, internalIndex)\n } else {\n elementData.copyInto(elementData, elementData.size - elementsSize, 0, elementsSize)\n elementData.copyInto(elementData, 0, elementsSize, internalIndex)\n }\n }\n head = shiftedHead\n copyCollectionElements(negativeMod(internalIndex - elementsSize), elements)\n } else {\n // closer to the last element -> shift succeeding elements\n\n val shiftedInternalIndex = internalIndex + elementsSize\n\n if (internalIndex < tail) {\n if (tail + elementsSize <= elementData.size) {\n elementData.copyInto(elementData, shiftedInternalIndex, internalIndex, tail)\n } else { // head < tail, insertion leads to head >= tail\n if (shiftedInternalIndex >= elementData.size) {\n elementData.copyInto(elementData, shiftedInternalIndex - elementData.size, internalIndex, tail)\n } else {\n val shiftToFront = tail + elementsSize - elementData.size\n elementData.copyInto(elementData, 0, tail - shiftToFront, tail)\n elementData.copyInto(elementData, shiftedInternalIndex, internalIndex, tail - shiftToFront)\n }\n }\n } else { // head > tail, internalIndex > head\n elementData.copyInto(elementData, elementsSize, 0, tail)\n if (shiftedInternalIndex >= elementData.size) {\n elementData.copyInto(elementData, shiftedInternalIndex - elementData.size, internalIndex, elementData.size)\n } else {\n elementData.copyInto(elementData, 0, elementData.size - elementsSize, elementData.size)\n elementData.copyInto(elementData, shiftedInternalIndex, internalIndex, elementData.size - elementsSize)\n }\n }\n copyCollectionElements(internalIndex, elements)\n }\n\n return true\n }\n\n public override fun get(index: Int): E {\n AbstractList.checkElementIndex(index, size)\n\n return internalGet(internalIndex(index))\n }\n\n public override fun set(index: Int, element: E): E {\n AbstractList.checkElementIndex(index, size)\n\n val internalIndex = internalIndex(index)\n val oldElement = internalGet(internalIndex)\n elementData[internalIndex] = element\n\n return oldElement\n }\n\n public override fun contains(element: E): Boolean = indexOf(element) != -1\n\n public override fun indexOf(element: E): Int {\n val tail = internalIndex(size)\n\n if (head < tail) {\n for (index in head until tail) {\n if (element == elementData[index]) return index - head\n }\n } else if (head >= tail) {\n for (index in head until elementData.size) {\n if (element == elementData[index]) return index - head\n }\n for (index in 0 until tail) {\n if (element == elementData[index]) return index + elementData.size - head\n }\n }\n\n return -1\n }\n\n public override fun lastIndexOf(element: E): Int {\n val tail = internalIndex(size)\n\n if (head < tail) {\n for (index in tail - 1 downTo head) {\n if (element == elementData[index]) return index - head\n }\n } else if (head > tail) {\n for (index in tail - 1 downTo 0) {\n if (element == elementData[index]) return index + elementData.size - head\n }\n for (index in elementData.lastIndex downTo head) {\n if (element == elementData[index]) return index - head\n }\n }\n\n return -1\n }\n\n public override fun remove(element: E): Boolean {\n val index = indexOf(element)\n if (index == -1) return false\n removeAt(index)\n return true\n }\n\n public override fun removeAt(index: Int): E {\n AbstractList.checkElementIndex(index, size)\n\n if (index == lastIndex) {\n return removeLast()\n } else if (index == 0) {\n return removeFirst()\n }\n\n val internalIndex = internalIndex(index)\n val element = internalGet(internalIndex)\n\n if (index < size shr 1) {\n // closer to the first element -> shift preceding elements\n if (internalIndex >= head) {\n elementData.copyInto(elementData, head + 1, head, internalIndex)\n } else { // head > tail, internalIndex < head\n elementData.copyInto(elementData, 1, 0, internalIndex)\n elementData[0] = elementData[elementData.size - 1]\n elementData.copyInto(elementData, head + 1, head, elementData.size - 1)\n }\n\n elementData[head] = null\n head = incremented(head)\n } else {\n // closer to the last element -> shift succeeding elements\n val internalLastIndex = internalIndex(lastIndex)\n\n if (internalIndex <= internalLastIndex) {\n elementData.copyInto(elementData, internalIndex, internalIndex + 1, internalLastIndex + 1)\n } else { // head > tail, internalIndex > head\n elementData.copyInto(elementData, internalIndex, internalIndex + 1, elementData.size)\n elementData[elementData.size - 1] = elementData[0]\n elementData.copyInto(elementData, 0, 1, internalLastIndex + 1)\n }\n\n elementData[internalLastIndex] = null\n }\n size -= 1\n\n return element\n }\n\n public override fun removeAll(elements: Collection): Boolean = filterInPlace { !elements.contains(it) }\n\n public override fun retainAll(elements: Collection): Boolean = filterInPlace { elements.contains(it) }\n\n private inline fun filterInPlace(predicate: (E) -> Boolean): Boolean {\n if (this.isEmpty() || elementData.isEmpty())\n return false\n\n val tail = internalIndex(size)\n var newTail = head\n var modified = false\n\n if (head < tail) {\n for (index in head until tail) {\n val element = elementData[index]\n\n @Suppress(\"UNCHECKED_CAST\")\n if (predicate(element as E))\n elementData[newTail++] = element\n else\n modified = true\n }\n\n elementData.fill(null, newTail, tail)\n\n } else {\n for (index in head until elementData.size) {\n val element = elementData[index]\n elementData[index] = null\n\n @Suppress(\"UNCHECKED_CAST\")\n if (predicate(element as E))\n elementData[newTail++] = element\n else\n modified = true\n }\n\n newTail = positiveMod(newTail)\n\n for (index in 0 until tail) {\n val element = elementData[index]\n elementData[index] = null\n\n @Suppress(\"UNCHECKED_CAST\")\n if (predicate(element as E)) {\n elementData[newTail] = element\n newTail = incremented(newTail)\n } else {\n modified = true\n }\n }\n }\n if (modified)\n size = negativeMod(newTail - head)\n\n return modified\n }\n\n public override fun clear() {\n val tail = internalIndex(size)\n if (head < tail) {\n elementData.fill(null, head, tail)\n } else if (isNotEmpty()) {\n elementData.fill(null, head, elementData.size)\n elementData.fill(null, 0, tail)\n }\n head = 0\n size = 0\n }\n\n internal companion object {\n private val emptyElementData = emptyArray()\n private const val maxArraySize = Int.MAX_VALUE - 8\n private const val defaultMinCapacity = 10\n\n internal fun newCapacity(oldCapacity: Int, minCapacity: Int): Int {\n // overflow-conscious\n var newCapacity = oldCapacity + (oldCapacity shr 1)\n if (newCapacity - minCapacity < 0)\n newCapacity = minCapacity\n if (newCapacity - maxArraySize > 0)\n newCapacity = if (minCapacity > maxArraySize) Int.MAX_VALUE else maxArraySize\n return newCapacity\n }\n }\n\n // For testing only\n internal fun internalStructure(structure: (head: Int, elements: Array) -> Unit) {\n val tail = internalIndex(size)\n\n if (isEmpty()) {\n structure(head, emptyArray())\n return\n }\n\n val elements = arrayOfNulls(size)\n if (head < tail) {\n elementData.copyInto(elements, startIndex = head, endIndex = tail)\n structure(head, elements)\n } else {\n elementData.copyInto(elements, startIndex = head)\n elementData.copyInto(elements, elementData.size - head, startIndex = 0, endIndex = tail)\n structure(head - elementData.size, elements)\n }\n }\n}","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.collections\n\n/**\n * Data class representing a value from a collection or sequence, along with its index in that collection or sequence.\n *\n * @property value the underlying value.\n * @property index the index of the value in the collection or sequence.\n */\npublic data class IndexedValue(public val index: Int, public val value: T)\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"CollectionsKt\")\n\npackage kotlin.collections\n\n\n/**\n * Returns the given iterator itself. This allows to use an instance of iterator in a `for` loop.\n * @sample samples.collections.Iterators.iterator\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun Iterator.iterator(): Iterator = this\n\n/**\n * Returns an [Iterator] that wraps each element produced by the original iterator\n * into an [IndexedValue] containing the index of that element and the element itself.\n *\n * @sample samples.collections.Iterators.withIndexIterator\n */\npublic fun Iterator.withIndex(): Iterator> = IndexingIterator(this)\n\n/**\n * Performs the given [operation] on each element of this [Iterator].\n * @sample samples.collections.Iterators.forEachIterator\n */\npublic inline fun Iterator.forEach(operation: (T) -> Unit): Unit {\n for (element in this) operation(element)\n}\n\n/**\n * Iterator transforming original `iterator` into iterator of [IndexedValue], counting index from zero.\n */\ninternal class IndexingIterator(private val iterator: Iterator) : Iterator> {\n private var index = 0\n final override fun hasNext(): Boolean = iterator.hasNext()\n final override fun next(): IndexedValue = IndexedValue(checkIndexOverflow(index++), iterator.next())\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"MapsKt\")\n\npackage kotlin.collections\n\n/**\n * Returns the value for the given key, or the implicit default value for this map.\n * By default no implicit value is provided for maps and a [NoSuchElementException] is thrown.\n * To create a map with implicit default value use [withDefault] method.\n *\n * @throws NoSuchElementException when the map doesn't contain a value for the specified key and no implicit default was provided for that map.\n */\n@kotlin.jvm.JvmName(\"getOrImplicitDefaultNullable\")\n@PublishedApi\ninternal fun Map.getOrImplicitDefault(key: K): V {\n if (this is MapWithDefault)\n return this.getOrImplicitDefault(key)\n\n return getOrElseNullable(key, { throw NoSuchElementException(\"Key $key is missing in the map.\") })\n}\n\n/**\n * Returns a wrapper of this read-only map, having the implicit default value provided with the specified function [defaultValue].\n *\n * This implicit default value is used when the original map doesn't contain a value for the key specified\n * and a value is obtained with [Map.getValue] function, for example when properties are delegated to the map.\n *\n * When this map already has an implicit default value provided with a former call to [withDefault], it is being replaced by this call.\n */\npublic fun Map.withDefault(defaultValue: (key: K) -> V): Map =\n when (this) {\n is MapWithDefault -> this.map.withDefault(defaultValue)\n else -> MapWithDefaultImpl(this, defaultValue)\n }\n\n/**\n * Returns a wrapper of this mutable map, having the implicit default value provided with the specified function [defaultValue].\n *\n * This implicit default value is used when the original map doesn't contain a value for the key specified\n * and a value is obtained with [Map.getValue] function, for example when properties are delegated to the map.\n *\n * When this map already has an implicit default value provided with a former call to [withDefault], it is being replaced by this call.\n */\n@kotlin.jvm.JvmName(\"withDefaultMutable\")\npublic fun MutableMap.withDefault(defaultValue: (key: K) -> V): MutableMap =\n when (this) {\n is MutableMapWithDefault -> this.map.withDefault(defaultValue)\n else -> MutableMapWithDefaultImpl(this, defaultValue)\n }\n\n\nprivate interface MapWithDefault : Map {\n public val map: Map\n public fun getOrImplicitDefault(key: K): V\n}\n\nprivate interface MutableMapWithDefault : MutableMap, MapWithDefault {\n public override val map: MutableMap\n}\n\n\nprivate class MapWithDefaultImpl(public override val map: Map, private val default: (key: K) -> V) : MapWithDefault {\n override fun equals(other: Any?): Boolean = map.equals(other)\n override fun hashCode(): Int = map.hashCode()\n override fun toString(): String = map.toString()\n override val size: Int get() = map.size\n override fun isEmpty(): Boolean = map.isEmpty()\n override fun containsKey(key: K): Boolean = map.containsKey(key)\n override fun containsValue(value: @UnsafeVariance V): Boolean = map.containsValue(value)\n override fun get(key: K): V? = map.get(key)\n override val keys: Set get() = map.keys\n override val values: Collection get() = map.values\n override val entries: Set> get() = map.entries\n\n override fun getOrImplicitDefault(key: K): V = map.getOrElseNullable(key, { default(key) })\n}\n\nprivate class MutableMapWithDefaultImpl(public override val map: MutableMap, private val default: (key: K) -> V) : MutableMapWithDefault {\n override fun equals(other: Any?): Boolean = map.equals(other)\n override fun hashCode(): Int = map.hashCode()\n override fun toString(): String = map.toString()\n override val size: Int get() = map.size\n override fun isEmpty(): Boolean = map.isEmpty()\n override fun containsKey(key: K): Boolean = map.containsKey(key)\n override fun containsValue(value: @UnsafeVariance V): Boolean = map.containsValue(value)\n override fun get(key: K): V? = map.get(key)\n override val keys: MutableSet get() = map.keys\n override val values: MutableCollection get() = map.values\n override val entries: MutableSet> get() = map.entries\n\n override fun put(key: K, value: V): V? = map.put(key, value)\n override fun remove(key: K): V? = map.remove(key)\n override fun putAll(from: Map) = map.putAll(from)\n override fun clear() = map.clear()\n\n override fun getOrImplicitDefault(key: K): V = map.getOrElseNullable(key, { default(key) })\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"CollectionsKt\")\n\npackage kotlin.collections\n\nimport kotlin.random.Random\n\n/**\n * Removes a single instance of the specified element from this\n * collection, if it is present.\n *\n * Allows to overcome type-safety restriction of `remove` that requires to pass an element of type `E`.\n *\n * @return `true` if the element has been successfully removed; `false` if it was not present in the collection.\n */\n@kotlin.internal.InlineOnly\npublic inline fun <@kotlin.internal.OnlyInputTypes T> MutableCollection.remove(element: T): Boolean =\n @Suppress(\"UNCHECKED_CAST\") (this as MutableCollection).remove(element)\n\n/**\n * Removes all of this collection's elements that are also contained in the specified collection.\n\n * Allows to overcome type-safety restriction of `removeAll` that requires to pass a collection of type `Collection`.\n *\n * @return `true` if any of the specified elements was removed from the collection, `false` if the collection was not modified.\n */\n@kotlin.internal.InlineOnly\npublic inline fun <@kotlin.internal.OnlyInputTypes T> MutableCollection.removeAll(elements: Collection): Boolean =\n @Suppress(\"UNCHECKED_CAST\") (this as MutableCollection).removeAll(elements)\n\n/**\n * Retains only the elements in this collection that are contained in the specified collection.\n *\n * Allows to overcome type-safety restriction of `retainAll` that requires to pass a collection of type `Collection`.\n *\n * @return `true` if any element was removed from the collection, `false` if the collection was not modified.\n */\n@kotlin.internal.InlineOnly\npublic inline fun <@kotlin.internal.OnlyInputTypes T> MutableCollection.retainAll(elements: Collection): Boolean =\n @Suppress(\"UNCHECKED_CAST\") (this as MutableCollection).retainAll(elements)\n\n/**\n * Adds the specified [element] to this mutable collection.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableCollection.plusAssign(element: T) {\n this.add(element)\n}\n\n/**\n * Adds all elements of the given [elements] collection to this mutable collection.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableCollection.plusAssign(elements: Iterable) {\n this.addAll(elements)\n}\n\n/**\n * Adds all elements of the given [elements] array to this mutable collection.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableCollection.plusAssign(elements: Array) {\n this.addAll(elements)\n}\n\n/**\n * Adds all elements of the given [elements] sequence to this mutable collection.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableCollection.plusAssign(elements: Sequence) {\n this.addAll(elements)\n}\n\n/**\n * Removes a single instance of the specified [element] from this mutable collection.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableCollection.minusAssign(element: T) {\n this.remove(element)\n}\n\n/**\n * Removes all elements contained in the given [elements] collection from this mutable collection.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableCollection.minusAssign(elements: Iterable) {\n this.removeAll(elements)\n}\n\n/**\n * Removes all elements contained in the given [elements] array from this mutable collection.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableCollection.minusAssign(elements: Array) {\n this.removeAll(elements)\n}\n\n/**\n * Removes all elements contained in the given [elements] sequence from this mutable collection.\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun MutableCollection.minusAssign(elements: Sequence) {\n this.removeAll(elements)\n}\n\n/**\n * Adds all elements of the given [elements] collection to this [MutableCollection].\n */\npublic fun MutableCollection.addAll(elements: Iterable): Boolean {\n when (elements) {\n is Collection -> return addAll(elements)\n else -> {\n var result: Boolean = false\n for (item in elements)\n if (add(item)) result = true\n return result\n }\n }\n}\n\n/**\n * Adds all elements of the given [elements] sequence to this [MutableCollection].\n */\npublic fun MutableCollection.addAll(elements: Sequence): Boolean {\n var result: Boolean = false\n for (item in elements) {\n if (add(item)) result = true\n }\n return result\n}\n\n/**\n * Adds all elements of the given [elements] array to this [MutableCollection].\n */\npublic fun MutableCollection.addAll(elements: Array): Boolean {\n return addAll(elements.asList())\n}\n\n/**\n * Removes all elements from this [MutableCollection] that are also contained in the given [elements] collection.\n */\npublic fun MutableCollection.removeAll(elements: Iterable): Boolean {\n return removeAll(elements.convertToSetForSetOperationWith(this))\n}\n\n/**\n * Removes all elements from this [MutableCollection] that are also contained in the given [elements] sequence.\n */\npublic fun MutableCollection.removeAll(elements: Sequence): Boolean {\n val set = elements.toHashSet()\n return set.isNotEmpty() && removeAll(set)\n}\n\n/**\n * Removes all elements from this [MutableCollection] that are also contained in the given [elements] array.\n */\npublic fun MutableCollection.removeAll(elements: Array): Boolean {\n return elements.isNotEmpty() && removeAll(elements.toHashSet())\n}\n\n/**\n * Retains only elements of this [MutableCollection] that are contained in the given [elements] collection.\n */\npublic fun MutableCollection.retainAll(elements: Iterable): Boolean {\n return retainAll(elements.convertToSetForSetOperationWith(this))\n}\n\n/**\n * Retains only elements of this [MutableCollection] that are contained in the given [elements] array.\n */\npublic fun MutableCollection.retainAll(elements: Array): Boolean {\n if (elements.isNotEmpty())\n return retainAll(elements.toHashSet())\n else\n return retainNothing()\n}\n\n/**\n * Retains only elements of this [MutableCollection] that are contained in the given [elements] sequence.\n */\npublic fun MutableCollection.retainAll(elements: Sequence): Boolean {\n val set = elements.toHashSet()\n if (set.isNotEmpty())\n return retainAll(set)\n else\n return retainNothing()\n}\n\nprivate fun MutableCollection<*>.retainNothing(): Boolean {\n val result = isNotEmpty()\n clear()\n return result\n}\n\n\n/**\n * Removes all elements from this [MutableIterable] that match the given [predicate].\n *\n * @return `true` if any element was removed from this collection, or `false` when no elements were removed and collection was not modified.\n */\npublic fun MutableIterable.removeAll(predicate: (T) -> Boolean): Boolean = filterInPlace(predicate, true)\n\n/**\n * Retains only elements of this [MutableIterable] that match the given [predicate].\n *\n * @return `true` if any element was removed from this collection, or `false` when all elements were retained and collection was not modified.\n */\npublic fun MutableIterable.retainAll(predicate: (T) -> Boolean): Boolean = filterInPlace(predicate, false)\n\nprivate fun MutableIterable.filterInPlace(predicate: (T) -> Boolean, predicateResultToRemove: Boolean): Boolean {\n var result = false\n with(iterator()) {\n while (hasNext())\n if (predicate(next()) == predicateResultToRemove) {\n remove()\n result = true\n }\n }\n return result\n}\n\n\n/**\n * Removes the element at the specified [index] from this list.\n * In Kotlin one should use the [MutableList.removeAt] function instead.\n */\n@Deprecated(\"Use removeAt(index) instead.\", ReplaceWith(\"removeAt(index)\"), level = DeprecationLevel.ERROR)\n@kotlin.internal.InlineOnly\npublic inline fun MutableList.remove(index: Int): T = removeAt(index)\n\n/**\n * Removes the first element from this mutable list and returns that removed element, or throws [NoSuchElementException] if this list is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun MutableList.removeFirst(): T = if (isEmpty()) throw NoSuchElementException(\"List is empty.\") else removeAt(0)\n\n/**\n * Removes the first element from this mutable list and returns that removed element, or returns `null` if this list is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun MutableList.removeFirstOrNull(): T? = if (isEmpty()) null else removeAt(0)\n\n/**\n * Removes the last element from this mutable list and returns that removed element, or throws [NoSuchElementException] if this list is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun MutableList.removeLast(): T = if (isEmpty()) throw NoSuchElementException(\"List is empty.\") else removeAt(lastIndex)\n\n/**\n * Removes the last element from this mutable list and returns that removed element, or returns `null` if this list is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun MutableList.removeLastOrNull(): T? = if (isEmpty()) null else removeAt(lastIndex)\n\n/**\n * Removes all elements from this [MutableList] that match the given [predicate].\n *\n * @return `true` if any element was removed from this collection, or `false` when no elements were removed and collection was not modified.\n */\npublic fun MutableList.removeAll(predicate: (T) -> Boolean): Boolean = filterInPlace(predicate, true)\n\n/**\n * Retains only elements of this [MutableList] that match the given [predicate].\n *\n * @return `true` if any element was removed from this collection, or `false` when all elements were retained and collection was not modified.\n */\npublic fun MutableList.retainAll(predicate: (T) -> Boolean): Boolean = filterInPlace(predicate, false)\n\nprivate fun MutableList.filterInPlace(predicate: (T) -> Boolean, predicateResultToRemove: Boolean): Boolean {\n if (this !is RandomAccess)\n return (this as MutableIterable).filterInPlace(predicate, predicateResultToRemove)\n\n var writeIndex: Int = 0\n for (readIndex in 0..lastIndex) {\n val element = this[readIndex]\n if (predicate(element) == predicateResultToRemove)\n continue\n\n if (writeIndex != readIndex)\n this[writeIndex] = element\n\n writeIndex++\n }\n if (writeIndex < size) {\n for (removeIndex in lastIndex downTo writeIndex)\n removeAt(removeIndex)\n\n return true\n } else {\n return false\n }\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"CollectionsKt\")\n\npackage kotlin.collections\n\nprivate open class ReversedListReadOnly(private val delegate: List) : AbstractList() {\n override val size: Int get() = delegate.size\n override fun get(index: Int): T = delegate[reverseElementIndex(index)]\n}\n\nprivate class ReversedList(private val delegate: MutableList) : AbstractMutableList() {\n override val size: Int get() = delegate.size\n override fun get(index: Int): T = delegate[reverseElementIndex(index)]\n\n override fun clear() = delegate.clear()\n override fun removeAt(index: Int): T = delegate.removeAt(reverseElementIndex(index))\n\n override fun set(index: Int, element: T): T = delegate.set(reverseElementIndex(index), element)\n override fun add(index: Int, element: T) {\n delegate.add(reversePositionIndex(index), element)\n }\n}\n\nprivate fun List<*>.reverseElementIndex(index: Int) =\n if (index in 0..lastIndex) lastIndex - index else throw IndexOutOfBoundsException(\"Element index $index must be in range [${0..lastIndex}].\")\n\nprivate fun List<*>.reversePositionIndex(index: Int) =\n if (index in 0..size) size - index else throw IndexOutOfBoundsException(\"Position index $index must be in range [${0..size}].\")\n\n\n/**\n * Returns a reversed read-only view of the original List.\n * All changes made in the original list will be reflected in the reversed one.\n * @sample samples.collections.ReversedViews.asReversedList\n */\npublic fun List.asReversed(): List = ReversedListReadOnly(this)\n\n/**\n * Returns a reversed mutable view of the original mutable List.\n * All changes made in the original list will be reflected in the reversed one and vice versa.\n * @sample samples.collections.ReversedViews.asReversedMutableList\n */\n@kotlin.jvm.JvmName(\"asReversedMutable\")\npublic fun MutableList.asReversed(): MutableList = ReversedList(this)\n\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"SequencesKt\")\n@file:OptIn(ExperimentalTypeInference::class)\n\npackage kotlin.sequences\n\nimport kotlin.coroutines.*\nimport kotlin.coroutines.intrinsics.*\nimport kotlin.experimental.ExperimentalTypeInference\n\n/**\n * Builds a [Sequence] lazily yielding values one by one.\n *\n * @see kotlin.sequences.generateSequence\n *\n * @sample samples.collections.Sequences.Building.buildSequenceYieldAll\n * @sample samples.collections.Sequences.Building.buildFibonacciSequence\n */\n@SinceKotlin(\"1.3\")\npublic fun sequence(@BuilderInference block: suspend SequenceScope.() -> Unit): Sequence = Sequence { iterator(block) }\n\n@SinceKotlin(\"1.3\")\n@Deprecated(\"Use 'sequence { }' function instead.\", ReplaceWith(\"sequence(builderAction)\"), level = DeprecationLevel.ERROR)\n@kotlin.internal.InlineOnly\npublic inline fun buildSequence(@BuilderInference noinline builderAction: suspend SequenceScope.() -> Unit): Sequence = Sequence { iterator(builderAction) }\n\n/**\n * Builds an [Iterator] lazily yielding values one by one.\n *\n * @sample samples.collections.Sequences.Building.buildIterator\n * @sample samples.collections.Iterables.Building.iterable\n */\n@SinceKotlin(\"1.3\")\npublic fun iterator(@BuilderInference block: suspend SequenceScope.() -> Unit): Iterator {\n val iterator = SequenceBuilderIterator()\n iterator.nextStep = block.createCoroutineUnintercepted(receiver = iterator, completion = iterator)\n return iterator\n}\n\n@SinceKotlin(\"1.3\")\n@Deprecated(\"Use 'iterator { }' function instead.\", ReplaceWith(\"iterator(builderAction)\"), level = DeprecationLevel.ERROR)\n@kotlin.internal.InlineOnly\npublic inline fun buildIterator(@BuilderInference noinline builderAction: suspend SequenceScope.() -> Unit): Iterator = iterator(builderAction)\n\n/**\n * The scope for yielding values of a [Sequence] or an [Iterator], provides [yield] and [yieldAll] suspension functions.\n *\n * @see sequence\n * @see iterator\n *\n * @sample samples.collections.Sequences.Building.buildSequenceYieldAll\n * @sample samples.collections.Sequences.Building.buildFibonacciSequence\n */\n@RestrictsSuspension\n@SinceKotlin(\"1.3\")\npublic abstract class SequenceScope internal constructor() {\n /**\n * Yields a value to the [Iterator] being built and suspends\n * until the next value is requested.\n *\n * @sample samples.collections.Sequences.Building.buildSequenceYieldAll\n * @sample samples.collections.Sequences.Building.buildFibonacciSequence\n */\n public abstract suspend fun yield(value: T)\n\n /**\n * Yields all values from the `iterator` to the [Iterator] being built\n * and suspends until all these values are iterated and the next one is requested.\n *\n * The sequence of values returned by the given iterator can be potentially infinite.\n *\n * @sample samples.collections.Sequences.Building.buildSequenceYieldAll\n */\n public abstract suspend fun yieldAll(iterator: Iterator)\n\n /**\n * Yields a collections of values to the [Iterator] being built\n * and suspends until all these values are iterated and the next one is requested.\n *\n * @sample samples.collections.Sequences.Building.buildSequenceYieldAll\n */\n public suspend fun yieldAll(elements: Iterable) {\n if (elements is Collection && elements.isEmpty()) return\n return yieldAll(elements.iterator())\n }\n\n /**\n * Yields potentially infinite sequence of values to the [Iterator] being built\n * and suspends until all these values are iterated and the next one is requested.\n *\n * The sequence can be potentially infinite.\n *\n * @sample samples.collections.Sequences.Building.buildSequenceYieldAll\n */\n public suspend fun yieldAll(sequence: Sequence) = yieldAll(sequence.iterator())\n}\n\n@Deprecated(\"Use SequenceScope class instead.\", ReplaceWith(\"SequenceScope\"), level = DeprecationLevel.ERROR)\npublic typealias SequenceBuilder = SequenceScope\n\nprivate typealias State = Int\n\nprivate const val State_NotReady: State = 0\nprivate const val State_ManyNotReady: State = 1\nprivate const val State_ManyReady: State = 2\nprivate const val State_Ready: State = 3\nprivate const val State_Done: State = 4\nprivate const val State_Failed: State = 5\n\nprivate class SequenceBuilderIterator : SequenceScope(), Iterator, Continuation {\n private var state = State_NotReady\n private var nextValue: T? = null\n private var nextIterator: Iterator? = null\n var nextStep: Continuation? = null\n\n override fun hasNext(): Boolean {\n while (true) {\n when (state) {\n State_NotReady -> {}\n State_ManyNotReady ->\n if (nextIterator!!.hasNext()) {\n state = State_ManyReady\n return true\n } else {\n nextIterator = null\n }\n State_Done -> return false\n State_Ready, State_ManyReady -> return true\n else -> throw exceptionalState()\n }\n\n state = State_Failed\n val step = nextStep!!\n nextStep = null\n step.resume(Unit)\n }\n }\n\n override fun next(): T {\n when (state) {\n State_NotReady, State_ManyNotReady -> return nextNotReady()\n State_ManyReady -> {\n state = State_ManyNotReady\n return nextIterator!!.next()\n }\n State_Ready -> {\n state = State_NotReady\n @Suppress(\"UNCHECKED_CAST\")\n val result = nextValue as T\n nextValue = null\n return result\n }\n else -> throw exceptionalState()\n }\n }\n\n private fun nextNotReady(): T {\n if (!hasNext()) throw NoSuchElementException() else return next()\n }\n\n private fun exceptionalState(): Throwable = when (state) {\n State_Done -> NoSuchElementException()\n State_Failed -> IllegalStateException(\"Iterator has failed.\")\n else -> IllegalStateException(\"Unexpected state of the iterator: $state\")\n }\n\n\n override suspend fun yield(value: T) {\n nextValue = value\n state = State_Ready\n return suspendCoroutineUninterceptedOrReturn { c ->\n nextStep = c\n COROUTINE_SUSPENDED\n }\n }\n\n override suspend fun yieldAll(iterator: Iterator) {\n if (!iterator.hasNext()) return\n nextIterator = iterator\n state = State_ManyReady\n return suspendCoroutineUninterceptedOrReturn { c ->\n nextStep = c\n COROUTINE_SUSPENDED\n }\n }\n\n // Completion continuation implementation\n override fun resumeWith(result: Result) {\n result.getOrThrow() // just rethrow exception if it is there\n state = State_Done\n }\n\n override val context: CoroutineContext\n get() = EmptyCoroutineContext\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n@file:kotlin.jvm.JvmName(\"ComparisonsKt\")\n@file:kotlin.jvm.JvmMultifileClass\n\npackage kotlin.comparisons\n\n/**\n * Compares two values using the specified functions [selectors] to calculate the result of the comparison.\n * The functions are called sequentially, receive the given values [a] and [b] and return [Comparable]\n * objects. As soon as the [Comparable] instances returned by a function for [a] and [b] values do not\n * compare as equal, the result of that comparison is returned.\n *\n * @sample samples.comparisons.Comparisons.compareValuesByWithSelectors\n */\npublic fun compareValuesBy(a: T, b: T, vararg selectors: (T) -> Comparable<*>?): Int {\n require(selectors.size > 0)\n return compareValuesByImpl(a, b, selectors)\n}\n\nprivate fun compareValuesByImpl(a: T, b: T, selectors: Array Comparable<*>?>): Int {\n for (fn in selectors) {\n val v1 = fn(a)\n val v2 = fn(b)\n val diff = compareValues(v1, v2)\n if (diff != 0) return diff\n }\n return 0\n}\n\n/**\n * Compares two values using the specified [selector] function to calculate the result of the comparison.\n * The function is applied to the given values [a] and [b] and return [Comparable] objects.\n * The result of comparison of these [Comparable] instances is returned.\n *\n * @sample samples.comparisons.Comparisons.compareValuesByWithSingleSelector\n */\n@kotlin.internal.InlineOnly\npublic inline fun compareValuesBy(a: T, b: T, selector: (T) -> Comparable<*>?): Int {\n return compareValues(selector(a), selector(b))\n}\n\n/**\n * Compares two values using the specified [selector] function to calculate the result of the comparison.\n * The function is applied to the given values [a] and [b] and return objects of type K which are then being\n * compared with the given [comparator].\n *\n * @sample samples.comparisons.Comparisons.compareValuesByWithComparator\n */\n@kotlin.internal.InlineOnly\npublic inline fun compareValuesBy(a: T, b: T, comparator: Comparator, selector: (T) -> K): Int {\n return comparator.compare(selector(a), selector(b))\n}\n\n//// Not so useful without type inference for receiver of expression\n//// compareValuesWith(v1, v2, compareBy { it.prop1 } thenByDescending { it.prop2 })\n///**\n// * Compares two values using the specified [comparator].\n// */\n//@Suppress(\"NOTHING_TO_INLINE\")\n//public inline fun compareValuesWith(a: T, b: T, comparator: Comparator): Int = comparator.compare(a, b)\n//\n\n\n/**\n * Compares two nullable [Comparable] values. Null is considered less than any value.\n *\n * @sample samples.comparisons.Comparisons.compareValues\n */\npublic fun > compareValues(a: T?, b: T?): Int {\n if (a === b) return 0\n if (a == null) return -1\n if (b == null) return 1\n\n @Suppress(\"UNCHECKED_CAST\")\n return (a as Comparable).compareTo(b)\n}\n\n/**\n * Creates a comparator using the sequence of functions to calculate a result of comparison.\n * The functions are called sequentially, receive the given values `a` and `b` and return [Comparable]\n * objects. As soon as the [Comparable] instances returned by a function for `a` and `b` values do not\n * compare as equal, the result of that comparison is returned from the [Comparator].\n *\n * @sample samples.comparisons.Comparisons.compareByWithSelectors\n */\npublic fun compareBy(vararg selectors: (T) -> Comparable<*>?): Comparator {\n require(selectors.size > 0)\n return Comparator { a, b -> compareValuesByImpl(a, b, selectors) }\n}\n\n\n/**\n * Creates a comparator using the function to transform value to a [Comparable] instance for comparison.\n *\n * @sample samples.comparisons.Comparisons.compareByWithSingleSelector\n */\n@kotlin.internal.InlineOnly\npublic inline fun compareBy(crossinline selector: (T) -> Comparable<*>?): Comparator =\n Comparator { a, b -> compareValuesBy(a, b, selector) }\n\n/**\n * Creates a comparator using the [selector] function to transform values being compared and then applying\n * the specified [comparator] to compare transformed values.\n *\n * @sample samples.comparisons.Comparisons.compareByWithComparator\n */\n@kotlin.internal.InlineOnly\npublic inline fun compareBy(comparator: Comparator, crossinline selector: (T) -> K): Comparator =\n Comparator { a, b -> compareValuesBy(a, b, comparator, selector) }\n\n/**\n * Creates a descending comparator using the function to transform value to a [Comparable] instance for comparison.\n *\n * @sample samples.comparisons.Comparisons.compareByDescendingWithSingleSelector\n */\n@kotlin.internal.InlineOnly\npublic inline fun compareByDescending(crossinline selector: (T) -> Comparable<*>?): Comparator =\n Comparator { a, b -> compareValuesBy(b, a, selector) }\n\n/**\n * Creates a descending comparator using the [selector] function to transform values being compared and then applying\n * the specified [comparator] to compare transformed values.\n *\n * Note that an order of [comparator] is reversed by this wrapper.\n *\n * @sample samples.comparisons.Comparisons.compareByDescendingWithComparator\n */\n@kotlin.internal.InlineOnly\npublic inline fun compareByDescending(comparator: Comparator, crossinline selector: (T) -> K): Comparator =\n Comparator { a, b -> compareValuesBy(b, a, comparator, selector) }\n\n/**\n * Creates a comparator comparing values after the primary comparator defined them equal. It uses\n * the function to transform value to a [Comparable] instance for comparison.\n *\n * @sample samples.comparisons.Comparisons.thenBy\n */\n@kotlin.internal.InlineOnly\npublic inline fun Comparator.thenBy(crossinline selector: (T) -> Comparable<*>?): Comparator =\n Comparator { a, b ->\n val previousCompare = this@thenBy.compare(a, b)\n if (previousCompare != 0) previousCompare else compareValuesBy(a, b, selector)\n }\n\n/**\n * Creates a comparator comparing values after the primary comparator defined them equal. It uses\n * the [selector] function to transform values and then compares them with the given [comparator].\n *\n * @sample samples.comparisons.Comparisons.thenByWithComparator\n */\n@kotlin.internal.InlineOnly\npublic inline fun Comparator.thenBy(comparator: Comparator, crossinline selector: (T) -> K): Comparator =\n Comparator { a, b ->\n val previousCompare = this@thenBy.compare(a, b)\n if (previousCompare != 0) previousCompare else compareValuesBy(a, b, comparator, selector)\n }\n\n/**\n * Creates a descending comparator using the primary comparator and\n * the function to transform value to a [Comparable] instance for comparison.\n *\n * @sample samples.comparisons.Comparisons.thenByDescending\n */\n@kotlin.internal.InlineOnly\npublic inline fun Comparator.thenByDescending(crossinline selector: (T) -> Comparable<*>?): Comparator =\n Comparator { a, b ->\n val previousCompare = this@thenByDescending.compare(a, b)\n if (previousCompare != 0) previousCompare else compareValuesBy(b, a, selector)\n }\n\n/**\n * Creates a descending comparator comparing values after the primary comparator defined them equal. It uses\n * the [selector] function to transform values and then compares them with the given [comparator].\n *\n * @sample samples.comparisons.Comparisons.thenByDescendingWithComparator\n */\n@kotlin.internal.InlineOnly\npublic inline fun Comparator.thenByDescending(comparator: Comparator, crossinline selector: (T) -> K): Comparator =\n Comparator { a, b ->\n val previousCompare = this@thenByDescending.compare(a, b)\n if (previousCompare != 0) previousCompare else compareValuesBy(b, a, comparator, selector)\n }\n\n\n/**\n * Creates a comparator using the primary comparator and function to calculate a result of comparison.\n *\n * @sample samples.comparisons.Comparisons.thenComparator\n */\n@kotlin.internal.InlineOnly\npublic inline fun Comparator.thenComparator(crossinline comparison: (a: T, b: T) -> Int): Comparator =\n Comparator { a, b ->\n val previousCompare = this@thenComparator.compare(a, b)\n if (previousCompare != 0) previousCompare else comparison(a, b)\n }\n\n/**\n * Combines this comparator and the given [comparator] such that the latter is applied only\n * when the former considered values equal.\n *\n * @sample samples.comparisons.Comparisons.then\n */\npublic infix fun Comparator.then(comparator: Comparator): Comparator =\n Comparator { a, b ->\n val previousCompare = this@then.compare(a, b)\n if (previousCompare != 0) previousCompare else comparator.compare(a, b)\n }\n\n/**\n * Combines this comparator and the given [comparator] such that the latter is applied only\n * when the former considered values equal.\n *\n * @sample samples.comparisons.Comparisons.thenDescending\n */\npublic infix fun Comparator.thenDescending(comparator: Comparator): Comparator =\n Comparator { a, b ->\n val previousCompare = this@thenDescending.compare(a, b)\n if (previousCompare != 0) previousCompare else comparator.compare(b, a)\n }\n\n// Not so useful without type inference for receiver of expression\n/**\n * Extends the given [comparator] of non-nullable values to a comparator of nullable values\n * considering `null` value less than any other value.\n *\n * @sample samples.comparisons.Comparisons.nullsFirstLastWithComparator\n */\npublic fun nullsFirst(comparator: Comparator): Comparator =\n Comparator { a, b ->\n when {\n a === b -> 0\n a == null -> -1\n b == null -> 1\n else -> comparator.compare(a, b)\n }\n }\n\n/**\n * Provides a comparator of nullable [Comparable] values\n * considering `null` value less than any other value.\n *\n * @sample samples.comparisons.Comparisons.nullsFirstLastComparator\n */\n@kotlin.internal.InlineOnly\npublic inline fun > nullsFirst(): Comparator = nullsFirst(naturalOrder())\n\n/**\n * Extends the given [comparator] of non-nullable values to a comparator of nullable values\n * considering `null` value greater than any other value.\n *\n * @sample samples.comparisons.Comparisons.nullsFirstLastWithComparator\n */\npublic fun nullsLast(comparator: Comparator): Comparator =\n Comparator { a, b ->\n when {\n a === b -> 0\n a == null -> 1\n b == null -> -1\n else -> comparator.compare(a, b)\n }\n }\n\n/**\n * Provides a comparator of nullable [Comparable] values\n * considering `null` value greater than any other value.\n *\n * @sample samples.comparisons.Comparisons.nullsFirstLastComparator\n */\n@kotlin.internal.InlineOnly\npublic inline fun > nullsLast(): Comparator = nullsLast(naturalOrder())\n\n/**\n * Returns a comparator that compares [Comparable] objects in natural order.\n *\n * @sample samples.comparisons.Comparisons.naturalOrderComparator\n */\npublic fun > naturalOrder(): Comparator = @Suppress(\"UNCHECKED_CAST\") (NaturalOrderComparator as Comparator)\n\n/**\n * Returns a comparator that compares [Comparable] objects in reversed natural order.\n *\n * @sample samples.comparisons.Comparisons.nullsFirstLastWithComparator\n */\npublic fun > reverseOrder(): Comparator = @Suppress(\"UNCHECKED_CAST\") (ReverseOrderComparator as Comparator)\n\n/**\n * Returns a comparator that imposes the reverse ordering of this comparator.\n *\n * @sample samples.comparisons.Comparisons.reversed\n */\npublic fun Comparator.reversed(): Comparator = when (this) {\n is ReversedComparator -> this.comparator\n NaturalOrderComparator -> @Suppress(\"UNCHECKED_CAST\") (ReverseOrderComparator as Comparator)\n ReverseOrderComparator -> @Suppress(\"UNCHECKED_CAST\") (NaturalOrderComparator as Comparator)\n else -> ReversedComparator(this)\n}\n\n\nprivate class ReversedComparator(public val comparator: Comparator) : Comparator {\n override fun compare(a: T, b: T): Int = comparator.compare(b, a)\n @Suppress(\"VIRTUAL_MEMBER_HIDDEN\")\n fun reversed(): Comparator = comparator\n}\n\nprivate object NaturalOrderComparator : Comparator> {\n override fun compare(a: Comparable, b: Comparable): Int = a.compareTo(b)\n @Suppress(\"VIRTUAL_MEMBER_HIDDEN\")\n fun reversed(): Comparator> = ReverseOrderComparator\n}\n\nprivate object ReverseOrderComparator : Comparator> {\n override fun compare(a: Comparable, b: Comparable): Int = b.compareTo(a)\n @Suppress(\"VIRTUAL_MEMBER_HIDDEN\")\n fun reversed(): Comparator> = NaturalOrderComparator\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.coroutines\n\n/**\n * Marks coroutine context element that intercepts coroutine continuations.\n * The coroutines framework uses [ContinuationInterceptor.Key] to retrieve the interceptor and\n * intercepts all coroutine continuations with [interceptContinuation] invocations.\n *\n * [ContinuationInterceptor] behaves like a [polymorphic element][AbstractCoroutineContextKey], meaning that\n * its implementation delegates [get][CoroutineContext.Element.get] and [minusKey][CoroutineContext.Element.minusKey]\n * to [getPolymorphicElement] and [minusPolymorphicKey] respectively.\n * [ContinuationInterceptor] subtypes can be extracted from the coroutine context using either [ContinuationInterceptor.Key]\n * or subtype key if it extends [AbstractCoroutineContextKey].\n */\n@SinceKotlin(\"1.3\")\npublic interface ContinuationInterceptor : CoroutineContext.Element {\n /**\n * The key that defines *the* context interceptor.\n */\n companion object Key : CoroutineContext.Key\n\n /**\n * Returns continuation that wraps the original [continuation], thus intercepting all resumptions.\n * This function is invoked by coroutines framework when needed and the resulting continuations are\n * cached internally per each instance of the original [continuation].\n *\n * This function may simply return original [continuation] if it does not want to intercept this particular continuation.\n *\n * When the original [continuation] completes, coroutine framework invokes [releaseInterceptedContinuation]\n * with the resulting continuation if it was intercepted, that is if `interceptContinuation` had previously\n * returned a different continuation instance.\n */\n public fun interceptContinuation(continuation: Continuation): Continuation\n\n /**\n * Invoked for the continuation instance returned by [interceptContinuation] when the original\n * continuation completes and will not be used anymore. This function is invoked only if [interceptContinuation]\n * had returned a different continuation instance from the one it was invoked with.\n *\n * Default implementation does nothing.\n *\n * @param continuation Continuation instance returned by this interceptor's [interceptContinuation] invocation.\n */\n public fun releaseInterceptedContinuation(continuation: Continuation<*>) {\n /* do nothing by default */\n }\n\n public override operator fun get(key: CoroutineContext.Key): E? {\n // getPolymorphicKey specialized for ContinuationInterceptor key\n @OptIn(ExperimentalStdlibApi::class)\n if (key is AbstractCoroutineContextKey<*, *>) {\n @Suppress(\"UNCHECKED_CAST\")\n return if (key.isSubKey(this.key)) key.tryCast(this) as? E else null\n }\n @Suppress(\"UNCHECKED_CAST\")\n return if (ContinuationInterceptor === key) this as E else null\n }\n\n\n public override fun minusKey(key: CoroutineContext.Key<*>): CoroutineContext {\n // minusPolymorphicKey specialized for ContinuationInterceptor key\n @OptIn(ExperimentalStdlibApi::class)\n if (key is AbstractCoroutineContextKey<*, *>) {\n return if (key.isSubKey(this.key) && key.tryCast(this) != null) EmptyCoroutineContext else this\n }\n return if (ContinuationInterceptor === key) EmptyCoroutineContext else this\n }\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.coroutines\n\n/**\n * Persistent context for the coroutine. It is an indexed set of [Element] instances.\n * An indexed set is a mix between a set and a map.\n * Every element in this set has a unique [Key].\n */\n@SinceKotlin(\"1.3\")\npublic interface CoroutineContext {\n /**\n * Returns the element with the given [key] from this context or `null`.\n */\n public operator fun get(key: Key): E?\n\n /**\n * Accumulates entries of this context starting with [initial] value and applying [operation]\n * from left to right to current accumulator value and each element of this context.\n */\n public fun fold(initial: R, operation: (R, Element) -> R): R\n\n /**\n * Returns a context containing elements from this context and elements from other [context].\n * The elements from this context with the same key as in the other one are dropped.\n */\n public operator fun plus(context: CoroutineContext): CoroutineContext =\n if (context === EmptyCoroutineContext) this else // fast path -- avoid lambda creation\n context.fold(this) { acc, element ->\n val removed = acc.minusKey(element.key)\n if (removed === EmptyCoroutineContext) element else {\n // make sure interceptor is always last in the context (and thus is fast to get when present)\n val interceptor = removed[ContinuationInterceptor]\n if (interceptor == null) CombinedContext(removed, element) else {\n val left = removed.minusKey(ContinuationInterceptor)\n if (left === EmptyCoroutineContext) CombinedContext(element, interceptor) else\n CombinedContext(CombinedContext(left, element), interceptor)\n }\n }\n }\n\n /**\n * Returns a context containing elements from this context, but without an element with\n * the specified [key].\n */\n public fun minusKey(key: Key<*>): CoroutineContext\n\n /**\n * Key for the elements of [CoroutineContext]. [E] is a type of element with this key.\n */\n public interface Key\n\n /**\n * An element of the [CoroutineContext]. An element of the coroutine context is a singleton context by itself.\n */\n public interface Element : CoroutineContext {\n /**\n * A key of this coroutine context element.\n */\n public val key: Key<*>\n\n public override operator fun get(key: Key): E? =\n @Suppress(\"UNCHECKED_CAST\")\n if (this.key == key) this as E else null\n\n public override fun fold(initial: R, operation: (R, Element) -> R): R =\n operation(initial, this)\n\n public override fun minusKey(key: Key<*>): CoroutineContext =\n if (this.key == key) EmptyCoroutineContext else this\n }\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.coroutines\n\nimport kotlin.coroutines.CoroutineContext.Element\nimport kotlin.coroutines.CoroutineContext.Key\n\n/**\n * Base class for [CoroutineContext.Element] implementations.\n */\n@SinceKotlin(\"1.3\")\npublic abstract class AbstractCoroutineContextElement(public override val key: Key<*>) : Element\n\n/**\n * Base class for [CoroutineContext.Key] associated with polymorphic [CoroutineContext.Element] implementation.\n * Polymorphic element implementation implies delegating its [get][Element.get] and [minusKey][Element.minusKey]\n * to [getPolymorphicElement] and [minusPolymorphicKey] respectively.\n *\n * Polymorphic elements can be extracted from the coroutine context using both element key and its supertype key.\n * Example of polymorphic elements:\n * ```\n * open class BaseElement : CoroutineContext.Element {\n * companion object Key : CoroutineContext.Key\n * override val key: CoroutineContext.Key<*> get() = Key\n * // It is important to use getPolymorphicKey and minusPolymorphicKey\n * override fun get(key: CoroutineContext.Key): E? = getPolymorphicElement(key)\n * override fun minusKey(key: CoroutineContext.Key<*>): CoroutineContext = minusPolymorphicKey(key)\n * }\n *\n * class DerivedElement : BaseElement() {\n * companion object Key : AbstractCoroutineContextKey(BaseElement, { it as? DerivedElement })\n * }\n * // Now it is possible to query both `BaseElement` and `DerivedElement`\n * someContext[BaseElement] // Returns BaseElement?, non-null both for BaseElement and DerivedElement instances\n * someContext[DerivedElement] // Returns DerivedElement?, non-null only for DerivedElement instance\n * ```\n * @param B base class of a polymorphic element\n * @param baseKey an instance of base key\n * @param E element type associated with the current key\n * @param safeCast a function that can safely cast abstract [CoroutineContext.Element] to the concrete [E] type\n * and return the element if it is a subtype of [E] or `null` otherwise.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\npublic abstract class AbstractCoroutineContextKey(\n baseKey: Key,\n private val safeCast: (element: Element) -> E?\n) : Key {\n private val topmostKey: Key<*> = if (baseKey is AbstractCoroutineContextKey<*, *>) baseKey.topmostKey else baseKey\n\n internal fun tryCast(element: Element): E? = safeCast(element)\n internal fun isSubKey(key: Key<*>): Boolean = key === this || topmostKey === key\n}\n\n/**\n * Returns the current element if it is associated with the given [key] in a polymorphic manner or `null` otherwise.\n * This method returns non-null value if either [Element.key] is equal to the given [key] or if the [key] is associated\n * with [Element.key] via [AbstractCoroutineContextKey].\n * See [AbstractCoroutineContextKey] for the example of usage.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\npublic fun Element.getPolymorphicElement(key: Key): E? {\n if (key is AbstractCoroutineContextKey<*, *>) {\n @Suppress(\"UNCHECKED_CAST\")\n return if (key.isSubKey(this.key)) key.tryCast(this) as? E else null\n }\n @Suppress(\"UNCHECKED_CAST\")\n return if (this.key === key) this as E else null\n}\n\n/**\n * Returns empty coroutine context if the element is associated with the given [key] in a polymorphic manner\n * or `null` otherwise.\n * This method returns empty context if either [Element.key] is equal to the given [key] or if the [key] is associated\n * with [Element.key] via [AbstractCoroutineContextKey].\n * See [AbstractCoroutineContextKey] for the example of usage.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\npublic fun Element.minusPolymorphicKey(key: Key<*>): CoroutineContext {\n if (key is AbstractCoroutineContextKey<*, *>) {\n return if (key.isSubKey(this.key) && key.tryCast(this) != null) EmptyCoroutineContext else this\n }\n return if (this.key === key) EmptyCoroutineContext else this\n}\n\n/**\n * An empty coroutine context.\n */\n@SinceKotlin(\"1.3\")\npublic object EmptyCoroutineContext : CoroutineContext, Serializable {\n private const val serialVersionUID: Long = 0\n private fun readResolve(): Any = EmptyCoroutineContext\n\n public override fun get(key: Key): E? = null\n public override fun fold(initial: R, operation: (R, Element) -> R): R = initial\n public override fun plus(context: CoroutineContext): CoroutineContext = context\n public override fun minusKey(key: Key<*>): CoroutineContext = this\n public override fun hashCode(): Int = 0\n public override fun toString(): String = \"EmptyCoroutineContext\"\n}\n\n//--------------------- internal impl ---------------------\n\n// this class is not exposed, but is hidden inside implementations\n// this is a left-biased list, so that `plus` works naturally\n@SinceKotlin(\"1.3\")\ninternal class CombinedContext(\n private val left: CoroutineContext,\n private val element: Element\n) : CoroutineContext, Serializable {\n\n override fun get(key: Key): E? {\n var cur = this\n while (true) {\n cur.element[key]?.let { return it }\n val next = cur.left\n if (next is CombinedContext) {\n cur = next\n } else {\n return next[key]\n }\n }\n }\n\n public override fun fold(initial: R, operation: (R, Element) -> R): R =\n operation(left.fold(initial, operation), element)\n\n public override fun minusKey(key: Key<*>): CoroutineContext {\n element[key]?.let { return left }\n val newLeft = left.minusKey(key)\n return when {\n newLeft === left -> this\n newLeft === EmptyCoroutineContext -> element\n else -> CombinedContext(newLeft, element)\n }\n }\n\n private fun size(): Int {\n var cur = this\n var size = 2\n while (true) {\n cur = cur.left as? CombinedContext ?: return size\n size++\n }\n }\n\n private fun contains(element: Element): Boolean =\n get(element.key) == element\n\n private fun containsAll(context: CombinedContext): Boolean {\n var cur = context\n while (true) {\n if (!contains(cur.element)) return false\n val next = cur.left\n if (next is CombinedContext) {\n cur = next\n } else {\n return contains(next as Element)\n }\n }\n }\n\n override fun equals(other: Any?): Boolean =\n this === other || other is CombinedContext && other.size() == size() && other.containsAll(this)\n\n override fun hashCode(): Int = left.hashCode() + element.hashCode()\n\n override fun toString(): String =\n \"[\" + fold(\"\") { acc, element ->\n if (acc.isEmpty()) element.toString() else \"$acc, $element\"\n } + \"]\"\n\n private fun writeReplace(): Any {\n val n = size()\n val elements = arrayOfNulls(n)\n var index = 0\n fold(Unit) { _, element -> elements[index++] = element }\n check(index == n)\n @Suppress(\"UNCHECKED_CAST\")\n return Serialized(elements as Array)\n }\n\n private class Serialized(val elements: Array) : Serializable {\n companion object {\n private const val serialVersionUID: Long = 0L\n }\n\n private fun readResolve(): Any = elements.fold(EmptyCoroutineContext, CoroutineContext::plus)\n }\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmName(\"IntrinsicsKt\")\n@file:kotlin.jvm.JvmMultifileClass\n\npackage kotlin.coroutines.intrinsics\n\nimport kotlin.contracts.*\nimport kotlin.coroutines.*\nimport kotlin.internal.InlineOnly\n\n/**\n * Obtains the current continuation instance inside suspend functions and either suspends\n * currently running coroutine or returns result immediately without suspension.\n *\n * If the [block] returns the special [COROUTINE_SUSPENDED] value, it means that suspend function did suspend the execution and will\n * not return any result immediately. In this case, the [Continuation] provided to the [block] shall be\n * resumed by invoking [Continuation.resumeWith] at some moment in the\n * future when the result becomes available to resume the computation.\n *\n * Otherwise, the return value of the [block] must have a type assignable to [T] and represents the result of this suspend function.\n * It means that the execution was not suspended and the [Continuation] provided to the [block] shall not be invoked.\n * As the result type of the [block] is declared as `Any?` and cannot be correctly type-checked,\n * its proper return type remains on the conscience of the suspend function's author.\n *\n * Invocation of [Continuation.resumeWith] resumes coroutine directly in the invoker's thread without going through the\n * [ContinuationInterceptor] that might be present in the coroutine's [CoroutineContext].\n * It is the invoker's responsibility to ensure that a proper invocation context is established.\n * [Continuation.intercepted] can be used to acquire the intercepted continuation.\n *\n * Note that it is not recommended to call either [Continuation.resume] nor [Continuation.resumeWithException] functions synchronously\n * in the same stackframe where suspension function is run. Use [suspendCoroutine] as a safer way to obtain current\n * continuation instance.\n */\n@SinceKotlin(\"1.3\")\n@InlineOnly\n@Suppress(\"UNUSED_PARAMETER\", \"RedundantSuspendModifier\")\npublic suspend inline fun suspendCoroutineUninterceptedOrReturn(crossinline block: (Continuation) -> Any?): T {\n contract { callsInPlace(block, InvocationKind.EXACTLY_ONCE) }\n throw NotImplementedError(\"Implementation of suspendCoroutineUninterceptedOrReturn is intrinsic\")\n}\n\n/**\n * This value is used as a return value of [suspendCoroutineUninterceptedOrReturn] `block` argument to state that\n * the execution was suspended and will not return any result immediately.\n *\n * **Note: this value should not be used in general code.** Using it outside of the context of\n * `suspendCoroutineUninterceptedOrReturn` function return value (including, but not limited to,\n * storing this value in other properties, returning it from other functions, etc)\n * can lead to unspecified behavior of the code.\n */\n// It is implemented as property with getter to avoid ProGuard problem with multifile IntrinsicsKt class\n@SinceKotlin(\"1.3\")\npublic val COROUTINE_SUSPENDED: Any get() = CoroutineSingletons.COROUTINE_SUSPENDED\n\n// Using enum here ensures two important properties:\n// 1. It makes SafeContinuation serializable with all kinds of serialization frameworks (since all of them natively support enums)\n// 2. It improves debugging experience, since you clearly see toString() value of those objects and what package they come from\n@SinceKotlin(\"1.3\")\n@PublishedApi // This class is Published API via serialized representation of SafeContinuation, don't rename/move\ninternal enum class CoroutineSingletons { COROUTINE_SUSPENDED, UNDECIDED, RESUMED }\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.properties\n\nimport kotlin.reflect.KProperty\n\n/**\n * Implements the core logic of a property delegate for a read/write property that calls callback functions when changed.\n * @param initialValue the initial value of the property.\n */\npublic abstract class ObservableProperty(initialValue: V) : ReadWriteProperty {\n private var value = initialValue\n\n /**\n * The callback which is called before a change to the property value is attempted.\n * The value of the property hasn't been changed yet, when this callback is invoked.\n * If the callback returns `true` the value of the property is being set to the new value,\n * and if the callback returns `false` the new value is discarded and the property remains its old value.\n */\n protected open fun beforeChange(property: KProperty<*>, oldValue: V, newValue: V): Boolean = true\n\n /**\n * The callback which is called after the change of the property is made. The value of the property\n * has already been changed when this callback is invoked.\n */\n protected open fun afterChange(property: KProperty<*>, oldValue: V, newValue: V): Unit {}\n\n public override fun getValue(thisRef: Any?, property: KProperty<*>): V {\n return value\n }\n\n public override fun setValue(thisRef: Any?, property: KProperty<*>, value: V) {\n val oldValue = this.value\n if (!beforeChange(property, oldValue, value)) {\n return\n }\n this.value = value\n afterChange(property, oldValue, value)\n }\n}","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.random\n\nimport kotlin.math.nextDown\n\n/**\n * An abstract class that is implemented by random number generator algorithms.\n *\n * The companion object [Random.Default] is the default instance of [Random].\n *\n * To get a seeded instance of random generator use [Random] function.\n *\n * @sample samples.random.Randoms.defaultRandom\n */\n@SinceKotlin(\"1.3\")\npublic abstract class Random {\n\n /**\n * Gets the next random [bitCount] number of bits.\n *\n * Generates an `Int` whose lower [bitCount] bits are filled with random values and the remaining upper bits are zero.\n *\n * @param bitCount number of bits to generate, must be in range 0..32, otherwise the behavior is unspecified.\n *\n * @sample samples.random.Randoms.nextBits\n */\n public abstract fun nextBits(bitCount: Int): Int\n\n /**\n * Gets the next random `Int` from the random number generator.\n *\n * Generates an `Int` random value uniformly distributed between `Int.MIN_VALUE` and `Int.MAX_VALUE` (inclusive).\n *\n * @sample samples.random.Randoms.nextInt\n */\n public open fun nextInt(): Int = nextBits(32)\n\n /**\n * Gets the next random non-negative `Int` from the random number generator less than the specified [until] bound.\n *\n * Generates an `Int` random value uniformly distributed between `0` (inclusive) and the specified [until] bound (exclusive).\n *\n * @param until must be positive.\n *\n * @throws IllegalArgumentException if [until] is negative or zero.\n *\n * @sample samples.random.Randoms.nextIntFromUntil\n */\n public open fun nextInt(until: Int): Int = nextInt(0, until)\n\n /**\n * Gets the next random `Int` from the random number generator in the specified range.\n *\n * Generates an `Int` random value uniformly distributed between the specified [from] (inclusive) and [until] (exclusive) bounds.\n *\n * @throws IllegalArgumentException if [from] is greater than or equal to [until].\n *\n * @sample samples.random.Randoms.nextIntFromUntil\n */\n public open fun nextInt(from: Int, until: Int): Int {\n checkRangeBounds(from, until)\n val n = until - from\n if (n > 0 || n == Int.MIN_VALUE) {\n val rnd = if (n and -n == n) {\n val bitCount = fastLog2(n)\n nextBits(bitCount)\n } else {\n var v: Int\n do {\n val bits = nextInt().ushr(1)\n v = bits % n\n } while (bits - v + (n - 1) < 0)\n v\n }\n return from + rnd\n } else {\n while (true) {\n val rnd = nextInt()\n if (rnd in from until until) return rnd\n }\n }\n }\n\n /**\n * Gets the next random `Long` from the random number generator.\n *\n * Generates a `Long` random value uniformly distributed between `Long.MIN_VALUE` and `Long.MAX_VALUE` (inclusive).\n *\n * @sample samples.random.Randoms.nextLong\n */\n public open fun nextLong(): Long = nextInt().toLong().shl(32) + nextInt()\n\n /**\n * Gets the next random non-negative `Long` from the random number generator less than the specified [until] bound.\n *\n * Generates a `Long` random value uniformly distributed between `0` (inclusive) and the specified [until] bound (exclusive).\n *\n * @param until must be positive.\n *\n * @throws IllegalArgumentException if [until] is negative or zero.\n *\n * @sample samples.random.Randoms.nextLongFromUntil\n */\n public open fun nextLong(until: Long): Long = nextLong(0, until)\n\n /**\n * Gets the next random `Long` from the random number generator in the specified range.\n *\n * Generates a `Long` random value uniformly distributed between the specified [from] (inclusive) and [until] (exclusive) bounds.\n *\n * @throws IllegalArgumentException if [from] is greater than or equal to [until].\n *\n * @sample samples.random.Randoms.nextLongFromUntil\n */\n public open fun nextLong(from: Long, until: Long): Long {\n checkRangeBounds(from, until)\n val n = until - from\n if (n > 0) {\n val rnd: Long\n if (n and -n == n) {\n val nLow = n.toInt()\n val nHigh = (n ushr 32).toInt()\n rnd = when {\n nLow != 0 -> {\n val bitCount = fastLog2(nLow)\n // toUInt().toLong()\n nextBits(bitCount).toLong() and 0xFFFF_FFFF\n }\n nHigh == 1 ->\n // toUInt().toLong()\n nextInt().toLong() and 0xFFFF_FFFF\n else -> {\n val bitCount = fastLog2(nHigh)\n nextBits(bitCount).toLong().shl(32) + nextInt()\n }\n }\n } else {\n var v: Long\n do {\n val bits = nextLong().ushr(1)\n v = bits % n\n } while (bits - v + (n - 1) < 0)\n rnd = v\n }\n return from + rnd\n } else {\n while (true) {\n val rnd = nextLong()\n if (rnd in from until until) return rnd\n }\n }\n }\n\n /**\n * Gets the next random [Boolean] value.\n *\n * @sample samples.random.Randoms.nextBoolean\n */\n public open fun nextBoolean(): Boolean = nextBits(1) != 0\n\n /**\n * Gets the next random [Double] value uniformly distributed between 0 (inclusive) and 1 (exclusive).\n *\n * @sample samples.random.Randoms.nextDouble\n */\n public open fun nextDouble(): Double = doubleFromParts(nextBits(26), nextBits(27))\n\n /**\n * Gets the next random non-negative `Double` from the random number generator less than the specified [until] bound.\n *\n * Generates a `Double` random value uniformly distributed between 0 (inclusive) and [until] (exclusive).\n *\n * @throws IllegalArgumentException if [until] is negative or zero.\n *\n * @sample samples.random.Randoms.nextDoubleFromUntil\n */\n public open fun nextDouble(until: Double): Double = nextDouble(0.0, until)\n\n /**\n * Gets the next random `Double` from the random number generator in the specified range.\n *\n * Generates a `Double` random value uniformly distributed between the specified [from] (inclusive) and [until] (exclusive) bounds.\n *\n * [from] and [until] must be finite otherwise the behavior is unspecified.\n *\n * @throws IllegalArgumentException if [from] is greater than or equal to [until].\n *\n * @sample samples.random.Randoms.nextDoubleFromUntil\n */\n public open fun nextDouble(from: Double, until: Double): Double {\n checkRangeBounds(from, until)\n val size = until - from\n val r = if (size.isInfinite() && from.isFinite() && until.isFinite()) {\n val r1 = nextDouble() * (until / 2 - from / 2)\n from + r1 + r1\n } else {\n from + nextDouble() * size\n }\n return if (r >= until) until.nextDown() else r\n }\n\n /**\n * Gets the next random [Float] value uniformly distributed between 0 (inclusive) and 1 (exclusive).\n *\n * @sample samples.random.Randoms.nextFloat\n */\n public open fun nextFloat(): Float = nextBits(24) / (1 shl 24).toFloat()\n\n /**\n * Fills a subrange of the specified byte [array] starting from [fromIndex] inclusive and ending [toIndex] exclusive\n * with random bytes.\n *\n * @return [array] with the subrange filled with random bytes.\n *\n * @sample samples.random.Randoms.nextBytes\n */\n public open fun nextBytes(array: ByteArray, fromIndex: Int = 0, toIndex: Int = array.size): ByteArray {\n require(fromIndex in 0..array.size && toIndex in 0..array.size) { \"fromIndex ($fromIndex) or toIndex ($toIndex) are out of range: 0..${array.size}.\" }\n require(fromIndex <= toIndex) { \"fromIndex ($fromIndex) must be not greater than toIndex ($toIndex).\" }\n\n val steps = (toIndex - fromIndex) / 4\n\n var position = fromIndex\n repeat(steps) {\n val v = nextInt()\n array[position] = v.toByte()\n array[position + 1] = v.ushr(8).toByte()\n array[position + 2] = v.ushr(16).toByte()\n array[position + 3] = v.ushr(24).toByte()\n position += 4\n }\n\n val remainder = toIndex - position\n val vr = nextBits(remainder * 8)\n for (i in 0 until remainder) {\n array[position + i] = vr.ushr(i * 8).toByte()\n }\n\n return array\n }\n\n /**\n * Fills the specified byte [array] with random bytes and returns it.\n *\n * @return [array] filled with random bytes.\n *\n * @sample samples.random.Randoms.nextBytes\n */\n public open fun nextBytes(array: ByteArray): ByteArray = nextBytes(array, 0, array.size)\n\n /**\n * Creates a byte array of the specified [size], filled with random bytes.\n *\n * @sample samples.random.Randoms.nextBytes\n */\n public open fun nextBytes(size: Int): ByteArray = nextBytes(ByteArray(size))\n\n\n /**\n * The default random number generator.\n *\n * On JVM this generator is thread-safe, its methods can be invoked from multiple threads.\n *\n * @sample samples.random.Randoms.defaultRandom\n */\n companion object Default : Random() {\n\n private val defaultRandom: Random = defaultPlatformRandom()\n\n override fun nextBits(bitCount: Int): Int = defaultRandom.nextBits(bitCount)\n override fun nextInt(): Int = defaultRandom.nextInt()\n override fun nextInt(until: Int): Int = defaultRandom.nextInt(until)\n override fun nextInt(from: Int, until: Int): Int = defaultRandom.nextInt(from, until)\n\n override fun nextLong(): Long = defaultRandom.nextLong()\n override fun nextLong(until: Long): Long = defaultRandom.nextLong(until)\n override fun nextLong(from: Long, until: Long): Long = defaultRandom.nextLong(from, until)\n\n override fun nextBoolean(): Boolean = defaultRandom.nextBoolean()\n\n override fun nextDouble(): Double = defaultRandom.nextDouble()\n override fun nextDouble(until: Double): Double = defaultRandom.nextDouble(until)\n override fun nextDouble(from: Double, until: Double): Double = defaultRandom.nextDouble(from, until)\n\n override fun nextFloat(): Float = defaultRandom.nextFloat()\n\n override fun nextBytes(array: ByteArray): ByteArray = defaultRandom.nextBytes(array)\n override fun nextBytes(size: Int): ByteArray = defaultRandom.nextBytes(size)\n override fun nextBytes(array: ByteArray, fromIndex: Int, toIndex: Int): ByteArray = defaultRandom.nextBytes(array, fromIndex, toIndex)\n }\n}\n\n/**\n * Returns a repeatable random number generator seeded with the given [seed] `Int` value.\n *\n * Two generators with the same seed produce the same sequence of values within the same version of Kotlin runtime.\n *\n * *Note:* Future versions of Kotlin may change the algorithm of this seeded number generator so that it will return\n * a sequence of values different from the current one for a given seed.\n *\n * On JVM the returned generator is NOT thread-safe. Do not invoke it from multiple threads without proper synchronization.\n *\n * @sample samples.random.Randoms.seededRandom\n */\n@SinceKotlin(\"1.3\")\npublic fun Random(seed: Int): Random = XorWowRandom(seed, seed.shr(31))\n\n/**\n * Returns a repeatable random number generator seeded with the given [seed] `Long` value.\n *\n * Two generators with the same seed produce the same sequence of values within the same version of Kotlin runtime.\n *\n * *Note:* Future versions of Kotlin may change the algorithm of this seeded number generator so that it will return\n * a sequence of values different from the current one for a given seed.\n *\n * On JVM the returned generator is NOT thread-safe. Do not invoke it from multiple threads without proper synchronization.\n *\n * @sample samples.random.Randoms.seededRandom\n */\n@SinceKotlin(\"1.3\")\npublic fun Random(seed: Long): Random = XorWowRandom(seed.toInt(), seed.shr(32).toInt())\n\n\n\n/**\n * Gets the next random `Int` from the random number generator in the specified [range].\n *\n * Generates an `Int` random value uniformly distributed in the specified [range]:\n * from `range.start` inclusive to `range.endInclusive` inclusive.\n *\n * @throws IllegalArgumentException if [range] is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun Random.nextInt(range: IntRange): Int = when {\n range.isEmpty() -> throw IllegalArgumentException(\"Cannot get random in empty range: $range\")\n range.last < Int.MAX_VALUE -> nextInt(range.first, range.last + 1)\n range.first > Int.MIN_VALUE -> nextInt(range.first - 1, range.last) + 1\n else -> nextInt()\n}\n\n/**\n * Gets the next random `Long` from the random number generator in the specified [range].\n *\n * Generates a `Long` random value uniformly distributed in the specified [range]:\n * from `range.start` inclusive to `range.endInclusive` inclusive.\n *\n * @throws IllegalArgumentException if [range] is empty.\n */\n@SinceKotlin(\"1.3\")\npublic fun Random.nextLong(range: LongRange): Long = when {\n range.isEmpty() -> throw IllegalArgumentException(\"Cannot get random in empty range: $range\")\n range.last < Long.MAX_VALUE -> nextLong(range.first, range.last + 1)\n range.first > Long.MIN_VALUE -> nextLong(range.first - 1, range.last) + 1\n else -> nextLong()\n}\n\n\ninternal expect fun defaultPlatformRandom(): Random\ninternal expect fun doubleFromParts(hi26: Int, low27: Int): Double\n\n@OptIn(ExperimentalStdlibApi::class)\ninternal fun fastLog2(value: Int): Int = 31 - value.countLeadingZeroBits()\n\n/** Takes upper [bitCount] bits (0..32) from this number. */\ninternal fun Int.takeUpperBits(bitCount: Int): Int =\n this.ushr(32 - bitCount) and (-bitCount).shr(31)\n\ninternal fun checkRangeBounds(from: Int, until: Int) = require(until > from) { boundsErrorMessage(from, until) }\ninternal fun checkRangeBounds(from: Long, until: Long) = require(until > from) { boundsErrorMessage(from, until) }\ninternal fun checkRangeBounds(from: Double, until: Double) = require(until > from) { boundsErrorMessage(from, until) }\n\ninternal fun boundsErrorMessage(from: Any, until: Any) = \"Random range is empty: [$from, $until).\"\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.properties\n\nimport kotlin.reflect.KProperty\n\n/**\n * Base interface that can be used for implementing property delegates of read-only properties.\n *\n * This is provided only for convenience; you don't have to extend this interface\n * as long as your property delegate has methods with the same signatures.\n *\n * @param T the type of object which owns the delegated property.\n * @param V the type of the property value.\n */\npublic fun interface ReadOnlyProperty {\n /**\n * Returns the value of the property for the given object.\n * @param thisRef the object for which the value is requested.\n * @param property the metadata for the property.\n * @return the property value.\n */\n public operator fun getValue(thisRef: T, property: KProperty<*>): V\n}\n\n/**\n * Base interface that can be used for implementing property delegates of read-write properties.\n *\n * This is provided only for convenience; you don't have to extend this interface\n * as long as your property delegate has methods with the same signatures.\n *\n * @param T the type of object which owns the delegated property.\n * @param V the type of the property value.\n */\npublic interface ReadWriteProperty : ReadOnlyProperty {\n /**\n * Returns the value of the property for the given object.\n * @param thisRef the object for which the value is requested.\n * @param property the metadata for the property.\n * @return the property value.\n */\n public override operator fun getValue(thisRef: T, property: KProperty<*>): V\n\n /**\n * Sets the value of the property for the given object.\n * @param thisRef the object for which the value is requested.\n * @param property the metadata for the property.\n * @param value the value to set.\n */\n public operator fun setValue(thisRef: T, property: KProperty<*>, value: V)\n}\n\n/**\n * Base interface that can be used for implementing property delegate providers.\n *\n * This is provided only for convenience; you don't have to extend this interface\n * as long as your delegate provider has a method with the same signature.\n *\n * @param T the type of object which owns the delegated property.\n * @param D the type of property delegates this provider provides.\n */\n@SinceKotlin(\"1.4\")\npublic fun interface PropertyDelegateProvider {\n /**\n * Returns the delegate of the property for the given object.\n *\n * This function can be used to extend the logic of creating the object (e.g. perform validation checks)\n * to which the property implementation is delegated.\n *\n * @param thisRef the object for which property delegate is requested.\n * @param property the metadata for the property.\n * @return the property delegate.\n */\n public operator fun provideDelegate(thisRef: T, property: KProperty<*>): D\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.random\n\n/**\n * Random number generator, using Marsaglia's \"xorwow\" algorithm\n *\n * Cycles after 2^192 - 2^32 repetitions.\n *\n * For more details, see Marsaglia, George (July 2003). \"Xorshift RNGs\". Journal of Statistical Software. 8 (14). doi:10.18637/jss.v008.i14\n *\n * Available at https://www.jstatsoft.org/v08/i14/paper\n *\n */\ninternal class XorWowRandom\ninternal constructor(\n private var x: Int,\n private var y: Int,\n private var z: Int,\n private var w: Int,\n private var v: Int,\n private var addend: Int\n) : Random() {\n\n internal constructor(seed1: Int, seed2: Int) :\n this(seed1, seed2, 0, 0, seed1.inv(), (seed1 shl 10) xor (seed2 ushr 4))\n\n init {\n require((x or y or z or w or v) != 0) { \"Initial state must have at least one non-zero element.\" }\n\n // some trivial seeds can produce several values with zeroes in upper bits, so we discard first 64\n repeat(64) { nextInt() }\n }\n\n override fun nextInt(): Int {\n // Equivalent to the xorxow algorithm\n // From Marsaglia, G. 2003. Xorshift RNGs. J. Statis. Soft. 8, 14, p. 5\n var t = x\n t = t xor (t ushr 2)\n x = y\n y = z\n z = w\n val v0 = v\n w = v0\n t = (t xor (t shl 1)) xor v0 xor (v0 shl 4)\n v = t\n addend += 362437\n return t + addend\n }\n\n override fun nextBits(bitCount: Int): Int =\n nextInt().takeUpperBits(bitCount)\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"RangesKt\")\n\npackage kotlin.ranges\n\n/**\n * Represents a range of [Comparable] values.\n */\nprivate open class ComparableRange>(\n override val start: T,\n override val endInclusive: T\n) : ClosedRange {\n\n override fun equals(other: Any?): Boolean {\n return other is ComparableRange<*> && (isEmpty() && other.isEmpty() ||\n start == other.start && endInclusive == other.endInclusive)\n }\n\n override fun hashCode(): Int {\n return if (isEmpty()) -1 else 31 * start.hashCode() + endInclusive.hashCode()\n }\n\n override fun toString(): String = \"$start..$endInclusive\"\n}\n\n/**\n * Creates a range from this [Comparable] value to the specified [that] value.\n *\n * This value needs to be smaller than or equal to [that] value, otherwise the returned range will be empty.\n * @sample samples.ranges.Ranges.rangeFromComparable\n */\npublic operator fun > T.rangeTo(that: T): ClosedRange = ComparableRange(this, that)\n\n\n/**\n * Represents a range of floating point numbers.\n * Extends [ClosedRange] interface providing custom operation [lessThanOrEquals] for comparing values of range domain type.\n *\n * This interface is implemented by floating point ranges returned by [Float.rangeTo] and [Double.rangeTo] operators to\n * achieve IEEE-754 comparison order instead of total order of floating point numbers.\n */\n@SinceKotlin(\"1.1\")\npublic interface ClosedFloatingPointRange> : ClosedRange {\n override fun contains(value: T): Boolean = lessThanOrEquals(start, value) && lessThanOrEquals(value, endInclusive)\n override fun isEmpty(): Boolean = !lessThanOrEquals(start, endInclusive)\n\n /**\n * Compares two values of range domain type and returns true if first is less than or equal to second.\n */\n fun lessThanOrEquals(a: T, b: T): Boolean\n}\n\n\n/**\n * A closed range of values of type `Double`.\n *\n * Numbers are compared with the ends of this range according to IEEE-754.\n */\nprivate class ClosedDoubleRange(\n start: Double,\n endInclusive: Double\n) : ClosedFloatingPointRange {\n private val _start = start\n private val _endInclusive = endInclusive\n override val start: Double get() = _start\n override val endInclusive: Double get() = _endInclusive\n\n override fun lessThanOrEquals(a: Double, b: Double): Boolean = a <= b\n\n override fun contains(value: Double): Boolean = value >= _start && value <= _endInclusive\n override fun isEmpty(): Boolean = !(_start <= _endInclusive)\n\n override fun equals(other: Any?): Boolean {\n return other is ClosedDoubleRange && (isEmpty() && other.isEmpty() ||\n _start == other._start && _endInclusive == other._endInclusive)\n }\n\n override fun hashCode(): Int {\n return if (isEmpty()) -1 else 31 * _start.hashCode() + _endInclusive.hashCode()\n }\n\n override fun toString(): String = \"$_start..$_endInclusive\"\n}\n\n/**\n * Creates a range from this [Double] value to the specified [that] value.\n *\n * Numbers are compared with the ends of this range according to IEEE-754.\n * @sample samples.ranges.Ranges.rangeFromDouble\n */\n@SinceKotlin(\"1.1\")\npublic operator fun Double.rangeTo(that: Double): ClosedFloatingPointRange = ClosedDoubleRange(this, that)\n\n\n/**\n * A closed range of values of type `Float`.\n *\n * Numbers are compared with the ends of this range according to IEEE-754.\n */\nprivate class ClosedFloatRange(\n start: Float,\n endInclusive: Float\n) : ClosedFloatingPointRange {\n private val _start = start\n private val _endInclusive = endInclusive\n override val start: Float get() = _start\n override val endInclusive: Float get() = _endInclusive\n\n override fun lessThanOrEquals(a: Float, b: Float): Boolean = a <= b\n\n override fun contains(value: Float): Boolean = value >= _start && value <= _endInclusive\n override fun isEmpty(): Boolean = !(_start <= _endInclusive)\n\n override fun equals(other: Any?): Boolean {\n return other is ClosedFloatRange && (isEmpty() && other.isEmpty() ||\n _start == other._start && _endInclusive == other._endInclusive)\n }\n\n override fun hashCode(): Int {\n return if (isEmpty()) -1 else 31 * _start.hashCode() + _endInclusive.hashCode()\n }\n\n override fun toString(): String = \"$_start..$_endInclusive\"\n}\n\n/**\n * Creates a range from this [Float] value to the specified [that] value.\n *\n * Numbers are compared with the ends of this range according to IEEE-754.\n * @sample samples.ranges.Ranges.rangeFromFloat\n */\n@SinceKotlin(\"1.1\")\npublic operator fun Float.rangeTo(that: Float): ClosedFloatingPointRange = ClosedFloatRange(this, that)\n\n\n/**\n * Returns `true` if this iterable range contains the specified [element].\n *\n * Always returns `false` if the [element] is `null`.\n */\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\npublic inline operator fun R.contains(element: T?): Boolean where T : Any, R : Iterable, R : ClosedRange =\n element != null && contains(element)\n\n\ninternal fun checkStepIsPositive(isPositive: Boolean, step: Number) {\n if (!isPositive) throw IllegalArgumentException(\"Step must be positive, was: $step.\")\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.reflect\n\nimport kotlin.jvm.JvmField\nimport kotlin.jvm.JvmStatic\n\n\n\n/**\n * Represents a type projection. Type projection is usually the argument to another type in a type usage.\n * For example, in the type `Array`, `out Number` is the covariant projection of the type represented by the class `Number`.\n *\n * Type projection is either the star projection, or an entity consisting of a specific type plus optional variance.\n *\n * See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/generics.html#type-projections)\n * for more information.\n */\n@SinceKotlin(\"1.1\")\npublic data class KTypeProjection constructor(\n /**\n * The use-site variance specified in the projection, or `null` if this is a star projection.\n */\n public val variance: KVariance?,\n /**\n * The type specified in the projection, or `null` if this is a star projection.\n */\n public val type: KType?\n) {\n\n init {\n require((variance == null) == (type == null)) {\n if (variance == null)\n \"Star projection must have no type specified.\"\n else\n \"The projection variance $variance requires type to be specified.\"\n }\n }\n\n override fun toString(): String = when (variance) {\n null -> \"*\"\n KVariance.INVARIANT -> type.toString()\n KVariance.IN -> \"in $type\"\n KVariance.OUT -> \"out $type\"\n }\n\n public companion object {\n // provided for compiler access\n @JvmField\n @PublishedApi\n internal val star: KTypeProjection = KTypeProjection(null, null)\n\n /**\n * Star projection, denoted by the `*` character.\n * For example, in the type `KClass<*>`, `*` is the star projection.\n * See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/generics.html#star-projections)\n * for more information.\n */\n public val STAR: KTypeProjection get() = star\n\n /**\n * Creates an invariant projection of a given type. Invariant projection is just the type itself,\n * without any use-site variance modifiers applied to it.\n * For example, in the type `Set`, `String` is an invariant projection of the type represented by the class `String`.\n */\n @JvmStatic\n public fun invariant(type: KType): KTypeProjection =\n KTypeProjection(KVariance.INVARIANT, type)\n\n /**\n * Creates a contravariant projection of a given type, denoted by the `in` modifier applied to a type.\n * For example, in the type `MutableList`, `in Number` is a contravariant projection of the type of class `Number`.\n */\n @JvmStatic\n public fun contravariant(type: KType): KTypeProjection =\n KTypeProjection(KVariance.IN, type)\n\n /**\n * Creates a covariant projection of a given type, denoted by the `out` modifier applied to a type.\n * For example, in the type `Array`, `out Number` is a covariant projection of the type of class `Number`.\n */\n @JvmStatic\n public fun covariant(type: KType): KTypeProjection =\n KTypeProjection(KVariance.OUT, type)\n }\n}","/*\n * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.reflect\n\n/**\n * Represents variance applied to a type parameter on the declaration site (*declaration-site variance*),\n * or to a type in a projection (*use-site variance*).\n *\n * See the [Kotlin language documentation](https://kotlinlang.org/docs/reference/generics.html#variance)\n * for more information.\n *\n * @see [KTypeParameter.variance]\n * @see [KTypeProjection]\n */\n@SinceKotlin(\"1.1\")\nenum class KVariance {\n /**\n * The affected type parameter or type is *invariant*, which means it has no variance applied to it.\n */\n INVARIANT,\n\n /**\n * The affected type parameter or type is *contravariant*. Denoted by the `in` modifier in the source code.\n */\n IN,\n\n /**\n * The affected type parameter or type is *covariant*. Denoted by the `out` modifier in the source code.\n */\n OUT,\n}","/*\n * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"StringsKt\")\n\npackage kotlin.text\n\n/**\n * An object to which char sequences and values can be appended.\n */\nexpect interface Appendable {\n /**\n * Appends the specified character [value] to this Appendable and returns this instance.\n *\n * @param value the character to append.\n */\n fun append(value: Char): Appendable\n\n /**\n * Appends the specified character sequence [value] to this Appendable and returns this instance.\n *\n * @param value the character sequence to append. If [value] is `null`, then the four characters `\"null\"` are appended to this Appendable.\n */\n fun append(value: CharSequence?): Appendable\n\n /**\n * Appends a subsequence of the specified character sequence [value] to this Appendable and returns this instance.\n *\n * @param value the character sequence from which a subsequence is appended. If [value] is `null`,\n * then characters are appended as if [value] contained the four characters `\"null\"`.\n * @param startIndex the beginning (inclusive) of the subsequence to append.\n * @param endIndex the end (exclusive) of the subsequence to append.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.\n */\n fun append(value: CharSequence?, startIndex: Int, endIndex: Int): Appendable\n}\n\n/**\n * Appends a subsequence of the specified character sequence [value] to this Appendable and returns this instance.\n *\n * @param value the character sequence from which a subsequence is appended.\n * @param startIndex the beginning (inclusive) of the subsequence to append.\n * @param endIndex the end (exclusive) of the subsequence to append.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic fun T.appendRange(value: CharSequence, startIndex: Int, endIndex: Int): T {\n @Suppress(\"UNCHECKED_CAST\")\n return append(value, startIndex, endIndex) as T\n}\n\n/**\n * Appends all arguments to the given [Appendable].\n */\npublic fun T.append(vararg value: CharSequence?): T {\n for (item in value)\n append(item)\n return this\n}\n\n/** Appends a line feed character (`\\n`) to this Appendable. */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun Appendable.appendLine(): Appendable = append('\\n')\n\n/** Appends value to the given Appendable and a line feed character (`\\n`) after it. */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun Appendable.appendLine(value: CharSequence?): Appendable = append(value).appendLine()\n\n/** Appends value to the given Appendable and a line feed character (`\\n`) after it. */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun Appendable.appendLine(value: Char): Appendable = append(value).appendLine()\n\n\ninternal fun Appendable.appendElement(element: T, transform: ((T) -> CharSequence)?) {\n when {\n transform != null -> append(transform(element))\n element is CharSequence? -> append(element)\n element is Char -> append(element)\n else -> append(element.toString())\n }\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"CharsKt\")\n\npackage kotlin.text\n\n/**\n * Returns the numeric value of the decimal digit that this Char represents.\n * Throws an exception if this Char is not a valid decimal digit.\n *\n * A Char is considered to represent a decimal digit if the Char is one of the ASCII decimal digits '0' through '9'.\n * In this case, `this.code - '0'.code` is returned.\n *\n * @sample samples.text.Chars.digitToInt\n */\n@ExperimentalStdlibApi\n@SinceKotlin(\"1.4\")\npublic fun Char.digitToInt(): Int {\n if (this in '0'..'9') {\n return this - '0'\n }\n throw IllegalArgumentException(\"Char $this is not a decimal digit\")\n}\n\n/**\n * Returns the numeric value of the digit that this Char represents in the specified [radix].\n * Throws an exception if the [radix] is not in the range `2..36` or if this Char is not a valid digit in the specified [radix].\n *\n * A Char is considered to represent a digit in the specified [radix] if at least one of the following is true:\n * - The Char is one of the ASCII decimal digits '0' through '9' and its [code] is less than `radix + '0'.code`. In this case, `this.code - '0'.code` is returned.\n * - The Char is one of the uppercase Latin letters 'A' through 'Z' and its [code] is less than `radix + 'A'.code - 10`. In this case, `this.code - 'A'.code + 10` is returned.\n * - The Char is one of the lowercase Latin letters 'a' through 'z' and its [code] is less than `radix + 'a'.code - 10`. In this case, `this.code - 'a'.code + 10` is returned.\n *\n * @sample samples.text.Chars.digitToInt\n */\n@ExperimentalStdlibApi\n@SinceKotlin(\"1.4\")\npublic fun Char.digitToInt(radix: Int): Int {\n return digitToIntOrNull(radix) ?: throw IllegalArgumentException(\"Char $this is not a digit in the given radix=$radix\")\n}\n\n/**\n *\n * Returns the numeric value of the decimal digit that this Char represents, or `null` if this Char is not a valid decimal digit.\n *\n * A Char is considered to represent a decimal digit if the Char is one of the ASCII decimal digits '0' through '9'.\n * In this case, `this.code - '0'.code` is returned.\n *\n * @sample samples.text.Chars.digitToIntOrNull\n */\n@ExperimentalStdlibApi\n@SinceKotlin(\"1.4\")\npublic fun Char.digitToIntOrNull(): Int? {\n if (this in '0'..'9') {\n return this - '0'\n }\n return null\n}\n\n/**\n * Returns the numeric value of the digit that this Char represents in the specified [radix], or `null` if this Char is not a valid digit in the specified [radix].\n * Throws an exception if the [radix] is not in the range `2..36`.\n *\n * A Char is considered to represent a digit in the specified [radix] if at least one of the following is true:\n * - The Char is one of the ASCII decimal digits '0' through '9' and its [code] is less than `radix + '0'.code`. In this case, `this.code - '0'.code` is returned.\n * - The Char is one of the uppercase Latin letters 'A' through 'Z' and its [code] is less than `radix + 'A'.code - 10`. In this case, `this.code - 'A'.code + 10` is returned.\n * - The Char is one of the lowercase Latin letters 'a' through 'z' and its [code] is less than `radix + 'a'.code - 10`. In this case, `this.code - 'a'.code + 10` is returned.\n *\n * @sample samples.text.Chars.digitToIntOrNull\n */\n@ExperimentalStdlibApi\n@SinceKotlin(\"1.4\")\npublic fun Char.digitToIntOrNull(radix: Int): Int? {\n if (radix !in 2..36) {\n throw IllegalArgumentException(\"Invalid radix: $radix. Valid radix values are in range 2..36\")\n }\n if (this in '0'..'9') {\n val digit = this - '0'\n return if (digit < radix) digit else null\n }\n val a = if (this <= 'Z') 'A' else 'a'\n val digit = 10 + (this - a)\n return if (digit in 10 until radix) digit else null\n}\n\n/**\n * Returns the Char that represents this decimal digit.\n * Throws an exception if this value is not in the range `0..9`.\n *\n * If this value is in `0..9`, the decimal digit Char with code `'0'.code + this` is returned.\n *\n * @sample samples.text.Chars.digitToChar\n */\n@ExperimentalStdlibApi\n@SinceKotlin(\"1.4\")\npublic fun Int.digitToChar(): Char {\n if (this in 0..9) {\n return '0' + this\n }\n throw IllegalArgumentException(\"Int $this is not a decimal digit\")\n}\n\n/**\n * Returns the Char that represents this numeric digit value in the specified [radix].\n * Throws an exception if the [radix] is not in the range `2..36` or if this value is not in the range `0 until radix`.\n *\n * If this value is less than `10`, the decimal digit Char with code `'0'.code + this` is returned.\n * Otherwise, the uppercase Latin letter with code `'A'.code + this - 10` is returned.\n *\n * @sample samples.text.Chars.digitToChar\n */\n@ExperimentalStdlibApi\n@SinceKotlin(\"1.4\")\npublic fun Int.digitToChar(radix: Int): Char {\n if (radix !in 2..36) {\n throw IllegalArgumentException(\"Invalid radix: $radix. Valid radix values are in range 2..36\")\n }\n if (this < 0 || this >= radix) {\n throw IllegalArgumentException(\"Digit $this does not represent a valid digit in radix $radix\")\n }\n return if (this < 10) {\n '0' + this\n } else {\n 'A' + this - 10\n }\n}\n\n/**\n * Converts this character to lower case using Unicode mapping rules of the invariant locale.\n */\npublic expect fun Char.toLowerCase(): Char\n\n/**\n * Converts this character to lower case using Unicode mapping rules of the invariant locale.\n *\n * This function performs one-to-one character mapping.\n * To support one-to-many character mapping use the [lowercase] function.\n * If this character has no mapping equivalent, the character itself is returned.\n *\n * @sample samples.text.Chars.lowercase\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\npublic expect fun Char.lowercaseChar(): Char\n\n/**\n * Converts this character to lower case using Unicode mapping rules of the invariant locale.\n *\n * This function supports one-to-many character mapping, thus the length of the returned string can be greater than one.\n * For example, `'\\u0130'.lowercase()` returns `\"\\u0069\\u0307\"`,\n * where `'\\u0130'` is the LATIN CAPITAL LETTER I WITH DOT ABOVE character (`İ`).\n * If this character has no lower case mapping, the result of `toString()` of this char is returned.\n *\n * @sample samples.text.Chars.lowercase\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\npublic expect fun Char.lowercase(): String\n\n/**\n * Converts this character to upper case using Unicode mapping rules of the invariant locale.\n */\npublic expect fun Char.toUpperCase(): Char\n\n/**\n * Converts this character to upper case using Unicode mapping rules of the invariant locale.\n *\n * This function performs one-to-one character mapping.\n * To support one-to-many character mapping use the [uppercase] function.\n * If this character has no mapping equivalent, the character itself is returned.\n *\n * @sample samples.text.Chars.uppercase\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\npublic expect fun Char.uppercaseChar(): Char\n\n/**\n * Converts this character to upper case using Unicode mapping rules of the invariant locale.\n *\n * This function supports one-to-many character mapping, thus the length of the returned string can be greater than one.\n * For example, `'\\uFB00'.uppercase()` returns `\"\\u0046\\u0046\"`,\n * where `'\\uFB00'` is the LATIN SMALL LIGATURE FF character (`ff`).\n * If this character has no upper case mapping, the result of `toString()` of this char is returned.\n *\n * @sample samples.text.Chars.uppercase\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\npublic expect fun Char.uppercase(): String\n\n/**\n * Concatenates this Char and a String.\n *\n * @sample samples.text.Chars.plus\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun Char.plus(other: String): String = this.toString() + other\n\n/**\n * Returns `true` if this character is equal to the [other] character, optionally ignoring character case.\n *\n * @param ignoreCase `true` to ignore character case when comparing characters. By default `false`.\n *\n * Two characters are considered the same ignoring case if at least one of the following is `true`:\n * - The two characters are the same (as compared by the == operator)\n * - Applying the method [uppercaseChar] to each character produces the same result\n * - Applying the method [lowercaseChar] to each character produces the same result\n *\n * @sample samples.text.Chars.equals\n */\n@OptIn(ExperimentalStdlibApi::class)\npublic fun Char.equals(other: Char, ignoreCase: Boolean = false): Boolean {\n if (this == other) return true\n if (!ignoreCase) return false\n\n if (this.uppercaseChar() == other.uppercaseChar()) return true\n if (this.lowercaseChar() == other.lowercaseChar()) return true\n return false\n}\n\n/**\n * Returns `true` if this character is a Unicode surrogate code unit.\n */\npublic fun Char.isSurrogate(): Boolean = this in Char.MIN_SURROGATE..Char.MAX_SURROGATE\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"StringsKt\")\n\npackage kotlin.text\n\n/**\n * Trims leading whitespace characters followed by [marginPrefix] from every line of a source string and removes\n * the first and the last lines if they are blank (notice difference blank vs empty).\n *\n * Doesn't affect a line if it doesn't contain [marginPrefix] except the first and the last blank lines.\n *\n * Doesn't preserve the original line endings.\n *\n * @param marginPrefix non-blank string, which is used as a margin delimiter. Default is `|` (pipe character).\n *\n * @sample samples.text.Strings.trimMargin\n * @see trimIndent\n * @see kotlin.text.isWhitespace\n */\npublic fun String.trimMargin(marginPrefix: String = \"|\"): String =\n replaceIndentByMargin(\"\", marginPrefix)\n\n/**\n * Detects indent by [marginPrefix] as it does [trimMargin] and replace it with [newIndent].\n *\n * @param marginPrefix non-blank string, which is used as a margin delimiter. Default is `|` (pipe character).\n */\npublic fun String.replaceIndentByMargin(newIndent: String = \"\", marginPrefix: String = \"|\"): String {\n require(marginPrefix.isNotBlank()) { \"marginPrefix must be non-blank string.\" }\n val lines = lines()\n\n return lines.reindent(length + newIndent.length * lines.size, getIndentFunction(newIndent), { line ->\n val firstNonWhitespaceIndex = line.indexOfFirst { !it.isWhitespace() }\n\n when {\n firstNonWhitespaceIndex == -1 -> null\n line.startsWith(marginPrefix, firstNonWhitespaceIndex) -> line.substring(firstNonWhitespaceIndex + marginPrefix.length)\n else -> null\n }\n })\n}\n\n/**\n * Detects a common minimal indent of all the input lines, removes it from every line and also removes the first and the last\n * lines if they are blank (notice difference blank vs empty).\n *\n * Note that blank lines do not affect the detected indent level.\n *\n * In case if there are non-blank lines with no leading whitespace characters (no indent at all) then the\n * common indent is 0, and therefore this function doesn't change the indentation.\n *\n * Doesn't preserve the original line endings.\n *\n * @sample samples.text.Strings.trimIndent\n * @see trimMargin\n * @see kotlin.text.isBlank\n */\npublic fun String.trimIndent(): String = replaceIndent(\"\")\n\n/**\n * Detects a common minimal indent like it does [trimIndent] and replaces it with the specified [newIndent].\n */\npublic fun String.replaceIndent(newIndent: String = \"\"): String {\n val lines = lines()\n\n val minCommonIndent = lines\n .filter(String::isNotBlank)\n .map(String::indentWidth)\n .minOrNull() ?: 0\n\n return lines.reindent(length + newIndent.length * lines.size, getIndentFunction(newIndent), { line -> line.drop(minCommonIndent) })\n}\n\n/**\n * Prepends [indent] to every line of the original string.\n *\n * Doesn't preserve the original line endings.\n */\npublic fun String.prependIndent(indent: String = \" \"): String =\n lineSequence()\n .map {\n when {\n it.isBlank() -> {\n when {\n it.length < indent.length -> indent\n else -> it\n }\n }\n else -> indent + it\n }\n }\n .joinToString(\"\\n\")\n\nprivate fun String.indentWidth(): Int = indexOfFirst { !it.isWhitespace() }.let { if (it == -1) length else it }\n\nprivate fun getIndentFunction(indent: String) = when {\n indent.isEmpty() -> { line: String -> line }\n else -> { line: String -> indent + line }\n}\n\nprivate inline fun List.reindent(\n resultSizeEstimate: Int,\n indentAddFunction: (String) -> String,\n indentCutFunction: (String) -> String?\n): String {\n val lastIndex = lastIndex\n return mapIndexedNotNull { index, value ->\n if ((index == 0 || index == lastIndex) && value.isBlank())\n null\n else\n indentCutFunction(value)?.let(indentAddFunction) ?: value\n }\n .joinTo(StringBuilder(resultSizeEstimate), \"\\n\")\n .toString()\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.text\n\n/**\n * Represents a collection of captured groups in a single match of a regular expression.\n *\n * This collection has size of `groupCount + 1` where `groupCount` is the count of groups in the regular expression.\n * Groups are indexed from 1 to `groupCount` and group with the index 0 corresponds to the entire match.\n *\n * An element of the collection at the particular index can be `null`,\n * if the corresponding group in the regular expression is optional and\n * there was no match captured by that group.\n */\npublic interface MatchGroupCollection : Collection {\n\n /** Returns a group with the specified [index].\n *\n * @return An instance of [MatchGroup] if the group with the specified [index] was matched or `null` otherwise.\n *\n * Groups are indexed from 1 to the count of groups in the regular expression. A group with the index 0\n * corresponds to the entire match.\n */\n public operator fun get(index: Int): MatchGroup?\n}\n\n/**\n * Extends [MatchGroupCollection] by introducing a way to get matched groups by name, when regex supports it.\n */\n@SinceKotlin(\"1.1\")\npublic interface MatchNamedGroupCollection : MatchGroupCollection {\n /**\n * Returns a named group with the specified [name].\n * @return An instance of [MatchGroup] if the group with the specified [name] was matched or `null` otherwise.\n * @throws IllegalArgumentException if there is no group with the specified [name] defined in the regex pattern.\n * @throws UnsupportedOperationException if getting named groups isn't supported on the current platform.\n */\n public operator fun get(name: String): MatchGroup?\n}\n\n/**\n * Represents the results from a single regular expression match.\n */\npublic interface MatchResult {\n /** The range of indices in the original string where match was captured. */\n public val range: IntRange\n /** The substring from the input string captured by this match. */\n public val value: String\n /**\n * A collection of groups matched by the regular expression.\n *\n * This collection has size of `groupCount + 1` where `groupCount` is the count of groups in the regular expression.\n * Groups are indexed from 1 to `groupCount` and group with the index 0 corresponds to the entire match.\n */\n public val groups: MatchGroupCollection\n /**\n * A list of matched indexed group values.\n *\n * This list has size of `groupCount + 1` where `groupCount` is the count of groups in the regular expression.\n * Groups are indexed from 1 to `groupCount` and group with the index 0 corresponds to the entire match.\n *\n * If the group in the regular expression is optional and there were no match captured by that group,\n * corresponding item in [groupValues] is an empty string.\n *\n * @sample samples.text.Regexps.matchDestructuringToGroupValues\n */\n public val groupValues: List\n\n /**\n * An instance of [MatchResult.Destructured] wrapper providing components for destructuring assignment of group values.\n *\n * component1 corresponds to the value of the first group, component2 — of the second, and so on.\n *\n * @sample samples.text.Regexps.matchDestructuringToGroupValues\n */\n public val destructured: Destructured get() = Destructured(this)\n\n /** Returns a new [MatchResult] with the results for the next match, starting at the position\n * at which the last match ended (at the character after the last matched character).\n */\n public fun next(): MatchResult?\n\n /**\n * Provides components for destructuring assignment of group values.\n *\n * [component1] corresponds to the value of the first group, [component2] — of the second, and so on.\n *\n * If the group in the regular expression is optional and there were no match captured by that group,\n * corresponding component value is an empty string.\n *\n * @sample samples.text.Regexps.matchDestructuringToGroupValues\n */\n public class Destructured internal constructor(public val match: MatchResult) {\n @kotlin.internal.InlineOnly\n public operator inline fun component1(): String = match.groupValues[1]\n @kotlin.internal.InlineOnly\n public operator inline fun component2(): String = match.groupValues[2]\n @kotlin.internal.InlineOnly\n public operator inline fun component3(): String = match.groupValues[3]\n @kotlin.internal.InlineOnly\n public operator inline fun component4(): String = match.groupValues[4]\n @kotlin.internal.InlineOnly\n public operator inline fun component5(): String = match.groupValues[5]\n @kotlin.internal.InlineOnly\n public operator inline fun component6(): String = match.groupValues[6]\n @kotlin.internal.InlineOnly\n public operator inline fun component7(): String = match.groupValues[7]\n @kotlin.internal.InlineOnly\n public operator inline fun component8(): String = match.groupValues[8]\n @kotlin.internal.InlineOnly\n public operator inline fun component9(): String = match.groupValues[9]\n @kotlin.internal.InlineOnly\n public operator inline fun component10(): String = match.groupValues[10]\n\n /**\n * Returns destructured group values as a list of strings.\n * First value in the returned list corresponds to the value of the first group, and so on.\n *\n * @sample samples.text.Regexps.matchDestructuringToGroupValues\n */\n public fun toList(): List = match.groupValues.subList(1, match.groupValues.size)\n }\n}","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.time\n\nimport kotlin.contracts.*\nimport kotlin.math.abs\n\n@OptIn(ExperimentalTime::class)\nprivate inline val storageUnit get() = DurationUnit.NANOSECONDS\n\n/**\n * Represents the amount of time one instant of time is away from another instant.\n *\n * A negative duration is possible in a situation when the second instant is earlier than the first one.\n * An infinite duration value [Duration.INFINITE] can be used to represent infinite timeouts.\n *\n * To construct a duration use either the extension function [toDuration],\n * or the extension properties [hours], [minutes], [seconds], and so on,\n * available on [Int], [Long], and [Double] numeric types.\n *\n * To get the value of this duration expressed in a particular [duration units][DurationUnit]\n * use the functions [toInt], [toLong], and [toDouble]\n * or the properties [inHours], [inMinutes], [inSeconds], [inNanoseconds], and so on.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\n@Suppress(\"NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS\")\npublic inline class Duration internal constructor(internal val value: Double) : Comparable {\n// TODO: backend fails on init block, wait for KT-28055\n\n// init {\n// require(_value.isNaN().not())\n// }\n\n companion object {\n /** The duration equal to exactly 0 seconds. */\n public val ZERO: Duration = Duration(0.0)\n\n /** The duration whose value is positive infinity. It is useful for representing timeouts that should never expire. */\n public val INFINITE: Duration = Duration(Double.POSITIVE_INFINITY)\n\n /** Converts the given time duration [value] expressed in the specified [sourceUnit] into the specified [targetUnit]. */\n public fun convert(value: Double, sourceUnit: DurationUnit, targetUnit: DurationUnit): Double =\n convertDurationUnit(value, sourceUnit, targetUnit)\n }\n\n // arithmetic operators\n\n /** Returns the negative of this value. */\n public operator fun unaryMinus(): Duration = Duration(-value)\n\n /** Returns a duration whose value is the sum of this and [other] duration values. */\n public operator fun plus(other: Duration): Duration = Duration(value + other.value)\n\n /** Returns a duration whose value is the difference between this and [other] duration values. */\n public operator fun minus(other: Duration): Duration = Duration(value - other.value)\n\n /** Returns a duration whose value is this duration value multiplied by the given [scale] number. */\n public operator fun times(scale: Int): Duration = Duration(value * scale)\n\n /** Returns a duration whose value is this duration value multiplied by the given [scale] number. */\n public operator fun times(scale: Double): Duration = Duration(value * scale)\n\n /** Returns a duration whose value is this duration value divided by the given [scale] number. */\n public operator fun div(scale: Int): Duration = Duration(value / scale)\n\n /** Returns a duration whose value is this duration value divided by the given [scale] number. */\n public operator fun div(scale: Double): Duration = Duration(value / scale)\n\n /** Returns a number that is the ratio of this and [other] duration values. */\n public operator fun div(other: Duration): Double = this.value / other.value\n\n /** Returns true, if the duration value is less than zero. */\n public fun isNegative(): Boolean = value < 0\n\n /** Returns true, if the duration value is greater than zero. */\n public fun isPositive(): Boolean = value > 0\n\n /** Returns true, if the duration value is infinite. */\n public fun isInfinite(): Boolean = value.isInfinite()\n\n /** Returns true, if the duration value is finite. */\n public fun isFinite(): Boolean = value.isFinite()\n\n /** Returns the absolute value of this value. The returned value is always non-negative. */\n public val absoluteValue: Duration get() = if (isNegative()) -this else this\n\n override fun compareTo(other: Duration): Int = this.value.compareTo(other.value)\n\n\n // splitting to components\n\n /**\n * Splits this duration into days, hours, minutes, seconds, and nanoseconds and executes the given [action] with these components.\n * The result of [action] is returned as the result of this function.\n *\n * - `nanoseconds` represents the whole number of nanoseconds in this duration, and its absolute value is less than 1_000_000_000;\n * - `seconds` represents the whole number of seconds in this duration, and its absolute value is less than 60;\n * - `minutes` represents the whole number of minutes in this duration, and its absolute value is less than 60;\n * - `hours` represents the whole number of hours in this duration, and its absolute value is less than 24;\n * - `days` represents the whole number of days in this duration.\n * If the value doesn't fit in [Int] range, i.e. it's greater than [Int.MAX_VALUE] or less than [Int.MIN_VALUE],\n * it is coerced into that range.\n */\n public inline fun toComponents(action: (days: Int, hours: Int, minutes: Int, seconds: Int, nanoseconds: Int) -> T): T {\n contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) }\n return action(inDays.toInt(), hoursComponent, minutesComponent, secondsComponent, nanosecondsComponent)\n }\n\n /**\n * Splits this duration into hours, minutes, seconds, and nanoseconds and executes the given [action] with these components.\n * The result of [action] is returned as the result of this function.\n *\n * - `nanoseconds` represents the whole number of nanoseconds in this duration, and its absolute value is less than 1_000_000_000;\n * - `seconds` represents the whole number of seconds in this duration, and its absolute value is less than 60;\n * - `minutes` represents the whole number of minutes in this duration, and its absolute value is less than 60;\n * - `hours` represents the whole number of hours in this duration.\n * If the value doesn't fit in [Int] range, i.e. it's greater than [Int.MAX_VALUE] or less than [Int.MIN_VALUE],\n * it is coerced into that range.\n */\n public inline fun toComponents(action: (hours: Int, minutes: Int, seconds: Int, nanoseconds: Int) -> T): T {\n contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) }\n return action(inHours.toInt(), minutesComponent, secondsComponent, nanosecondsComponent)\n }\n\n /**\n * Splits this duration into minutes, seconds, and nanoseconds and executes the given [action] with these components.\n * The result of [action] is returned as the result of this function.\n *\n * - `nanoseconds` represents the whole number of nanoseconds in this duration, and its absolute value is less than 1_000_000_000;\n * - `seconds` represents the whole number of seconds in this duration, and its absolute value is less than 60;\n * - `minutes` represents the whole number of minutes in this duration.\n * If the value doesn't fit in [Int] range, i.e. it's greater than [Int.MAX_VALUE] or less than [Int.MIN_VALUE],\n * it is coerced into that range.\n */\n public inline fun toComponents(action: (minutes: Int, seconds: Int, nanoseconds: Int) -> T): T {\n contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) }\n return action(inMinutes.toInt(), secondsComponent, nanosecondsComponent)\n }\n\n /**\n * Splits this duration into seconds, and nanoseconds and executes the given [action] with these components.\n * The result of [action] is returned as the result of this function.\n *\n * - `nanoseconds` represents the whole number of nanoseconds in this duration, and its absolute value is less than 1_000_000_000;\n * - `seconds` represents the whole number of seconds in this duration.\n * If the value doesn't fit in [Long] range, i.e. it's greater than [Long.MAX_VALUE] or less than [Long.MIN_VALUE],\n * it is coerced into that range.\n */\n public inline fun toComponents(action: (seconds: Long, nanoseconds: Int) -> T): T {\n contract { callsInPlace(action, InvocationKind.EXACTLY_ONCE) }\n return action(inSeconds.toLong(), nanosecondsComponent)\n }\n\n @PublishedApi\n internal val hoursComponent: Int get() = (inHours % 24).toInt()\n @PublishedApi\n internal val minutesComponent: Int get() = (inMinutes % 60).toInt()\n @PublishedApi\n internal val secondsComponent: Int get() = (inSeconds % 60).toInt()\n @PublishedApi\n internal val nanosecondsComponent: Int get() = (inNanoseconds % 1e9).toInt()\n\n\n // conversion to units\n\n /** Returns the value of this duration expressed as a [Double] number of the specified [unit]. */\n public fun toDouble(unit: DurationUnit): Double = convertDurationUnit(value, storageUnit, unit)\n\n /**\n * Returns the value of this duration expressed as a [Long] number of the specified [unit].\n *\n * If the value doesn't fit in the range of [Long] type, it is coerced into that range, see the conversion [Double.toLong] for details.\n */\n public fun toLong(unit: DurationUnit): Long = toDouble(unit).toLong()\n\n /**\n * Returns the value of this duration expressed as an [Int] number of the specified [unit].\n *\n * If the value doesn't fit in the range of [Int] type, it is coerced into that range, see the conversion [Double.toInt] for details.\n */\n public fun toInt(unit: DurationUnit): Int = toDouble(unit).toInt()\n\n /** The value of this duration expressed as a [Double] number of days. */\n public val inDays: Double get() = toDouble(DurationUnit.DAYS)\n\n /** The value of this duration expressed as a [Double] number of hours. */\n public val inHours: Double get() = toDouble(DurationUnit.HOURS)\n\n /** The value of this duration expressed as a [Double] number of minutes. */\n public val inMinutes: Double get() = toDouble(DurationUnit.MINUTES)\n\n /** The value of this duration expressed as a [Double] number of seconds. */\n public val inSeconds: Double get() = toDouble(DurationUnit.SECONDS)\n\n /** The value of this duration expressed as a [Double] number of milliseconds. */\n public val inMilliseconds: Double get() = toDouble(DurationUnit.MILLISECONDS)\n\n /** The value of this duration expressed as a [Double] number of microseconds. */\n public val inMicroseconds: Double get() = toDouble(DurationUnit.MICROSECONDS)\n\n /** The value of this duration expressed as a [Double] number of nanoseconds. */\n public val inNanoseconds: Double get() = toDouble(DurationUnit.NANOSECONDS)\n\n // shortcuts\n\n /**\n * Returns the value of this duration expressed as a [Long] number of nanoseconds.\n *\n * If the value doesn't fit in the range of [Long] type, it is coerced into that range, see the conversion [Double.toLong] for details.\n *\n * The range of durations that can be expressed as a `Long` number of nanoseconds is approximately ±292 years.\n */\n public fun toLongNanoseconds(): Long = toLong(DurationUnit.NANOSECONDS)\n\n /**\n * Returns the value of this duration expressed as a [Long] number of milliseconds.\n *\n * The value is coerced to the range of [Long] type, if it doesn't fit in that range, see the conversion [Double.toLong] for details.\n *\n * The range of durations that can be expressed as a `Long` number of milliseconds is approximately ±292 million years.\n */\n public fun toLongMilliseconds(): Long = toLong(DurationUnit.MILLISECONDS)\n\n /**\n * Returns a string representation of this duration value expressed in the unit which yields the most compact and readable number value.\n *\n * Special cases:\n * - zero duration is formatted as `\"0s\"`\n * - the infinite duration is formatted as `\"Infinity\"` without unit\n * - very small durations (less than 1e-15 s) are expressed in seconds and formatted in scientific notation\n * - very big durations (more than 1e+7 days) are expressed in days and formatted in scientific notation\n *\n * @return the value of duration in the automatically determined unit followed by that unit abbreviated name: `d`, `h`, `m`, `s`, `ms`, `us`, or `ns`.\n *\n * @sample samples.time.Durations.toStringDefault\n */\n override fun toString(): String = when {\n isInfinite() -> value.toString()\n value == 0.0 -> \"0s\"\n else -> {\n val absNs = absoluteValue.inNanoseconds\n var scientific = false\n var maxDecimals = 0\n val unit = when {\n absNs < 1e-6 -> DurationUnit.SECONDS.also { scientific = true }\n absNs < 1 -> DurationUnit.NANOSECONDS.also { maxDecimals = 7 }\n absNs < 1e3 -> DurationUnit.NANOSECONDS\n absNs < 1e6 -> DurationUnit.MICROSECONDS\n absNs < 1e9 -> DurationUnit.MILLISECONDS\n absNs < 1000e9 -> DurationUnit.SECONDS\n absNs < 60_000e9 -> DurationUnit.MINUTES\n absNs < 3600_000e9 -> DurationUnit.HOURS\n absNs < 86400e9 * 1e7 -> DurationUnit.DAYS\n else -> DurationUnit.DAYS.also { scientific = true }\n }\n val value = toDouble(unit)\n when {\n scientific -> formatScientific(value)\n maxDecimals > 0 -> formatUpToDecimals(value, maxDecimals)\n else -> formatToExactDecimals(value, precision(abs(value)))\n } + unit.shortName()\n }\n }\n\n private fun precision(value: Double): Int = when {\n value < 1 -> 3\n value < 10 -> 2\n value < 100 -> 1\n else -> 0\n }\n\n /**\n * Returns a string representation of this duration value expressed in the given [unit]\n * and formatted with the specified [decimals] number of digits after decimal point.\n *\n * Special cases:\n * - the infinite duration is formatted as `\"Infinity\"` without unit\n *\n * @return the value of duration in the specified [unit] followed by that unit abbreviated name: `d`, `h`, `m`, `s`, `ms`, `us`, or `ns`.\n *\n * @throws IllegalArgumentException if [decimals] is less than zero.\n *\n * @sample samples.time.Durations.toStringDecimals\n */\n public fun toString(unit: DurationUnit, decimals: Int = 0): String {\n require(decimals >= 0) { \"decimals must be not negative, but was $decimals\" }\n if (isInfinite()) return value.toString()\n val number = toDouble(unit)\n return when {\n abs(number) < 1e14 -> formatToExactDecimals(number, decimals.coerceAtMost(12))\n else -> formatScientific(number)\n } + unit.shortName()\n }\n\n\n /**\n * Returns an ISO-8601 based string representation of this duration.\n *\n * The returned value is presented in the format `PThHmMs.fS`, where `h`, `m`, `s` are the integer components of this duration (see [toComponents])\n * and `f` is a fractional part of second. Depending on the roundness of the value the fractional part can be formatted with either\n * 0, 3, 6, or 9 decimal digits.\n *\n * If the hours component absolute value of this duration is greater than [Int.MAX_VALUE], it is replaced with [Int.MAX_VALUE],\n * so the infinite duration is formatted as `\"PT2147483647H\".\n *\n * Negative durations are indicated with the sign `-` in the beginning of the returned string, for example, `\"-PT5M30S\"`.\n *\n * @sample samples.time.Durations.toIsoString\n */\n @OptIn(ExperimentalStdlibApi::class)\n public fun toIsoString(): String = buildString {\n if (isNegative()) append('-')\n append(\"PT\")\n absoluteValue.toComponents { hours, minutes, seconds, nanoseconds ->\n val hasHours = hours != 0\n val hasSeconds = seconds != 0 || nanoseconds != 0\n val hasMinutes = minutes != 0 || (hasSeconds && hasHours)\n if (hasHours) {\n append(hours).append('H')\n }\n if (hasMinutes) {\n append(minutes).append('M')\n }\n if (hasSeconds || (!hasHours && !hasMinutes)) {\n append(seconds)\n if (nanoseconds != 0) {\n append('.')\n val nss = nanoseconds.toString().padStart(9, '0')\n when {\n nanoseconds % 1_000_000 == 0 -> appendRange(nss, 0, 3)\n nanoseconds % 1_000 == 0 -> appendRange(nss, 0, 6)\n else -> append(nss)\n }\n }\n append('S')\n }\n }\n }\n\n}\n\n// constructing from number of units\n// extension functions\n\n/** Returns a [Duration] equal to this [Int] number of the specified [unit]. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic fun Int.toDuration(unit: DurationUnit): Duration = toDouble().toDuration(unit)\n\n/** Returns a [Duration] equal to this [Long] number of the specified [unit]. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic fun Long.toDuration(unit: DurationUnit): Duration = toDouble().toDuration(unit)\n\n/** Returns a [Duration] equal to this [Double] number of the specified [unit]. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic fun Double.toDuration(unit: DurationUnit): Duration = Duration(convertDurationUnit(this, unit, storageUnit))\n\n// constructing from number of units\n// extension properties\n\n/** Returns a [Duration] equal to this [Int] number of nanoseconds. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Int.nanoseconds get() = toDuration(DurationUnit.NANOSECONDS)\n\n/** Returns a [Duration] equal to this [Long] number of nanoseconds. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Long.nanoseconds get() = toDuration(DurationUnit.NANOSECONDS)\n\n/** Returns a [Duration] equal to this [Double] number of nanoseconds. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Double.nanoseconds get() = toDuration(DurationUnit.NANOSECONDS)\n\n/** Returns a [Duration] equal to this [Int] number of microseconds. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Int.microseconds get() = toDuration(DurationUnit.MICROSECONDS)\n\n/** Returns a [Duration] equal to this [Long] number of microseconds. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Long.microseconds get() = toDuration(DurationUnit.MICROSECONDS)\n\n/** Returns a [Duration] equal to this [Double] number of microseconds. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Double.microseconds get() = toDuration(DurationUnit.MICROSECONDS)\n\n/** Returns a [Duration] equal to this [Int] number of milliseconds. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Int.milliseconds get() = toDuration(DurationUnit.MILLISECONDS)\n\n/** Returns a [Duration] equal to this [Long] number of milliseconds. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Long.milliseconds get() = toDuration(DurationUnit.MILLISECONDS)\n\n/** Returns a [Duration] equal to this [Double] number of milliseconds. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Double.milliseconds get() = toDuration(DurationUnit.MILLISECONDS)\n\n/** Returns a [Duration] equal to this [Int] number of seconds. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Int.seconds get() = toDuration(DurationUnit.SECONDS)\n\n/** Returns a [Duration] equal to this [Long] number of seconds. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Long.seconds get() = toDuration(DurationUnit.SECONDS)\n\n/** Returns a [Duration] equal to this [Double] number of seconds. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Double.seconds get() = toDuration(DurationUnit.SECONDS)\n\n/** Returns a [Duration] equal to this [Int] number of minutes. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Int.minutes get() = toDuration(DurationUnit.MINUTES)\n\n/** Returns a [Duration] equal to this [Long] number of minutes. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Long.minutes get() = toDuration(DurationUnit.MINUTES)\n\n/** Returns a [Duration] equal to this [Double] number of minutes. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Double.minutes get() = toDuration(DurationUnit.MINUTES)\n\n/** Returns a [Duration] equal to this [Int] number of hours. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Int.hours get() = toDuration(DurationUnit.HOURS)\n\n/** Returns a [Duration] equal to this [Long] number of hours. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Long.hours get() = toDuration(DurationUnit.HOURS)\n\n/** Returns a [Duration] equal to this [Double] number of hours. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Double.hours get() = toDuration(DurationUnit.HOURS)\n\n/** Returns a [Duration] equal to this [Int] number of days. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Int.days get() = toDuration(DurationUnit.DAYS)\n\n/** Returns a [Duration] equal to this [Long] number of days. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Long.days get() = toDuration(DurationUnit.DAYS)\n\n/** Returns a [Duration] equal to this [Double] number of days. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic val Double.days get() = toDuration(DurationUnit.DAYS)\n\n\n/** Returns a duration whose value is the specified [duration] value multiplied by this number. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\n@kotlin.internal.InlineOnly\npublic inline operator fun Int.times(duration: Duration): Duration = duration * this\n\n/** Returns a duration whose value is the specified [duration] value multiplied by this number. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\n@kotlin.internal.InlineOnly\npublic inline operator fun Double.times(duration: Duration): Duration = duration * this\n\n\ninternal expect fun formatToExactDecimals(value: Double, decimals: Int): String\ninternal expect fun formatUpToDecimals(value: Double, decimals: Int): String\ninternal expect fun formatScientific(value: Double): String","/*\n * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass()\n@file:kotlin.jvm.JvmName(\"DurationUnitKt\")\n\npackage kotlin.time\n\n\n/**\n * The list of possible time measurement units, in which a duration can be expressed.\n *\n * The smallest time unit is [NANOSECONDS] and the largest is [DAYS], which corresponds to exactly 24 [HOURS].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic expect enum class DurationUnit {\n /**\n * Time unit representing one nanosecond, which is 1/1000 of a microsecond.\n */\n NANOSECONDS,\n /**\n * Time unit representing one microsecond, which is 1/1000 of a millisecond.\n */\n MICROSECONDS,\n /**\n * Time unit representing one millisecond, which is 1/1000 of a second.\n */\n MILLISECONDS,\n /**\n * Time unit representing one second.\n */\n SECONDS,\n /**\n * Time unit representing one minute.\n */\n MINUTES,\n /**\n * Time unit representing one hour.\n */\n HOURS,\n /**\n * Time unit representing one day, which is always equal to 24 hours.\n */\n DAYS;\n}\n\n/** Converts the given time duration [value] expressed in the specified [sourceUnit] into the specified [targetUnit]. */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\ninternal expect fun convertDurationUnit(value: Double, sourceUnit: DurationUnit, targetUnit: DurationUnit): Double\n\n\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\ninternal fun DurationUnit.shortName(): String = when (this) {\n DurationUnit.NANOSECONDS -> \"ns\"\n DurationUnit.MICROSECONDS -> \"us\"\n DurationUnit.MILLISECONDS -> \"ms\"\n DurationUnit.SECONDS -> \"s\"\n DurationUnit.MINUTES -> \"m\"\n DurationUnit.HOURS -> \"h\"\n DurationUnit.DAYS -> \"d\"\n}","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.time\n\n/**\n * A source of time for measuring time intervals.\n *\n * The only operation provided by the time source is [markNow]. It returns a [TimeMark], which can be used to query the elapsed time later.\n *\n * @see [measureTime]\n * @see [measureTimedValue]\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic interface TimeSource {\n /**\n * Marks a point in time on this time source.\n *\n * The returned [TimeMark] instance encapsulates the captured time point and allows querying\n * the duration of time interval [elapsed][TimeMark.elapsedNow] from that point.\n */\n public fun markNow(): TimeMark\n\n /**\n * The most precise time source available in the platform.\n *\n * This time source returns its readings from a source of monotonic time when it is available in a target platform,\n * and resorts to a non-monotonic time source otherwise.\n */\n public object Monotonic : TimeSource by MonotonicTimeSource {\n override fun toString(): String = MonotonicTimeSource.toString()\n }\n\n\n public companion object {\n\n }\n}\n\n/**\n * Represents a time point notched on a particular [TimeSource]. Remains bound to the time source it was taken from\n * and allows querying for the duration of time elapsed from that point (see the function [elapsedNow]).\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic abstract class TimeMark {\n /**\n * Returns the amount of time passed from this mark measured with the time source from which this mark was taken.\n *\n * Note that the value returned by this function can change on subsequent invocations.\n */\n public abstract fun elapsedNow(): Duration\n\n /**\n * Returns a time mark on the same time source that is ahead of this time mark by the specified [duration].\n *\n * The returned time mark is more _late_ when the [duration] is positive, and more _early_ when the [duration] is negative.\n */\n public open operator fun plus(duration: Duration): TimeMark = AdjustedTimeMark(this, duration)\n\n /**\n * Returns a time mark on the same time source that is behind this time mark by the specified [duration].\n *\n * The returned time mark is more _early_ when the [duration] is positive, and more _late_ when the [duration] is negative.\n */\n public open operator fun minus(duration: Duration): TimeMark = plus(-duration)\n\n\n /**\n * Returns true if this time mark has passed according to the time source from which this mark was taken.\n *\n * Note that the value returned by this function can change on subsequent invocations.\n * If the time source is monotonic, it can change only from `false` to `true`, namely, when the time mark becomes behind the current point of the time source.\n */\n public fun hasPassedNow(): Boolean = !elapsedNow().isNegative()\n\n /**\n * Returns false if this time mark has not passed according to the time source from which this mark was taken.\n *\n * Note that the value returned by this function can change on subsequent invocations.\n * If the time source is monotonic, it can change only from `true` to `false`, namely, when the time mark becomes behind the current point of the time source.\n */\n public fun hasNotPassedNow(): Boolean = elapsedNow().isNegative()\n}\n\n\n@ExperimentalTime\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\n@Deprecated(\n \"Subtracting one TimeMark from another is not a well defined operation because these time marks could have been obtained from the different time sources.\",\n level = DeprecationLevel.ERROR\n)\n@Suppress(\"UNUSED_PARAMETER\")\npublic inline operator fun TimeMark.minus(other: TimeMark): Duration = throw Error(\"Operation is disallowed.\")\n\n@ExperimentalTime\n@SinceKotlin(\"1.3\")\n@kotlin.internal.InlineOnly\n@Deprecated(\n \"Comparing one TimeMark to another is not a well defined operation because these time marks could have been obtained from the different time sources.\",\n level = DeprecationLevel.ERROR\n)\n@Suppress(\"UNUSED_PARAMETER\")\npublic inline operator fun TimeMark.compareTo(other: TimeMark): Int = throw Error(\"Operation is disallowed.\")\n\n\n@ExperimentalTime\nprivate class AdjustedTimeMark(val mark: TimeMark, val adjustment: Duration) : TimeMark() {\n override fun elapsedNow(): Duration = mark.elapsedNow() - adjustment\n\n override fun plus(duration: Duration): TimeMark = AdjustedTimeMark(mark, adjustment + duration)\n}\n\n\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\n@Deprecated(\"Use TimeSource interface instead.\", ReplaceWith(\"TimeSource\", \"kotlin.time.TimeSource\"), DeprecationLevel.ERROR)\npublic typealias Clock = TimeSource\n\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\n@Deprecated(\"Use TimeMark class instead.\", ReplaceWith(\"TimeMark\", \"kotlin.time.TimeMark\"), DeprecationLevel.ERROR)\npublic typealias ClockMark = TimeMark\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"StringsKt\")\n\npackage kotlin.text\n\nimport kotlin.contracts.*\n\n/**\n * A mutable sequence of characters.\n *\n * String builder can be used to efficiently perform multiple string manipulation operations.\n */\nexpect class StringBuilder : Appendable, CharSequence {\n /** Constructs an empty string builder. */\n constructor()\n\n /** Constructs an empty string builder with the specified initial [capacity]. */\n constructor(capacity: Int)\n\n /** Constructs a string builder that contains the same characters as the specified [content] char sequence. */\n constructor(content: CharSequence)\n\n /** Constructs a string builder that contains the same characters as the specified [content] string. */\n @SinceKotlin(\"1.3\")\n// @ExperimentalStdlibApi\n constructor(content: String)\n\n override val length: Int\n\n override operator fun get(index: Int): Char\n\n override fun subSequence(startIndex: Int, endIndex: Int): CharSequence\n\n override fun append(value: Char): StringBuilder\n override fun append(value: CharSequence?): StringBuilder\n override fun append(value: CharSequence?, startIndex: Int, endIndex: Int): StringBuilder\n\n /**\n * Reverses the contents of this string builder and returns this instance.\n *\n * Surrogate pairs included in this string builder are treated as single characters.\n * Therefore, the order of the high-low surrogates is never reversed.\n *\n * Note that the reverse operation may produce new surrogate pairs that were unpaired low-surrogates and high-surrogates before the operation.\n * For example, reversing `\"\\uDC00\\uD800\"` produces `\"\\uD800\\uDC00\"` which is a valid surrogate pair.\n */\n fun reverse(): StringBuilder\n\n /**\n * Appends the string representation of the specified object [value] to this string builder and returns this instance.\n *\n * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,\n * and then that string was appended to this string builder.\n */\n fun append(value: Any?): StringBuilder\n\n /**\n * Appends the string representation of the specified boolean [value] to this string builder and returns this instance.\n *\n * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,\n * and then that string was appended to this string builder.\n */\n @SinceKotlin(\"1.3\")\n fun append(value: Boolean): StringBuilder\n\n /**\n * Appends characters in the specified character array [value] to this string builder and returns this instance.\n *\n * Characters are appended in order, starting at the index 0.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun append(value: CharArray): StringBuilder\n\n /**\n * Appends the specified string [value] to this string builder and returns this instance.\n *\n * If [value] is `null`, then the four characters `\"null\"` are appended.\n */\n @SinceKotlin(\"1.3\")\n fun append(value: String?): StringBuilder\n\n /**\n * Returns the current capacity of this string builder.\n *\n * The capacity is the maximum length this string builder can have before an allocation occurs.\n */\n @SinceKotlin(\"1.3\")\n// @ExperimentalStdlibApi\n @Deprecated(\"Obtaining StringBuilder capacity is not supported in JS and common code.\", level = DeprecationLevel.ERROR)\n fun capacity(): Int\n\n /**\n * Ensures that the capacity of this string builder is at least equal to the specified [minimumCapacity].\n *\n * If the current capacity is less than the [minimumCapacity], a new backing storage is allocated with greater capacity.\n * Otherwise, this method takes no action and simply returns.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun ensureCapacity(minimumCapacity: Int)\n\n /**\n * Returns the index within this string builder of the first occurrence of the specified [string].\n *\n * Returns `-1` if the specified [string] does not occur in this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun indexOf(string: String): Int\n\n /**\n * Returns the index within this string builder of the first occurrence of the specified [string],\n * starting at the specified [startIndex].\n *\n * Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun indexOf(string: String, startIndex: Int): Int\n\n /**\n * Returns the index within this string builder of the last occurrence of the specified [string].\n * The last occurrence of empty string `\"\"` is considered to be at the index equal to `this.length`.\n *\n * Returns `-1` if the specified [string] does not occur in this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun lastIndexOf(string: String): Int\n\n /**\n * Returns the index within this string builder of the last occurrence of the specified [string],\n * starting from the specified [startIndex] toward the beginning.\n *\n * Returns `-1` if the specified [string] does not occur in this string builder starting at the specified [startIndex].\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun lastIndexOf(string: String, startIndex: Int): Int\n\n /**\n * Inserts the string representation of the specified boolean [value] into this string builder at the specified [index] and returns this instance.\n *\n * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,\n * and then that string was inserted into this string builder at the specified [index].\n *\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun insert(index: Int, value: Boolean): StringBuilder\n\n /**\n * Inserts the specified character [value] into this string builder at the specified [index] and returns this instance.\n *\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun insert(index: Int, value: Char): StringBuilder\n\n /**\n * Inserts characters in the specified character array [value] into this string builder at the specified [index] and returns this instance.\n *\n * The inserted characters go in same order as in the [value] character array, starting at [index].\n *\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun insert(index: Int, value: CharArray): StringBuilder\n\n /**\n * Inserts characters in the specified character sequence [value] into this string builder at the specified [index] and returns this instance.\n *\n * The inserted characters go in the same order as in the [value] character sequence, starting at [index].\n *\n * @param index the position in this string builder to insert at.\n * @param value the character sequence from which characters are inserted. If [value] is `null`, then the four characters `\"null\"` are inserted.\n *\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun insert(index: Int, value: CharSequence?): StringBuilder\n\n /**\n * Inserts the string representation of the specified object [value] into this string builder at the specified [index] and returns this instance.\n *\n * The overall effect is exactly as if the [value] were converted to a string by the `value.toString()` method,\n * and then that string was inserted into this string builder at the specified [index].\n *\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun insert(index: Int, value: Any?): StringBuilder\n\n /**\n * Inserts the string [value] into this string builder at the specified [index] and returns this instance.\n *\n * If [value] is `null`, then the four characters `\"null\"` are inserted.\n *\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun insert(index: Int, value: String?): StringBuilder\n\n /**\n * Sets the length of this string builder to the specified [newLength].\n *\n * If the [newLength] is less than the current length, it is changed to the specified [newLength].\n * Otherwise, null characters '\\u0000' are appended to this string builder until its length is less than the [newLength].\n *\n * Note that in Kotlin/JS [set] operator function has non-constant execution time complexity.\n * Therefore, increasing length of this string builder and then updating each character by index may slow down your program.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] if [newLength] is less than zero.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun setLength(newLength: Int)\n\n /**\n * Returns a new [String] that contains characters in this string builder at [startIndex] (inclusive) and up to the [length] (exclusive).\n *\n * @throws IndexOutOfBoundsException if [startIndex] is less than zero or greater than the length of this string builder.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun substring(startIndex: Int): String\n\n /**\n * Returns a new [String] that contains characters in this string builder at [startIndex] (inclusive) and up to the [endIndex] (exclusive).\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun substring(startIndex: Int, endIndex: Int): String\n\n /**\n * Attempts to reduce storage used for this string builder.\n *\n * If the backing storage of this string builder is larger than necessary to hold its current contents,\n * then it may be resized to become more space efficient.\n * Calling this method may, but is not required to, affect the value of the [capacity] property.\n */\n @SinceKotlin(\"1.4\")\n @WasExperimental(ExperimentalStdlibApi::class)\n fun trimToSize()\n}\n\n\n/**\n * Clears the content of this string builder making it empty and returns this instance.\n *\n * @sample samples.text.Strings.clearStringBuilder\n */\n@SinceKotlin(\"1.3\")\npublic expect fun StringBuilder.clear(): StringBuilder\n\n/**\n * Sets the character at the specified [index] to the specified [value].\n *\n * @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic expect operator fun StringBuilder.set(index: Int, value: Char)\n\n/**\n * Replaces characters in the specified range of this string builder with characters in the specified string [value] and returns this instance.\n *\n * @param startIndex the beginning (inclusive) of the range to replace.\n * @param endIndex the end (exclusive) of the range to replace.\n * @param value the string to replace with.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] if [startIndex] is less than zero, greater than the length of this string builder, or `startIndex > endIndex`.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic expect fun StringBuilder.setRange(startIndex: Int, endIndex: Int, value: String): StringBuilder\n\n/**\n * Removes the character at the specified [index] from this string builder and returns this instance.\n *\n * If the `Char` at the specified [index] is part of a supplementary code point, this method does not remove the entire supplementary character.\n *\n * @param index the index of `Char` to remove.\n *\n * @throws IndexOutOfBoundsException if [index] is out of bounds of this string builder.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic expect fun StringBuilder.deleteAt(index: Int): StringBuilder\n\n/**\n * Removes characters in the specified range from this string builder and returns this instance.\n *\n * @param startIndex the beginning (inclusive) of the range to remove.\n * @param endIndex the end (exclusive) of the range to remove.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] is out of range of this string builder indices or when `startIndex > endIndex`.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic expect fun StringBuilder.deleteRange(startIndex: Int, endIndex: Int): StringBuilder\n\n/**\n * Copies characters from this string builder into the [destination] character array.\n *\n * @param destination the array to copy to.\n * @param destinationOffset the position in the array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the range to copy, 0 by default.\n * @param endIndex the end (exclusive) of the range to copy, length of this string builder by default.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this string builder indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic expect fun StringBuilder.toCharArray(destination: CharArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = this.length)\n\n/**\n * Appends characters in a subarray of the specified character array [value] to this string builder and returns this instance.\n *\n * Characters are appended in order, starting at specified [startIndex].\n *\n * @param value the array from which characters are appended.\n * @param startIndex the beginning (inclusive) of the subarray to append.\n * @param endIndex the end (exclusive) of the subarray to append.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] array indices or when `startIndex > endIndex`.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic expect fun StringBuilder.appendRange(value: CharArray, startIndex: Int, endIndex: Int): StringBuilder\n\n/**\n * Appends a subsequence of the specified character sequence [value] to this string builder and returns this instance.\n *\n * @param value the character sequence from which a subsequence is appended.\n * @param startIndex the beginning (inclusive) of the subsequence to append.\n * @param endIndex the end (exclusive) of the subsequence to append.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic expect fun StringBuilder.appendRange(value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder\n\n/**\n * Inserts characters in a subarray of the specified character array [value] into this string builder at the specified [index] and returns this instance.\n *\n * The inserted characters go in same order as in the [value] array, starting at [index].\n *\n * @param index the position in this string builder to insert at.\n * @param value the array from which characters are inserted.\n * @param startIndex the beginning (inclusive) of the subarray to insert.\n * @param endIndex the end (exclusive) of the subarray to insert.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic expect fun StringBuilder.insertRange(index: Int, value: CharArray, startIndex: Int, endIndex: Int): StringBuilder\n\n/**\n * Inserts characters in a subsequence of the specified character sequence [value] into this string builder at the specified [index] and returns this instance.\n *\n * The inserted characters go in the same order as in the [value] character sequence, starting at [index].\n *\n * @param index the position in this string builder to insert at.\n * @param value the character sequence from which a subsequence is inserted.\n * @param startIndex the beginning (inclusive) of the subsequence to insert.\n * @param endIndex the end (exclusive) of the subsequence to insert.\n *\n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of the [value] character sequence indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException if [index] is less than zero or greater than the length of this string builder.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\npublic expect fun StringBuilder.insertRange(index: Int, value: CharSequence, startIndex: Int, endIndex: Int): StringBuilder\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\n@Deprecated(\"Use append(value: Any?) instead\", ReplaceWith(\"append(value = obj)\"), DeprecationLevel.WARNING)\n@kotlin.internal.InlineOnly\npublic inline fun StringBuilder.append(obj: Any?): StringBuilder = this.append(obj)\n\n/**\n * Builds new string by populating newly created [StringBuilder] using provided [builderAction]\n * and then converting it to [String].\n */\n@kotlin.internal.InlineOnly\npublic inline fun buildString(builderAction: StringBuilder.() -> Unit): String {\n contract { callsInPlace(builderAction, InvocationKind.EXACTLY_ONCE) }\n return StringBuilder().apply(builderAction).toString()\n}\n\n/**\n * Builds new string by populating newly created [StringBuilder] initialized with the given [capacity]\n * using provided [builderAction] and then converting it to [String].\n */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline fun buildString(capacity: Int, builderAction: StringBuilder.() -> Unit): String {\n contract { callsInPlace(builderAction, InvocationKind.EXACTLY_ONCE) }\n return StringBuilder(capacity).apply(builderAction).toString()\n}\n\n/**\n * Appends all arguments to the given StringBuilder.\n */\npublic fun StringBuilder.append(vararg value: String?): StringBuilder {\n for (item in value)\n append(item)\n return this\n}\n\n/**\n * Appends all arguments to the given StringBuilder.\n */\npublic fun StringBuilder.append(vararg value: Any?): StringBuilder {\n for (item in value)\n append(item)\n return this\n}\n\n/** Appends a line feed character (`\\n`) to this StringBuilder. */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun StringBuilder.appendLine(): StringBuilder = append('\\n')\n\n/** Appends [value] to this [StringBuilder], followed by a line feed character (`\\n`). */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun StringBuilder.appendLine(value: CharSequence?): StringBuilder = append(value).appendLine()\n\n/** Appends [value] to this [StringBuilder], followed by a line feed character (`\\n`). */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun StringBuilder.appendLine(value: String?): StringBuilder = append(value).appendLine()\n\n/** Appends [value] to this [StringBuilder], followed by a line feed character (`\\n`). */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun StringBuilder.appendLine(value: Any?): StringBuilder = append(value).appendLine()\n\n/** Appends [value] to this [StringBuilder], followed by a line feed character (`\\n`). */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun StringBuilder.appendLine(value: CharArray): StringBuilder = append(value).appendLine()\n\n/** Appends [value] to this [StringBuilder], followed by a line feed character (`\\n`). */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun StringBuilder.appendLine(value: Char): StringBuilder = append(value).appendLine()\n\n/** Appends [value] to this [StringBuilder], followed by a line feed character (`\\n`). */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun StringBuilder.appendLine(value: Boolean): StringBuilder = append(value).appendLine()\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.time\n\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\ninternal expect object MonotonicTimeSource : TimeSource\n\n/**\n * An abstract class used to implement time sources that return their readings as [Long] values in the specified [unit].\n *\n * @property unit The unit in which this time source's readings are expressed.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic abstract class AbstractLongTimeSource(protected val unit: DurationUnit) : TimeSource {\n /**\n * This protected method should be overridden to return the current reading of the time source expressed as a [Long] number\n * in the unit specified by the [unit] property.\n */\n protected abstract fun read(): Long\n\n private class LongTimeMark(private val startedAt: Long, private val timeSource: AbstractLongTimeSource, private val offset: Duration) : TimeMark() {\n override fun elapsedNow(): Duration = (timeSource.read() - startedAt).toDuration(timeSource.unit) - offset\n override fun plus(duration: Duration): TimeMark = LongTimeMark(startedAt, timeSource, offset + duration)\n }\n\n override fun markNow(): TimeMark = LongTimeMark(read(), this, Duration.ZERO)\n}\n\n/**\n * An abstract class used to implement time sources that return their readings as [Double] values in the specified [unit].\n *\n * @property unit The unit in which this time source's readings are expressed.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic abstract class AbstractDoubleTimeSource(protected val unit: DurationUnit) : TimeSource {\n /**\n * This protected method should be overridden to return the current reading of the time source expressed as a [Double] number\n * in the unit specified by the [unit] property.\n */\n protected abstract fun read(): Double\n\n private class DoubleTimeMark(private val startedAt: Double, private val timeSource: AbstractDoubleTimeSource, private val offset: Duration) : TimeMark() {\n override fun elapsedNow(): Duration = (timeSource.read() - startedAt).toDuration(timeSource.unit) - offset\n override fun plus(duration: Duration): TimeMark = DoubleTimeMark(startedAt, timeSource, offset + duration)\n }\n\n override fun markNow(): TimeMark = DoubleTimeMark(read(), this, Duration.ZERO)\n}\n\n/**\n * A time source that has programmatically updatable readings. It is useful as a predictable source of time in tests.\n *\n * The current reading value can be advanced by the specified duration amount with the operator [plusAssign]:\n *\n * ```\n * val timeSource = TestTimeSource()\n * timeSource += 10.seconds\n * ```\n *\n * Implementation note: the current reading value is stored as a [Long] number of nanoseconds,\n * thus it's capable to represent a time range of approximately ±292 years.\n * Should the reading value overflow as the result of [plusAssign] operation, an [IllegalStateException] is thrown.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic class TestTimeSource : AbstractLongTimeSource(unit = DurationUnit.NANOSECONDS) {\n private var reading: Long = 0L\n\n override fun read(): Long = reading\n\n /**\n * Advances the current reading value of this time source by the specified [duration].\n *\n * [duration] value is rounded down towards zero when converting it to a [Long] number of nanoseconds.\n * For example, if the duration being added is `0.6.nanoseconds`, the reading doesn't advance because\n * the duration value is rounded to zero nanoseconds.\n *\n * @throws IllegalStateException when the reading value overflows as the result of this operation.\n */\n public operator fun plusAssign(duration: Duration) {\n val delta = duration.toDouble(unit)\n val longDelta = delta.toLong()\n reading = if (longDelta != Long.MIN_VALUE && longDelta != Long.MAX_VALUE) {\n // when delta fits in long, add it as long\n val newReading = reading + longDelta\n if (reading xor longDelta >= 0 && reading xor newReading < 0) overflow(duration)\n newReading\n } else {\n // when delta is greater than long, add it as double\n val newReading = reading + delta\n if (newReading > Long.MAX_VALUE || newReading < Long.MIN_VALUE) overflow(duration)\n newReading.toLong()\n }\n }\n\n private fun overflow(duration: Duration) {\n throw IllegalStateException(\"TestTimeSource will overflow if its reading ${reading}ns is advanced by $duration.\")\n }\n}\n\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\n@Deprecated(\"Use TimeSource.Monotonic instead.\", ReplaceWith(\"TimeSource.Monotonic\", \"kotlin.time.TimeSource\"), DeprecationLevel.ERROR)\npublic typealias MonoClock = TimeSource.Monotonic\n\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\n@Deprecated(\"Use AbstractLongTimeSource instead.\", ReplaceWith(\"AbstractLongTimeSource\", \"kotlin.time.AbstractLongTimeSource\"), DeprecationLevel.ERROR)\npublic typealias AbstractLongClock = AbstractLongTimeSource\n\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\n@Deprecated(\"Use AbstractDoubleTimeSource instead.\", ReplaceWith(\"AbstractDoubleTimeSource\", \"kotlin.time.AbstractDoubleTimeSource\"), DeprecationLevel.ERROR)\npublic typealias AbstractDoubleClock = AbstractDoubleTimeSource\n\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\n@Deprecated(\"Use TestTimeSource instead.\", ReplaceWith(\"TestTimeSource\", \"kotlin.time.TestTimeSource\"), DeprecationLevel.ERROR)\npublic typealias TestClock = TestTimeSource\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.time\n\nimport kotlin.contracts.*\n\n/**\n * Executes the given function [block] and returns the duration of elapsed time interval.\n *\n * The elapsed time is measured with [TimeSource.Monotonic].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic inline fun measureTime(block: () -> Unit): Duration {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n return TimeSource.Monotonic.measureTime(block)\n}\n\n\n/**\n * Executes the given function [block] and returns the duration of elapsed time interval.\n *\n * The elapsed time is measured with the specified `this` [TimeSource] instance.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic inline fun TimeSource.measureTime(block: () -> Unit): Duration {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n val mark = markNow()\n block()\n return mark.elapsedNow()\n}\n\n\n/**\n * Data class representing a result of executing an action, along with the duration of elapsed time interval.\n *\n * @property value the result of the action.\n * @property duration the time elapsed to execute the action.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic data class TimedValue(val value: T, val duration: Duration)\n\n/**\n * Executes the given function [block] and returns an instance of [TimedValue] class, containing both\n * the result of the function execution and the duration of elapsed time interval.\n *\n * The elapsed time is measured with [TimeSource.Monotonic].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic inline fun measureTimedValue(block: () -> T): TimedValue {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n return TimeSource.Monotonic.measureTimedValue(block)\n}\n\n/**\n * Executes the given [block] and returns an instance of [TimedValue] class, containing both\n * the result of function execution and the duration of elapsed time interval.\n *\n * The elapsed time is measured with the specified `this` [TimeSource] instance.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalTime\npublic inline fun TimeSource.measureTimedValue(block: () -> T): TimedValue {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n val mark = markNow()\n val result = block()\n return TimedValue(result, mark.elapsedNow())\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmName(\"LazyKt\")\n@file:kotlin.jvm.JvmMultifileClass\n\npackage kotlin\n\nimport kotlin.reflect.KProperty\n\n/**\n * Represents a value with lazy initialization.\n *\n * To create an instance of [Lazy] use the [lazy] function.\n */\npublic interface Lazy {\n /**\n * Gets the lazily initialized value of the current Lazy instance.\n * Once the value was initialized it must not change during the rest of lifetime of this Lazy instance.\n */\n public val value: T\n\n /**\n * Returns `true` if a value for this Lazy instance has been already initialized, and `false` otherwise.\n * Once this function has returned `true` it stays `true` for the rest of lifetime of this Lazy instance.\n */\n public fun isInitialized(): Boolean\n}\n\n/**\n * Creates a new instance of the [Lazy] that is already initialized with the specified [value].\n */\npublic fun lazyOf(value: T): Lazy = InitializedLazyImpl(value)\n\n/**\n * An extension to delegate a read-only property of type [T] to an instance of [Lazy].\n *\n * This extension allows to use instances of Lazy for property delegation:\n * `val property: String by lazy { initializer }`\n */\n@kotlin.internal.InlineOnly\npublic inline operator fun Lazy.getValue(thisRef: Any?, property: KProperty<*>): T = value\n\n/**\n * Specifies how a [Lazy] instance synchronizes initialization among multiple threads.\n */\npublic enum class LazyThreadSafetyMode {\n\n /**\n * Locks are used to ensure that only a single thread can initialize the [Lazy] instance.\n */\n SYNCHRONIZED,\n\n /**\n * Initializer function can be called several times on concurrent access to uninitialized [Lazy] instance value,\n * but only the first returned value will be used as the value of [Lazy] instance.\n */\n PUBLICATION,\n\n /**\n * No locks are used to synchronize an access to the [Lazy] instance value; if the instance is accessed from multiple threads, its behavior is undefined.\n *\n * This mode should not be used unless the [Lazy] instance is guaranteed never to be initialized from more than one thread.\n */\n NONE,\n}\n\n\ninternal object UNINITIALIZED_VALUE\n\n// internal to be called from lazy in JS\ninternal class UnsafeLazyImpl(initializer: () -> T) : Lazy, Serializable {\n private var initializer: (() -> T)? = initializer\n private var _value: Any? = UNINITIALIZED_VALUE\n\n override val value: T\n get() {\n if (_value === UNINITIALIZED_VALUE) {\n _value = initializer!!()\n initializer = null\n }\n @Suppress(\"UNCHECKED_CAST\")\n return _value as T\n }\n\n override fun isInitialized(): Boolean = _value !== UNINITIALIZED_VALUE\n\n override fun toString(): String = if (isInitialized()) value.toString() else \"Lazy value not initialized yet.\"\n\n private fun writeReplace(): Any = InitializedLazyImpl(value)\n}\n\ninternal class InitializedLazyImpl(override val value: T) : Lazy, Serializable {\n\n override fun isInitialized(): Boolean = true\n\n override fun toString(): String = value.toString()\n\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmName(\"TuplesKt\")\n\npackage kotlin\n\n\n/**\n * Represents a generic pair of two values.\n *\n * There is no meaning attached to values in this class, it can be used for any purpose.\n * Pair exhibits value semantics, i.e. two pairs are equal if both components are equal.\n *\n * An example of decomposing it into values:\n * @sample samples.misc.Tuples.pairDestructuring\n *\n * @param A type of the first value.\n * @param B type of the second value.\n * @property first First value.\n * @property second Second value.\n * @constructor Creates a new instance of Pair.\n */\npublic data class Pair(\n public val first: A,\n public val second: B\n) : Serializable {\n\n /**\n * Returns string representation of the [Pair] including its [first] and [second] values.\n */\n public override fun toString(): String = \"($first, $second)\"\n}\n\n/**\n * Creates a tuple of type [Pair] from this and [that].\n *\n * This can be useful for creating [Map] literals with less noise, for example:\n * @sample samples.collections.Maps.Instantiation.mapFromPairs\n */\npublic infix fun A.to(that: B): Pair = Pair(this, that)\n\n/**\n * Converts this pair into a list.\n * @sample samples.misc.Tuples.pairToList\n */\npublic fun Pair.toList(): List = listOf(first, second)\n\n/**\n * Represents a triad of values\n *\n * There is no meaning attached to values in this class, it can be used for any purpose.\n * Triple exhibits value semantics, i.e. two triples are equal if all three components are equal.\n * An example of decomposing it into values:\n * @sample samples.misc.Tuples.tripleDestructuring\n *\n * @param A type of the first value.\n * @param B type of the second value.\n * @param C type of the third value.\n * @property first First value.\n * @property second Second value.\n * @property third Third value.\n */\npublic data class Triple(\n public val first: A,\n public val second: B,\n public val third: C\n) : Serializable {\n\n /**\n * Returns string representation of the [Triple] including its [first], [second] and [third] values.\n */\n public override fun toString(): String = \"($first, $second, $third)\"\n}\n\n/**\n * Converts this triple into a list.\n * @sample samples.misc.Tuples.tripleToList\n */\npublic fun Triple.toList(): List = listOf(first, second, third)\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// Auto-generated file. DO NOT EDIT!\n\npackage kotlin\n\nimport kotlin.experimental.*\n\n@Suppress(\"NON_PUBLIC_PRIMARY_CONSTRUCTOR_OF_INLINE_CLASS\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic inline class ULong @PublishedApi internal constructor(@PublishedApi internal val data: Long) : Comparable {\n\n companion object {\n /**\n * A constant holding the minimum value an instance of ULong can have.\n */\n public const val MIN_VALUE: ULong = ULong(0)\n\n /**\n * A constant holding the maximum value an instance of ULong can have.\n */\n public const val MAX_VALUE: ULong = ULong(-1)\n\n /**\n * The number of bytes used to represent an instance of ULong in a binary form.\n */\n public const val SIZE_BYTES: Int = 8\n\n /**\n * The number of bits used to represent an instance of ULong in a binary form.\n */\n public const val SIZE_BITS: Int = 64\n }\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n public inline operator fun compareTo(other: UByte): Int = this.compareTo(other.toULong())\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n public inline operator fun compareTo(other: UShort): Int = this.compareTo(other.toULong())\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n public inline operator fun compareTo(other: UInt): Int = this.compareTo(other.toULong())\n\n /**\n * Compares this value with the specified value for order.\n * Returns zero if this value is equal to the specified other value, a negative number if it's less than other,\n * or a positive number if it's greater than other.\n */\n @kotlin.internal.InlineOnly\n @Suppress(\"OVERRIDE_BY_INLINE\")\n public override inline operator fun compareTo(other: ULong): Int = ulongCompare(this.data, other.data)\n\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: UByte): ULong = this.plus(other.toULong())\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: UShort): ULong = this.plus(other.toULong())\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: UInt): ULong = this.plus(other.toULong())\n /** Adds the other value to this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun plus(other: ULong): ULong = ULong(this.data.plus(other.data))\n\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: UByte): ULong = this.minus(other.toULong())\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: UShort): ULong = this.minus(other.toULong())\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: UInt): ULong = this.minus(other.toULong())\n /** Subtracts the other value from this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun minus(other: ULong): ULong = ULong(this.data.minus(other.data))\n\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: UByte): ULong = this.times(other.toULong())\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: UShort): ULong = this.times(other.toULong())\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: UInt): ULong = this.times(other.toULong())\n /** Multiplies this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun times(other: ULong): ULong = ULong(this.data.times(other.data))\n\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: UByte): ULong = this.div(other.toULong())\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: UShort): ULong = this.div(other.toULong())\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: UInt): ULong = this.div(other.toULong())\n /** Divides this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun div(other: ULong): ULong = ulongDivide(this, other)\n\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: UByte): ULong = this.rem(other.toULong())\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: UShort): ULong = this.rem(other.toULong())\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: UInt): ULong = this.rem(other.toULong())\n /** Calculates the remainder of dividing this value by the other value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rem(other: ULong): ULong = ulongRemainder(this, other)\n\n /** Increments this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun inc(): ULong = ULong(data.inc())\n /** Decrements this value. */\n @kotlin.internal.InlineOnly\n public inline operator fun dec(): ULong = ULong(data.dec())\n\n /** Creates a range from this value to the specified [other] value. */\n @kotlin.internal.InlineOnly\n public inline operator fun rangeTo(other: ULong): ULongRange = ULongRange(this, other)\n\n /**\n * Shifts this value left by the [bitCount] number of bits.\n *\n * Note that only the six lowest-order bits of the [bitCount] are used as the shift distance.\n * The shift distance actually used is therefore always in the range `0..63`.\n */\n @kotlin.internal.InlineOnly\n public inline infix fun shl(bitCount: Int): ULong = ULong(data shl bitCount)\n\n /**\n * Shifts this value right by the [bitCount] number of bits, filling the leftmost bits with zeros.\n *\n * Note that only the six lowest-order bits of the [bitCount] are used as the shift distance.\n * The shift distance actually used is therefore always in the range `0..63`.\n */\n @kotlin.internal.InlineOnly\n public inline infix fun shr(bitCount: Int): ULong = ULong(data ushr bitCount)\n\n /** Performs a bitwise AND operation between the two values. */\n @kotlin.internal.InlineOnly\n public inline infix fun and(other: ULong): ULong = ULong(this.data and other.data)\n /** Performs a bitwise OR operation between the two values. */\n @kotlin.internal.InlineOnly\n public inline infix fun or(other: ULong): ULong = ULong(this.data or other.data)\n /** Performs a bitwise XOR operation between the two values. */\n @kotlin.internal.InlineOnly\n public inline infix fun xor(other: ULong): ULong = ULong(this.data xor other.data)\n /** Inverts the bits in this value. */\n @kotlin.internal.InlineOnly\n public inline fun inv(): ULong = ULong(data.inv())\n\n /**\n * Converts this [ULong] value to [Byte].\n *\n * If this value is less than or equals to [Byte.MAX_VALUE], the resulting `Byte` value represents\n * the same numerical value as this `ULong`.\n *\n * The resulting `Byte` value is represented by the least significant 8 bits of this `ULong` value.\n * Note that the resulting `Byte` value may be negative.\n */\n @kotlin.internal.InlineOnly\n public inline fun toByte(): Byte = data.toByte()\n /**\n * Converts this [ULong] value to [Short].\n *\n * If this value is less than or equals to [Short.MAX_VALUE], the resulting `Short` value represents\n * the same numerical value as this `ULong`.\n *\n * The resulting `Short` value is represented by the least significant 16 bits of this `ULong` value.\n * Note that the resulting `Short` value may be negative.\n */\n @kotlin.internal.InlineOnly\n public inline fun toShort(): Short = data.toShort()\n /**\n * Converts this [ULong] value to [Int].\n *\n * If this value is less than or equals to [Int.MAX_VALUE], the resulting `Int` value represents\n * the same numerical value as this `ULong`.\n *\n * The resulting `Int` value is represented by the least significant 32 bits of this `ULong` value.\n * Note that the resulting `Int` value may be negative.\n */\n @kotlin.internal.InlineOnly\n public inline fun toInt(): Int = data.toInt()\n /**\n * Converts this [ULong] value to [Long].\n *\n * If this value is less than or equals to [Long.MAX_VALUE], the resulting `Long` value represents\n * the same numerical value as this `ULong`. Otherwise the result is negative.\n *\n * The resulting `Long` value has the same binary representation as this `ULong` value.\n */\n @kotlin.internal.InlineOnly\n public inline fun toLong(): Long = data\n\n /**\n * Converts this [ULong] value to [UByte].\n *\n * If this value is less than or equals to [UByte.MAX_VALUE], the resulting `UByte` value represents\n * the same numerical value as this `ULong`.\n *\n * The resulting `UByte` value is represented by the least significant 8 bits of this `ULong` value.\n */\n @kotlin.internal.InlineOnly\n public inline fun toUByte(): UByte = data.toUByte()\n /**\n * Converts this [ULong] value to [UShort].\n *\n * If this value is less than or equals to [UShort.MAX_VALUE], the resulting `UShort` value represents\n * the same numerical value as this `ULong`.\n *\n * The resulting `UShort` value is represented by the least significant 16 bits of this `ULong` value.\n */\n @kotlin.internal.InlineOnly\n public inline fun toUShort(): UShort = data.toUShort()\n /**\n * Converts this [ULong] value to [UInt].\n *\n * If this value is less than or equals to [UInt.MAX_VALUE], the resulting `UInt` value represents\n * the same numerical value as this `ULong`.\n *\n * The resulting `UInt` value is represented by the least significant 32 bits of this `ULong` value.\n */\n @kotlin.internal.InlineOnly\n public inline fun toUInt(): UInt = data.toUInt()\n /** Returns this value. */\n @kotlin.internal.InlineOnly\n public inline fun toULong(): ULong = this\n\n /**\n * Converts this [ULong] value to [Float].\n *\n * The resulting value is the closest `Float` to this `ULong` value.\n * In case when this `ULong` value is exactly between two `Float`s,\n * the one with zero at least significant bit of mantissa is selected.\n */\n @kotlin.internal.InlineOnly\n public inline fun toFloat(): Float = this.toDouble().toFloat()\n /**\n * Converts this [ULong] value to [Double].\n *\n * The resulting value is the closest `Double` to this `ULong` value.\n * In case when this `ULong` value is exactly between two `Double`s,\n * the one with zero at least significant bit of mantissa is selected.\n */\n @kotlin.internal.InlineOnly\n public inline fun toDouble(): Double = ulongToDouble(data)\n\n public override fun toString(): String = ulongToString(data)\n\n}\n\n/**\n * Converts this [Byte] value to [ULong].\n *\n * If this value is positive, the resulting `ULong` value represents the same numerical value as this `Byte`.\n *\n * The least significant 8 bits of the resulting `ULong` value are the same as the bits of this `Byte` value,\n * whereas the most significant 56 bits are filled with the sign bit of this value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Byte.toULong(): ULong = ULong(this.toLong())\n/**\n * Converts this [Short] value to [ULong].\n *\n * If this value is positive, the resulting `ULong` value represents the same numerical value as this `Short`.\n *\n * The least significant 16 bits of the resulting `ULong` value are the same as the bits of this `Short` value,\n * whereas the most significant 48 bits are filled with the sign bit of this value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Short.toULong(): ULong = ULong(this.toLong())\n/**\n * Converts this [Int] value to [ULong].\n *\n * If this value is positive, the resulting `ULong` value represents the same numerical value as this `Int`.\n *\n * The least significant 32 bits of the resulting `ULong` value are the same as the bits of this `Int` value,\n * whereas the most significant 32 bits are filled with the sign bit of this value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Int.toULong(): ULong = ULong(this.toLong())\n/**\n * Converts this [Long] value to [ULong].\n *\n * If this value is positive, the resulting `ULong` value represents the same numerical value as this `Long`.\n *\n * The resulting `ULong` value has the same binary representation as this `Long` value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Long.toULong(): ULong = ULong(this)\n\n/**\n * Converts this [Float] value to [ULong].\n *\n * The fractional part, if any, is rounded down towards zero.\n * Returns zero if this `Float` value is negative or `NaN`, [ULong.MAX_VALUE] if it's bigger than `ULong.MAX_VALUE`.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Float.toULong(): ULong = doubleToULong(this.toDouble())\n/**\n * Converts this [Double] value to [ULong].\n *\n * The fractional part, if any, is rounded down towards zero.\n * Returns zero if this `Double` value is negative or `NaN`, [ULong.MAX_VALUE] if it's bigger than `ULong.MAX_VALUE`.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun Double.toULong(): ULong = doubleToULong(this)\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.experimental\n\n/** Performs a bitwise AND operation between the two values. */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline infix fun Byte.and(other: Byte): Byte = (this.toInt() and other.toInt()).toByte()\n\n/** Performs a bitwise OR operation between the two values. */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline infix fun Byte.or(other: Byte): Byte = (this.toInt() or other.toInt()).toByte()\n\n/** Performs a bitwise XOR operation between the two values. */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline infix fun Byte.xor(other: Byte): Byte = (this.toInt() xor other.toInt()).toByte()\n\n/** Inverts the bits in this value. */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline fun Byte.inv(): Byte = (this.toInt().inv()).toByte()\n\n\n/** Performs a bitwise AND operation between the two values. */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline infix fun Short.and(other: Short): Short = (this.toInt() and other.toInt()).toShort()\n\n/** Performs a bitwise OR operation between the two values. */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline infix fun Short.or(other: Short): Short = (this.toInt() or other.toInt()).toShort()\n\n/** Performs a bitwise XOR operation between the two values. */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline infix fun Short.xor(other: Short): Short = (this.toInt() xor other.toInt()).toShort()\n\n/** Inverts the bits in this value. */\n@SinceKotlin(\"1.1\")\n@kotlin.internal.InlineOnly\npublic inline fun Short.inv(): Short = (this.toInt().inv()).toShort()\n\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// Auto-generated file. DO NOT EDIT!\n\npackage kotlin.ranges\n\n\n\nimport kotlin.internal.*\n\n/**\n * A range of values of type `UInt`.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic class UIntRange(start: UInt, endInclusive: UInt) : UIntProgression(start, endInclusive, 1), ClosedRange {\n override val start: UInt get() = first\n override val endInclusive: UInt get() = last\n\n override fun contains(value: UInt): Boolean = first <= value && value <= last\n\n override fun isEmpty(): Boolean = first > last\n\n override fun equals(other: Any?): Boolean =\n other is UIntRange && (isEmpty() && other.isEmpty() ||\n first == other.first && last == other.last)\n\n override fun hashCode(): Int =\n if (isEmpty()) -1 else (31 * first.toInt() + last.toInt())\n\n override fun toString(): String = \"$first..$last\"\n\n companion object {\n /** An empty range of values of type UInt. */\n public val EMPTY: UIntRange = UIntRange(UInt.MAX_VALUE, UInt.MIN_VALUE)\n }\n}\n\n/**\n * A progression of values of type `UInt`.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic open class UIntProgression\ninternal constructor(\n start: UInt,\n endInclusive: UInt,\n step: Int\n) : Iterable {\n init {\n if (step == 0.toInt()) throw kotlin.IllegalArgumentException(\"Step must be non-zero.\")\n if (step == Int.MIN_VALUE) throw kotlin.IllegalArgumentException(\"Step must be greater than Int.MIN_VALUE to avoid overflow on negation.\")\n }\n\n /**\n * The first element in the progression.\n */\n public val first: UInt = start\n\n /**\n * The last element in the progression.\n */\n public val last: UInt = getProgressionLastElement(start, endInclusive, step)\n\n /**\n * The step of the progression.\n */\n public val step: Int = step\n\n override fun iterator(): UIntIterator = UIntProgressionIterator(first, last, step)\n\n /** Checks if the progression is empty. */\n public open fun isEmpty(): Boolean = if (step > 0) first > last else first < last\n\n override fun equals(other: Any?): Boolean =\n other is UIntProgression && (isEmpty() && other.isEmpty() ||\n first == other.first && last == other.last && step == other.step)\n\n override fun hashCode(): Int =\n if (isEmpty()) -1 else (31 * (31 * first.toInt() + last.toInt()) + step.toInt())\n\n override fun toString(): String = if (step > 0) \"$first..$last step $step\" else \"$first downTo $last step ${-step}\"\n\n companion object {\n /**\n * Creates UIntProgression within the specified bounds of a closed range.\n\n * The progression starts with the [rangeStart] value and goes toward the [rangeEnd] value not excluding it, with the specified [step].\n * In order to go backwards the [step] must be negative.\n *\n * [step] must be greater than `Int.MIN_VALUE` and not equal to zero.\n */\n public fun fromClosedRange(rangeStart: UInt, rangeEnd: UInt, step: Int): UIntProgression = UIntProgression(rangeStart, rangeEnd, step)\n }\n}\n\n\n/**\n * An iterator over a progression of values of type `UInt`.\n * @property step the number by which the value is incremented on each step.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\nprivate class UIntProgressionIterator(first: UInt, last: UInt, step: Int) : UIntIterator() {\n private val finalElement = last\n private var hasNext: Boolean = if (step > 0) first <= last else first >= last\n private val step = step.toUInt() // use 2-complement math for negative steps\n private var next = if (hasNext) first else finalElement\n\n override fun hasNext(): Boolean = hasNext\n\n override fun nextUInt(): UInt {\n val value = next\n if (value == finalElement) {\n if (!hasNext) throw kotlin.NoSuchElementException()\n hasNext = false\n } else {\n next += step\n }\n return value\n }\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// Auto-generated file. DO NOT EDIT!\n\npackage kotlin.collections\n\n/** An iterator over a sequence of values of type `UByte`. */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic abstract class UByteIterator : Iterator {\n override final fun next() = nextUByte()\n\n /** Returns the next value in the sequence without boxing. */\n public abstract fun nextUByte(): UByte\n}\n\n/** An iterator over a sequence of values of type `UShort`. */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic abstract class UShortIterator : Iterator {\n override final fun next() = nextUShort()\n\n /** Returns the next value in the sequence without boxing. */\n public abstract fun nextUShort(): UShort\n}\n\n/** An iterator over a sequence of values of type `UInt`. */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic abstract class UIntIterator : Iterator {\n override final fun next() = nextUInt()\n\n /** Returns the next value in the sequence without boxing. */\n public abstract fun nextUInt(): UInt\n}\n\n/** An iterator over a sequence of values of type `ULong`. */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic abstract class ULongIterator : Iterator {\n override final fun next() = nextULong()\n\n /** Returns the next value in the sequence without boxing. */\n public abstract fun nextULong(): ULong\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// Auto-generated file. DO NOT EDIT!\n\npackage kotlin.ranges\n\n\n\nimport kotlin.internal.*\n\n/**\n * A range of values of type `ULong`.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic class ULongRange(start: ULong, endInclusive: ULong) : ULongProgression(start, endInclusive, 1), ClosedRange {\n override val start: ULong get() = first\n override val endInclusive: ULong get() = last\n\n override fun contains(value: ULong): Boolean = first <= value && value <= last\n\n override fun isEmpty(): Boolean = first > last\n\n override fun equals(other: Any?): Boolean =\n other is ULongRange && (isEmpty() && other.isEmpty() ||\n first == other.first && last == other.last)\n\n override fun hashCode(): Int =\n if (isEmpty()) -1 else (31 * (first xor (first shr 32)).toInt() + (last xor (last shr 32)).toInt())\n\n override fun toString(): String = \"$first..$last\"\n\n companion object {\n /** An empty range of values of type ULong. */\n public val EMPTY: ULongRange = ULongRange(ULong.MAX_VALUE, ULong.MIN_VALUE)\n }\n}\n\n/**\n * A progression of values of type `ULong`.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic open class ULongProgression\ninternal constructor(\n start: ULong,\n endInclusive: ULong,\n step: Long\n) : Iterable {\n init {\n if (step == 0.toLong()) throw kotlin.IllegalArgumentException(\"Step must be non-zero.\")\n if (step == Long.MIN_VALUE) throw kotlin.IllegalArgumentException(\"Step must be greater than Long.MIN_VALUE to avoid overflow on negation.\")\n }\n\n /**\n * The first element in the progression.\n */\n public val first: ULong = start\n\n /**\n * The last element in the progression.\n */\n public val last: ULong = getProgressionLastElement(start, endInclusive, step)\n\n /**\n * The step of the progression.\n */\n public val step: Long = step\n\n override fun iterator(): ULongIterator = ULongProgressionIterator(first, last, step)\n\n /** Checks if the progression is empty. */\n public open fun isEmpty(): Boolean = if (step > 0) first > last else first < last\n\n override fun equals(other: Any?): Boolean =\n other is ULongProgression && (isEmpty() && other.isEmpty() ||\n first == other.first && last == other.last && step == other.step)\n\n override fun hashCode(): Int =\n if (isEmpty()) -1 else (31 * (31 * (first xor (first shr 32)).toInt() + (last xor (last shr 32)).toInt()) + (step xor (step ushr 32)).toInt())\n\n override fun toString(): String = if (step > 0) \"$first..$last step $step\" else \"$first downTo $last step ${-step}\"\n\n companion object {\n /**\n * Creates ULongProgression within the specified bounds of a closed range.\n\n * The progression starts with the [rangeStart] value and goes toward the [rangeEnd] value not excluding it, with the specified [step].\n * In order to go backwards the [step] must be negative.\n *\n * [step] must be greater than `Long.MIN_VALUE` and not equal to zero.\n */\n public fun fromClosedRange(rangeStart: ULong, rangeEnd: ULong, step: Long): ULongProgression = ULongProgression(rangeStart, rangeEnd, step)\n }\n}\n\n\n/**\n * An iterator over a progression of values of type `ULong`.\n * @property step the number by which the value is incremented on each step.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\nprivate class ULongProgressionIterator(first: ULong, last: ULong, step: Long) : ULongIterator() {\n private val finalElement = last\n private var hasNext: Boolean = if (step > 0) first <= last else first >= last\n private val step = step.toULong() // use 2-complement math for negative steps\n private var next = if (hasNext) first else finalElement\n\n override fun hasNext(): Boolean = hasNext\n\n override fun nextULong(): ULong {\n val value = next\n if (value == finalElement) {\n if (!hasNext) throw kotlin.NoSuchElementException()\n hasNext = false\n } else {\n next += step\n }\n return value\n }\n}\n\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:OptIn(ExperimentalUnsignedTypes::class)\npackage kotlin.internal\n\n// (a - b) mod c\nprivate fun differenceModulo(a: UInt, b: UInt, c: UInt): UInt {\n val ac = a % c\n val bc = b % c\n return if (ac >= bc) ac - bc else ac - bc + c\n}\n\nprivate fun differenceModulo(a: ULong, b: ULong, c: ULong): ULong {\n val ac = a % c\n val bc = b % c\n return if (ac >= bc) ac - bc else ac - bc + c\n}\n\n/**\n * Calculates the final element of a bounded arithmetic progression, i.e. the last element of the progression which is in the range\n * from [start] to [end] in case of a positive [step], or from [end] to [start] in case of a negative\n * [step].\n *\n * No validation on passed parameters is performed. The given parameters should satisfy the condition:\n *\n * - either `step > 0` and `start <= end`,\n * - or `step < 0` and `start >= end`.\n *\n * @param start first element of the progression\n * @param end ending bound for the progression\n * @param step increment, or difference of successive elements in the progression\n * @return the final element of the progression\n * @suppress\n */\n@PublishedApi\n@SinceKotlin(\"1.3\")\ninternal fun getProgressionLastElement(start: UInt, end: UInt, step: Int): UInt = when {\n step > 0 -> if (start >= end) end else end - differenceModulo(end, start, step.toUInt())\n step < 0 -> if (start <= end) end else end + differenceModulo(start, end, (-step).toUInt())\n else -> throw kotlin.IllegalArgumentException(\"Step is zero.\")\n}\n\n/**\n * Calculates the final element of a bounded arithmetic progression, i.e. the last element of the progression which is in the range\n * from [start] to [end] in case of a positive [step], or from [end] to [start] in case of a negative\n * [step].\n *\n * No validation on passed parameters is performed. The given parameters should satisfy the condition:\n *\n * - either `step > 0` and `start <= end`,\n * - or `step < 0` and `start >= end`.\n *\n * @param start first element of the progression\n * @param end ending bound for the progression\n * @param step increment, or difference of successive elements in the progression\n * @return the final element of the progression\n * @suppress\n */\n@PublishedApi\n@SinceKotlin(\"1.3\")\ninternal fun getProgressionLastElement(start: ULong, end: ULong, step: Long): ULong = when {\n step > 0 -> if (start >= end) end else end - differenceModulo(end, start, step.toULong())\n step < 0 -> if (start <= end) end else end + differenceModulo(start, end, (-step).toULong())\n else -> throw kotlin.IllegalArgumentException(\"Step is zero.\")\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmName(\"UStringsKt\") // string representation of unsigned numbers\n\npackage kotlin.text\n\n/**\n * Returns a string representation of this [Byte] value in the specified [radix].\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n//@kotlin.internal.InlineOnly\npublic /*inline*/ fun UByte.toString(radix: Int): String = this.toInt().toString(radix)\n\n/**\n * Returns a string representation of this [Short] value in the specified [radix].\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n//@kotlin.internal.InlineOnly\npublic /*inline*/ fun UShort.toString(radix: Int): String = this.toInt().toString(radix)\n\n\n/**\n * Returns a string representation of this [Int] value in the specified [radix].\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n//@kotlin.internal.InlineOnly\npublic /*inline*/ fun UInt.toString(radix: Int): String = this.toLong().toString(radix)\n\n/**\n * Returns a string representation of this [Long] value in the specified [radix].\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for number to string conversion.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULong.toString(radix: Int): String = ulongToString(this.toLong(), checkRadix(radix))\n\n\n/**\n * Parses the string as a signed [UByte] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toUByte(): UByte = toUByteOrNull() ?: numberFormatError(this)\n\n/**\n * Parses the string as a signed [UByte] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toUByte(radix: Int): UByte = toUByteOrNull(radix) ?: numberFormatError(this)\n\n\n/**\n * Parses the string as a [UShort] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toUShort(): UShort = toUShortOrNull() ?: numberFormatError(this)\n\n/**\n * Parses the string as a [UShort] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toUShort(radix: Int): UShort = toUShortOrNull(radix) ?: numberFormatError(this)\n\n/**\n * Parses the string as an [UInt] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toUInt(): UInt = toUIntOrNull() ?: numberFormatError(this)\n\n/**\n * Parses the string as an [UInt] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toUInt(radix: Int): UInt = toUIntOrNull(radix) ?: numberFormatError(this)\n\n/**\n * Parses the string as a [ULong] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toULong(): ULong = toULongOrNull() ?: numberFormatError(this)\n\n/**\n * Parses the string as a [ULong] number and returns the result.\n * @throws NumberFormatException if the string is not a valid representation of a number.\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toULong(radix: Int): ULong = toULongOrNull(radix) ?: numberFormatError(this)\n\n\n\n\n\n/**\n * Parses the string as an [UByte] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toUByteOrNull(): UByte? = toUByteOrNull(radix = 10)\n\n/**\n * Parses the string as an [UByte] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toUByteOrNull(radix: Int): UByte? {\n val int = this.toUIntOrNull(radix) ?: return null\n if (int > UByte.MAX_VALUE) return null\n return int.toUByte()\n}\n\n/**\n * Parses the string as an [UShort] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toUShortOrNull(): UShort? = toUShortOrNull(radix = 10)\n\n/**\n * Parses the string as an [UShort] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toUShortOrNull(radix: Int): UShort? {\n val int = this.toUIntOrNull(radix) ?: return null\n if (int > UShort.MAX_VALUE) return null\n return int.toUShort()\n}\n\n/**\n * Parses the string as an [UInt] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toUIntOrNull(): UInt? = toUIntOrNull(radix = 10)\n\n/**\n * Parses the string as an [UInt] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toUIntOrNull(radix: Int): UInt? {\n checkRadix(radix)\n\n val length = this.length\n if (length == 0) return null\n\n val limit: UInt = UInt.MAX_VALUE\n val start: Int\n\n val firstChar = this[0]\n if (firstChar < '0') {\n if (length == 1 || firstChar != '+') return null\n start = 1\n } else {\n start = 0\n }\n\n val limitForMaxRadix = 119304647u // limit / 36\n\n var limitBeforeMul = limitForMaxRadix\n val uradix = radix.toUInt()\n var result = 0u\n for (i in start until length) {\n val digit = digitOf(this[i], radix)\n\n if (digit < 0) return null\n if (result > limitBeforeMul) {\n if (limitBeforeMul == limitForMaxRadix) {\n limitBeforeMul = limit / uradix\n\n if (result > limitBeforeMul) {\n return null\n }\n } else {\n return null\n }\n }\n\n result *= uradix\n\n val beforeAdding = result\n result += digit.toUInt()\n if (result < beforeAdding) return null // overflow has happened\n }\n\n return result\n}\n\n/**\n * Parses the string as an [ULong] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toULongOrNull(): ULong? = toULongOrNull(radix = 10)\n\n/**\n * Parses the string as an [ULong] number and returns the result\n * or `null` if the string is not a valid representation of a number.\n *\n * @throws IllegalArgumentException when [radix] is not a valid radix for string to number conversion.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun String.toULongOrNull(radix: Int): ULong? {\n checkRadix(radix)\n\n val length = this.length\n if (length == 0) return null\n\n val limit: ULong = ULong.MAX_VALUE\n val start: Int\n\n val firstChar = this[0]\n if (firstChar < '0') {\n if (length == 1 || firstChar != '+') return null\n start = 1\n } else {\n start = 0\n }\n\n\n val limitForMaxRadix = 512409557603043100uL // limit / 36\n\n var limitBeforeMul = limitForMaxRadix\n val uradix = radix.toULong()\n var result = 0uL\n for (i in start until length) {\n val digit = digitOf(this[i], radix)\n\n if (digit < 0) return null\n if (result > limitBeforeMul) {\n if (limitBeforeMul == limitForMaxRadix) {\n limitBeforeMul = limit / uradix\n\n if (result > limitBeforeMul) {\n return null\n }\n } else {\n return null\n }\n }\n\n result *= uradix\n\n val beforeAdding = result\n result += digit.toUInt()\n if (result < beforeAdding) return null // overflow has happened\n }\n\n return result\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"MapsKt\")\n\npackage kotlin.collections\n\n//\n// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt\n// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib\n//\n\nimport kotlin.random.*\nimport kotlin.ranges.contains\nimport kotlin.ranges.reversed\n\n/**\n * Returns a [List] containing all key-value pairs.\n */\npublic fun Map.toList(): List> {\n if (size == 0)\n return emptyList()\n val iterator = entries.iterator()\n if (!iterator.hasNext())\n return emptyList()\n val first = iterator.next()\n if (!iterator.hasNext())\n return listOf(first.toPair())\n val result = ArrayList>(size)\n result.add(first.toPair())\n do {\n result.add(iterator.next().toPair())\n } while (iterator.hasNext())\n return result\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each entry of original map.\n * \n * @sample samples.collections.Maps.Transformations.flatMap\n */\npublic inline fun Map.flatMap(transform: (Map.Entry) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each entry of original map.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapSequence\")\npublic inline fun Map.flatMap(transform: (Map.Entry) -> Sequence): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each entry of original map, to the given [destination].\n */\npublic inline fun > Map.flatMapTo(destination: C, transform: (Map.Entry) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each entry of original map, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.jvm.JvmName(\"flatMapSequenceTo\")\npublic inline fun > Map.flatMapTo(destination: C, transform: (Map.Entry) -> Sequence): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each entry in the original map.\n * \n * @sample samples.collections.Maps.Transformations.mapToList\n */\npublic inline fun Map.map(transform: (Map.Entry) -> R): List {\n return mapTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing only the non-null results of applying the given [transform] function\n * to each entry in the original map.\n * \n * @sample samples.collections.Maps.Transformations.mapNotNull\n */\npublic inline fun Map.mapNotNull(transform: (Map.Entry) -> R?): List {\n return mapNotNullTo(ArrayList(), transform)\n}\n\n/**\n * Applies the given [transform] function to each entry in the original map\n * and appends only the non-null results to the given [destination].\n */\npublic inline fun > Map.mapNotNullTo(destination: C, transform: (Map.Entry) -> R?): C {\n forEach { element -> transform(element)?.let { destination.add(it) } }\n return destination\n}\n\n/**\n * Applies the given [transform] function to each entry of the original map\n * and appends the results to the given [destination].\n */\npublic inline fun > Map.mapTo(destination: C, transform: (Map.Entry) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Returns `true` if all entries match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\npublic inline fun Map.all(predicate: (Map.Entry) -> Boolean): Boolean {\n if (isEmpty()) return true\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if map has at least one entry.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\npublic fun Map.any(): Boolean {\n return !isEmpty()\n}\n\n/**\n * Returns `true` if at least one entry matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\npublic inline fun Map.any(predicate: (Map.Entry) -> Boolean): Boolean {\n if (isEmpty()) return false\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns the number of entries in this map.\n */\n@kotlin.internal.InlineOnly\npublic inline fun Map.count(): Int {\n return size\n}\n\n/**\n * Returns the number of entries matching the given [predicate].\n */\npublic inline fun Map.count(predicate: (Map.Entry) -> Boolean): Int {\n if (isEmpty()) return 0\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Performs the given [action] on each entry.\n */\n@kotlin.internal.HidesMembers\npublic inline fun Map.forEach(action: (Map.Entry) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun > Map.maxBy(selector: (Map.Entry) -> R): Map.Entry? {\n return maxByOrNull(selector)\n}\n\n/**\n * Returns the first entry yielding the largest value of the given function or `null` if there are no entries.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun > Map.maxByOrNull(selector: (Map.Entry) -> R): Map.Entry? {\n return entries.maxByOrNull(selector)\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each entry in the map.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the map is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Map.maxOf(selector: (Map.Entry) -> Double): Double {\n return entries.maxOf(selector)\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each entry in the map.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the map is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Map.maxOf(selector: (Map.Entry) -> Float): Float {\n return entries.maxOf(selector)\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each entry in the map.\n * \n * @throws NoSuchElementException if the map is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Map.maxOf(selector: (Map.Entry) -> R): R {\n return entries.maxOf(selector)\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each entry in the map or `null` if there are no entries.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Map.maxOfOrNull(selector: (Map.Entry) -> Double): Double? {\n return entries.maxOfOrNull(selector)\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each entry in the map or `null` if there are no entries.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Map.maxOfOrNull(selector: (Map.Entry) -> Float): Float? {\n return entries.maxOfOrNull(selector)\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each entry in the map or `null` if there are no entries.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Map.maxOfOrNull(selector: (Map.Entry) -> R): R? {\n return entries.maxOfOrNull(selector)\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each entry in the map.\n * \n * @throws NoSuchElementException if the map is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Map.maxOfWith(comparator: Comparator, selector: (Map.Entry) -> R): R {\n return entries.maxOfWith(comparator, selector)\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each entry in the map or `null` if there are no entries.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Map.maxOfWithOrNull(comparator: Comparator, selector: (Map.Entry) -> R): R? {\n return entries.maxOfWithOrNull(comparator, selector)\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun Map.maxWith(comparator: Comparator>): Map.Entry? {\n return maxWithOrNull(comparator)\n}\n\n/**\n * Returns the first entry having the largest value according to the provided [comparator] or `null` if there are no entries.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun Map.maxWithOrNull(comparator: Comparator>): Map.Entry? {\n return entries.maxWithOrNull(comparator)\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic inline fun > Map.minBy(selector: (Map.Entry) -> R): Map.Entry? {\n return minByOrNull(selector)\n}\n\n/**\n * Returns the first entry yielding the smallest value of the given function or `null` if there are no entries.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun > Map.minByOrNull(selector: (Map.Entry) -> R): Map.Entry? {\n return entries.minByOrNull(selector)\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each entry in the map.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the map is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Map.minOf(selector: (Map.Entry) -> Double): Double {\n return entries.minOf(selector)\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each entry in the map.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the map is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Map.minOf(selector: (Map.Entry) -> Float): Float {\n return entries.minOf(selector)\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each entry in the map.\n * \n * @throws NoSuchElementException if the map is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Map.minOf(selector: (Map.Entry) -> R): R {\n return entries.minOf(selector)\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each entry in the map or `null` if there are no entries.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Map.minOfOrNull(selector: (Map.Entry) -> Double): Double? {\n return entries.minOfOrNull(selector)\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each entry in the map or `null` if there are no entries.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Map.minOfOrNull(selector: (Map.Entry) -> Float): Float? {\n return entries.minOfOrNull(selector)\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each entry in the map or `null` if there are no entries.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun > Map.minOfOrNull(selector: (Map.Entry) -> R): R? {\n return entries.minOfOrNull(selector)\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each entry in the map.\n * \n * @throws NoSuchElementException if the map is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Map.minOfWith(comparator: Comparator, selector: (Map.Entry) -> R): R {\n return entries.minOfWith(comparator, selector)\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each entry in the map or `null` if there are no entries.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@kotlin.internal.InlineOnly\npublic inline fun Map.minOfWithOrNull(comparator: Comparator, selector: (Map.Entry) -> R): R? {\n return entries.minOfWithOrNull(comparator, selector)\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\npublic fun Map.minWith(comparator: Comparator>): Map.Entry? {\n return minWithOrNull(comparator)\n}\n\n/**\n * Returns the first entry having the smallest value according to the provided [comparator] or `null` if there are no entries.\n */\n@SinceKotlin(\"1.4\")\n@kotlin.internal.InlineOnly\npublic inline fun Map.minWithOrNull(comparator: Comparator>): Map.Entry? {\n return entries.minWithOrNull(comparator)\n}\n\n/**\n * Returns `true` if the map has no entries.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\npublic fun Map.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if no entries match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\npublic inline fun Map.none(predicate: (Map.Entry) -> Boolean): Boolean {\n if (isEmpty()) return true\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Performs the given [action] on each entry and returns the map itself afterwards.\n */\n@SinceKotlin(\"1.1\")\npublic inline fun > M.onEach(action: (Map.Entry) -> Unit): M {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each entry, providing sequential index with the entry,\n * and returns the map itself afterwards.\n * @param [action] function that takes the index of an entry and the entry itself\n * and performs the action on the entry.\n */\n@SinceKotlin(\"1.4\")\npublic inline fun > M.onEachIndexed(action: (index: Int, Map.Entry) -> Unit): M {\n return apply { entries.forEachIndexed(action) }\n}\n\n/**\n * Creates an [Iterable] instance that wraps the original map returning its entries when being iterated.\n */\n@kotlin.internal.InlineOnly\npublic inline fun Map.asIterable(): Iterable> {\n return entries\n}\n\n/**\n * Creates a [Sequence] instance that wraps the original map returning its entries when being iterated.\n */\npublic fun Map.asSequence(): Sequence> {\n return entries.asSequence()\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"SetsKt\")\n\npackage kotlin.collections\n\n//\n// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt\n// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib\n//\n\nimport kotlin.random.*\nimport kotlin.ranges.contains\nimport kotlin.ranges.reversed\n\n/**\n * Returns a set containing all elements of the original set except the given [element].\n * \n * The returned set preserves the element iteration order of the original set.\n */\npublic operator fun Set.minus(element: T): Set {\n val result = LinkedHashSet(mapCapacity(size))\n var removed = false\n return this.filterTo(result) { if (!removed && it == element) { removed = true; false } else true }\n}\n\n/**\n * Returns a set containing all elements of the original set except the elements contained in the given [elements] array.\n * \n * The returned set preserves the element iteration order of the original set.\n * \n * The [elements] array may be converted to a [HashSet] to speed up the operation, thus the elements are required to have\n * a correct and stable implementation of `hashCode()` that doesn't change between successive invocations.\n */\npublic operator fun Set.minus(elements: Array): Set {\n val result = LinkedHashSet(this)\n result.removeAll(elements)\n return result\n}\n\n/**\n * Returns a set containing all elements of the original set except the elements contained in the given [elements] collection.\n * \n * The returned set preserves the element iteration order of the original set.\n * \n * The [elements] collection may be converted to a [HashSet] to speed up the operation, thus the elements are required to have\n * a correct and stable implementation of `hashCode()` that doesn't change between successive invocations.\n */\npublic operator fun Set.minus(elements: Iterable): Set {\n val other = elements.convertToSetForSetOperationWith(this)\n if (other.isEmpty())\n return this.toSet()\n if (other is Set)\n return this.filterNotTo(LinkedHashSet()) { it in other }\n val result = LinkedHashSet(this)\n result.removeAll(other)\n return result\n}\n\n/**\n * Returns a set containing all elements of the original set except the elements contained in the given [elements] sequence.\n * \n * The returned set preserves the element iteration order of the original set.\n * \n * The [elements] sequence may be converted to a [HashSet] to speed up the operation, thus the elements are required to have\n * a correct and stable implementation of `hashCode()` that doesn't change between successive invocations.\n */\npublic operator fun Set.minus(elements: Sequence): Set {\n val result = LinkedHashSet(this)\n result.removeAll(elements)\n return result\n}\n\n/**\n * Returns a set containing all elements of the original set except the given [element].\n * \n * The returned set preserves the element iteration order of the original set.\n */\n@kotlin.internal.InlineOnly\npublic inline fun Set.minusElement(element: T): Set {\n return minus(element)\n}\n\n/**\n * Returns a set containing all elements of the original set and then the given [element] if it isn't already in this set.\n * \n * The returned set preserves the element iteration order of the original set.\n */\npublic operator fun Set.plus(element: T): Set {\n val result = LinkedHashSet(mapCapacity(size + 1))\n result.addAll(this)\n result.add(element)\n return result\n}\n\n/**\n * Returns a set containing all elements of the original set and the given [elements] array,\n * which aren't already in this set.\n * \n * The returned set preserves the element iteration order of the original set.\n */\npublic operator fun Set.plus(elements: Array): Set {\n val result = LinkedHashSet(mapCapacity(this.size + elements.size))\n result.addAll(this)\n result.addAll(elements)\n return result\n}\n\n/**\n * Returns a set containing all elements of the original set and the given [elements] collection,\n * which aren't already in this set.\n * The returned set preserves the element iteration order of the original set.\n */\npublic operator fun Set.plus(elements: Iterable): Set {\n val result = LinkedHashSet(mapCapacity(elements.collectionSizeOrNull()?.let { this.size + it } ?: this.size * 2))\n result.addAll(this)\n result.addAll(elements)\n return result\n}\n\n/**\n * Returns a set containing all elements of the original set and the given [elements] sequence,\n * which aren't already in this set.\n * \n * The returned set preserves the element iteration order of the original set.\n */\npublic operator fun Set.plus(elements: Sequence): Set {\n val result = LinkedHashSet(mapCapacity(this.size * 2))\n result.addAll(this)\n result.addAll(elements)\n return result\n}\n\n/**\n * Returns a set containing all elements of the original set and then the given [element] if it isn't already in this set.\n * \n * The returned set preserves the element iteration order of the original set.\n */\n@kotlin.internal.InlineOnly\npublic inline fun Set.plusElement(element: T): Set {\n return plus(element)\n}\n\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\nimport kotlin.reflect.KClass\n\n@PublishedApi\ninternal fun KClass<*>.findAssociatedObject(@Suppress(\"UNUSED_PARAMETER\") annotationClass: KClass): Any? {\n // This API is not supported in js-v1. Return `null` to be source-compatible with js-ir.\n return null\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.js\n\nimport getKClass\nimport kotlin.reflect.KClass\nimport kotlin.reflect.js.internal.KClassImpl\n\n/**\n * Represents the constructor of a class. Instances of `JsClass` can be passed to JavaScript APIs that expect a constructor reference.\n */\nexternal interface JsClass {\n /**\n * Returns the unqualified name of the class represented by this instance.\n */\n val name: String\n}\n\n/**\n * Obtains a constructor reference for the given `KClass`.\n */\nval KClass.js: JsClass\n get() = (this as KClassImpl).jClass\n\n/**\n * Obtains a `KClass` instance for the given constructor reference.\n */\nval JsClass.kotlin: KClass\n get() = getKClass(this)\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// a package is omitted to get declarations directly under the module\n\n// TODO: Remove once JsReflectionAPICallChecker supports more reflection types\n@file:Suppress(\"Unsupported\")\n\nimport kotlin.reflect.*\nimport kotlin.reflect.js.internal.*\n\n@JsName(\"createKType\")\ninternal fun createKType(\n classifier: KClassifier,\n arguments: Array,\n isMarkedNullable: Boolean\n) =\n KTypeImpl(classifier, arguments.asList(), isMarkedNullable)\n\n@JsName(\"createDynamicKType\")\ninternal fun createDynamicKType(): KType = DynamicKType\n\n@JsName(\"markKTypeNullable\")\ninternal fun markKTypeNullable(kType: KType) = KTypeImpl(kType.classifier!!, kType.arguments, true)\n\n@JsName(\"createKTypeParameter\")\ninternal fun createKTypeParameter(\n name: String,\n upperBounds: Array,\n variance: String\n): KTypeParameter {\n val kVariance = when (variance) {\n \"in\" -> KVariance.IN\n \"out\" -> KVariance.OUT\n else -> KVariance.INVARIANT\n }\n\n return KTypeParameterImpl(name, upperBounds.asList(), kVariance, false)\n}\n\n@JsName(\"getStarKTypeProjection\")\ninternal fun getStarKTypeProjection(): KTypeProjection =\n KTypeProjection.STAR\n\n@JsName(\"createCovariantKTypeProjection\")\ninternal fun createCovariantKTypeProjection(type: KType): KTypeProjection =\n KTypeProjection.covariant(type)\n\n@JsName(\"createInvariantKTypeProjection\")\ninternal fun createInvariantKTypeProjection(type: KType): KTypeProjection =\n KTypeProjection.invariant(type)\n\n@JsName(\"createContravariantKTypeProjection\")\ninternal fun createContravariantKTypeProjection(type: KType): KTypeProjection =\n KTypeProjection.contravariant(type)\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin\n\n/**\n * Returns the detailed description of this throwable with its stack trace.\n *\n * The detailed description includes:\n * - the short description (see [Throwable.toString]) of this throwable;\n * - the complete stack trace;\n * - detailed descriptions of the exceptions that were [suppressed][suppressedExceptions] in order to deliver this exception;\n * - the detailed description of each throwable in the [Throwable.cause] chain.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun Throwable.stackTraceToString(): String = ExceptionTraceBuilder().buildFor(this)\n\n/**\n * Prints the [detailed description][Throwable.stackTraceToString] of this throwable to console error output.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun Throwable.printStackTrace() {\n console.error(this.stackTraceToString())\n}\n\n/**\n * Adds the specified exception to the list of exceptions that were\n * suppressed in order to deliver this exception.\n */\n@SinceKotlin(\"1.4\")\npublic actual fun Throwable.addSuppressed(exception: Throwable) {\n if (this !== exception) {\n val suppressed = this.asDynamic()._suppressed.unsafeCast?>()\n if (suppressed == null) {\n this.asDynamic()._suppressed = mutableListOf(exception)\n } else {\n suppressed.add(exception)\n }\n }\n}\n\n/**\n * Returns a list of all exceptions that were suppressed in order to deliver this exception.\n */\n@SinceKotlin(\"1.4\")\npublic actual val Throwable.suppressedExceptions: List\n get() {\n return this.asDynamic()._suppressed?.unsafeCast>() ?: emptyList()\n }\n\n\nprivate class ExceptionTraceBuilder {\n private val target = StringBuilder()\n private val visited = arrayOf()\n private var topStack: String = \"\"\n private var topStackStart: Int = 0\n\n fun buildFor(exception: Throwable): String {\n exception.dumpFullTrace(\"\", \"\")\n return target.toString()\n }\n\n private fun hasSeen(exception: Throwable): Boolean = visited.any { it === exception }\n\n private fun Throwable.dumpFullTrace(indent: String, qualifier: String) {\n this.dumpSelfTrace(indent, qualifier) || return\n\n var cause = this.cause\n while (cause != null) {\n cause.dumpSelfTrace(indent, \"Caused by: \") || return\n cause = cause.cause\n }\n }\n\n private fun Throwable.dumpSelfTrace(indent: String, qualifier: String): Boolean {\n target.append(indent).append(qualifier)\n val shortInfo = this.toString()\n if (hasSeen(this)) {\n target.append(\"[CIRCULAR REFERENCE, SEE ABOVE: \").append(shortInfo).append(\"]\\n\")\n return false\n }\n visited.asDynamic().push(this)\n\n var stack = this.asDynamic().stack as String?\n if (stack != null) {\n val stackStart = stack.indexOf(shortInfo).let { if (it < 0) 0 else it + shortInfo.length }\n if (stackStart == 0) target.append(shortInfo).append(\"\\n\")\n if (topStack.isEmpty()) {\n topStack = stack\n topStackStart = stackStart\n } else {\n stack = dropCommonFrames(stack, stackStart)\n }\n if (indent.isNotEmpty()) {\n // indent stack, but avoid indenting exception message lines\n val messageLines = if (stackStart == 0) 0 else 1 + shortInfo.count { c -> c == '\\n' }\n stack.lineSequence().forEachIndexed { index: Int, line: String ->\n if (index >= messageLines) target.append(indent)\n target.append(line).append(\"\\n\")\n }\n } else {\n target.append(stack).append(\"\\n\")\n }\n } else {\n target.append(shortInfo).append(\"\\n\")\n }\n\n val suppressed = suppressedExceptions\n if (suppressed.isNotEmpty()) {\n val suppressedIndent = indent + \" \"\n for (s in suppressed) {\n s.dumpFullTrace(suppressedIndent, \"Suppressed: \")\n }\n }\n return true\n }\n\n private fun dropCommonFrames(stack: String, stackStart: Int): String {\n var commonFrames: Int = 0\n var lastBreak: Int = 0\n var preLastBreak: Int = 0\n for (pos in 0 until minOf(topStack.length - topStackStart, stack.length - stackStart)) {\n val c = stack[stack.lastIndex - pos]\n if (c != topStack[topStack.lastIndex - pos]) break\n if (c == '\\n') {\n commonFrames += 1\n preLastBreak = lastBreak\n lastBreak = pos\n }\n }\n if (commonFrames <= 1) return stack\n while (preLastBreak > 0 && stack[stack.lastIndex - (preLastBreak - 1)] == ' ')\n preLastBreak -= 1\n\n // leave 1 common frame to ease matching with the top exception stack\n return stack.dropLast(preLastBreak) + \"... and ${commonFrames - 1} more common stack frames skipped\"\n }\n}","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"MathKt\")\n\n\npackage kotlin.math\n\n\n\n// constants, can't use them from nativeMath as they are not constants there\n\n/** Ratio of the circumference of a circle to its diameter, approximately 3.14159. */\n@SinceKotlin(\"1.2\")\npublic const val PI: Double = 3.141592653589793\n/** Base of the natural logarithms, approximately 2.71828. */\n@SinceKotlin(\"1.2\")\npublic const val E: Double = 2.718281828459045\n\n// region ================ Double Math ========================================\n\n/** Computes the sine of the angle [x] given in radians.\n *\n * Special cases:\n * - `sin(NaN|+Inf|-Inf)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun sin(x: Double): Double\n\n/** Computes the cosine of the angle [x] given in radians.\n *\n * Special cases:\n * - `cos(NaN|+Inf|-Inf)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun cos(x: Double): Double\n\n/** Computes the tangent of the angle [x] given in radians.\n *\n * Special cases:\n * - `tan(NaN|+Inf|-Inf)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun tan(x: Double): Double\n\n/**\n * Computes the arc sine of the value [x];\n * the returned value is an angle in the range from `-PI/2` to `PI/2` radians.\n *\n * Special cases:\n * - `asin(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun asin(x: Double): Double\n\n/**\n * Computes the arc cosine of the value [x];\n * the returned value is an angle in the range from `0.0` to `PI` radians.\n *\n * Special cases:\n * - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun acos(x: Double): Double\n\n/**\n * Computes the arc tangent of the value [x];\n * the returned value is an angle in the range from `-PI/2` to `PI/2` radians.\n *\n * Special cases:\n * - `atan(NaN)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun atan(x: Double): Double\n\n/**\n * Returns the angle `theta` of the polar coordinates `(r, theta)` that correspond\n * to the rectangular coordinates `(x, y)` by computing the arc tangent of the value [y] / [x];\n * the returned value is an angle in the range from `-PI` to `PI` radians.\n *\n * Special cases:\n * - `atan2(0.0, 0.0)` is `0.0`\n * - `atan2(0.0, x)` is `0.0` for `x > 0` and `PI` for `x < 0`\n * - `atan2(-0.0, x)` is `-0.0` for 'x > 0` and `-PI` for `x < 0`\n * - `atan2(y, +Inf)` is `0.0` for `0 < y < +Inf` and `-0.0` for '-Inf < y < 0`\n * - `atan2(y, -Inf)` is `PI` for `0 < y < +Inf` and `-PI` for `-Inf < y < 0`\n * - `atan2(y, 0.0)` is `PI/2` for `y > 0` and `-PI/2` for `y < 0`\n * - `atan2(+Inf, x)` is `PI/2` for finite `x`y\n * - `atan2(-Inf, x)` is `-PI/2` for finite `x`\n * - `atan2(NaN, x)` and `atan2(y, NaN)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun atan2(y: Double, x: Double): Double\n\n/**\n * Computes the hyperbolic sine of the value [x].\n *\n * Special cases:\n * - `sinh(NaN)` is `NaN`\n * - `sinh(+Inf)` is `+Inf`\n * - `sinh(-Inf)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun sinh(x: Double): Double\n\n/**\n * Computes the hyperbolic cosine of the value [x].\n *\n * Special cases:\n * - `cosh(NaN)` is `NaN`\n * - `cosh(+Inf|-Inf)` is `+Inf`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun cosh(x: Double): Double\n\n/**\n * Computes the hyperbolic tangent of the value [x].\n *\n * Special cases:\n * - `tanh(NaN)` is `NaN`\n * - `tanh(+Inf)` is `1.0`\n * - `tanh(-Inf)` is `-1.0`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun tanh(x: Double): Double\n\n/**\n * Computes the inverse hyperbolic sine of the value [x].\n *\n * The returned value is `y` such that `sinh(y) == x`.\n *\n * Special cases:\n * - `asinh(NaN)` is `NaN`\n * - `asinh(+Inf)` is `+Inf`\n * - `asinh(-Inf)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun asinh(x: Double): Double\n\n/**\n * Computes the inverse hyperbolic cosine of the value [x].\n *\n * The returned value is positive `y` such that `cosh(y) == x`.\n *\n * Special cases:\n * - `acosh(NaN)` is `NaN`\n * - `acosh(x)` is `NaN` when `x < 1`\n * - `acosh(+Inf)` is `+Inf`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun acosh(x: Double): Double\n\n/**\n * Computes the inverse hyperbolic tangent of the value [x].\n *\n * The returned value is `y` such that `tanh(y) == x`.\n *\n * Special cases:\n * - `tanh(NaN)` is `NaN`\n * - `tanh(x)` is `NaN` when `x > 1` or `x < -1`\n * - `tanh(1.0)` is `+Inf`\n * - `tanh(-1.0)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun atanh(x: Double): Double\n\n/**\n * Computes `sqrt(x^2 + y^2)` without intermediate overflow or underflow.\n *\n * Special cases:\n * - returns `+Inf` if any of arguments is infinite\n * - returns `NaN` if any of arguments is `NaN` and the other is not infinite\n */\n@SinceKotlin(\"1.2\")\npublic expect fun hypot(x: Double, y: Double): Double\n\n/**\n * Computes the positive square root of the value [x].\n *\n * Special cases:\n * - `sqrt(x)` is `NaN` when `x < 0` or `x` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun sqrt(x: Double): Double\n\n/**\n * Computes Euler's number `e` raised to the power of the value [x].\n *\n * Special cases:\n * - `exp(NaN)` is `NaN`\n * - `exp(+Inf)` is `+Inf`\n * - `exp(-Inf)` is `0.0`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun exp(x: Double): Double\n\n/**\n * Computes `exp(x) - 1`.\n *\n * This function can be implemented to produce more precise result for [x] near zero.\n *\n * Special cases:\n * - `expm1(NaN)` is `NaN`\n * - `expm1(+Inf)` is `+Inf`\n * - `expm1(-Inf)` is `-1.0`\n *\n * @see [exp] function.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun expm1(x: Double): Double\n\n/**\n * Computes the logarithm of the value [x] to the given [base].\n *\n * Special cases:\n * - `log(x, b)` is `NaN` if either `x` or `b` are `NaN`\n * - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0`\n * - `log(+Inf, +Inf)` is `NaN`\n * - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1`\n * - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1`\n *\n * See also logarithm functions for common fixed bases: [ln], [log10] and [log2].\n */\n@SinceKotlin(\"1.2\")\npublic expect fun log(x: Double, base: Double): Double\n\n/**\n * Computes the natural logarithm (base `E`) of the value [x].\n *\n * Special cases:\n * - `ln(NaN)` is `NaN`\n * - `ln(x)` is `NaN` when `x < 0.0`\n * - `ln(+Inf)` is `+Inf`\n * - `ln(0.0)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun ln(x: Double): Double\n\n/**\n * Computes the common logarithm (base 10) of the value [x].\n *\n * @see [ln] function for special cases.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun log10(x: Double): Double\n\n/**\n * Computes the binary logarithm (base 2) of the value [x].\n *\n * @see [ln] function for special cases.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun log2(x: Double): Double\n\n/**\n * Computes `ln(x + 1)`.\n *\n * This function can be implemented to produce more precise result for [x] near zero.\n *\n * Special cases:\n * - `ln1p(NaN)` is `NaN`\n * - `ln1p(x)` is `NaN` where `x < -1.0`\n * - `ln1p(-1.0)` is `-Inf`\n * - `ln1p(+Inf)` is `+Inf`\n *\n * @see [ln] function\n * @see [expm1] function\n */\n@SinceKotlin(\"1.2\")\npublic expect fun ln1p(x: Double): Double\n\n/**\n * Rounds the given value [x] to an integer towards positive infinity.\n\n * @return the smallest double value that is greater than or equal to the given value [x] and is a mathematical integer.\n *\n * Special cases:\n * - `ceil(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun ceil(x: Double): Double\n\n/**\n * Rounds the given value [x] to an integer towards negative infinity.\n\n * @return the largest double value that is smaller than or equal to the given value [x] and is a mathematical integer.\n *\n * Special cases:\n * - `floor(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun floor(x: Double): Double\n\n/**\n * Rounds the given value [x] to an integer towards zero.\n *\n * @return the value [x] having its fractional part truncated.\n *\n * Special cases:\n * - `truncate(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun truncate(x: Double): Double\n\n/**\n * Rounds the given value [x] towards the closest integer with ties rounded towards even integer.\n *\n * Special cases:\n * - `round(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun round(x: Double): Double\n\n/**\n * Returns the absolute value of the given value [x].\n *\n * Special cases:\n * - `abs(NaN)` is `NaN`\n *\n * @see absoluteValue extension property for [Double]\n */\n@SinceKotlin(\"1.2\")\npublic expect fun abs(x: Double): Double\n\n/**\n * Returns the sign of the given value [x]:\n * - `-1.0` if the value is negative,\n * - zero if the value is zero,\n * - `1.0` if the value is positive\n *\n * Special case:\n * - `sign(NaN)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun sign(x: Double): Double\n\n\n/**\n * Returns the smaller of two values.\n *\n * If either value is `NaN`, then the result is `NaN`.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun min(a: Double, b: Double): Double\n\n/**\n * Returns the greater of two values.\n *\n * If either value is `NaN`, then the result is `NaN`.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun max(a: Double, b: Double): Double\n\n// extensions\n\n/**\n * Raises this value to the power [x].\n *\n * Special cases:\n * - `b.pow(0.0)` is `1.0`\n * - `b.pow(1.0) == b`\n * - `b.pow(NaN)` is `NaN`\n * - `NaN.pow(x)` is `NaN` for `x != 0.0`\n * - `b.pow(Inf)` is `NaN` for `abs(b) == 1.0`\n * - `b.pow(x)` is `NaN` for `b < 0` and `x` is finite and not an integer\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Double.pow(x: Double): Double\n\n/**\n * Raises this value to the integer power [n].\n *\n * See the other overload of [pow] for details.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Double.pow(n: Int): Double\n\n/**\n * Returns the absolute value of this value.\n *\n * Special cases:\n * - `NaN.absoluteValue` is `NaN`\n *\n * @see abs function\n */\n@SinceKotlin(\"1.2\")\npublic expect val Double.absoluteValue: Double\n\n/**\n * Returns the sign of this value:\n * - `-1.0` if the value is negative,\n * - zero if the value is zero,\n * - `1.0` if the value is positive\n *\n * Special case:\n * - `NaN.sign` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect val Double.sign: Double\n\n/**\n * Returns this value with the sign bit same as of the [sign] value.\n *\n * If [sign] is `NaN` the sign of the result is undefined.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Double.withSign(sign: Double): Double\n\n/**\n * Returns this value with the sign bit same as of the [sign] value.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Double.withSign(sign: Int): Double\n\n/**\n * Returns the ulp (unit in the last place) of this value.\n *\n * An ulp is a positive distance between this value and the next nearest [Double] value larger in magnitude.\n *\n * Special Cases:\n * - `NaN.ulp` is `NaN`\n * - `x.ulp` is `+Inf` when `x` is `+Inf` or `-Inf`\n * - `0.0.ulp` is `Double.MIN_VALUE`\n */\n@SinceKotlin(\"1.2\")\npublic expect val Double.ulp: Double\n\n/**\n * Returns the [Double] value nearest to this value in direction of positive infinity.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Double.nextUp(): Double\n\n/**\n * Returns the [Double] value nearest to this value in direction of negative infinity.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Double.nextDown(): Double\n\n/**\n * Returns the [Double] value nearest to this value in direction from this value towards the value [to].\n *\n * Special cases:\n * - `x.nextTowards(y)` is `NaN` if either `x` or `y` are `NaN`\n * - `x.nextTowards(x) == x`\n *\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Double.nextTowards(to: Double): Double\n\n/**\n * Rounds this [Double] value to the nearest integer and converts the result to [Int].\n * Ties are rounded towards positive infinity.\n *\n * Special cases:\n * - `x.roundToInt() == Int.MAX_VALUE` when `x > Int.MAX_VALUE`\n * - `x.roundToInt() == Int.MIN_VALUE` when `x < Int.MIN_VALUE`\n *\n * @throws IllegalArgumentException when this value is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Double.roundToInt(): Int\n\n/**\n * Rounds this [Double] value to the nearest integer and converts the result to [Long].\n * Ties are rounded towards positive infinity.\n *\n * Special cases:\n * - `x.roundToLong() == Long.MAX_VALUE` when `x > Long.MAX_VALUE`\n * - `x.roundToLong() == Long.MIN_VALUE` when `x < Long.MIN_VALUE`\n *\n * @throws IllegalArgumentException when this value is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Double.roundToLong(): Long\n\n// endregion\n\n\n\n// region ================ Float Math ========================================\n\n/** Computes the sine of the angle [x] given in radians.\n *\n * Special cases:\n * - `sin(NaN|+Inf|-Inf)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun sin(x: Float): Float\n\n/** Computes the cosine of the angle [x] given in radians.\n *\n * Special cases:\n * - `cos(NaN|+Inf|-Inf)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun cos(x: Float): Float\n\n/** Computes the tangent of the angle [x] given in radians.\n *\n * Special cases:\n * - `tan(NaN|+Inf|-Inf)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun tan(x: Float): Float\n\n/**\n * Computes the arc sine of the value [x];\n * the returned value is an angle in the range from `-PI/2` to `PI/2` radians.\n *\n * Special cases:\n * - `asin(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun asin(x: Float): Float\n\n/**\n * Computes the arc cosine of the value [x];\n * the returned value is an angle in the range from `0.0` to `PI` radians.\n *\n * Special cases:\n * - `acos(x)` is `NaN`, when `abs(x) > 1` or x is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun acos(x: Float): Float\n\n/**\n * Computes the arc tangent of the value [x];\n * the returned value is an angle in the range from `-PI/2` to `PI/2` radians.\n *\n * Special cases:\n * - `atan(NaN)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun atan(x: Float): Float\n\n/**\n * Returns the angle `theta` of the polar coordinates `(r, theta)` that correspond\n * to the rectangular coordinates `(x, y)` by computing the arc tangent of the value [y] / [x];\n * the returned value is an angle in the range from `-PI` to `PI` radians.\n *\n * Special cases:\n * - `atan2(0.0, 0.0)` is `0.0`\n * - `atan2(0.0, x)` is `0.0` for `x > 0` and `PI` for `x < 0`\n * - `atan2(-0.0, x)` is `-0.0` for 'x > 0` and `-PI` for `x < 0`\n * - `atan2(y, +Inf)` is `0.0` for `0 < y < +Inf` and `-0.0` for '-Inf < y < 0`\n * - `atan2(y, -Inf)` is `PI` for `0 < y < +Inf` and `-PI` for `-Inf < y < 0`\n * - `atan2(y, 0.0)` is `PI/2` for `y > 0` and `-PI/2` for `y < 0`\n * - `atan2(+Inf, x)` is `PI/2` for finite `x`y\n * - `atan2(-Inf, x)` is `-PI/2` for finite `x`\n * - `atan2(NaN, x)` and `atan2(y, NaN)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun atan2(y: Float, x: Float): Float\n\n/**\n * Computes the hyperbolic sine of the value [x].\n *\n * Special cases:\n * - `sinh(NaN)` is `NaN`\n * - `sinh(+Inf)` is `+Inf`\n * - `sinh(-Inf)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun sinh(x: Float): Float\n\n/**\n * Computes the hyperbolic cosine of the value [x].\n *\n * Special cases:\n * - `cosh(NaN)` is `NaN`\n * - `cosh(+Inf|-Inf)` is `+Inf`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun cosh(x: Float): Float\n\n/**\n * Computes the hyperbolic tangent of the value [x].\n *\n * Special cases:\n * - `tanh(NaN)` is `NaN`\n * - `tanh(+Inf)` is `1.0`\n * - `tanh(-Inf)` is `-1.0`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun tanh(x: Float): Float\n\n/**\n * Computes the inverse hyperbolic sine of the value [x].\n *\n * The returned value is `y` such that `sinh(y) == x`.\n *\n * Special cases:\n * - `asinh(NaN)` is `NaN`\n * - `asinh(+Inf)` is `+Inf`\n * - `asinh(-Inf)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun asinh(x: Float): Float\n\n/**\n * Computes the inverse hyperbolic cosine of the value [x].\n *\n * The returned value is positive `y` such that `cosh(y) == x`.\n *\n * Special cases:\n * - `acosh(NaN)` is `NaN`\n * - `acosh(x)` is `NaN` when `x < 1`\n * - `acosh(+Inf)` is `+Inf`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun acosh(x: Float): Float\n\n/**\n * Computes the inverse hyperbolic tangent of the value [x].\n *\n * The returned value is `y` such that `tanh(y) == x`.\n *\n * Special cases:\n * - `tanh(NaN)` is `NaN`\n * - `tanh(x)` is `NaN` when `x > 1` or `x < -1`\n * - `tanh(1.0)` is `+Inf`\n * - `tanh(-1.0)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun atanh(x: Float): Float\n\n/**\n * Computes `sqrt(x^2 + y^2)` without intermediate overflow or underflow.\n *\n * Special cases:\n * - returns `+Inf` if any of arguments is infinite\n * - returns `NaN` if any of arguments is `NaN` and the other is not infinite\n */\n@SinceKotlin(\"1.2\")\npublic expect fun hypot(x: Float, y: Float): Float\n\n/**\n * Computes the positive square root of the value [x].\n *\n * Special cases:\n * - `sqrt(x)` is `NaN` when `x < 0` or `x` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun sqrt(x: Float): Float\n\n/**\n * Computes Euler's number `e` raised to the power of the value [x].\n *\n * Special cases:\n * - `exp(NaN)` is `NaN`\n * - `exp(+Inf)` is `+Inf`\n * - `exp(-Inf)` is `0.0`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun exp(x: Float): Float\n\n/**\n * Computes `exp(x) - 1`.\n *\n * This function can be implemented to produce more precise result for [x] near zero.\n *\n * Special cases:\n * - `expm1(NaN)` is `NaN`\n * - `expm1(+Inf)` is `+Inf`\n * - `expm1(-Inf)` is `-1.0`\n *\n * @see [exp] function.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun expm1(x: Float): Float\n\n/**\n * Computes the logarithm of the value [x] to the given [base].\n *\n * Special cases:\n * - `log(x, b)` is `NaN` if either `x` or `b` are `NaN`\n * - `log(x, b)` is `NaN` when `x < 0` or `b <= 0` or `b == 1.0`\n * - `log(+Inf, +Inf)` is `NaN`\n * - `log(+Inf, b)` is `+Inf` for `b > 1` and `-Inf` for `b < 1`\n * - `log(0.0, b)` is `-Inf` for `b > 1` and `+Inf` for `b > 1`\n *\n * See also logarithm functions for common fixed bases: [ln], [log10] and [log2].\n */\n@SinceKotlin(\"1.2\")\npublic expect fun log(x: Float, base: Float): Float\n\n/**\n * Computes the natural logarithm (base `E`) of the value [x].\n *\n * Special cases:\n * - `ln(NaN)` is `NaN`\n * - `ln(x)` is `NaN` when `x < 0.0`\n * - `ln(+Inf)` is `+Inf`\n * - `ln(0.0)` is `-Inf`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun ln(x: Float): Float\n\n/**\n * Computes the common logarithm (base 10) of the value [x].\n *\n * @see [ln] function for special cases.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun log10(x: Float): Float\n\n/**\n * Computes the binary logarithm (base 2) of the value [x].\n *\n * @see [ln] function for special cases.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun log2(x: Float): Float\n\n/**\n * Computes `ln(a + 1)`.\n *\n * This function can be implemented to produce more precise result for [x] near zero.\n *\n * Special cases:\n * - `ln1p(NaN)` is `NaN`\n * - `ln1p(x)` is `NaN` where `x < -1.0`\n * - `ln1p(-1.0)` is `-Inf`\n * - `ln1p(+Inf)` is `+Inf`\n *\n * @see [ln] function\n * @see [expm1] function\n */\n@SinceKotlin(\"1.2\")\npublic expect fun ln1p(x: Float): Float\n\n/**\n * Rounds the given value [x] to an integer towards positive infinity.\n\n * @return the smallest Float value that is greater than or equal to the given value [x] and is a mathematical integer.\n *\n * Special cases:\n * - `ceil(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun ceil(x: Float): Float\n\n/**\n * Rounds the given value [x] to an integer towards negative infinity.\n\n * @return the largest Float value that is smaller than or equal to the given value [x] and is a mathematical integer.\n *\n * Special cases:\n * - `floor(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun floor(x: Float): Float\n\n/**\n * Rounds the given value [x] to an integer towards zero.\n *\n * @return the value [x] having its fractional part truncated.\n *\n * Special cases:\n * - `truncate(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun truncate(x: Float): Float\n\n/**\n * Rounds the given value [x] towards the closest integer with ties rounded towards even integer.\n *\n * Special cases:\n * - `round(x)` is `x` where `x` is `NaN` or `+Inf` or `-Inf` or already a mathematical integer.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun round(x: Float): Float\n\n\n/**\n * Returns the absolute value of the given value [x].\n *\n * Special cases:\n * - `abs(NaN)` is `NaN`\n *\n * @see absoluteValue extension property for [Float]\n */\n@SinceKotlin(\"1.2\")\npublic expect fun abs(x: Float): Float\n\n/**\n * Returns the sign of the given value [x]:\n * - `-1.0` if the value is negative,\n * - zero if the value is zero,\n * - `1.0` if the value is positive\n *\n * Special case:\n * - `sign(NaN)` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun sign(x: Float): Float\n\n\n\n/**\n * Returns the smaller of two values.\n *\n * If either value is `NaN`, then the result is `NaN`.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun min(a: Float, b: Float): Float\n\n/**\n * Returns the greater of two values.\n *\n * If either value is `NaN`, then the result is `NaN`.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun max(a: Float, b: Float): Float\n\n// extensions\n\n\n/**\n * Raises this value to the power [x].\n *\n * Special cases:\n * - `b.pow(0.0)` is `1.0`\n * - `b.pow(1.0) == b`\n * - `b.pow(NaN)` is `NaN`\n * - `NaN.pow(x)` is `NaN` for `x != 0.0`\n * - `b.pow(Inf)` is `NaN` for `abs(b) == 1.0`\n * - `b.pow(x)` is `NaN` for `b < 0` and `x` is finite and not an integer\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Float.pow(x: Float): Float\n\n/**\n * Raises this value to the integer power [n].\n *\n * See the other overload of [pow] for details.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Float.pow(n: Int): Float\n\n/**\n * Returns the absolute value of this value.\n *\n * Special cases:\n * - `NaN.absoluteValue` is `NaN`\n *\n * @see abs function\n */\n@SinceKotlin(\"1.2\")\npublic expect val Float.absoluteValue: Float\n\n/**\n * Returns the sign of this value:\n * - `-1.0` if the value is negative,\n * - zero if the value is zero,\n * - `1.0` if the value is positive\n *\n * Special case:\n * - `NaN.sign` is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect val Float.sign: Float\n\n/**\n * Returns this value with the sign bit same as of the [sign] value.\n *\n * If [sign] is `NaN` the sign of the result is undefined.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Float.withSign(sign: Float): Float\n\n/**\n * Returns this value with the sign bit same as of the [sign] value.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Float.withSign(sign: Int): Float\n\n\n/**\n * Rounds this [Float] value to the nearest integer and converts the result to [Int].\n * Ties are rounded towards positive infinity.\n *\n * Special cases:\n * - `x.roundToInt() == Int.MAX_VALUE` when `x > Int.MAX_VALUE`\n * - `x.roundToInt() == Int.MIN_VALUE` when `x < Int.MIN_VALUE`\n *\n * @throws IllegalArgumentException when this value is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Float.roundToInt(): Int\n\n/**\n * Rounds this [Float] value to the nearest integer and converts the result to [Long].\n * Ties are rounded towards positive infinity.\n *\n * Special cases:\n * - `x.roundToLong() == Long.MAX_VALUE` when `x > Long.MAX_VALUE`\n * - `x.roundToLong() == Long.MIN_VALUE` when `x < Long.MIN_VALUE`\n *\n * @throws IllegalArgumentException when this value is `NaN`\n */\n@SinceKotlin(\"1.2\")\npublic expect fun Float.roundToLong(): Long\n\n\n// endregion\n\n// region ================ Integer Math ========================================\n\n\n/**\n * Returns the absolute value of the given value [n].\n *\n * Special cases:\n * - `abs(Int.MIN_VALUE)` is `Int.MIN_VALUE` due to an overflow\n *\n * @see absoluteValue extension property for [Int]\n */\n@SinceKotlin(\"1.2\")\npublic expect fun abs(n: Int): Int\n\n/**\n * Returns the smaller of two values.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun min(a: Int, b: Int): Int\n\n/**\n * Returns the greater of two values.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun max(a: Int, b: Int): Int\n\n/**\n * Returns the absolute value of this value.\n *\n * Special cases:\n * - `Int.MIN_VALUE.absoluteValue` is `Int.MIN_VALUE` due to an overflow\n *\n * @see abs function\n */\n@SinceKotlin(\"1.2\")\npublic expect val Int.absoluteValue: Int\n\n/**\n * Returns the sign of this value:\n * - `-1` if the value is negative,\n * - `0` if the value is zero,\n * - `1` if the value is positive\n */\n@SinceKotlin(\"1.2\")\npublic expect val Int.sign: Int\n\n\n\n/**\n * Returns the absolute value of the given value [n].\n *\n * Special cases:\n * - `abs(Long.MIN_VALUE)` is `Long.MIN_VALUE` due to an overflow\n *\n * @see absoluteValue extension property for [Long]\n */\n@SinceKotlin(\"1.2\")\npublic expect fun abs(n: Long): Long\n\n/**\n * Returns the smaller of two values.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun min(a: Long, b: Long): Long\n\n/**\n * Returns the greater of two values.\n */\n@SinceKotlin(\"1.2\")\npublic expect fun max(a: Long, b: Long): Long\n\n/**\n * Returns the absolute value of this value.\n *\n * Special cases:\n * - `Long.MIN_VALUE.absoluteValue` is `Long.MIN_VALUE` due to an overflow\n *\n * @see abs function\n */\n@SinceKotlin(\"1.2\")\npublic expect val Long.absoluteValue: Long\n\n/**\n * Returns the sign of this value:\n * - `-1` if the value is negative,\n * - `0` if the value is zero,\n * - `1` if the value is positive\n */\n@SinceKotlin(\"1.2\")\npublic expect val Long.sign: Int\n\n\n// endregion\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.coroutines.js.internal\n\nimport kotlin.coroutines.Continuation\nimport kotlin.coroutines.EmptyCoroutineContext\n\n@PublishedApi\n@SinceKotlin(\"1.3\")\ninternal val EmptyContinuation = Continuation(EmptyCoroutineContext) { result ->\n result.getOrThrow()\n}","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin\n\nimport kotlin.coroutines.*\nimport kotlin.coroutines.intrinsics.*\n\n/**\n * Defines deep recursive function that keeps its stack on the heap,\n * which allows very deep recursive computations that do not use the actual call stack.\n * To initiate a call to this deep recursive function use its [invoke] function.\n * As a rule of thumb, it should be used if recursion goes deeper than a thousand calls.\n *\n * The [DeepRecursiveFunction] takes one parameter of type [T] and returns a result of type [R].\n * The [block] of code defines the body of a recursive function. In this block\n * [callRecursive][DeepRecursiveScope.callRecursive] function can be used to make a recursive call\n * to the declared function. Other instances of [DeepRecursiveFunction] can be called\n * in this scope with `callRecursive` extension, too.\n *\n * For example, take a look at the following recursive tree class and a deeply\n * recursive instance of this tree with 100K nodes:\n *\n * ```\n * class Tree(val left: Tree? = null, val right: Tree? = null)\n * val deepTree = generateSequence(Tree()) { Tree(it) }.take(100_000).last()\n * ```\n *\n * A regular recursive function can be defined to compute a depth of a tree:\n *\n * ```\n * fun depth(t: Tree?): Int =\n * if (t == null) 0 else max(depth(t.left), depth(t.right)) + 1\n * println(depth(deepTree)) // StackOverflowError\n * ```\n *\n * If this `depth` function is called for a `deepTree` it produces [StackOverflowError] because of deep recursion.\n * However, the `depth` function can be rewritten using `DeepRecursiveFunction` in the following way, and then\n * it successfully computes [`depth(deepTree)`][DeepRecursiveFunction.invoke] expression:\n *\n * ```\n * val depth = DeepRecursiveFunction { t ->\n * if (t == null) 0 else max(callRecursive(t.left), callRecursive(t.right)) + 1\n * }\n * println(depth(deepTree)) // Ok\n * ```\n *\n * Deep recursive functions can also mutually call each other using a heap for the stack via\n * [callRecursive][DeepRecursiveScope.callRecursive] extension. For example, the\n * following pair of mutually recursive functions computes the number of tree nodes at even depth in the tree.\n *\n * ```\n * val mutualRecursion = object {\n * val even: DeepRecursiveFunction = DeepRecursiveFunction { t ->\n * if (t == null) 0 else odd.callRecursive(t.left) + odd.callRecursive(t.right) + 1\n * }\n * val odd: DeepRecursiveFunction = DeepRecursiveFunction { t ->\n * if (t == null) 0 else even.callRecursive(t.left) + even.callRecursive(t.right)\n * }\n * }\n * ```\n *\n * @param [T] the function parameter type.\n * @param [R] the function result type.\n * @param block the function body.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\npublic class DeepRecursiveFunction(\n internal val block: suspend DeepRecursiveScope.(T) -> R\n)\n\n/**\n * Initiates a call to this deep recursive function, forming a root of the call tree.\n *\n * This operator should not be used from inside of [DeepRecursiveScope] as it uses the call stack slot for\n * initial recursive invocation. From inside of [DeepRecursiveScope] use\n * [callRecursive][DeepRecursiveScope.callRecursive].\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\npublic operator fun DeepRecursiveFunction.invoke(value: T): R =\n DeepRecursiveScopeImpl(block, value).runCallLoop()\n\n/**\n * A scope class for [DeepRecursiveFunction] function declaration that defines [callRecursive] methods to\n * recursively call this function or another [DeepRecursiveFunction] putting the call activation frame on the heap.\n *\n * @param [T] function parameter type.\n * @param [R] function result type.\n */\n@RestrictsSuspension\n@SinceKotlin(\"1.4\")\n@ExperimentalStdlibApi\npublic sealed class DeepRecursiveScope {\n /**\n * Makes recursive call to this [DeepRecursiveFunction] function putting the call activation frame on the heap,\n * as opposed to the actual call stack that is used by a regular recursive call.\n */\n public abstract suspend fun callRecursive(value: T): R\n\n /**\n * Makes call to the specified [DeepRecursiveFunction] function putting the call activation frame on the heap,\n * as opposed to the actual call stack that is used by a regular call.\n */\n public abstract suspend fun DeepRecursiveFunction.callRecursive(value: U): S\n\n @Deprecated(\n level = DeprecationLevel.ERROR,\n message =\n \"'invoke' should not be called from DeepRecursiveScope. \" +\n \"Use 'callRecursive' to do recursion in the heap instead of the call stack.\",\n replaceWith = ReplaceWith(\"this.callRecursive(value)\")\n )\n @Suppress(\"UNUSED_PARAMETER\")\n public operator fun DeepRecursiveFunction<*, *>.invoke(value: Any?): Nothing =\n throw UnsupportedOperationException(\"Should not be called from DeepRecursiveScope\")\n}\n\n// ================== Implementation ==================\n\n@ExperimentalStdlibApi\nprivate typealias DeepRecursiveFunctionBlock = suspend DeepRecursiveScope<*, *>.(Any?) -> Any?\n\nprivate val UNDEFINED_RESULT = Result.success(COROUTINE_SUSPENDED)\n\n@Suppress(\"UNCHECKED_CAST\")\n@ExperimentalStdlibApi\nprivate class DeepRecursiveScopeImpl(\n block: suspend DeepRecursiveScope.(T) -> R,\n value: T\n) : DeepRecursiveScope(), Continuation {\n // Active function block\n private var function: DeepRecursiveFunctionBlock = block as DeepRecursiveFunctionBlock\n\n // Value to call function with\n private var value: Any? = value\n\n // Continuation of the current call\n private var cont: Continuation? = this as Continuation\n\n // Completion result (completion of the whole call stack)\n private var result: Result = UNDEFINED_RESULT\n\n override val context: CoroutineContext\n get() = EmptyCoroutineContext\n\n override fun resumeWith(result: Result) {\n this.cont = null\n this.result = result\n }\n\n override suspend fun callRecursive(value: T): R = suspendCoroutineUninterceptedOrReturn { cont ->\n // calling the same function that is currently active\n this.cont = cont as Continuation\n this.value = value\n COROUTINE_SUSPENDED\n }\n\n override suspend fun DeepRecursiveFunction.callRecursive(value: U): S = suspendCoroutineUninterceptedOrReturn { cont ->\n // calling another recursive function\n val function = block as DeepRecursiveFunctionBlock\n with(this@DeepRecursiveScopeImpl) {\n val currentFunction = this.function\n if (function !== currentFunction) {\n // calling a different function -- create a trampoline to restore function ref\n this.function = function\n this.cont = crossFunctionCompletion(currentFunction, cont as Continuation)\n } else {\n // calling the same function -- direct\n this.cont = cont as Continuation\n }\n this.value = value\n }\n COROUTINE_SUSPENDED\n }\n\n private fun crossFunctionCompletion(\n currentFunction: DeepRecursiveFunctionBlock,\n cont: Continuation\n ): Continuation = Continuation(EmptyCoroutineContext) {\n this.function = currentFunction\n // When going back from a trampoline we cannot just call cont.resume (stack usage!)\n // We delegate the cont.resumeWith(it) call to runCallLoop\n this.cont = cont\n this.result = it\n }\n\n @Suppress(\"UNCHECKED_CAST\")\n fun runCallLoop(): R {\n while (true) {\n // Note: cont is set to null in DeepRecursiveScopeImpl.resumeWith when the whole computation completes\n val result = this.result\n val cont = this.cont\n ?: return (result as Result).getOrThrow() // done -- final result\n // The order of comparison is important here for that case of rogue class with broken equals\n if (UNDEFINED_RESULT == result) {\n // call \"function\" with \"value\" using \"cont\" as completion\n val r = try {\n // This is block.startCoroutine(this, value, cont)\n function.startCoroutineUninterceptedOrReturn(this, value, cont)\n } catch (e: Throwable) {\n cont.resumeWithException(e)\n continue\n }\n // If the function returns without suspension -- calls its continuation immediately\n if (r !== COROUTINE_SUSPENDED)\n cont.resume(r as R)\n } else {\n // we returned from a crossFunctionCompletion trampoline -- call resume here\n this.result = UNDEFINED_RESULT // reset result back\n cont.resumeWith(result)\n }\n }\n }\n}\n","/*! safe-buffer. MIT License. Feross Aboukhadijeh */\n/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.prototype = Object.create(Buffer.prototype)\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react.production.min.js');\n} else {\n module.exports = require('./cjs/react.development.js');\n}\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = require('buffer').Buffer;\n }\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [ number & 0x3ffffff ];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [ 0 ];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this.strip();\n };\n\n function parseHex4Bits (string, index) {\n var c = string.charCodeAt(index);\n // 'A' - 'F'\n if (c >= 65 && c <= 70) {\n return c - 55;\n // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n // '0' - '9'\n } else {\n return (c - 48) & 0xf;\n }\n }\n\n function parseHexByte (string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start, endian) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n // 24-bits chunks\n var off = 0;\n var j = 0;\n\n var w;\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n\n this.strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n r += c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n r += c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n r += c;\n }\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [ 0 ];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n this.strip();\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype.strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n BN.prototype.inspect = function inspect () {\n return (this.red ? '';\n };\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16);\n };\n\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n assert(typeof Buffer !== 'undefined');\n return this.toArrayLike(Buffer, endian, length);\n };\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n this.strip();\n var littleEndian = endian === 'le';\n var res = new ArrayType(reqLength);\n\n var b, i;\n var q = this.clone();\n if (!littleEndian) {\n // Assume big-endian\n for (i = 0; i < reqLength - byteLength; i++) {\n res[i] = 0;\n }\n\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(0xff);\n q.iushrn(8);\n\n res[reqLength - i - 1] = b;\n }\n } else {\n for (i = 0; !q.isZero(); i++) {\n b = q.andln(0xff);\n q.iushrn(8);\n\n res[i] = b;\n }\n\n for (; i < reqLength; i++) {\n res[i] = 0;\n }\n }\n\n return res;\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] & (1 << wbit)) >>> wbit;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this.strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this.strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this.strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this.strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this.strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this.strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out.strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out.strip();\n }\n\n function jumboMulTo (self, num, out) {\n var fftm = new FFTM();\n return fftm.mulp(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out.strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this.strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this.strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this.strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) < num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this.strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this.strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this.strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q.strip();\n }\n a.strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || r2 === 1 && cmp === 0) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modn = function modn (num) {\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return acc;\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n return this.strip();\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this.strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is BN v4 instance\n r.strip();\n } else {\n // r is BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n return a.umod(this.m)._forceRed(this);\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})(typeof module === 'undefined' || module, this);\n","/*!\n * The buffer module from node.js, for the browser.\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n/* eslint-disable no-proto */\n\n'use strict'\n\nvar base64 = require('base64-js')\nvar ieee754 = require('ieee754')\nvar isArray = require('isarray')\n\nexports.Buffer = Buffer\nexports.SlowBuffer = SlowBuffer\nexports.INSPECT_MAX_BYTES = 50\n\n/**\n * If `Buffer.TYPED_ARRAY_SUPPORT`:\n * === true Use Uint8Array implementation (fastest)\n * === false Use Object implementation (most compatible, even IE6)\n *\n * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,\n * Opera 11.6+, iOS 4.2+.\n *\n * Due to various browser bugs, sometimes the Object implementation will be used even\n * when the browser supports typed arrays.\n *\n * Note:\n *\n * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,\n * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.\n *\n * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.\n *\n * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of\n * incorrect length in some situations.\n\n * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they\n * get the Object implementation, which is slower but behaves correctly.\n */\nBuffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined\n ? global.TYPED_ARRAY_SUPPORT\n : typedArraySupport()\n\n/*\n * Export kMaxLength after typed array support is determined.\n */\nexports.kMaxLength = kMaxLength()\n\nfunction typedArraySupport () {\n try {\n var arr = new Uint8Array(1)\n arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}\n return arr.foo() === 42 && // typed array instances can be augmented\n typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`\n arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`\n } catch (e) {\n return false\n }\n}\n\nfunction kMaxLength () {\n return Buffer.TYPED_ARRAY_SUPPORT\n ? 0x7fffffff\n : 0x3fffffff\n}\n\nfunction createBuffer (that, length) {\n if (kMaxLength() < length) {\n throw new RangeError('Invalid typed array length')\n }\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = new Uint8Array(length)\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n if (that === null) {\n that = new Buffer(length)\n }\n that.length = length\n }\n\n return that\n}\n\n/**\n * The Buffer constructor returns instances of `Uint8Array` that have their\n * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of\n * `Uint8Array`, so the returned instances will have all the node `Buffer` methods\n * and the `Uint8Array` methods. Square bracket notation works as expected -- it\n * returns a single octet.\n *\n * The `Uint8Array` prototype remains unmodified.\n */\n\nfunction Buffer (arg, encodingOrOffset, length) {\n if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {\n return new Buffer(arg, encodingOrOffset, length)\n }\n\n // Common case.\n if (typeof arg === 'number') {\n if (typeof encodingOrOffset === 'string') {\n throw new Error(\n 'If encoding is specified then the first argument must be a string'\n )\n }\n return allocUnsafe(this, arg)\n }\n return from(this, arg, encodingOrOffset, length)\n}\n\nBuffer.poolSize = 8192 // not used by this implementation\n\n// TODO: Legacy, not needed anymore. Remove in next major version.\nBuffer._augment = function (arr) {\n arr.__proto__ = Buffer.prototype\n return arr\n}\n\nfunction from (that, value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {\n return fromArrayBuffer(that, value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(that, value, encodingOrOffset)\n }\n\n return fromObject(that, value)\n}\n\n/**\n * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError\n * if value is a number.\n * Buffer.from(str[, encoding])\n * Buffer.from(array)\n * Buffer.from(buffer)\n * Buffer.from(arrayBuffer[, byteOffset[, length]])\n **/\nBuffer.from = function (value, encodingOrOffset, length) {\n return from(null, value, encodingOrOffset, length)\n}\n\nif (Buffer.TYPED_ARRAY_SUPPORT) {\n Buffer.prototype.__proto__ = Uint8Array.prototype\n Buffer.__proto__ = Uint8Array\n if (typeof Symbol !== 'undefined' && Symbol.species &&\n Buffer[Symbol.species] === Buffer) {\n // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97\n Object.defineProperty(Buffer, Symbol.species, {\n value: null,\n configurable: true\n })\n }\n}\n\nfunction assertSize (size) {\n if (typeof size !== 'number') {\n throw new TypeError('\"size\" argument must be a number')\n } else if (size < 0) {\n throw new RangeError('\"size\" argument must not be negative')\n }\n}\n\nfunction alloc (that, size, fill, encoding) {\n assertSize(size)\n if (size <= 0) {\n return createBuffer(that, size)\n }\n if (fill !== undefined) {\n // Only pay attention to encoding if it's a string. This\n // prevents accidentally sending in a number that would\n // be interpretted as a start offset.\n return typeof encoding === 'string'\n ? createBuffer(that, size).fill(fill, encoding)\n : createBuffer(that, size).fill(fill)\n }\n return createBuffer(that, size)\n}\n\n/**\n * Creates a new filled Buffer instance.\n * alloc(size[, fill[, encoding]])\n **/\nBuffer.alloc = function (size, fill, encoding) {\n return alloc(null, size, fill, encoding)\n}\n\nfunction allocUnsafe (that, size) {\n assertSize(size)\n that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) {\n for (var i = 0; i < size; ++i) {\n that[i] = 0\n }\n }\n return that\n}\n\n/**\n * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.\n * */\nBuffer.allocUnsafe = function (size) {\n return allocUnsafe(null, size)\n}\n/**\n * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.\n */\nBuffer.allocUnsafeSlow = function (size) {\n return allocUnsafe(null, size)\n}\n\nfunction fromString (that, string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n var length = byteLength(string, encoding) | 0\n that = createBuffer(that, length)\n\n var actual = that.write(string, encoding)\n\n if (actual !== length) {\n // Writing a hex string, for example, that contains invalid characters will\n // cause everything after the first invalid character to be ignored. (e.g.\n // 'abxxcd' will be treated as 'ab')\n that = that.slice(0, actual)\n }\n\n return that\n}\n\nfunction fromArrayLike (that, array) {\n var length = array.length < 0 ? 0 : checked(array.length) | 0\n that = createBuffer(that, length)\n for (var i = 0; i < length; i += 1) {\n that[i] = array[i] & 255\n }\n return that\n}\n\nfunction fromArrayBuffer (that, array, byteOffset, length) {\n array.byteLength // this throws if `array` is not a valid ArrayBuffer\n\n if (byteOffset < 0 || array.byteLength < byteOffset) {\n throw new RangeError('\\'offset\\' is out of bounds')\n }\n\n if (array.byteLength < byteOffset + (length || 0)) {\n throw new RangeError('\\'length\\' is out of bounds')\n }\n\n if (byteOffset === undefined && length === undefined) {\n array = new Uint8Array(array)\n } else if (length === undefined) {\n array = new Uint8Array(array, byteOffset)\n } else {\n array = new Uint8Array(array, byteOffset, length)\n }\n\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n // Return an augmented `Uint8Array` instance, for best performance\n that = array\n that.__proto__ = Buffer.prototype\n } else {\n // Fallback: Return an object instance of the Buffer class\n that = fromArrayLike(that, array)\n }\n return that\n}\n\nfunction fromObject (that, obj) {\n if (Buffer.isBuffer(obj)) {\n var len = checked(obj.length) | 0\n that = createBuffer(that, len)\n\n if (that.length === 0) {\n return that\n }\n\n obj.copy(that, 0, 0, len)\n return that\n }\n\n if (obj) {\n if ((typeof ArrayBuffer !== 'undefined' &&\n obj.buffer instanceof ArrayBuffer) || 'length' in obj) {\n if (typeof obj.length !== 'number' || isnan(obj.length)) {\n return createBuffer(that, 0)\n }\n return fromArrayLike(that, obj)\n }\n\n if (obj.type === 'Buffer' && isArray(obj.data)) {\n return fromArrayLike(that, obj.data)\n }\n }\n\n throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')\n}\n\nfunction checked (length) {\n // Note: cannot use `length < kMaxLength()` here because that fails when\n // length is NaN (which is otherwise coerced to zero.)\n if (length >= kMaxLength()) {\n throw new RangeError('Attempt to allocate Buffer larger than maximum ' +\n 'size: 0x' + kMaxLength().toString(16) + ' bytes')\n }\n return length | 0\n}\n\nfunction SlowBuffer (length) {\n if (+length != length) { // eslint-disable-line eqeqeq\n length = 0\n }\n return Buffer.alloc(+length)\n}\n\nBuffer.isBuffer = function isBuffer (b) {\n return !!(b != null && b._isBuffer)\n}\n\nBuffer.compare = function compare (a, b) {\n if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {\n throw new TypeError('Arguments must be Buffers')\n }\n\n if (a === b) return 0\n\n var x = a.length\n var y = b.length\n\n for (var i = 0, len = Math.min(x, y); i < len; ++i) {\n if (a[i] !== b[i]) {\n x = a[i]\n y = b[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\nBuffer.isEncoding = function isEncoding (encoding) {\n switch (String(encoding).toLowerCase()) {\n case 'hex':\n case 'utf8':\n case 'utf-8':\n case 'ascii':\n case 'latin1':\n case 'binary':\n case 'base64':\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return true\n default:\n return false\n }\n}\n\nBuffer.concat = function concat (list, length) {\n if (!isArray(list)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n\n if (list.length === 0) {\n return Buffer.alloc(0)\n }\n\n var i\n if (length === undefined) {\n length = 0\n for (i = 0; i < list.length; ++i) {\n length += list[i].length\n }\n }\n\n var buffer = Buffer.allocUnsafe(length)\n var pos = 0\n for (i = 0; i < list.length; ++i) {\n var buf = list[i]\n if (!Buffer.isBuffer(buf)) {\n throw new TypeError('\"list\" argument must be an Array of Buffers')\n }\n buf.copy(buffer, pos)\n pos += buf.length\n }\n return buffer\n}\n\nfunction byteLength (string, encoding) {\n if (Buffer.isBuffer(string)) {\n return string.length\n }\n if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&\n (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {\n return string.byteLength\n }\n if (typeof string !== 'string') {\n string = '' + string\n }\n\n var len = string.length\n if (len === 0) return 0\n\n // Use a for loop to avoid recursion\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'ascii':\n case 'latin1':\n case 'binary':\n return len\n case 'utf8':\n case 'utf-8':\n case undefined:\n return utf8ToBytes(string).length\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return len * 2\n case 'hex':\n return len >>> 1\n case 'base64':\n return base64ToBytes(string).length\n default:\n if (loweredCase) return utf8ToBytes(string).length // assume utf8\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\nBuffer.byteLength = byteLength\n\nfunction slowToString (encoding, start, end) {\n var loweredCase = false\n\n // No need to verify that \"this.length <= MAX_UINT32\" since it's a read-only\n // property of a typed array.\n\n // This behaves neither like String nor Uint8Array in that we set start/end\n // to their upper/lower bounds if the value passed is out of range.\n // undefined is handled specially as per ECMA-262 6th Edition,\n // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.\n if (start === undefined || start < 0) {\n start = 0\n }\n // Return early if start > this.length. Done here to prevent potential uint32\n // coercion fail below.\n if (start > this.length) {\n return ''\n }\n\n if (end === undefined || end > this.length) {\n end = this.length\n }\n\n if (end <= 0) {\n return ''\n }\n\n // Force coersion to uint32. This will also coerce falsey/NaN values to 0.\n end >>>= 0\n start >>>= 0\n\n if (end <= start) {\n return ''\n }\n\n if (!encoding) encoding = 'utf8'\n\n while (true) {\n switch (encoding) {\n case 'hex':\n return hexSlice(this, start, end)\n\n case 'utf8':\n case 'utf-8':\n return utf8Slice(this, start, end)\n\n case 'ascii':\n return asciiSlice(this, start, end)\n\n case 'latin1':\n case 'binary':\n return latin1Slice(this, start, end)\n\n case 'base64':\n return base64Slice(this, start, end)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return utf16leSlice(this, start, end)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = (encoding + '').toLowerCase()\n loweredCase = true\n }\n }\n}\n\n// The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect\n// Buffer instances.\nBuffer.prototype._isBuffer = true\n\nfunction swap (b, n, m) {\n var i = b[n]\n b[n] = b[m]\n b[m] = i\n}\n\nBuffer.prototype.swap16 = function swap16 () {\n var len = this.length\n if (len % 2 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 16-bits')\n }\n for (var i = 0; i < len; i += 2) {\n swap(this, i, i + 1)\n }\n return this\n}\n\nBuffer.prototype.swap32 = function swap32 () {\n var len = this.length\n if (len % 4 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 32-bits')\n }\n for (var i = 0; i < len; i += 4) {\n swap(this, i, i + 3)\n swap(this, i + 1, i + 2)\n }\n return this\n}\n\nBuffer.prototype.swap64 = function swap64 () {\n var len = this.length\n if (len % 8 !== 0) {\n throw new RangeError('Buffer size must be a multiple of 64-bits')\n }\n for (var i = 0; i < len; i += 8) {\n swap(this, i, i + 7)\n swap(this, i + 1, i + 6)\n swap(this, i + 2, i + 5)\n swap(this, i + 3, i + 4)\n }\n return this\n}\n\nBuffer.prototype.toString = function toString () {\n var length = this.length | 0\n if (length === 0) return ''\n if (arguments.length === 0) return utf8Slice(this, 0, length)\n return slowToString.apply(this, arguments)\n}\n\nBuffer.prototype.equals = function equals (b) {\n if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')\n if (this === b) return true\n return Buffer.compare(this, b) === 0\n}\n\nBuffer.prototype.inspect = function inspect () {\n var str = ''\n var max = exports.INSPECT_MAX_BYTES\n if (this.length > 0) {\n str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')\n if (this.length > max) str += ' ... '\n }\n return ''\n}\n\nBuffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {\n if (!Buffer.isBuffer(target)) {\n throw new TypeError('Argument must be a Buffer')\n }\n\n if (start === undefined) {\n start = 0\n }\n if (end === undefined) {\n end = target ? target.length : 0\n }\n if (thisStart === undefined) {\n thisStart = 0\n }\n if (thisEnd === undefined) {\n thisEnd = this.length\n }\n\n if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {\n throw new RangeError('out of range index')\n }\n\n if (thisStart >= thisEnd && start >= end) {\n return 0\n }\n if (thisStart >= thisEnd) {\n return -1\n }\n if (start >= end) {\n return 1\n }\n\n start >>>= 0\n end >>>= 0\n thisStart >>>= 0\n thisEnd >>>= 0\n\n if (this === target) return 0\n\n var x = thisEnd - thisStart\n var y = end - start\n var len = Math.min(x, y)\n\n var thisCopy = this.slice(thisStart, thisEnd)\n var targetCopy = target.slice(start, end)\n\n for (var i = 0; i < len; ++i) {\n if (thisCopy[i] !== targetCopy[i]) {\n x = thisCopy[i]\n y = targetCopy[i]\n break\n }\n }\n\n if (x < y) return -1\n if (y < x) return 1\n return 0\n}\n\n// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,\n// OR the last index of `val` in `buffer` at offset <= `byteOffset`.\n//\n// Arguments:\n// - buffer - a Buffer to search\n// - val - a string, Buffer, or number\n// - byteOffset - an index into `buffer`; will be clamped to an int32\n// - encoding - an optional encoding, relevant is val is a string\n// - dir - true for indexOf, false for lastIndexOf\nfunction bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {\n // Empty buffer means no match\n if (buffer.length === 0) return -1\n\n // Normalize byteOffset\n if (typeof byteOffset === 'string') {\n encoding = byteOffset\n byteOffset = 0\n } else if (byteOffset > 0x7fffffff) {\n byteOffset = 0x7fffffff\n } else if (byteOffset < -0x80000000) {\n byteOffset = -0x80000000\n }\n byteOffset = +byteOffset // Coerce to Number.\n if (isNaN(byteOffset)) {\n // byteOffset: it it's undefined, null, NaN, \"foo\", etc, search whole buffer\n byteOffset = dir ? 0 : (buffer.length - 1)\n }\n\n // Normalize byteOffset: negative offsets start from the end of the buffer\n if (byteOffset < 0) byteOffset = buffer.length + byteOffset\n if (byteOffset >= buffer.length) {\n if (dir) return -1\n else byteOffset = buffer.length - 1\n } else if (byteOffset < 0) {\n if (dir) byteOffset = 0\n else return -1\n }\n\n // Normalize val\n if (typeof val === 'string') {\n val = Buffer.from(val, encoding)\n }\n\n // Finally, search either indexOf (if dir is true) or lastIndexOf\n if (Buffer.isBuffer(val)) {\n // Special case: looking for empty string/buffer always fails\n if (val.length === 0) {\n return -1\n }\n return arrayIndexOf(buffer, val, byteOffset, encoding, dir)\n } else if (typeof val === 'number') {\n val = val & 0xFF // Search for a byte value [0-255]\n if (Buffer.TYPED_ARRAY_SUPPORT &&\n typeof Uint8Array.prototype.indexOf === 'function') {\n if (dir) {\n return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)\n } else {\n return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)\n }\n }\n return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)\n }\n\n throw new TypeError('val must be string, number or Buffer')\n}\n\nfunction arrayIndexOf (arr, val, byteOffset, encoding, dir) {\n var indexSize = 1\n var arrLength = arr.length\n var valLength = val.length\n\n if (encoding !== undefined) {\n encoding = String(encoding).toLowerCase()\n if (encoding === 'ucs2' || encoding === 'ucs-2' ||\n encoding === 'utf16le' || encoding === 'utf-16le') {\n if (arr.length < 2 || val.length < 2) {\n return -1\n }\n indexSize = 2\n arrLength /= 2\n valLength /= 2\n byteOffset /= 2\n }\n }\n\n function read (buf, i) {\n if (indexSize === 1) {\n return buf[i]\n } else {\n return buf.readUInt16BE(i * indexSize)\n }\n }\n\n var i\n if (dir) {\n var foundIndex = -1\n for (i = byteOffset; i < arrLength; i++) {\n if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {\n if (foundIndex === -1) foundIndex = i\n if (i - foundIndex + 1 === valLength) return foundIndex * indexSize\n } else {\n if (foundIndex !== -1) i -= i - foundIndex\n foundIndex = -1\n }\n }\n } else {\n if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength\n for (i = byteOffset; i >= 0; i--) {\n var found = true\n for (var j = 0; j < valLength; j++) {\n if (read(arr, i + j) !== read(val, j)) {\n found = false\n break\n }\n }\n if (found) return i\n }\n }\n\n return -1\n}\n\nBuffer.prototype.includes = function includes (val, byteOffset, encoding) {\n return this.indexOf(val, byteOffset, encoding) !== -1\n}\n\nBuffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, true)\n}\n\nBuffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {\n return bidirectionalIndexOf(this, val, byteOffset, encoding, false)\n}\n\nfunction hexWrite (buf, string, offset, length) {\n offset = Number(offset) || 0\n var remaining = buf.length - offset\n if (!length) {\n length = remaining\n } else {\n length = Number(length)\n if (length > remaining) {\n length = remaining\n }\n }\n\n // must be an even number of digits\n var strLen = string.length\n if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')\n\n if (length > strLen / 2) {\n length = strLen / 2\n }\n for (var i = 0; i < length; ++i) {\n var parsed = parseInt(string.substr(i * 2, 2), 16)\n if (isNaN(parsed)) return i\n buf[offset + i] = parsed\n }\n return i\n}\n\nfunction utf8Write (buf, string, offset, length) {\n return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nfunction asciiWrite (buf, string, offset, length) {\n return blitBuffer(asciiToBytes(string), buf, offset, length)\n}\n\nfunction latin1Write (buf, string, offset, length) {\n return asciiWrite(buf, string, offset, length)\n}\n\nfunction base64Write (buf, string, offset, length) {\n return blitBuffer(base64ToBytes(string), buf, offset, length)\n}\n\nfunction ucs2Write (buf, string, offset, length) {\n return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)\n}\n\nBuffer.prototype.write = function write (string, offset, length, encoding) {\n // Buffer#write(string)\n if (offset === undefined) {\n encoding = 'utf8'\n length = this.length\n offset = 0\n // Buffer#write(string, encoding)\n } else if (length === undefined && typeof offset === 'string') {\n encoding = offset\n length = this.length\n offset = 0\n // Buffer#write(string, offset[, length][, encoding])\n } else if (isFinite(offset)) {\n offset = offset | 0\n if (isFinite(length)) {\n length = length | 0\n if (encoding === undefined) encoding = 'utf8'\n } else {\n encoding = length\n length = undefined\n }\n // legacy write(string, encoding, offset, length) - remove in v0.13\n } else {\n throw new Error(\n 'Buffer.write(string, encoding, offset[, length]) is no longer supported'\n )\n }\n\n var remaining = this.length - offset\n if (length === undefined || length > remaining) length = remaining\n\n if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {\n throw new RangeError('Attempt to write outside buffer bounds')\n }\n\n if (!encoding) encoding = 'utf8'\n\n var loweredCase = false\n for (;;) {\n switch (encoding) {\n case 'hex':\n return hexWrite(this, string, offset, length)\n\n case 'utf8':\n case 'utf-8':\n return utf8Write(this, string, offset, length)\n\n case 'ascii':\n return asciiWrite(this, string, offset, length)\n\n case 'latin1':\n case 'binary':\n return latin1Write(this, string, offset, length)\n\n case 'base64':\n // Warning: maxLength not taken into account in base64Write\n return base64Write(this, string, offset, length)\n\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return ucs2Write(this, string, offset, length)\n\n default:\n if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)\n encoding = ('' + encoding).toLowerCase()\n loweredCase = true\n }\n }\n}\n\nBuffer.prototype.toJSON = function toJSON () {\n return {\n type: 'Buffer',\n data: Array.prototype.slice.call(this._arr || this, 0)\n }\n}\n\nfunction base64Slice (buf, start, end) {\n if (start === 0 && end === buf.length) {\n return base64.fromByteArray(buf)\n } else {\n return base64.fromByteArray(buf.slice(start, end))\n }\n}\n\nfunction utf8Slice (buf, start, end) {\n end = Math.min(buf.length, end)\n var res = []\n\n var i = start\n while (i < end) {\n var firstByte = buf[i]\n var codePoint = null\n var bytesPerSequence = (firstByte > 0xEF) ? 4\n : (firstByte > 0xDF) ? 3\n : (firstByte > 0xBF) ? 2\n : 1\n\n if (i + bytesPerSequence <= end) {\n var secondByte, thirdByte, fourthByte, tempCodePoint\n\n switch (bytesPerSequence) {\n case 1:\n if (firstByte < 0x80) {\n codePoint = firstByte\n }\n break\n case 2:\n secondByte = buf[i + 1]\n if ((secondByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)\n if (tempCodePoint > 0x7F) {\n codePoint = tempCodePoint\n }\n }\n break\n case 3:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)\n if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {\n codePoint = tempCodePoint\n }\n }\n break\n case 4:\n secondByte = buf[i + 1]\n thirdByte = buf[i + 2]\n fourthByte = buf[i + 3]\n if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {\n tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)\n if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {\n codePoint = tempCodePoint\n }\n }\n }\n }\n\n if (codePoint === null) {\n // we did not generate a valid codePoint so insert a\n // replacement char (U+FFFD) and advance only 1 byte\n codePoint = 0xFFFD\n bytesPerSequence = 1\n } else if (codePoint > 0xFFFF) {\n // encode to utf16 (surrogate pair dance)\n codePoint -= 0x10000\n res.push(codePoint >>> 10 & 0x3FF | 0xD800)\n codePoint = 0xDC00 | codePoint & 0x3FF\n }\n\n res.push(codePoint)\n i += bytesPerSequence\n }\n\n return decodeCodePointsArray(res)\n}\n\n// Based on http://stackoverflow.com/a/22747272/680742, the browser with\n// the lowest limit is Chrome, with 0x10000 args.\n// We go 1 magnitude less, for safety\nvar MAX_ARGUMENTS_LENGTH = 0x1000\n\nfunction decodeCodePointsArray (codePoints) {\n var len = codePoints.length\n if (len <= MAX_ARGUMENTS_LENGTH) {\n return String.fromCharCode.apply(String, codePoints) // avoid extra slice()\n }\n\n // Decode in chunks to avoid \"call stack size exceeded\".\n var res = ''\n var i = 0\n while (i < len) {\n res += String.fromCharCode.apply(\n String,\n codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)\n )\n }\n return res\n}\n\nfunction asciiSlice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i] & 0x7F)\n }\n return ret\n}\n\nfunction latin1Slice (buf, start, end) {\n var ret = ''\n end = Math.min(buf.length, end)\n\n for (var i = start; i < end; ++i) {\n ret += String.fromCharCode(buf[i])\n }\n return ret\n}\n\nfunction hexSlice (buf, start, end) {\n var len = buf.length\n\n if (!start || start < 0) start = 0\n if (!end || end < 0 || end > len) end = len\n\n var out = ''\n for (var i = start; i < end; ++i) {\n out += toHex(buf[i])\n }\n return out\n}\n\nfunction utf16leSlice (buf, start, end) {\n var bytes = buf.slice(start, end)\n var res = ''\n for (var i = 0; i < bytes.length; i += 2) {\n res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)\n }\n return res\n}\n\nBuffer.prototype.slice = function slice (start, end) {\n var len = this.length\n start = ~~start\n end = end === undefined ? len : ~~end\n\n if (start < 0) {\n start += len\n if (start < 0) start = 0\n } else if (start > len) {\n start = len\n }\n\n if (end < 0) {\n end += len\n if (end < 0) end = 0\n } else if (end > len) {\n end = len\n }\n\n if (end < start) end = start\n\n var newBuf\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n newBuf = this.subarray(start, end)\n newBuf.__proto__ = Buffer.prototype\n } else {\n var sliceLen = end - start\n newBuf = new Buffer(sliceLen, undefined)\n for (var i = 0; i < sliceLen; ++i) {\n newBuf[i] = this[i + start]\n }\n }\n\n return newBuf\n}\n\n/*\n * Need to make sure that buffer isn't trying to write out of bounds.\n */\nfunction checkOffset (offset, ext, length) {\n if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')\n if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')\n}\n\nBuffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n checkOffset(offset, byteLength, this.length)\n }\n\n var val = this[offset + --byteLength]\n var mul = 1\n while (byteLength > 0 && (mul *= 0x100)) {\n val += this[offset + --byteLength] * mul\n }\n\n return val\n}\n\nBuffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n return this[offset]\n}\n\nBuffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return this[offset] | (this[offset + 1] << 8)\n}\n\nBuffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n return (this[offset] << 8) | this[offset + 1]\n}\n\nBuffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return ((this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16)) +\n (this[offset + 3] * 0x1000000)\n}\n\nBuffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] * 0x1000000) +\n ((this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n this[offset + 3])\n}\n\nBuffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var val = this[offset]\n var mul = 1\n var i = 0\n while (++i < byteLength && (mul *= 0x100)) {\n val += this[offset + i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) checkOffset(offset, byteLength, this.length)\n\n var i = byteLength\n var mul = 1\n var val = this[offset + --i]\n while (i > 0 && (mul *= 0x100)) {\n val += this[offset + --i] * mul\n }\n mul *= 0x80\n\n if (val >= mul) val -= Math.pow(2, 8 * byteLength)\n\n return val\n}\n\nBuffer.prototype.readInt8 = function readInt8 (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 1, this.length)\n if (!(this[offset] & 0x80)) return (this[offset])\n return ((0xff - this[offset] + 1) * -1)\n}\n\nBuffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset] | (this[offset + 1] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 2, this.length)\n var val = this[offset + 1] | (this[offset] << 8)\n return (val & 0x8000) ? val | 0xFFFF0000 : val\n}\n\nBuffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset]) |\n (this[offset + 1] << 8) |\n (this[offset + 2] << 16) |\n (this[offset + 3] << 24)\n}\n\nBuffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n\n return (this[offset] << 24) |\n (this[offset + 1] << 16) |\n (this[offset + 2] << 8) |\n (this[offset + 3])\n}\n\nBuffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, true, 23, 4)\n}\n\nBuffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 4, this.length)\n return ieee754.read(this, offset, false, 23, 4)\n}\n\nBuffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, true, 52, 8)\n}\n\nBuffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {\n if (!noAssert) checkOffset(offset, 8, this.length)\n return ieee754.read(this, offset, false, 52, 8)\n}\n\nfunction checkInt (buf, value, offset, ext, max, min) {\n if (!Buffer.isBuffer(buf)) throw new TypeError('\"buffer\" argument must be a Buffer instance')\n if (value > max || value < min) throw new RangeError('\"value\" argument is out of bounds')\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n}\n\nBuffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var mul = 1\n var i = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n byteLength = byteLength | 0\n if (!noAssert) {\n var maxBytes = Math.pow(2, 8 * byteLength) - 1\n checkInt(this, value, offset, byteLength, maxBytes, 0)\n }\n\n var i = byteLength - 1\n var mul = 1\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n this[offset + i] = (value / mul) & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nfunction objectWriteUInt16 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {\n buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>\n (littleEndian ? i : 1 - i) * 8\n }\n}\n\nBuffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nfunction objectWriteUInt32 (buf, value, offset, littleEndian) {\n if (value < 0) value = 0xffffffff + value + 1\n for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {\n buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff\n }\n}\n\nBuffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset + 3] = (value >>> 24)\n this[offset + 2] = (value >>> 16)\n this[offset + 1] = (value >>> 8)\n this[offset] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = 0\n var mul = 1\n var sub = 0\n this[offset] = value & 0xFF\n while (++i < byteLength && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) {\n var limit = Math.pow(2, 8 * byteLength - 1)\n\n checkInt(this, value, offset, byteLength, limit - 1, -limit)\n }\n\n var i = byteLength - 1\n var mul = 1\n var sub = 0\n this[offset + i] = value & 0xFF\n while (--i >= 0 && (mul *= 0x100)) {\n if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {\n sub = 1\n }\n this[offset + i] = ((value / mul) >> 0) - sub & 0xFF\n }\n\n return offset + byteLength\n}\n\nBuffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)\n if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)\n if (value < 0) value = 0xff + value + 1\n this[offset] = (value & 0xff)\n return offset + 1\n}\n\nBuffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n } else {\n objectWriteUInt16(this, value, offset, true)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 8)\n this[offset + 1] = (value & 0xff)\n } else {\n objectWriteUInt16(this, value, offset, false)\n }\n return offset + 2\n}\n\nBuffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value & 0xff)\n this[offset + 1] = (value >>> 8)\n this[offset + 2] = (value >>> 16)\n this[offset + 3] = (value >>> 24)\n } else {\n objectWriteUInt32(this, value, offset, true)\n }\n return offset + 4\n}\n\nBuffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {\n value = +value\n offset = offset | 0\n if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)\n if (value < 0) value = 0xffffffff + value + 1\n if (Buffer.TYPED_ARRAY_SUPPORT) {\n this[offset] = (value >>> 24)\n this[offset + 1] = (value >>> 16)\n this[offset + 2] = (value >>> 8)\n this[offset + 3] = (value & 0xff)\n } else {\n objectWriteUInt32(this, value, offset, false)\n }\n return offset + 4\n}\n\nfunction checkIEEE754 (buf, value, offset, ext, max, min) {\n if (offset + ext > buf.length) throw new RangeError('Index out of range')\n if (offset < 0) throw new RangeError('Index out of range')\n}\n\nfunction writeFloat (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)\n }\n ieee754.write(buf, value, offset, littleEndian, 23, 4)\n return offset + 4\n}\n\nBuffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {\n return writeFloat(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {\n return writeFloat(this, value, offset, false, noAssert)\n}\n\nfunction writeDouble (buf, value, offset, littleEndian, noAssert) {\n if (!noAssert) {\n checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)\n }\n ieee754.write(buf, value, offset, littleEndian, 52, 8)\n return offset + 8\n}\n\nBuffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {\n return writeDouble(this, value, offset, true, noAssert)\n}\n\nBuffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {\n return writeDouble(this, value, offset, false, noAssert)\n}\n\n// copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)\nBuffer.prototype.copy = function copy (target, targetStart, start, end) {\n if (!start) start = 0\n if (!end && end !== 0) end = this.length\n if (targetStart >= target.length) targetStart = target.length\n if (!targetStart) targetStart = 0\n if (end > 0 && end < start) end = start\n\n // Copy 0 bytes; we're done\n if (end === start) return 0\n if (target.length === 0 || this.length === 0) return 0\n\n // Fatal error conditions\n if (targetStart < 0) {\n throw new RangeError('targetStart out of bounds')\n }\n if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')\n if (end < 0) throw new RangeError('sourceEnd out of bounds')\n\n // Are we oob?\n if (end > this.length) end = this.length\n if (target.length - targetStart < end - start) {\n end = target.length - targetStart + start\n }\n\n var len = end - start\n var i\n\n if (this === target && start < targetStart && targetStart < end) {\n // descending copy from end\n for (i = len - 1; i >= 0; --i) {\n target[i + targetStart] = this[i + start]\n }\n } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {\n // ascending copy from start\n for (i = 0; i < len; ++i) {\n target[i + targetStart] = this[i + start]\n }\n } else {\n Uint8Array.prototype.set.call(\n target,\n this.subarray(start, start + len),\n targetStart\n )\n }\n\n return len\n}\n\n// Usage:\n// buffer.fill(number[, offset[, end]])\n// buffer.fill(buffer[, offset[, end]])\n// buffer.fill(string[, offset[, end]][, encoding])\nBuffer.prototype.fill = function fill (val, start, end, encoding) {\n // Handle string cases:\n if (typeof val === 'string') {\n if (typeof start === 'string') {\n encoding = start\n start = 0\n end = this.length\n } else if (typeof end === 'string') {\n encoding = end\n end = this.length\n }\n if (val.length === 1) {\n var code = val.charCodeAt(0)\n if (code < 256) {\n val = code\n }\n }\n if (encoding !== undefined && typeof encoding !== 'string') {\n throw new TypeError('encoding must be a string')\n }\n if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {\n throw new TypeError('Unknown encoding: ' + encoding)\n }\n } else if (typeof val === 'number') {\n val = val & 255\n }\n\n // Invalid ranges are not set to a default, so can range check early.\n if (start < 0 || this.length < start || this.length < end) {\n throw new RangeError('Out of range index')\n }\n\n if (end <= start) {\n return this\n }\n\n start = start >>> 0\n end = end === undefined ? this.length : end >>> 0\n\n if (!val) val = 0\n\n var i\n if (typeof val === 'number') {\n for (i = start; i < end; ++i) {\n this[i] = val\n }\n } else {\n var bytes = Buffer.isBuffer(val)\n ? val\n : utf8ToBytes(new Buffer(val, encoding).toString())\n var len = bytes.length\n for (i = 0; i < end - start; ++i) {\n this[i + start] = bytes[i % len]\n }\n }\n\n return this\n}\n\n// HELPER FUNCTIONS\n// ================\n\nvar INVALID_BASE64_RE = /[^+\\/0-9A-Za-z-_]/g\n\nfunction base64clean (str) {\n // Node strips out invalid characters like \\n and \\t from the string, base64-js does not\n str = stringtrim(str).replace(INVALID_BASE64_RE, '')\n // Node converts strings with length < 2 to ''\n if (str.length < 2) return ''\n // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not\n while (str.length % 4 !== 0) {\n str = str + '='\n }\n return str\n}\n\nfunction stringtrim (str) {\n if (str.trim) return str.trim()\n return str.replace(/^\\s+|\\s+$/g, '')\n}\n\nfunction toHex (n) {\n if (n < 16) return '0' + n.toString(16)\n return n.toString(16)\n}\n\nfunction utf8ToBytes (string, units) {\n units = units || Infinity\n var codePoint\n var length = string.length\n var leadSurrogate = null\n var bytes = []\n\n for (var i = 0; i < length; ++i) {\n codePoint = string.charCodeAt(i)\n\n // is surrogate component\n if (codePoint > 0xD7FF && codePoint < 0xE000) {\n // last char was a lead\n if (!leadSurrogate) {\n // no lead yet\n if (codePoint > 0xDBFF) {\n // unexpected trail\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n } else if (i + 1 === length) {\n // unpaired lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n continue\n }\n\n // valid lead\n leadSurrogate = codePoint\n\n continue\n }\n\n // 2 leads in a row\n if (codePoint < 0xDC00) {\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n leadSurrogate = codePoint\n continue\n }\n\n // valid surrogate pair\n codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000\n } else if (leadSurrogate) {\n // valid bmp char, but last char was a lead\n if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)\n }\n\n leadSurrogate = null\n\n // encode utf8\n if (codePoint < 0x80) {\n if ((units -= 1) < 0) break\n bytes.push(codePoint)\n } else if (codePoint < 0x800) {\n if ((units -= 2) < 0) break\n bytes.push(\n codePoint >> 0x6 | 0xC0,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x10000) {\n if ((units -= 3) < 0) break\n bytes.push(\n codePoint >> 0xC | 0xE0,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else if (codePoint < 0x110000) {\n if ((units -= 4) < 0) break\n bytes.push(\n codePoint >> 0x12 | 0xF0,\n codePoint >> 0xC & 0x3F | 0x80,\n codePoint >> 0x6 & 0x3F | 0x80,\n codePoint & 0x3F | 0x80\n )\n } else {\n throw new Error('Invalid code point')\n }\n }\n\n return bytes\n}\n\nfunction asciiToBytes (str) {\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n // Node's code seems to be doing this and not & 0x7F..\n byteArray.push(str.charCodeAt(i) & 0xFF)\n }\n return byteArray\n}\n\nfunction utf16leToBytes (str, units) {\n var c, hi, lo\n var byteArray = []\n for (var i = 0; i < str.length; ++i) {\n if ((units -= 2) < 0) break\n\n c = str.charCodeAt(i)\n hi = c >> 8\n lo = c % 256\n byteArray.push(lo)\n byteArray.push(hi)\n }\n\n return byteArray\n}\n\nfunction base64ToBytes (str) {\n return base64.toByteArray(base64clean(str))\n}\n\nfunction blitBuffer (src, dst, offset, length) {\n for (var i = 0; i < length; ++i) {\n if ((i + offset >= dst.length) || (i >= src.length)) break\n dst[i + offset] = src[i]\n }\n return i\n}\n\nfunction isnan (val) {\n return val !== val // eslint-disable-line no-self-compare\n}\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin\n\nimport kotlin.internal.InlineOnly\n\n\n/**\n * Returns a hash code value for the object or zero if the object is `null`.\n *\n * @see Any.hashCode\n */\n@SinceKotlin(\"1.3\")\n@InlineOnly\npublic inline fun Any?.hashCode(): Int = this?.hashCode() ?: 0\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.js\n\n/**\n * Function corresponding to JavaScript's `typeof` operator\n */\n@kotlin.internal.InlineOnly\n@Suppress(\"UNUSED_PARAMETER\")\npublic inline fun jsTypeOf(a: Any?): String = js(\"typeof a\")\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"module.exports = assert;\n\nfunction assert(val, msg) {\n if (!val)\n throw new Error(msg || 'Assertion failed');\n}\n\nassert.equal = function assertEqual(l, r, msg) {\n if (l != r)\n throw new Error(msg || ('Assertion failed: ' + l + ' != ' + r));\n};\n","'use strict';\n\nvar utils = exports;\nvar BN = require('bn.js');\nvar minAssert = require('minimalistic-assert');\nvar minUtils = require('minimalistic-crypto-utils');\n\nutils.assert = minAssert;\nutils.toArray = minUtils.toArray;\nutils.zero2 = minUtils.zero2;\nutils.toHex = minUtils.toHex;\nutils.encode = minUtils.encode;\n\n// Represent num in a w-NAF form\nfunction getNAF(num, w, bits) {\n var naf = new Array(Math.max(num.bitLength(), bits) + 1);\n naf.fill(0);\n\n var ws = 1 << (w + 1);\n var k = num.clone();\n\n for (var i = 0; i < naf.length; i++) {\n var z;\n var mod = k.andln(ws - 1);\n if (k.isOdd()) {\n if (mod > (ws >> 1) - 1)\n z = (ws >> 1) - mod;\n else\n z = mod;\n k.isubn(z);\n } else {\n z = 0;\n }\n\n naf[i] = z;\n k.iushrn(1);\n }\n\n return naf;\n}\nutils.getNAF = getNAF;\n\n// Represent k1, k2 in a Joint Sparse Form\nfunction getJSF(k1, k2) {\n var jsf = [\n [],\n [],\n ];\n\n k1 = k1.clone();\n k2 = k2.clone();\n var d1 = 0;\n var d2 = 0;\n var m8;\n while (k1.cmpn(-d1) > 0 || k2.cmpn(-d2) > 0) {\n // First phase\n var m14 = (k1.andln(3) + d1) & 3;\n var m24 = (k2.andln(3) + d2) & 3;\n if (m14 === 3)\n m14 = -1;\n if (m24 === 3)\n m24 = -1;\n var u1;\n if ((m14 & 1) === 0) {\n u1 = 0;\n } else {\n m8 = (k1.andln(7) + d1) & 7;\n if ((m8 === 3 || m8 === 5) && m24 === 2)\n u1 = -m14;\n else\n u1 = m14;\n }\n jsf[0].push(u1);\n\n var u2;\n if ((m24 & 1) === 0) {\n u2 = 0;\n } else {\n m8 = (k2.andln(7) + d2) & 7;\n if ((m8 === 3 || m8 === 5) && m14 === 2)\n u2 = -m24;\n else\n u2 = m24;\n }\n jsf[1].push(u2);\n\n // Second phase\n if (2 * d1 === u1 + 1)\n d1 = 1 - d1;\n if (2 * d2 === u2 + 1)\n d2 = 1 - d2;\n k1.iushrn(1);\n k2.iushrn(1);\n }\n\n return jsf;\n}\nutils.getJSF = getJSF;\n\nfunction cachedProperty(obj, name, computer) {\n var key = '_' + name;\n obj.prototype[name] = function cachedProperty() {\n return this[key] !== undefined ? this[key] :\n this[key] = computer.call(this);\n };\n}\nutils.cachedProperty = cachedProperty;\n\nfunction parseBytes(bytes) {\n return typeof bytes === 'string' ? utils.toArray(bytes, 'hex') :\n bytes;\n}\nutils.parseBytes = parseBytes;\n\nfunction intFromLE(bytes) {\n return new BN(bytes, 'hex', 'le');\n}\nutils.intFromLE = intFromLE;\n\n","'use strict';\n\nvar assert = require('minimalistic-assert');\nvar inherits = require('inherits');\n\nexports.inherits = inherits;\n\nfunction isSurrogatePair(msg, i) {\n if ((msg.charCodeAt(i) & 0xFC00) !== 0xD800) {\n return false;\n }\n if (i < 0 || i + 1 >= msg.length) {\n return false;\n }\n return (msg.charCodeAt(i + 1) & 0xFC00) === 0xDC00;\n}\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg === 'string') {\n if (!enc) {\n // Inspired by stringToUtf8ByteArray() in closure-library by Google\n // https://github.com/google/closure-library/blob/8598d87242af59aac233270742c8984e2b2bdbe0/closure/goog/crypt/crypt.js#L117-L143\n // Apache License 2.0\n // https://github.com/google/closure-library/blob/master/LICENSE\n var p = 0;\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n if (c < 128) {\n res[p++] = c;\n } else if (c < 2048) {\n res[p++] = (c >> 6) | 192;\n res[p++] = (c & 63) | 128;\n } else if (isSurrogatePair(msg, i)) {\n c = 0x10000 + ((c & 0x03FF) << 10) + (msg.charCodeAt(++i) & 0x03FF);\n res[p++] = (c >> 18) | 240;\n res[p++] = ((c >> 12) & 63) | 128;\n res[p++] = ((c >> 6) & 63) | 128;\n res[p++] = (c & 63) | 128;\n } else {\n res[p++] = (c >> 12) | 224;\n res[p++] = ((c >> 6) & 63) | 128;\n res[p++] = (c & 63) | 128;\n }\n }\n } else if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n }\n } else {\n for (i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n }\n return res;\n}\nexports.toArray = toArray;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nexports.toHex = toHex;\n\nfunction htonl(w) {\n var res = (w >>> 24) |\n ((w >>> 8) & 0xff00) |\n ((w << 8) & 0xff0000) |\n ((w & 0xff) << 24);\n return res >>> 0;\n}\nexports.htonl = htonl;\n\nfunction toHex32(msg, endian) {\n var res = '';\n for (var i = 0; i < msg.length; i++) {\n var w = msg[i];\n if (endian === 'little')\n w = htonl(w);\n res += zero8(w.toString(16));\n }\n return res;\n}\nexports.toHex32 = toHex32;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nexports.zero2 = zero2;\n\nfunction zero8(word) {\n if (word.length === 7)\n return '0' + word;\n else if (word.length === 6)\n return '00' + word;\n else if (word.length === 5)\n return '000' + word;\n else if (word.length === 4)\n return '0000' + word;\n else if (word.length === 3)\n return '00000' + word;\n else if (word.length === 2)\n return '000000' + word;\n else if (word.length === 1)\n return '0000000' + word;\n else\n return word;\n}\nexports.zero8 = zero8;\n\nfunction join32(msg, start, end, endian) {\n var len = end - start;\n assert(len % 4 === 0);\n var res = new Array(len / 4);\n for (var i = 0, k = start; i < res.length; i++, k += 4) {\n var w;\n if (endian === 'big')\n w = (msg[k] << 24) | (msg[k + 1] << 16) | (msg[k + 2] << 8) | msg[k + 3];\n else\n w = (msg[k + 3] << 24) | (msg[k + 2] << 16) | (msg[k + 1] << 8) | msg[k];\n res[i] = w >>> 0;\n }\n return res;\n}\nexports.join32 = join32;\n\nfunction split32(msg, endian) {\n var res = new Array(msg.length * 4);\n for (var i = 0, k = 0; i < msg.length; i++, k += 4) {\n var m = msg[i];\n if (endian === 'big') {\n res[k] = m >>> 24;\n res[k + 1] = (m >>> 16) & 0xff;\n res[k + 2] = (m >>> 8) & 0xff;\n res[k + 3] = m & 0xff;\n } else {\n res[k + 3] = m >>> 24;\n res[k + 2] = (m >>> 16) & 0xff;\n res[k + 1] = (m >>> 8) & 0xff;\n res[k] = m & 0xff;\n }\n }\n return res;\n}\nexports.split32 = split32;\n\nfunction rotr32(w, b) {\n return (w >>> b) | (w << (32 - b));\n}\nexports.rotr32 = rotr32;\n\nfunction rotl32(w, b) {\n return (w << b) | (w >>> (32 - b));\n}\nexports.rotl32 = rotl32;\n\nfunction sum32(a, b) {\n return (a + b) >>> 0;\n}\nexports.sum32 = sum32;\n\nfunction sum32_3(a, b, c) {\n return (a + b + c) >>> 0;\n}\nexports.sum32_3 = sum32_3;\n\nfunction sum32_4(a, b, c, d) {\n return (a + b + c + d) >>> 0;\n}\nexports.sum32_4 = sum32_4;\n\nfunction sum32_5(a, b, c, d, e) {\n return (a + b + c + d + e) >>> 0;\n}\nexports.sum32_5 = sum32_5;\n\nfunction sum64(buf, pos, ah, al) {\n var bh = buf[pos];\n var bl = buf[pos + 1];\n\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n buf[pos] = hi >>> 0;\n buf[pos + 1] = lo;\n}\nexports.sum64 = sum64;\n\nfunction sum64_hi(ah, al, bh, bl) {\n var lo = (al + bl) >>> 0;\n var hi = (lo < al ? 1 : 0) + ah + bh;\n return hi >>> 0;\n}\nexports.sum64_hi = sum64_hi;\n\nfunction sum64_lo(ah, al, bh, bl) {\n var lo = al + bl;\n return lo >>> 0;\n}\nexports.sum64_lo = sum64_lo;\n\nfunction sum64_4_hi(ah, al, bh, bl, ch, cl, dh, dl) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n\n var hi = ah + bh + ch + dh + carry;\n return hi >>> 0;\n}\nexports.sum64_4_hi = sum64_4_hi;\n\nfunction sum64_4_lo(ah, al, bh, bl, ch, cl, dh, dl) {\n var lo = al + bl + cl + dl;\n return lo >>> 0;\n}\nexports.sum64_4_lo = sum64_4_lo;\n\nfunction sum64_5_hi(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var carry = 0;\n var lo = al;\n lo = (lo + bl) >>> 0;\n carry += lo < al ? 1 : 0;\n lo = (lo + cl) >>> 0;\n carry += lo < cl ? 1 : 0;\n lo = (lo + dl) >>> 0;\n carry += lo < dl ? 1 : 0;\n lo = (lo + el) >>> 0;\n carry += lo < el ? 1 : 0;\n\n var hi = ah + bh + ch + dh + eh + carry;\n return hi >>> 0;\n}\nexports.sum64_5_hi = sum64_5_hi;\n\nfunction sum64_5_lo(ah, al, bh, bl, ch, cl, dh, dl, eh, el) {\n var lo = al + bl + cl + dl + el;\n\n return lo >>> 0;\n}\nexports.sum64_5_lo = sum64_5_lo;\n\nfunction rotr64_hi(ah, al, num) {\n var r = (al << (32 - num)) | (ah >>> num);\n return r >>> 0;\n}\nexports.rotr64_hi = rotr64_hi;\n\nfunction rotr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n}\nexports.rotr64_lo = rotr64_lo;\n\nfunction shr64_hi(ah, al, num) {\n return ah >>> num;\n}\nexports.shr64_hi = shr64_hi;\n\nfunction shr64_lo(ah, al, num) {\n var r = (ah << (32 - num)) | (al >>> num);\n return r >>> 0;\n}\nexports.shr64_lo = shr64_lo;\n","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.default = isPrefixedValue;\nvar regex = /-webkit-|-moz-|-ms-/;\n\nfunction isPrefixedValue(value) {\n return typeof value === 'string' && regex.test(value);\n}\nmodule.exports = exports['default'];","package io.ktor.utils.io\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.concurrent.*\nimport io.ktor.utils.io.core.*\nimport io.ktor.utils.io.core.internal.*\nimport io.ktor.utils.io.internal.*\nimport io.ktor.utils.io.pool.*\nimport kotlinx.atomicfu.locks.*\nimport kotlin.math.*\n\n@Deprecated(\"This is going to become internal. Use ByteReadChannel receiver instead.\", level = DeprecationLevel.ERROR)\npublic suspend fun ByteChannelSequentialBase.joinTo(dst: ByteChannelSequentialBase, closeOnEnd: Boolean) {\n return joinToImpl(dst, closeOnEnd)\n}\n\n@Deprecated(\"This is going to become internal. Use ByteReadChannel receiver instead.\", level = DeprecationLevel.ERROR)\npublic suspend fun ByteChannelSequentialBase.copyTo(\n dst: ByteChannelSequentialBase,\n limit: Long = Long.MAX_VALUE\n): Long {\n return copyToSequentialImpl(dst, limit)\n}\n\nprivate const val EXPECTED_CAPACITY: Long = 4088L\n\n/**\n * Sequential (non-concurrent) byte channel implementation\n */\n@Suppress(\"OverridingDeprecatedMember\")\n@DangerousInternalIoApi\npublic abstract class ByteChannelSequentialBase(\n initial: IoBuffer,\n override val autoFlush: Boolean,\n pool: ObjectPool = ChunkBuffer.Pool\n) : ByteChannel, ByteReadChannel, ByteWriteChannel, SuspendableReadSession, HasReadSession, HasWriteSession {\n\n @Suppress(\"unused\", \"DEPRECATION\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public constructor(initial: IoBuffer, autoFlush: Boolean) : this(initial, autoFlush, ChunkBuffer.Pool)\n\n private val state = ByteChannelSequentialBaseSharedState()\n\n protected var closed: Boolean\n get() = state.closed\n set(value) {\n state.closed = value\n }\n\n protected val writable: BytePacketBuilder = BytePacketBuilder(0, pool)\n protected val readable: ByteReadPacket = ByteReadPacket(initial, pool)\n\n private val slot = AwaitingSlot()\n\n @Suppress(\"NOTHING_TO_INLINE\")\n private inline fun totalPending(): Int = availableForRead + writable.size\n\n private val flushSize: Int get() = flushBuffer.size\n\n override val availableForRead: Int\n get() = flushSize + readable.remaining.toInt()\n\n override val availableForWrite: Int\n get() = maxOf(0, EXPECTED_CAPACITY.toInt() - totalPending())\n\n override var readByteOrder: ByteOrder\n get() = state.readByteOrder\n set(value) {\n state.readByteOrder = value\n }\n\n override var writeByteOrder: ByteOrder\n get() = state.writeByteOrder\n set(value) {\n state.writeByteOrder = value\n }\n\n override val isClosedForRead: Boolean\n get() = closed && readable.isEmpty && flushSize == 0 && writable.isEmpty\n\n override val isClosedForWrite: Boolean\n get() = closed\n\n private var _totalBytesRead: Long\n get() = state.totalBytesRead\n set(value) {\n state.totalBytesRead = value\n }\n\n override val totalBytesRead: Long get() = state.totalBytesRead\n\n private var _totalBytesWritten: Long\n get() = state.totalBytesWritten\n set(value) {\n state.totalBytesWritten = value\n }\n\n override val totalBytesWritten: Long get() = state.totalBytesWritten\n\n final override var closedCause: Throwable?\n get() = state.closedCause\n private set(value) {\n state.closedCause = value\n }\n\n private val flushMutex = SynchronizedObject()\n private val flushBuffer: BytePacketBuilder = BytePacketBuilder()\n\n internal suspend fun awaitAtLeastNBytesAvailableForWrite(count: Int) {\n while (availableForWrite < count && !closed) {\n if (!flushImpl()) {\n slot.sleep()\n }\n }\n }\n\n internal suspend fun awaitAtLeastNBytesAvailableForRead(count: Int) {\n while (availableForRead < count && !closed) {\n slot.sleep()\n }\n }\n\n override fun flush() {\n flushImpl()\n }\n\n private fun flushImpl(): Boolean {\n if (writable.isEmpty) {\n return false\n }\n\n flushWrittenBytes()\n slot.resume()\n return true\n }\n\n /**\n * Send bytes to thread-safe storage.\n *\n * This method is writer-only safe.\n */\n private fun flushWrittenBytes() {\n synchronized(flushMutex) {\n val buffer = writable.stealAll()!!\n flushBuffer.writeChunkBuffer(buffer)\n }\n }\n\n /**\n * Take flushed bytes before read.\n *\n * This method is reader-only safe.\n */\n protected fun prepareFlushedBytes() {\n synchronized(flushMutex) {\n readable.unsafeAppend(flushBuffer)\n }\n }\n\n private fun ensureNotClosed() {\n if (closed) {\n throw closedCause ?: ClosedWriteChannelException(\"Channel is already closed\")\n }\n }\n\n private fun ensureNotFailed() {\n closedCause?.let { throw it }\n }\n\n private fun ensureNotFailed(closeable: BytePacketBuilder) {\n closedCause?.let { cause ->\n closeable.release()\n throw cause\n }\n }\n\n override suspend fun writeByte(b: Byte) {\n awaitAtLeastNBytesAvailableForWrite(1)\n writable.writeByte(b)\n afterWrite(1)\n }\n\n private inline fun reverseWrite(value: () -> T, reversed: () -> T): T {\n @Suppress(\"DEPRECATION_ERROR\")\n return if (writeByteOrder == ByteOrder.BIG_ENDIAN) {\n value()\n } else {\n reversed()\n }\n }\n\n override suspend fun writeShort(s: Short) {\n awaitAtLeastNBytesAvailableForWrite(2)\n writable.writeShort(reverseWrite({ s }, { s.reverseByteOrder() }))\n afterWrite(2)\n }\n\n override suspend fun writeInt(i: Int) {\n awaitAtLeastNBytesAvailableForWrite(4)\n writable.writeInt(reverseWrite({ i }, { i.reverseByteOrder() }))\n afterWrite(4)\n }\n\n override suspend fun writeLong(l: Long) {\n awaitAtLeastNBytesAvailableForWrite(8)\n writable.writeLong(reverseWrite({ l }, { l.reverseByteOrder() }))\n afterWrite(8)\n }\n\n override suspend fun writeFloat(f: Float) {\n awaitAtLeastNBytesAvailableForWrite(4)\n writable.writeFloat(reverseWrite({ f }, { f.reverseByteOrder() }))\n afterWrite(4)\n }\n\n override suspend fun writeDouble(d: Double) {\n awaitAtLeastNBytesAvailableForWrite(8)\n writable.writeDouble(reverseWrite({ d }, { d.reverseByteOrder() }))\n afterWrite(8)\n }\n\n override suspend fun writePacket(packet: ByteReadPacket) {\n awaitAtLeastNBytesAvailableForWrite(1)\n val size = packet.remaining.toInt()\n writable.writePacket(packet)\n afterWrite(size)\n }\n\n override suspend fun writeFully(src: IoBuffer) {\n writeFully(src as Buffer)\n }\n\n override suspend fun writeFully(src: Buffer) {\n awaitAtLeastNBytesAvailableForWrite(1)\n val count = src.readRemaining\n writable.writeFully(src)\n afterWrite(count)\n }\n\n override suspend fun writeFully(src: ByteArray, offset: Int, length: Int) {\n var currentIndex = offset\n val endIndex = offset + length\n\n while (currentIndex < endIndex) {\n awaitAtLeastNBytesAvailableForWrite(1)\n\n val bytesCount = min(availableForWrite, endIndex - currentIndex)\n writable.writeFully(src, currentIndex, bytesCount)\n\n currentIndex += bytesCount\n afterWrite(bytesCount)\n }\n }\n\n override suspend fun writeFully(memory: Memory, startIndex: Int, endIndex: Int) {\n var currentIndex = startIndex\n\n while (currentIndex < endIndex) {\n awaitAtLeastNBytesAvailableForWrite(1)\n\n val bytesCount = min(availableForWrite, endIndex - currentIndex)\n writable.writeFully(memory, currentIndex, bytesCount)\n\n currentIndex += bytesCount\n afterWrite(bytesCount)\n }\n }\n\n override suspend fun writeAvailable(src: IoBuffer): Int {\n val srcRemaining = src.readRemaining\n if (srcRemaining == 0) return 0\n val size = minOf(srcRemaining, availableForWrite)\n\n return if (size == 0) writeAvailableSuspend(src)\n else {\n writable.writeFully(src, size)\n afterWrite(size)\n size\n }\n }\n\n override suspend fun writeAvailable(src: ByteArray, offset: Int, length: Int): Int {\n if (length == 0) return 0\n val size = minOf(length, availableForWrite)\n\n return if (size == 0) writeAvailableSuspend(src, offset, length)\n else {\n writable.writeFully(src, offset, size)\n afterWrite(size)\n size\n }\n }\n\n @ExperimentalIoApi\n @Suppress(\"DEPRECATION\")\n override suspend fun writeSuspendSession(visitor: suspend WriterSuspendSession.() -> Unit) {\n val session = beginWriteSession()\n visitor(session)\n }\n\n @Suppress(\"DEPRECATION\")\n override fun beginWriteSession(): WriterSuspendSession {\n return object : WriterSuspendSession {\n override fun request(min: Int): IoBuffer? {\n if (availableForWrite == 0) return null\n return writable.prepareWriteHead(min) as IoBuffer\n }\n\n override fun written(n: Int) {\n writable.afterHeadWrite()\n afterWrite(n)\n }\n\n override fun flush() {\n this@ByteChannelSequentialBase.flush()\n }\n\n override suspend fun tryAwait(n: Int) {\n if (availableForWrite < n) {\n awaitAtLeastNBytesAvailableForWrite(n)\n }\n }\n }\n }\n\n override fun endWriteSession(written: Int) {\n writable.afterHeadWrite()\n afterWrite(written)\n }\n\n override suspend fun readByte(): Byte {\n return if (readable.isNotEmpty) {\n readable.readByte().also { afterRead(1) }\n } else {\n readByteSlow()\n }\n }\n\n private fun checkClosed(n: Int) {\n if (closed) {\n throw closedCause ?: prematureClose(n)\n }\n }\n\n private fun prematureClose(n: Int): Exception {\n return EOFException(\"$n bytes required but EOF reached\")\n }\n\n private suspend fun readByteSlow(): Byte {\n do {\n awaitSuspend(1)\n\n if (readable.isNotEmpty) return readable.readByte().also { afterRead(1) }\n checkClosed(1)\n } while (true)\n }\n\n override suspend fun readShort(): Short {\n return if (readable.hasBytes(2)) {\n readable.readShort().reverseRead().also { afterRead(2) }\n } else {\n readShortSlow()\n }\n }\n\n private suspend fun readShortSlow(): Short {\n readNSlow(2) { return readable.readShort().reverseRead().also { afterRead(2) } }\n }\n\n @Deprecated(\"Consider providing consumed count of bytes\", level = DeprecationLevel.ERROR)\n protected fun afterRead() {\n afterRead(0)\n }\n\n protected fun afterRead(count: Int) {\n _totalBytesRead += count\n slot.resume()\n }\n\n @Suppress(\"NOTHING_TO_INLINE\", \"DEPRECATION_ERROR\")\n private inline fun Short.reverseRead(): Short = when {\n readByteOrder == ByteOrder.BIG_ENDIAN -> this\n else -> this.reverseByteOrder()\n }\n\n @Suppress(\"NOTHING_TO_INLINE\", \"DEPRECATION_ERROR\")\n private inline fun Int.reverseRead(): Int = when {\n readByteOrder == ByteOrder.BIG_ENDIAN -> this\n else -> this.reverseByteOrder()\n }\n\n @Suppress(\"NOTHING_TO_INLINE\", \"DEPRECATION_ERROR\")\n private inline fun Long.reverseRead(): Long = when {\n readByteOrder == ByteOrder.BIG_ENDIAN -> this\n else -> this.reverseByteOrder()\n }\n\n @Suppress(\"NOTHING_TO_INLINE\", \"DEPRECATION_ERROR\")\n private inline fun Float.reverseRead(): Float = when {\n readByteOrder == ByteOrder.BIG_ENDIAN -> this\n else -> this.reverseByteOrder()\n }\n\n @Suppress(\"NOTHING_TO_INLINE\", \"DEPRECATION_ERROR\")\n private inline fun Double.reverseRead(): Double = when {\n readByteOrder == ByteOrder.BIG_ENDIAN -> this\n else -> this.reverseByteOrder()\n }\n\n override suspend fun readInt(): Int {\n return if (readable.hasBytes(4)) {\n readable.readInt().reverseRead().also { afterRead(4) }\n } else {\n readIntSlow()\n }\n }\n\n private suspend fun readIntSlow(): Int {\n readNSlow(4) {\n return readable.readInt().reverseRead().also { afterRead(4) }\n }\n }\n\n override suspend fun readLong(): Long {\n return if (readable.hasBytes(8)) {\n readable.readLong().reverseRead().also { afterRead(8) }\n } else {\n readLongSlow()\n }\n }\n\n private suspend fun readLongSlow(): Long {\n readNSlow(8) {\n return readable.readLong().reverseRead().also { afterRead(8) }\n }\n }\n\n override suspend fun readFloat(): Float = if (readable.hasBytes(4)) {\n readable.readFloat().reverseRead().also { afterRead(4) }\n } else {\n readFloatSlow()\n }\n\n private suspend fun readFloatSlow(): Float {\n readNSlow(4) {\n return readable.readFloat().reverseRead().also { afterRead(4) }\n }\n }\n\n override suspend fun readDouble(): Double = if (readable.hasBytes(8)) {\n readable.readDouble().reverseRead().also { afterRead(8) }\n } else {\n readDoubleSlow()\n }\n\n private suspend fun readDoubleSlow(): Double {\n readNSlow(8) {\n return readable.readDouble().reverseRead().also { afterRead(8) }\n }\n }\n\n override suspend fun readRemaining(limit: Long, headerSizeHint: Int): ByteReadPacket {\n ensureNotFailed()\n\n val builder = BytePacketBuilder(headerSizeHint)\n\n val size = minOf(limit, readable.remaining)\n builder.writePacket(readable, size)\n val remaining = limit - builder.size\n\n return if (remaining == 0L || isClosedForRead) {\n afterRead(remaining.toInt())\n ensureNotFailed(builder)\n builder.build()\n } else {\n readRemainingSuspend(builder, limit)\n }\n }\n\n private suspend fun readRemainingSuspend(builder: BytePacketBuilder, limit: Long): ByteReadPacket {\n while (builder.size < limit) {\n val partLimit = minOf(limit - builder.size, readable.remaining)\n builder.writePacket(readable, partLimit)\n afterRead(partLimit.toInt())\n ensureNotFailed(builder)\n\n if (isClosedForRead || builder.size == limit.toInt()) {\n break\n }\n\n awaitSuspend(1)\n }\n\n ensureNotFailed(builder)\n return builder.build()\n }\n\n override suspend fun readPacket(size: Int, headerSizeHint: Int): ByteReadPacket {\n val builder = BytePacketBuilder(headerSizeHint)\n\n var remaining = size\n val partSize = minOf(remaining.toLong(), readable.remaining).toInt()\n remaining -= partSize\n builder.writePacket(readable, partSize)\n afterRead(partSize)\n\n return if (remaining > 0) readPacketSuspend(builder, remaining)\n else builder.build()\n }\n\n private suspend fun readPacketSuspend(builder: BytePacketBuilder, size: Int): ByteReadPacket {\n var remaining = size\n while (remaining > 0) {\n val partSize = minOf(remaining.toLong(), readable.remaining).toInt()\n remaining -= partSize\n builder.writePacket(readable, partSize)\n afterRead(partSize)\n\n if (remaining > 0) {\n awaitSuspend(1)\n }\n }\n\n return builder.build()\n }\n\n protected fun readAvailableClosed(): Int {\n closedCause?.let { throw it }\n return -1\n }\n\n override suspend fun readAvailable(dst: IoBuffer): Int = readAvailable(dst as Buffer)\n\n internal suspend fun readAvailable(dst: Buffer): Int = when {\n closedCause != null -> throw closedCause!!\n readable.canRead() -> {\n val size = minOf(dst.writeRemaining.toLong(), readable.remaining).toInt()\n readable.readFully(dst, size)\n afterRead(size)\n size\n }\n closed -> readAvailableClosed()\n !dst.canWrite() -> 0\n else -> readAvailableSuspend(dst)\n }\n\n private suspend fun readAvailableSuspend(dst: Buffer): Int {\n awaitSuspend(1)\n return readAvailable(dst)\n }\n\n override suspend fun readFully(dst: IoBuffer, n: Int) {\n readFully(dst as Buffer, n)\n }\n\n private suspend fun readFully(dst: Buffer, n: Int) {\n require(n <= dst.writeRemaining) { \"Not enough space in the destination buffer to write $n bytes\" }\n require(n >= 0) { \"n shouldn't be negative\" }\n\n return when {\n closedCause != null -> throw closedCause!!\n readable.remaining >= n -> readable.readFully(dst, n).also { afterRead(n) }\n closed -> throw EOFException(\n \"Channel is closed and not enough bytes available: required $n but $availableForRead available\"\n )\n else -> readFullySuspend(dst, n)\n }\n }\n\n private suspend fun readFullySuspend(dst: Buffer, n: Int) {\n awaitSuspend(n)\n return readFully(dst, n)\n }\n\n override suspend fun readAvailable(dst: ByteArray, offset: Int, length: Int): Int = when {\n readable.canRead() -> {\n val size = minOf(length.toLong(), readable.remaining).toInt()\n readable.readFully(dst, offset, size)\n afterRead(size)\n size\n }\n closed -> readAvailableClosed()\n else -> readAvailableSuspend(dst, offset, length)\n }\n\n private suspend fun readAvailableSuspend(dst: ByteArray, offset: Int, length: Int): Int {\n awaitSuspend(1)\n return readAvailable(dst, offset, length)\n }\n\n override suspend fun readFully(dst: ByteArray, offset: Int, length: Int) {\n val rc = readAvailable(dst, offset, length)\n if (rc == length) return\n if (rc == -1) throw EOFException(\"Unexpected end of stream\")\n\n return readFullySuspend(dst, offset + rc, length - rc)\n }\n\n private suspend fun readFullySuspend(dst: ByteArray, offset: Int, length: Int) {\n var written = 0\n\n while (written < length) {\n val rc = readAvailable(dst, offset + written, length - written)\n if (rc == -1) throw EOFException(\"Unexpected end of stream\")\n written += rc\n }\n }\n\n override suspend fun readBoolean(): Boolean {\n return if (readable.canRead()) (readable.readByte() == 1.toByte()).also { afterRead(1) }\n else readBooleanSlow()\n }\n\n private suspend fun readBooleanSlow(): Boolean {\n awaitSuspend(1)\n checkClosed(1)\n return readBoolean()\n }\n\n private var lastReadAvailable: Int\n get() = state.lastReadAvailable\n set(value) {\n state.lastReadAvailable = value\n }\n\n private var lastReadView: ChunkBuffer\n get() = state.lastReadView\n set(value) {\n state.lastReadView = value\n }\n\n private fun completeReading() {\n val remaining = lastReadView.readRemaining\n val delta = lastReadAvailable - remaining\n if (lastReadView !== Buffer.Empty) {\n readable.completeReadHead(lastReadView)\n }\n if (delta > 0) {\n afterRead(delta)\n }\n lastReadAvailable = 0\n lastReadView = ChunkBuffer.Empty\n }\n\n override suspend fun await(atLeast: Int): Boolean {\n require(atLeast >= 0) { \"atLeast parameter shouldn't be negative: $atLeast\" }\n require(atLeast <= EXPECTED_CAPACITY) {\n \"atLeast parameter shouldn't be larger than max buffer size of $EXPECTED_CAPACITY: $atLeast\"\n }\n\n completeReading()\n\n if (atLeast == 0) return !isClosedForRead\n if (readable.remaining >= atLeast) return true\n\n return awaitSuspend(atLeast)\n }\n\n internal suspend fun awaitInternalAtLeast1(): Boolean = if (readable.isNotEmpty) {\n true\n } else {\n awaitSuspend(1)\n }\n\n protected suspend fun awaitSuspend(atLeast: Int): Boolean {\n require(atLeast >= 0)\n\n awaitAtLeastNBytesAvailableForRead(atLeast)\n prepareFlushedBytes()\n\n closedCause?.let { throw it }\n return !isClosedForRead && availableForRead >= atLeast\n }\n\n override fun discard(n: Int): Int {\n closedCause?.let { throw it }\n\n if (n == 0) {\n return 0\n }\n\n return readable.discard(n).also {\n afterRead(n)\n requestNextView(1)\n }\n }\n\n override fun request(atLeast: Int): IoBuffer? {\n closedCause?.let { throw it }\n\n completeReading()\n\n return requestNextView(atLeast)\n }\n\n private fun requestNextView(atLeast: Int): IoBuffer? {\n if (readable.isEmpty) {\n prepareFlushedBytes()\n }\n\n val view = readable.prepareReadHead(atLeast) as IoBuffer?\n\n if (view == null) {\n lastReadView = ChunkBuffer.Empty\n lastReadAvailable = 0\n } else {\n lastReadView = view\n lastReadAvailable = view.readRemaining\n }\n\n return view\n }\n\n override suspend fun discard(max: Long): Long {\n val discarded = readable.discard(max)\n\n return if (discarded == max || isClosedForRead) {\n ensureNotFailed()\n return discarded\n } else {\n discardSuspend(max, discarded)\n }\n }\n\n private suspend fun discardSuspend(max: Long, discarded0: Long): Long {\n var discarded = discarded0\n\n do {\n if (!await(1)) break\n discarded += readable.discard(max - discarded)\n } while (discarded < max && !isClosedForRead)\n\n ensureNotFailed()\n\n return discarded\n }\n\n @Suppress(\"DEPRECATION\")\n @Deprecated(\"Use read instead.\")\n override fun readSession(consumer: ReadSession.() -> Unit) {\n try {\n consumer(this)\n } finally {\n completeReading()\n }\n }\n\n override fun startReadSession(): SuspendableReadSession = this\n\n override fun endReadSession() {\n completeReading()\n }\n\n @Suppress(\"DEPRECATION\")\n @Deprecated(\"Use read instead.\")\n override suspend fun readSuspendableSession(consumer: suspend SuspendableReadSession.() -> Unit) {\n try {\n consumer(this)\n } finally {\n completeReading()\n }\n }\n\n override suspend fun readUTF8LineTo(out: A, limit: Int): Boolean {\n if (isClosedForRead) {\n val cause = closedCause\n if (cause != null) {\n throw cause\n }\n\n return false\n }\n @OptIn(DangerousInternalIoApi::class)\n return decodeUTF8LineLoopSuspend(out, limit) { size ->\n afterRead(size)\n if (await(size)) readable\n else null\n }\n }\n\n override suspend fun readUTF8Line(limit: Int): String? {\n val sb = StringBuilder()\n if (!readUTF8LineTo(sb, limit)) {\n return null\n }\n\n return sb.toString()\n }\n\n override fun cancel(cause: Throwable?): Boolean {\n if (closedCause != null || closed) {\n return false\n }\n\n return close(cause ?: io.ktor.utils.io.CancellationException(\"Channel cancelled\"))\n }\n\n override fun close(cause: Throwable?): Boolean {\n if (closed || closedCause != null) return false\n closedCause = cause\n closed = true\n if (cause != null) {\n readable.release()\n writable.release()\n flushBuffer.release()\n } else {\n flush()\n }\n\n slot.cancel(cause)\n return true\n }\n\n internal fun transferTo(dst: ByteChannelSequentialBase, limit: Long): Long {\n val size = readable.remaining\n return if (size <= limit) {\n dst.writable.writePacket(readable)\n dst.afterWrite(size.toInt())\n afterRead(size.toInt())\n size\n } else {\n 0\n }\n }\n\n private suspend inline fun readNSlow(n: Int, block: () -> Nothing): Nothing {\n do {\n awaitSuspend(n)\n\n if (readable.hasBytes(n)) block()\n checkClosed(n)\n } while (true)\n }\n\n @Suppress(\"DEPRECATION\")\n private suspend fun writeAvailableSuspend(src: IoBuffer): Int {\n awaitAtLeastNBytesAvailableForWrite(1)\n return writeAvailable(src)\n }\n\n private suspend fun writeAvailableSuspend(src: ByteArray, offset: Int, length: Int): Int {\n awaitAtLeastNBytesAvailableForWrite(1)\n return writeAvailable(src, offset, length)\n }\n\n @Deprecated(\"Consider providing written count of bytes\", level = DeprecationLevel.ERROR)\n protected fun afterWrite() {\n afterWrite(0)\n }\n\n protected fun afterWrite(count: Int) {\n _totalBytesWritten += count\n\n if (closed) {\n writable.release()\n ensureNotClosed()\n }\n if (autoFlush || availableForWrite == 0) {\n flush()\n }\n }\n\n override suspend fun awaitFreeSpace() {\n flush()\n awaitAtLeastNBytesAvailableForWrite(1)\n ensureNotClosed()\n }\n\n final override suspend fun peekTo(\n destination: Memory,\n destinationOffset: Long,\n offset: Long,\n min: Long,\n max: Long\n ): Long {\n var bytesCopied = 0L\n\n @Suppress(\"DEPRECATION\")\n readSuspendableSession {\n val desiredSize = (min + offset).coerceAtMost(EXPECTED_CAPACITY).toInt()\n\n await(desiredSize)\n\n val buffer = request(1) ?: IoBuffer.Empty\n if (buffer.readRemaining > offset) {\n bytesCopied = minOf(buffer.readRemaining.toLong() - offset, max, destination.size - destinationOffset)\n buffer.memory.copyTo(destination, offset, bytesCopied, destinationOffset)\n }\n }\n\n return bytesCopied\n }\n}\n","package io.ktor.utils.io.charsets\n\nimport io.ktor.utils.io.core.*\nimport io.ktor.utils.io.core.internal.*\n\npublic expect abstract class Charset {\n @ExperimentalIoApi\n public abstract fun newEncoder(): CharsetEncoder\n\n @ExperimentalIoApi\n public abstract fun newDecoder(): CharsetDecoder\n\n public companion object {\n public fun forName(name: String): Charset\n }\n}\n\npublic expect val Charset.name: String\n\n// ----------------------------- ENCODER -------------------------------------------------------------------------------\n@ExperimentalIoApi\npublic expect abstract class CharsetEncoder\n\npublic expect val CharsetEncoder.charset: Charset\n\n@Deprecated(\n \"Use writeText on Output instead.\",\n ReplaceWith(\"dst.writeText(input, fromIndex, toIndex, charset)\", \"io.ktor.utils.io.core.writeText\")\n)\npublic fun CharsetEncoder.encode(input: CharSequence, fromIndex: Int, toIndex: Int, dst: Output) {\n encodeToImpl(dst, input, fromIndex, toIndex)\n}\n\n@ExperimentalIoApi\npublic expect fun CharsetEncoder.encodeToByteArray(\n input: CharSequence,\n fromIndex: Int = 0,\n toIndex: Int = input.length\n): ByteArray\n\n@Deprecated(\n \"Internal API. Will be hidden in future releases. Use encodeToByteArray instead.\",\n replaceWith = ReplaceWith(\"encodeToByteArray(input, fromIndex, toIndex)\")\n)\npublic fun CharsetEncoder.encodeToByteArrayImpl(\n input: CharSequence,\n fromIndex: Int = 0,\n toIndex: Int = input.length\n): ByteArray {\n return encodeToByteArray(input, fromIndex, toIndex)\n}\n\n@ExperimentalIoApi\npublic expect fun CharsetEncoder.encodeUTF8(input: ByteReadPacket, dst: Output)\n\n@ExperimentalIoApi\npublic fun CharsetEncoder.encode(\n input: CharSequence,\n fromIndex: Int = 0,\n toIndex: Int = input.length\n): ByteReadPacket = buildPacket {\n encodeToImpl(this, input, fromIndex, toIndex)\n}\n\n@ExperimentalIoApi\npublic fun CharsetEncoder.encodeUTF8(input: ByteReadPacket): ByteReadPacket = buildPacket {\n encodeUTF8(input, this)\n}\n\n@ExperimentalIoApi\npublic fun CharsetEncoder.encode(input: CharArray, fromIndex: Int, toIndex: Int, dst: Output) {\n var start = fromIndex\n\n if (start >= toIndex) return\n dst.writeWhileSize(1) { view: Buffer ->\n val rc = encodeArrayImpl(input, start, toIndex, view)\n check(rc >= 0)\n start += rc\n\n when {\n start >= toIndex -> 0\n rc == 0 -> 8\n else -> 1\n }\n }\n\n encodeCompleteImpl(dst)\n}\n\n// ----------------------------- DECODER -------------------------------------------------------------------------------\n\n@ExperimentalIoApi\npublic expect abstract class CharsetDecoder\n\n/**\n * Decoder's charset it is created for.\n */\npublic expect val CharsetDecoder.charset: Charset\n\n@ExperimentalIoApi\npublic fun CharsetDecoder.decode(input: Input, max: Int = Int.MAX_VALUE): String =\n buildString(minOf(max.toLong(), input.sizeEstimate()).toInt()) {\n decode(input, this, max)\n }\n\n@ExperimentalIoApi\npublic expect fun CharsetDecoder.decode(input: Input, dst: Appendable, max: Int): Int\n\n@ExperimentalIoApi\npublic expect fun CharsetDecoder.decodeExactBytes(input: Input, inputLength: Int): String\n\n// ----------------------------- REGISTRY ------------------------------------------------------------------------------\npublic expect object Charsets {\n public val UTF_8: Charset\n public val ISO_8859_1: Charset\n}\n\npublic expect open class MalformedInputException(message: String) : Throwable\n\npublic class TooLongLineException(message: String) : MalformedInputException(message)\n\n// ----------------------------- INTERNALS -----------------------------------------------------------------------------\n\ninternal fun CharsetEncoder.encodeArrayImpl(input: CharArray, fromIndex: Int, toIndex: Int, dst: Buffer): Int {\n val length = toIndex - fromIndex\n return encodeImpl(CharArraySequence(input, fromIndex, length), 0, length, dst)\n}\n\ninternal expect fun CharsetEncoder.encodeImpl(input: CharSequence, fromIndex: Int, toIndex: Int, dst: Buffer): Int\n\ninternal expect fun CharsetEncoder.encodeComplete(dst: Buffer): Boolean\n\ninternal expect fun CharsetDecoder.decodeBuffer(\n input: Buffer,\n out: Appendable,\n lastBuffer: Boolean,\n max: Int = Int.MAX_VALUE\n): Int\n\ninternal fun CharsetEncoder.encodeToByteArrayImpl1(\n input: CharSequence,\n fromIndex: Int = 0,\n toIndex: Int = input.length\n): ByteArray {\n var start = fromIndex\n if (start >= toIndex) return EmptyByteArray\n val single = ChunkBuffer.Pool.borrow()\n\n try {\n val rc = encodeImpl(input, start, toIndex, single)\n start += rc\n if (start == toIndex) {\n val result = ByteArray(single.readRemaining)\n single.readFully(result)\n return result\n }\n\n return buildPacket {\n appendSingleChunk(single.duplicate())\n encodeToImpl(this, input, start, toIndex)\n }.readBytes()\n } finally {\n single.release(ChunkBuffer.Pool)\n }\n}\n\ninternal fun Input.sizeEstimate(): Long = when (this) {\n is ByteReadPacket -> remaining\n is AbstractInput -> maxOf(remaining, 16)\n else -> 16\n}\n\nprivate fun CharsetEncoder.encodeCompleteImpl(dst: Output): Int {\n var size = 1\n var bytesWritten = 0\n\n dst.writeWhile { view ->\n val before = view.writeRemaining\n if (encodeComplete(view)) {\n size = 0\n } else {\n size++\n }\n bytesWritten += before - view.writeRemaining\n size > 0\n }\n\n return bytesWritten\n}\n\ninternal fun CharsetEncoder.encodeToImpl(\n destination: Output,\n input: CharSequence,\n fromIndex: Int,\n toIndex: Int\n): Int {\n var start = fromIndex\n if (start >= toIndex) return 0\n\n var bytesWritten = 0\n\n destination.writeWhileSize(1) { view: Buffer ->\n val before = view.writeRemaining\n val rc = encodeImpl(input, start, toIndex, view)\n check(rc >= 0)\n start += rc\n bytesWritten += before - view.writeRemaining\n\n when {\n start >= toIndex -> 0\n rc == 0 -> 8\n else -> 1\n }\n }\n\n bytesWritten += encodeCompleteImpl(destination)\n return bytesWritten\n}\n","@file:Suppress(\"NOTHING_TO_INLINE\")\n\npackage io.ktor.utils.io.bits\n\nimport io.ktor.utils.io.core.internal.*\n\npublic actual inline fun Memory.loadShortAt(offset: Int): Short = view.getInt16(offset, false)\n\npublic actual inline fun Memory.loadShortAt(offset: Long): Short = loadShortAt(offset.toIntOrFail(\"offset\"))\n\npublic actual inline fun Memory.loadIntAt(offset: Int): Int = view.getInt32(offset, false)\n\npublic actual inline fun Memory.loadIntAt(offset: Long): Int = loadIntAt(offset.toIntOrFail(\"offset\"))\n\npublic actual inline fun Memory.loadLongAt(offset: Int): Long =\n (view.getUint32(offset, false).toLong() shl 32) or\n view.getUint32(offset + 4, false).toLong()\n\npublic actual inline fun Memory.loadLongAt(offset: Long): Long = loadLongAt(offset.toIntOrFail(\"offset\"))\n\npublic actual inline fun Memory.loadFloatAt(offset: Int): Float = view.getFloat32(offset, false)\n\npublic actual inline fun Memory.loadFloatAt(offset: Long): Float = loadFloatAt(offset.toIntOrFail(\"offset\"))\n\npublic actual inline fun Memory.loadDoubleAt(offset: Int): Double = view.getFloat64(offset, false)\n\npublic actual inline fun Memory.loadDoubleAt(offset: Long): Double = loadDoubleAt(offset.toIntOrFail(\"offset\"))\n\n/**\n * Write regular signed 32bit integer in the network byte order (Big Endian)\n */\npublic actual inline fun Memory.storeIntAt(offset: Int, value: Int) {\n view.setInt32(offset, value, littleEndian = false)\n}\n\n/**\n * Write regular signed 32bit integer in the network byte order (Big Endian)\n */\npublic actual inline fun Memory.storeIntAt(offset: Long, value: Int) {\n view.setInt32(offset.toIntOrFail(\"offset\"), value, littleEndian = false)\n}\n\n/**\n * Write short signed 16bit integer in the network byte order (Big Endian)\n */\npublic actual inline fun Memory.storeShortAt(offset: Int, value: Short) {\n view.setInt16(offset, value, littleEndian = false)\n}\n\n/**\n * Write short signed 16bit integer in the network byte order (Big Endian)\n */\npublic actual inline fun Memory.storeShortAt(offset: Long, value: Short) {\n view.setInt16(offset.toIntOrFail(\"offset\"), value, littleEndian = false)\n}\n\n/**\n * Write short signed 64bit integer in the network byte order (Big Endian)\n */\npublic actual inline fun Memory.storeLongAt(offset: Int, value: Long) {\n view.setInt32(offset, (value shr 32).toInt(), littleEndian = false)\n view.setInt32(offset + 4, (value and 0xffffffffL).toInt(), littleEndian = false)\n}\n\n/**\n * Write short signed 64bit integer in the network byte order (Big Endian)\n */\npublic actual inline fun Memory.storeLongAt(offset: Long, value: Long) {\n storeLongAt(offset.toIntOrFail(\"offset\"), value)\n}\n\n/**\n * Write short signed 32bit floating point number in the network byte order (Big Endian)\n */\npublic actual inline fun Memory.storeFloatAt(offset: Int, value: Float) {\n view.setFloat32(offset, value, littleEndian = false)\n}\n\n/**\n * Write short signed 32bit floating point number in the network byte order (Big Endian)\n */\npublic actual inline fun Memory.storeFloatAt(offset: Long, value: Float) {\n view.setFloat32(offset.toIntOrFail(\"offset\"), value, littleEndian = false)\n}\n\n/**\n * Write short signed 64bit floating point number in the network byte order (Big Endian)\n */\npublic actual inline fun Memory.storeDoubleAt(offset: Int, value: Double) {\n view.setFloat64(offset, value, littleEndian = false)\n}\n\n/**\n * Write short signed 64bit floating point number in the network byte order (Big Endian)\n */\npublic actual inline fun Memory.storeDoubleAt(offset: Long, value: Double) {\n view.setFloat64(offset.toIntOrFail(\"offset\"), value, littleEndian = false)\n}\n","package io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.Memory\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readFully(dst: ByteArray, offset: Int = 0, length: Int = dst.size - offset) {\n readFullyBytesTemplate(offset, length) { src, dstOffset, count ->\n src.readFully(dst, dstOffset, count)\n }.requireNoRemaining()\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readFully(dst: ShortArray, offset: Int = 0, length: Int = dst.size - offset) {\n readFullyTemplate(offset, length, 2) { src, dstOffset, count ->\n src.readFully(dst, dstOffset, count)\n }.requireNoRemaining()\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readFully(dst: IntArray, offset: Int = 0, length: Int = dst.size - offset) {\n readFullyTemplate(offset, length, 4) { src, dstOffset, count ->\n src.readFully(dst, dstOffset, count)\n }.requireNoRemaining()\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readFully(dst: LongArray, offset: Int = 0, length: Int = dst.size - offset) {\n readFullyTemplate(offset, length, 8) { src, dstOffset, count ->\n src.readFully(dst, dstOffset, count)\n }.requireNoRemaining()\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readFully(dst: FloatArray, offset: Int = 0, length: Int = dst.size - offset) {\n readFullyTemplate(offset, length, 4) { src, dstOffset, count ->\n src.readFully(dst, dstOffset, count)\n }.requireNoRemaining()\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readFully(dst: DoubleArray, offset: Int = 0, length: Int = dst.size - offset) {\n readFullyTemplate(offset, length, 8) { src, dstOffset, count ->\n src.readFully(dst, dstOffset, count)\n }.requireNoRemaining()\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readFully(dst: Buffer, length: Int = dst.writeRemaining) {\n readFullyBytesTemplate(0, length) { src, _, count ->\n src.readFully(dst, count)\n }.requireNoRemaining()\n}\n\npublic fun Input.readFully(destination: Memory, destinationOffset: Int, length: Int) {\n readFully(destination, destinationOffset.toLong(), length.toLong())\n}\n\npublic fun Input.readFully(destination: Memory, destinationOffset: Long, length: Long) {\n if (readAvailable(destination, destinationOffset, length) != length) {\n prematureEndOfStream(length)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readAvailable(dst: ByteArray, offset: Int = 0, length: Int = dst.size - offset): Int {\n return length - readFullyBytesTemplate(offset, length) { src, dstOffset, count ->\n src.readFully(dst, dstOffset, count)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readAvailable(dst: ShortArray, offset: Int = 0, length: Int = dst.size - offset): Int {\n return length - readFullyTemplate(offset, length, 2) { src, dstOffset, count ->\n src.readFully(dst, dstOffset, count)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readAvailable(dst: IntArray, offset: Int = 0, length: Int = dst.size - offset): Int {\n return length - readFullyTemplate(offset, length, 4) { src, dstOffset, count ->\n src.readFully(dst, dstOffset, count)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readAvailable(dst: LongArray, offset: Int = 0, length: Int = dst.size - offset): Int {\n return length - readFullyTemplate(offset, length, 8) { src, dstOffset, count ->\n src.readFully(dst, dstOffset, count)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readAvailable(dst: FloatArray, offset: Int = 0, length: Int = dst.size - offset): Int {\n return length - readFullyTemplate(offset, length, 4) { src, dstOffset, count ->\n src.readFully(dst, dstOffset, count)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readAvailable(dst: DoubleArray, offset: Int = 0, length: Int = dst.size - offset): Int {\n return length - readFullyTemplate(offset, length, 8) { src, dstOffset, count ->\n src.readFully(dst, dstOffset, count)\n }\n}\n\npublic fun Input.readAvailable(dst: Buffer, length: Int = dst.writeRemaining): Int {\n return length - readFullyBytesTemplate(0, length) { src, _, count ->\n src.readFully(dst, count)\n }\n}\n\npublic fun Input.readAvailable(destination: Memory, destinationOffset: Int, length: Int): Int {\n return readAvailable(destination, destinationOffset.toLong(), length.toLong()).toInt()\n}\n\npublic fun Input.readAvailable(destination: Memory, destinationOffset: Long, length: Long): Long {\n val remaining = readFullyBytesTemplate(destinationOffset, length) { src, srcOffset, dstOffset, count ->\n src.copyTo(destination, srcOffset, count.toLong(), dstOffset)\n }\n val result = length - remaining\n return when {\n result == 0L && endOfInput -> -1\n else -> result\n }\n}\n\n/**\n * @return number of bytes remaining or 0 if all [length] bytes were copied\n */\nprivate inline fun Input.readFullyBytesTemplate(\n initialDstOffset: Int,\n length: Int,\n readBlock: (src: Buffer, dstOffset: Int, count: Int) -> Unit\n): Int {\n var remaining = length\n var dstOffset = initialDstOffset\n\n takeWhile { buffer ->\n val count = minOf(remaining, buffer.readRemaining)\n readBlock(buffer, dstOffset, count)\n remaining -= count\n dstOffset += count\n\n remaining > 0\n }\n\n return remaining\n}\n\n/**\n * @return number of bytes remaining or 0 if all [length] bytes were copied\n */\nprivate inline fun Input.readFullyBytesTemplate(\n initialDstOffset: Long,\n length: Long,\n readBlock: (src: Memory, srcOffset: Long, dstOffset: Long, count: Int) -> Unit\n): Long {\n var remaining = length\n var dstOffset = initialDstOffset\n\n takeWhile { buffer ->\n val count = minOf(remaining, buffer.readRemaining.toLong()).toInt()\n readBlock(buffer.memory, buffer.readPosition.toLong(), dstOffset, count)\n buffer.discardExact(count)\n remaining -= count\n dstOffset += count\n\n remaining > 0\n }\n\n return remaining\n}\n\n/**\n * @return number of elements remaining or 0 if all [length] elements were copied\n */\nprivate inline fun Input.readFullyTemplate(\n offset: Int,\n length: Int,\n componentSize: Int,\n readBlock: (src: Buffer, dstOffset: Int, count: Int) -> Unit\n): Int {\n var remaining = length\n var dstOffset = offset\n\n takeWhileSize { buffer ->\n val count = minOf(remaining, buffer.readRemaining / componentSize)\n readBlock(buffer, dstOffset, count)\n remaining -= count\n dstOffset += count\n\n when {\n remaining > 0 -> componentSize\n else -> 0\n }\n }\n\n return remaining\n}\n\n@Suppress(\"NOTHING_TO_INLINE\")\nprivate inline fun Int.requireNoRemaining() {\n if (this > 0) {\n prematureEndOfStream(this)\n }\n}\n","package io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.Memory\nimport io.ktor.utils.io.core.internal.*\nimport io.ktor.utils.io.pool.*\nimport kotlin.contracts.*\n\n/**\n * A read-write facade to actual buffer of fixed size. Multiple views could share the same actual buffer.\n * Concurrent unsafe. The only concurrent-safe operation is [release].\n * In most cases [ByteReadPacket] and [BytePacketBuilder] should be used instead.\n */\n@Suppress(\"DIFFERENT_NAMES_FOR_THE_SAME_PARAMETER_IN_SUPERTYPES\", \"DEPRECATION\")\n@Deprecated(\"Use Memory, Input or Output instead.\")\npublic expect class IoBuffer : Input, Output, ChunkBuffer {\n\n @Suppress(\"ConvertSecondaryConstructorToPrimary\")\n public constructor(memory: Memory, origin: ChunkBuffer?)\n\n @Deprecated(\n \"Not supported anymore. All operations are big endian by default. \" +\n \"Read/write with readXXXLittleEndian/writeXXXLittleEndian or \" +\n \"do readXXX/writeXXX with X.reverseByteOrder() instead.\",\n level = DeprecationLevel.ERROR\n )\n final override var byteOrder: ByteOrder\n\n override fun close()\n\n final override fun flush()\n\n public fun release(pool: ObjectPool)\n\n @Suppress(\"DEPRECATION\")\n public companion object {\n /**\n * Number of bytes usually reserved in the end of chunk\n * when several instances of [ChunkBuffer] are connected into a chain (usually inside of [ByteReadPacket]\n * or [BytePacketBuilder])\n */\n @DangerousInternalIoApi\n public val ReservedSize: Int\n\n /**\n * The empty buffer singleton: it has zero capacity for read and write.\n */\n public val Empty: IoBuffer\n\n /**\n * The default buffer pool\n */\n public val Pool: ObjectPool\n\n /**\n * Pool that always instantiates new buffers instead of reusing it\n */\n public val NoPool: ObjectPool\n\n /**\n * A pool that always returns [IoBuffer.Empty]\n */\n public val EmptyPool: ObjectPool\n }\n}\n\n/**\n * Read the specified number of bytes specified (optional, read all remaining by default)\n */\npublic fun Buffer.readBytes(count: Int = readRemaining): ByteArray {\n if (count == 0) {\n return EmptyByteArray\n }\n\n val result = ByteArray(count)\n readFully(result)\n return result\n}\n\n@Suppress(\"DEPRECATION\")\ninternal fun IoBuffer.releaseImpl(pool: ObjectPool) {\n if (release()) {\n val origin = origin\n if (origin is IoBuffer) {\n unlink()\n origin.release(pool)\n } else {\n pool.recycle(this)\n }\n }\n}\n\n@Suppress(\"DEPRECATION\", \"DEPRECATION_ERROR\")\ninternal object EmptyBufferPoolImpl : NoPoolImpl() {\n override fun borrow() = IoBuffer.Empty\n}\n\ninternal tailrec fun ChunkBuffer?.releaseAll(pool: ObjectPool) {\n if (this == null) return\n val next = cleanNext()\n release(pool)\n next.releaseAll(pool)\n}\n\ninternal inline fun ChunkBuffer.forEachChunk(block: (ChunkBuffer) -> Unit) {\n contract {\n callsInPlace(block, InvocationKind.AT_LEAST_ONCE)\n }\n var current = this\n do {\n block(current)\n current = current.next ?: break\n } while (true)\n}\n\n/**\n * Copy every element of the chain starting from this and setup next links.\n */\ninternal fun ChunkBuffer.copyAll(): ChunkBuffer {\n val copied = duplicate()\n val next = this.next ?: return copied\n\n return next.copyAll(copied, copied)\n}\n\nprivate tailrec fun ChunkBuffer.copyAll(head: ChunkBuffer, prev: ChunkBuffer): ChunkBuffer {\n val copied = duplicate()\n prev.next = copied\n\n val next = this.next ?: return head\n\n return next.copyAll(head, copied)\n}\n\ninternal tailrec fun ChunkBuffer.findTail(): ChunkBuffer {\n val next = this.next ?: return this\n return next.findTail()\n}\n\n/**\n * Summarize remainings of all elements of the chain\n */\n@DangerousInternalIoApi\npublic fun ChunkBuffer.remainingAll(): Long = remainingAll(0L)\n\n@Suppress(\"DEPRECATION\", \"UNUSED\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\npublic fun remainingAll(buffer: IoBuffer): Long = buffer.remainingAll()\n\nprivate tailrec fun ChunkBuffer.remainingAll(n: Long): Long {\n val rem = readRemaining.toLong() + n\n val next = this.next ?: return rem\n\n return next.remainingAll(rem)\n}\n\ninternal tailrec fun ChunkBuffer.isEmpty(): Boolean {\n if (readRemaining > 0) return false\n val next = this.next ?: return true\n return next.isEmpty()\n}\n\n@Suppress(\"NOTHING_TO_INLINE\")\ninternal inline fun Long.coerceAtMostMaxInt(): Int = minOf(this, Int.MAX_VALUE.toLong()).toInt()\n\n@Suppress(\"NOTHING_TO_INLINE\")\ninternal inline fun Long.coerceAtMostMaxIntOrFail(message: String): Int {\n if (this > Int.MAX_VALUE.toLong()) throw IllegalArgumentException(message)\n return this.toInt()\n}\n\ninternal fun Buffer.peekTo(destination: Memory, destinationOffset: Long, offset: Long, min: Long, max: Long): Long {\n val size = minOf(\n destination.size - destinationOffset,\n max,\n readRemaining.toLong()\n )\n\n memory.copyTo(\n destination,\n readPosition + offset,\n size,\n destinationOffset\n )\n\n return size\n}\n\npublic class BufferLimitExceededException(message: String) : Exception(message)\n","package io.ktor.utils.io.core.internal\n\nimport kotlin.contracts.*\n\n@PublishedApi\ninternal inline fun require(condition: Boolean, crossinline message: () -> String) {\n contract {\n returns() implies condition\n }\n\n if (!condition) {\n val m = object : RequireFailureCapture() {\n override fun doFail(): Nothing {\n throw IllegalArgumentException(message())\n }\n }\n m.doFail()\n }\n}\n\n@PublishedApi\ninternal abstract class RequireFailureCapture {\n abstract fun doFail(): Nothing\n}\n","package io.ktor.utils.io\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.*\n\n/**\n * Channel for asynchronous writing of sequences of bytes.\n * This is a **single-writer channel**.\n *\n * Operations on this channel cannot be invoked concurrently, unless explicitly specified otherwise\n * in description. Exceptions are [close] and [flush].\n */\npublic expect interface ByteWriteChannel {\n /**\n * Returns number of bytes that can be written without suspension. Write operations do no suspend and return\n * immediately when this number is at least the number of bytes requested for write.\n */\n public val availableForWrite: Int\n\n /**\n * Returns `true` is channel has been closed and attempting to write to the channel will cause an exception.\n */\n public val isClosedForWrite: Boolean\n\n /**\n * Returns `true` if channel flushes automatically all pending bytes after every write function call.\n * If `false` then flush only happens at manual [flush] invocation or when the buffer is full.\n */\n public val autoFlush: Boolean\n\n /**\n * Byte order that is used for multi-byte write operations\n * (such as [writeShort], [writeInt], [writeLong], [writeFloat], and [writeDouble]).\n */\n @Deprecated(\n \"Setting byte order is no longer supported. Read/write in big endian and use reverseByteOrder() extensions.\",\n level = DeprecationLevel.ERROR\n )\n public var writeByteOrder: ByteOrder\n\n /**\n * Number of bytes written to the channel.\n * It is not guaranteed to be atomic so could be updated in the middle of write operation.\n */\n public val totalBytesWritten: Long\n\n /**\n * An closure cause exception or `null` if closed successfully or not yet closed\n */\n public val closedCause: Throwable?\n\n /**\n * Writes as much as possible and only suspends if buffer is full\n */\n public suspend fun writeAvailable(src: ByteArray, offset: Int, length: Int): Int\n\n public suspend fun writeAvailable(src: IoBuffer): Int\n\n /**\n * Writes all [src] bytes and suspends until all bytes written. Causes flush if buffer filled up or when [autoFlush]\n * Crashes if channel get closed while writing.\n */\n public suspend fun writeFully(src: ByteArray, offset: Int, length: Int)\n\n public suspend fun writeFully(src: IoBuffer)\n\n public suspend fun writeFully(src: Buffer)\n\n public suspend fun writeFully(memory: Memory, startIndex: Int, endIndex: Int)\n\n @Suppress(\"DEPRECATION\")\n @Deprecated(\"Use write { } instead.\")\n public suspend fun writeSuspendSession(visitor: suspend WriterSuspendSession.() -> Unit)\n\n /**\n * Writes a [packet] fully or fails if channel get closed before the whole packet has been written\n */\n public suspend fun writePacket(packet: ByteReadPacket)\n\n /**\n * Writes long number and suspends until written.\n * Crashes if channel get closed while writing.\n */\n public suspend fun writeLong(l: Long)\n\n /**\n * Writes int number and suspends until written.\n * Crashes if channel get closed while writing.\n */\n public suspend fun writeInt(i: Int)\n\n /**\n * Writes short number and suspends until written.\n * Crashes if channel get closed while writing.\n */\n public suspend fun writeShort(s: Short)\n\n /**\n * Writes byte and suspends until written.\n * Crashes if channel get closed while writing.\n */\n public suspend fun writeByte(b: Byte)\n\n /**\n * Writes double number and suspends until written.\n * Crashes if channel get closed while writing.\n */\n public suspend fun writeDouble(d: Double)\n\n /**\n * Writes float number and suspends until written.\n * Crashes if channel get closed while writing.\n */\n public suspend fun writeFloat(f: Float)\n\n /**\n * Invokes [block] when at least 1 byte is available for write.\n */\n @ExperimentalIoApi\n public suspend fun awaitFreeSpace()\n\n /**\n * Closes this channel with an optional exceptional [cause].\n * It flushes all pending write bytes (via [flush]).\n * This is an idempotent operation -- repeated invocations of this function have no effect and return `false`.\n *\n * A channel that was closed without a [cause], is considered to be _closed normally_.\n * A channel that was closed with non-null [cause] is called a _failed channel_. Attempts to read or\n * write on a failed channel throw this cause exception.\n *\n * After invocation of this operation [isClosedForWrite] starts returning `true` and\n * all subsequent write operations throw [ClosedWriteChannelException] or the specified [cause].\n * However, [isClosedForRead][ByteReadChannel.isClosedForRead] on the side of [ByteReadChannel]\n * starts returning `true` only after all written bytes have been read.\n *\n * Please note that if the channel has been closed with cause and it has been provided by [reader] or [writer]\n * coroutine then the corresponding coroutine will be cancelled with [cause]. If no [cause] provided then no\n * cancellation will be propagated.\n */\n public fun close(cause: Throwable?): Boolean\n\n /**\n * Flushes all pending write bytes making them available for read.\n *\n * This function is thread-safe and can be invoked in any thread at any time.\n * It does nothing when invoked on a closed channel.\n */\n public fun flush()\n}\n\npublic suspend fun ByteWriteChannel.writeAvailable(src: ByteArray): Int = writeAvailable(src, 0, src.size)\npublic suspend fun ByteWriteChannel.writeFully(src: ByteArray): Unit = writeFully(src, 0, src.size)\n\npublic suspend fun ByteWriteChannel.writeShort(s: Int) {\n return writeShort((s and 0xffff).toShort())\n}\n\npublic suspend fun ByteWriteChannel.writeShort(s: Int, byteOrder: ByteOrder) {\n return writeShort((s and 0xffff).toShort(), byteOrder)\n}\n\npublic suspend fun ByteWriteChannel.writeByte(b: Int) {\n return writeByte((b and 0xff).toByte())\n}\n\npublic suspend fun ByteWriteChannel.writeInt(i: Long) {\n return writeInt(i.toInt())\n}\n\npublic suspend fun ByteWriteChannel.writeInt(i: Long, byteOrder: ByteOrder) {\n return writeInt(i.toInt(), byteOrder)\n}\n\n/**\n * Closes this channel with no failure (successfully)\n */\npublic fun ByteWriteChannel.close(): Boolean = close(null)\n\npublic suspend fun ByteWriteChannel.writeStringUtf8(s: CharSequence) {\n val packet = buildPacket {\n writeStringUtf8(s)\n }\n\n return writePacket(packet)\n}\n\n/*\nTODO\npublic suspend fun ByteWriteChannel.writeStringUtf8(s: CharBuffer) {\n val packet = buildPacket {\n writeStringUtf8(s)\n }\n\n return writePacket(packet)\n}*/\n\npublic suspend fun ByteWriteChannel.writeStringUtf8(s: String) {\n val packet = buildPacket {\n writeText(s)\n }\n\n return writePacket(packet)\n}\n\npublic suspend fun ByteWriteChannel.writeBoolean(b: Boolean) {\n return writeByte(if (b) 1 else 0)\n}\n\n/**\n * Writes UTF16 character\n */\npublic suspend fun ByteWriteChannel.writeChar(ch: Char) {\n return writeShort(ch.toInt())\n}\n\npublic suspend inline fun ByteWriteChannel.writePacket(headerSizeHint: Int = 0, builder: BytePacketBuilder.() -> Unit) {\n return writePacket(buildPacket(headerSizeHint, builder))\n}\n\npublic suspend fun ByteWriteChannel.writePacketSuspend(builder: suspend BytePacketBuilder.() -> Unit) {\n return writePacket(buildPacket { builder() })\n}\n\n/**\n * Indicates attempt to write on [isClosedForWrite][ByteWriteChannel.isClosedForWrite] channel\n * that was closed without a cause. A _failed_ channel rethrows the original [close][ByteWriteChannel.close] cause\n * exception on send attempts.\n */\npublic class ClosedWriteChannelException(message: String?) : CancellationException(message)\n","package io.ktor.utils.io\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.*\n\npublic suspend inline fun ByteReadChannel.readShort(byteOrder: ByteOrder): Short {\n return readShort().reverseIfNeeded(byteOrder) { reverseByteOrder() }\n}\n\npublic suspend inline fun ByteReadChannel.readInt(byteOrder: ByteOrder): Int {\n return readInt().reverseIfNeeded(byteOrder) { reverseByteOrder() }\n}\n\npublic suspend inline fun ByteReadChannel.readLong(byteOrder: ByteOrder): Long {\n return readLong().reverseIfNeeded(byteOrder) { reverseByteOrder() }\n}\n\npublic suspend inline fun ByteReadChannel.readFloat(byteOrder: ByteOrder): Float {\n return readFloat().reverseIfNeeded(byteOrder) { reverseByteOrder() }\n}\n\npublic suspend inline fun ByteReadChannel.readDouble(byteOrder: ByteOrder): Double {\n return readDouble().reverseIfNeeded(byteOrder) { reverseByteOrder() }\n}\n\npublic suspend inline fun ByteReadChannel.readShortLittleEndian(): Short {\n return toLittleEndian(readShort()) { reverseByteOrder() }\n}\n\npublic suspend inline fun ByteReadChannel.readIntLittleEndian(): Int {\n return toLittleEndian(readInt()) { reverseByteOrder() }\n}\n\npublic suspend inline fun ByteReadChannel.readLongLittleEndian(): Long {\n return toLittleEndian(readLong()) { reverseByteOrder() }\n}\n\npublic suspend inline fun ByteReadChannel.readFloatLittleEndian(): Float {\n return toLittleEndian(readFloat()) { reverseByteOrder() }\n}\n\npublic suspend inline fun ByteReadChannel.readDoubleLittleEndian(): Double {\n return toLittleEndian(readDouble()) { reverseByteOrder() }\n}\n\npublic suspend fun ByteWriteChannel.writeShort(value: Short, byteOrder: ByteOrder) {\n writeShort(value.reverseIfNeeded(byteOrder) { reverseByteOrder() })\n}\n\npublic suspend fun ByteWriteChannel.writeInt(value: Int, byteOrder: ByteOrder) {\n writeInt(value.reverseIfNeeded(byteOrder) { reverseByteOrder() })\n}\n\npublic suspend fun ByteWriteChannel.writeLong(value: Long, byteOrder: ByteOrder) {\n writeLong(value.reverseIfNeeded(byteOrder) { reverseByteOrder() })\n}\n\npublic suspend fun ByteWriteChannel.writeFloat(value: Float, byteOrder: ByteOrder) {\n writeFloat(value.reverseIfNeeded(byteOrder) { reverseByteOrder() })\n}\n\npublic suspend fun ByteWriteChannel.writeDouble(value: Double, byteOrder: ByteOrder) {\n writeDouble(value.reverseIfNeeded(byteOrder) { reverseByteOrder() })\n}\n\npublic suspend fun ByteWriteChannel.writeShortLittleEndian(value: Short) {\n writeShort(toLittleEndian(value) { reverseByteOrder() })\n}\n\npublic suspend fun ByteWriteChannel.writeIntLittleEndian(value: Int) {\n writeInt(toLittleEndian(value) { reverseByteOrder() })\n}\n\npublic suspend fun ByteWriteChannel.writeLongLittleEndian(value: Long) {\n writeLong(toLittleEndian(value) { reverseByteOrder() })\n}\n\npublic suspend fun ByteWriteChannel.writeFloatLittleEndian(value: Float) {\n writeFloat(toLittleEndian(value) { reverseByteOrder() })\n}\n\npublic suspend fun ByteWriteChannel.writeDoubleLittleEndian(value: Double) {\n writeDouble(toLittleEndian(value) { reverseByteOrder() })\n}\n\n@PublishedApi\n@Suppress(\"DEPRECATION_ERROR\")\ninternal inline fun ByteReadChannel.toLittleEndian(value: T, reverseBlock: T.() -> T): T {\n return when (readByteOrder) {\n ByteOrder.LITTLE_ENDIAN -> value\n else -> value.reverseBlock()\n }\n}\n\n@Suppress(\"DEPRECATION_ERROR\")\nprivate inline fun ByteWriteChannel.toLittleEndian(value: T, reverseBlock: T.() -> T): T {\n return when (writeByteOrder) {\n ByteOrder.LITTLE_ENDIAN -> value\n else -> value.reverseBlock()\n }\n}\n\n@PublishedApi\ninternal inline fun T.reverseIfNeeded(byteOrder: ByteOrder, reverseBlock: T.() -> T): T {\n return when (byteOrder) {\n ByteOrder.BIG_ENDIAN -> this\n else -> reverseBlock()\n }\n}\n","package io.ktor.utils.io\n\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\n\n/**\n * A coroutine job that is reading from a byte channel\n */\npublic interface ReaderJob : Job {\n /**\n * A reference to the channel that this coroutine is reading from\n */\n public val channel: ByteWriteChannel\n}\n\n/**\n * A coroutine job that is writing to a byte channel\n */\npublic interface WriterJob : Job {\n /**\n * A reference to the channel that this coroutine is writing to\n */\n public val channel: ByteReadChannel\n}\n\npublic interface ReaderScope : CoroutineScope {\n public val channel: ByteReadChannel\n}\n\npublic interface WriterScope : CoroutineScope {\n public val channel: ByteWriteChannel\n}\n\npublic fun CoroutineScope.reader(\n coroutineContext: CoroutineContext = EmptyCoroutineContext,\n channel: ByteChannel,\n block: suspend ReaderScope.() -> Unit\n): ReaderJob = launchChannel(coroutineContext, channel, attachJob = false, block = block)\n\npublic fun CoroutineScope.reader(\n coroutineContext: CoroutineContext = EmptyCoroutineContext,\n autoFlush: Boolean = false,\n block: suspend ReaderScope.() -> Unit\n): ReaderJob = launchChannel(coroutineContext, ByteChannel(autoFlush), attachJob = true, block = block)\n\n@Deprecated(\"Use scope.reader instead\")\npublic fun reader(\n coroutineContext: CoroutineContext,\n channel: ByteChannel,\n parent: Job? = null,\n block: suspend ReaderScope.() -> Unit\n): ReaderJob {\n val newContext = if (parent != null) GlobalScope.newCoroutineContext(coroutineContext + parent)\n else GlobalScope.newCoroutineContext(coroutineContext)\n\n return CoroutineScope(newContext).reader(EmptyCoroutineContext, channel, block)\n}\n\n@Suppress(\"DEPRECATION\")\n@Deprecated(\"Use scope.reader instead\")\npublic fun reader(\n coroutineContext: CoroutineContext,\n autoFlush: Boolean = false,\n parent: Job? = null,\n block: suspend ReaderScope.() -> Unit\n): ReaderJob {\n val channel = ByteChannel(autoFlush)\n return reader(coroutineContext, channel, parent, block).also {\n channel.attachJob(it)\n }\n}\n\npublic fun CoroutineScope.writer(\n coroutineContext: CoroutineContext = EmptyCoroutineContext,\n channel: ByteChannel,\n block: suspend WriterScope.() -> Unit\n): WriterJob = launchChannel(coroutineContext, channel, attachJob = false, block = block)\n\npublic fun CoroutineScope.writer(\n coroutineContext: CoroutineContext = EmptyCoroutineContext,\n autoFlush: Boolean = false,\n block: suspend WriterScope.() -> Unit\n): WriterJob = launchChannel(coroutineContext, ByteChannel(autoFlush), attachJob = true, block = block)\n\n@Deprecated(\"Use scope.writer instead\")\npublic fun writer(\n coroutineContext: CoroutineContext,\n channel: ByteChannel,\n parent: Job? = null,\n block: suspend WriterScope.() -> Unit\n): WriterJob {\n val newContext = if (parent != null) GlobalScope.newCoroutineContext(coroutineContext + parent)\n else GlobalScope.newCoroutineContext(coroutineContext)\n\n return CoroutineScope(newContext).writer(EmptyCoroutineContext, channel, block)\n}\n\n@Suppress(\"DEPRECATION\")\n@Deprecated(\"Use scope.writer instead\")\npublic fun writer(\n coroutineContext: CoroutineContext,\n autoFlush: Boolean = false,\n parent: Job? = null,\n block: suspend WriterScope.() -> Unit\n): WriterJob {\n val channel = ByteChannel(autoFlush)\n return writer(coroutineContext, channel, parent, block).also {\n channel.attachJob(it)\n }\n}\n\n/**\n * @param S not exactly safe (unchecked cast is used) so should be [ReaderScope] or [WriterScope]\n */\n@OptIn(ExperimentalStdlibApi::class)\nprivate fun CoroutineScope.launchChannel(\n context: CoroutineContext,\n channel: ByteChannel,\n attachJob: Boolean,\n block: suspend S.() -> Unit\n): ChannelJob {\n val dispatcher = coroutineContext[CoroutineDispatcher]\n val job = launch(context) {\n if (attachJob) {\n channel.attachJob(coroutineContext[Job]!!)\n }\n\n @Suppress(\"UNCHECKED_CAST\")\n val scope = ChannelScope(this, channel) as S\n\n try {\n block(scope)\n } catch (cause: Throwable) {\n if (dispatcher != Dispatchers.Unconfined && dispatcher != null) {\n throw cause\n }\n\n channel.cancel(cause)\n }\n }\n\n job.invokeOnCompletion { cause ->\n channel.close(cause)\n }\n\n return ChannelJob(job, channel)\n}\n\nprivate class ChannelScope(\n delegate: CoroutineScope,\n override val channel: ByteChannel\n) : ReaderScope, WriterScope, CoroutineScope by delegate\n\nprivate class ChannelJob(\n private val delegate: Job,\n override val channel: ByteChannel\n) : ReaderJob, WriterJob, Job by delegate {\n override fun toString(): String = \"ChannelJob[$delegate]\"\n}\n","package io.ktor.utils.io\n\nimport io.ktor.utils.io.bits.Memory\nimport io.ktor.utils.io.core.*\nimport io.ktor.utils.io.core.internal.*\n\n/**\n * Await until at least [desiredSize] is available for read or EOF and invoke [block] function. The block function\n * should never capture a provided [Memory] instance outside otherwise an undefined behaviour may occur including\n * accidental crash or data corruption. Block function should return number of bytes consumed or 0.\n *\n * Specifying [desiredSize] larger than the channel's capacity leads to block function invocation earlier\n * when the channel is full. So specifying too big [desiredSize] is identical to specifying [desiredSize] equal to\n * the channel's capacity. The other case when a provided memory range could be less than [desiredSize] is that\n * all the requested bytes couldn't be represented as a single memory range due to internal implementation reasons.\n *\n * @return number of bytes consumed, possibly 0\n */\n@ExperimentalIoApi\npublic suspend inline fun ByteReadChannel.read(\n desiredSize: Int = 1,\n block: (source: Memory, start: Long, endExclusive: Long) -> Int\n): Int {\n val buffer = requestBuffer(desiredSize) ?: Buffer.Empty\n\n try {\n val bytesRead = block(buffer.memory, buffer.readPosition.toLong(), buffer.writePosition.toLong())\n completeReadingFromBuffer(buffer, bytesRead)\n return bytesRead\n } catch (cause: Throwable) {\n completeReadingFromBuffer(buffer, 0)\n throw cause\n }\n\n // we don't use finally here because of KT-37279\n}\n\n@Deprecated(\"Use read { } instead.\")\npublic interface ReadSession {\n /**\n * Number of bytes available for read. However it doesn't necessarily means that all available bytes could be\n * requested at once\n */\n public val availableForRead: Int\n\n /**\n * Discard at most [n] available bytes or 0 if no bytes available yet\n * @return number of bytes actually discarded, could be 0\n */\n public fun discard(n: Int): Int\n\n /**\n * Request buffer range [atLeast] bytes length\n *\n * There are the following reasons for this function to return `null`:\n * - not enough bytes available yet (should be at least `atLeast` bytes available)\n * - due to buffer fragmentation it is impossible to represent the requested range as a single buffer range\n * - end of stream encountered and all bytes were consumed\n *\n * @return buffer for the requested range or `null` if it is impossible to provide such a buffer view\n * @throws Throwable if the channel has been closed with an exception or cancelled\n */\n @Suppress(\"DEPRECATION\")\n public fun request(atLeast: Int = 1): IoBuffer?\n}\n\n@Suppress(\"DEPRECATION\")\n@Deprecated(\"Use read { } instead.\")\npublic interface SuspendableReadSession : ReadSession {\n /**\n * Suspend until [atLeast] bytes become available or end of stream encountered (possibly due to exceptional close)\n *\n * @return true if there are [atLeast] bytes available or false if end of stream encountered (there still could be\n * bytes available but less than [atLeast])\n * @throws Throwable if the channel has been closed with an exception or cancelled\n * @throws IllegalArgumentException if [atLeast] is negative to too big (usually bigger that 4088)\n */\n public suspend fun await(atLeast: Int = 1): Boolean\n}\n\n@PublishedApi\ninternal suspend fun ByteReadChannel.requestBuffer(desiredSize: Int): Buffer? {\n @Suppress(\"DEPRECATION\")\n val readSession: SuspendableReadSession? = when {\n this is SuspendableReadSession -> this\n this is HasReadSession -> startReadSession()\n else -> null\n }\n\n if (readSession != null) {\n val buffer = readSession.request(desiredSize.coerceAtMost(Buffer.ReservedSize))\n if (buffer != null) {\n return buffer\n }\n\n return readSession.requestBufferSuspend(desiredSize)\n }\n\n return requestBufferFallback(desiredSize)\n}\n\n@PublishedApi\ninternal suspend fun ByteReadChannel.completeReadingFromBuffer(buffer: Buffer?, bytesRead: Int) {\n check(bytesRead >= 0) { \"bytesRead shouldn't be negative: $bytesRead\" }\n @Suppress(\"DEPRECATION\")\n val readSession: SuspendableReadSession? = readSessionFor()\n\n if (readSession != null) {\n readSession.discard(bytesRead)\n if (this is HasReadSession) {\n endReadSession()\n }\n return\n }\n\n if (buffer is ChunkBuffer && buffer !== ChunkBuffer.Empty) {\n buffer.release(ChunkBuffer.Pool)\n discard(bytesRead.toLong())\n }\n}\n\n@Suppress(\"DEPRECATION\")\nprivate suspend fun SuspendableReadSession.requestBufferSuspend(desiredSize: Int): Buffer? {\n await(desiredSize)\n return request(1)\n}\n\nprivate suspend fun ByteReadChannel.requestBufferFallback(desiredSize: Int): ChunkBuffer {\n val chunk = ChunkBuffer.Pool.borrow()\n val copied =\n peekTo(chunk.memory, chunk.writePosition.toLong(), 0L, desiredSize.toLong(), chunk.writeRemaining.toLong())\n chunk.commitWritten(copied.toInt())\n\n return chunk\n}\n\ninternal interface HasReadSession {\n @Suppress(\"DEPRECATION\")\n public fun startReadSession(): SuspendableReadSession\n\n public fun endReadSession()\n}\n\n@Suppress(\"DEPRECATION\", \"NOTHING_TO_INLINE\")\nprivate inline fun ByteReadChannel.readSessionFor(): SuspendableReadSession? = when {\n this is HasReadSession -> startReadSession()\n else -> null\n}\n","package io.ktor.utils.io\n\nimport io.ktor.utils.io.bits.Memory\nimport io.ktor.utils.io.core.*\nimport io.ktor.utils.io.core.internal.ChunkBuffer\n\n/**\n * Await for [desiredSpace] will be available for write and invoke [block] function providing [Memory] instance and\n * the corresponding range suitable for wiring in the memory. The block function should return number of bytes were\n * written, possibly 0.\n *\n * Similar to [ByteReadChannel.read], this function may invoke block function with lesser memory range when the\n * specified [desiredSpace] is bigger that the buffer's capacity\n * or when it is impossible to represent all [desiredSpace] bytes as a single memory range\n * due to internal implementation reasons.\n */\n@ExperimentalIoApi\npublic suspend inline fun ByteWriteChannel.write(\n desiredSpace: Int = 1,\n block: (freeSpace: Memory, startOffset: Long, endExclusive: Long) -> Int\n): Int {\n val buffer = requestWriteBuffer(desiredSpace) ?: Buffer.Empty\n var bytesWritten = 0\n try {\n bytesWritten = block(buffer.memory, buffer.writePosition.toLong(), buffer.limit.toLong())\n buffer.commitWritten(bytesWritten)\n return bytesWritten\n } finally {\n completeWriting(buffer, bytesWritten)\n }\n}\n\n@Suppress(\"DEPRECATION\")\n@Deprecated(\"Use writeMemory instead.\")\npublic interface WriterSession {\n public fun request(min: Int): IoBuffer?\n public fun written(n: Int)\n public fun flush()\n}\n\n@Suppress(\"DEPRECATION\")\n@Deprecated(\"Use writeMemory instead.\")\npublic interface WriterSuspendSession : WriterSession {\n public suspend fun tryAwait(n: Int)\n}\n\n@Suppress(\"DEPRECATION\")\ninternal interface HasWriteSession {\n public fun beginWriteSession(): WriterSuspendSession?\n public fun endWriteSession(written: Int)\n}\n\n@PublishedApi\ninternal suspend fun ByteWriteChannel.requestWriteBuffer(desiredSpace: Int): Buffer? {\n val session = writeSessionFor()\n if (session != null) {\n val buffer = session.request(desiredSpace)\n if (buffer != null) {\n return buffer\n }\n\n return writeBufferSuspend(session, desiredSpace)\n }\n\n return writeBufferFallback()\n}\n\n@PublishedApi\ninternal suspend fun ByteWriteChannel.completeWriting(buffer: Buffer, written: Int) {\n if (this is HasWriteSession) {\n endWriteSession(written)\n return\n }\n\n return completeWritingFallback(buffer)\n}\n\n@Suppress(\"DEPRECATION\")\nprivate suspend fun ByteWriteChannel.completeWritingFallback(buffer: Buffer) {\n if (buffer is IoBuffer) {\n writeFully(buffer)\n buffer.release(IoBuffer.Pool)\n return\n }\n\n throw UnsupportedOperationException(\"Only IoBuffer instance is supported.\")\n}\n\n@Suppress(\"DEPRECATION\")\nprivate suspend fun writeBufferSuspend(session: WriterSuspendSession, desiredSpace: Int): Buffer? {\n session.tryAwait(desiredSpace)\n return session.request(desiredSpace) ?: session.request(1)\n}\n\nprivate fun writeBufferFallback(): Buffer? {\n return ChunkBuffer.Pool.borrow().also { it.resetForWrite(); it.reserveEndGap(Buffer.ReservedSize) }\n}\n\n@Suppress(\"DEPRECATION\", \"NOTHING_TO_INLINE\")\nprivate inline fun ByteWriteChannel.writeSessionFor(): WriterSuspendSession? = when {\n this is HasWriteSession -> beginWriteSession()\n else -> null\n}\n","package io.ktor.utils.io.core.internal\n\n@PublishedApi\n@Suppress(\"NOTHING_TO_INLINE\")\ninternal inline fun Long.toIntOrFail(name: String): Int {\n if (this >= Int.MAX_VALUE) failLongToIntConversion(this, name)\n return toInt()\n}\n\n@PublishedApi\ninternal fun failLongToIntConversion(value: Long, name: String): Nothing =\n throw IllegalArgumentException(\"Long value $value of $name doesn't fit into 32-bit integer\")\n","@file:Suppress(\"NOTHING_TO_INLINE\")\n\npackage io.ktor.utils.io.bits\n\n/**\n * Read short signed 16bit integer in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.loadShortAt(offset: Int): Short\n\n/**\n * Read short signed 16bit integer in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.loadShortAt(offset: Long): Short\n\n/**\n * Write short signed 16bit integer in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.storeShortAt(offset: Int, value: Short)\n\n/**\n * Write short signed 16bit integer in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.storeShortAt(offset: Long, value: Short)\n\n/**\n * Read short unsigned 16bit integer in the network byte order (Big Endian)\n */\npublic inline fun Memory.loadUShortAt(offset: Int): UShort = loadShortAt(offset).toUShort()\n\n/**\n * Read short unsigned 16bit integer in the network byte order (Big Endian)\n */\npublic inline fun Memory.loadUShortAt(offset: Long): UShort = loadShortAt(offset).toUShort()\n\n/**\n * Write short unsigned 16bit integer in the network byte order (Big Endian)\n */\npublic inline fun Memory.storeUShortAt(offset: Int, value: UShort): Unit = storeShortAt(offset, value.toShort())\n\n/**\n * Write short unsigned 16bit integer in the network byte order (Big Endian)\n */\npublic inline fun Memory.storeUShortAt(offset: Long, value: UShort): Unit = storeShortAt(offset, value.toShort())\n\n/**\n * Read regular signed 32bit integer in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.loadIntAt(offset: Int): Int\n\n/**\n * Read regular signed 32bit integer in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.loadIntAt(offset: Long): Int\n\n/**\n * Write regular signed 32bit integer in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.storeIntAt(offset: Int, value: Int)\n\n/**\n * Write regular signed 32bit integer in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.storeIntAt(offset: Long, value: Int)\n\n/**\n * Read regular unsigned 32bit integer in the network byte order (Big Endian)\n */\npublic inline fun Memory.loadUIntAt(offset: Int): UInt = loadIntAt(offset).toUInt()\n\n/**\n * Read regular unsigned 32bit integer in the network byte order (Big Endian)\n */\npublic inline fun Memory.loadUIntAt(offset: Long): UInt = loadIntAt(offset).toUInt()\n\n/**\n * Write regular unsigned 32bit integer in the network byte order (Big Endian)\n */\npublic inline fun Memory.storeUIntAt(offset: Int, value: UInt): Unit = storeIntAt(offset, value.toInt())\n\n/**\n * Write regular unsigned 32bit integer in the network byte order (Big Endian)\n */\npublic inline fun Memory.storeUIntAt(offset: Long, value: UInt): Unit = storeIntAt(offset, value.toInt())\n\n/**\n * Read short signed 64bit integer in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.loadLongAt(offset: Int): Long\n\n/**\n * Read short signed 64bit integer in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.loadLongAt(offset: Long): Long\n\n/**\n * Write short signed 64bit integer in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.storeLongAt(offset: Int, value: Long)\n\n/**\n * write short signed 64bit integer in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.storeLongAt(offset: Long, value: Long)\n\n/**\n * Read short signed 64bit integer in the network byte order (Big Endian)\n */\npublic inline fun Memory.loadULongAt(offset: Int): ULong = loadLongAt(offset).toULong()\n\n/**\n * Read short signed 64bit integer in the network byte order (Big Endian)\n */\npublic inline fun Memory.loadULongAt(offset: Long): ULong = loadLongAt(offset).toULong()\n\n/**\n * Write short signed 64bit integer in the network byte order (Big Endian)\n */\npublic inline fun Memory.storeULongAt(offset: Int, value: ULong): Unit = storeLongAt(offset, value.toLong())\n\n/**\n * Write short signed 64bit integer in the network byte order (Big Endian)\n */\npublic inline fun Memory.storeULongAt(offset: Long, value: ULong): Unit = storeLongAt(offset, value.toLong())\n\n/**\n * Read short signed 32bit floating point number in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.loadFloatAt(offset: Int): Float\n\n/**\n * Read short signed 32bit floating point number in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.loadFloatAt(offset: Long): Float\n\n/**\n * Write short signed 32bit floating point number in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.storeFloatAt(offset: Int, value: Float)\n\n/**\n * Write short signed 32bit floating point number in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.storeFloatAt(offset: Long, value: Float)\n\n/**\n * Read short signed 64bit floating point number in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.loadDoubleAt(offset: Int): Double\n\n/**\n * Read short signed 64bit floating point number in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.loadDoubleAt(offset: Long): Double\n\n/**\n * Write short signed 64bit floating point number in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.storeDoubleAt(offset: Int, value: Double)\n\n/**\n * Write short signed 64bit floating point number in the network byte order (Big Endian)\n */\npublic expect inline fun Memory.storeDoubleAt(offset: Long, value: Double)\n","@file:Suppress(\"NOTHING_TO_INLINE\")\n\npackage io.ktor.utils.io.bits\n\n/**\n * Copies bytes from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset].\n */\npublic inline fun Memory.loadByteArray(\n offset: Int,\n destination: ByteArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n) {\n copyTo(destination, offset, count, destinationOffset)\n}\n\n/**\n * Copies unsigned shorts integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic inline fun Memory.loadByteArray(\n offset: Long,\n destination: ByteArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n) {\n copyTo(destination, offset, count, destinationOffset)\n}\n\n/**\n * Copies unsigned shorts integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic inline fun Memory.loadUByteArray(\n offset: Int,\n destination: UByteArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n) {\n copyTo(destination.asByteArray(), offset, count, destinationOffset)\n}\n\n/**\n * Copies unsigned shorts integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic inline fun Memory.loadUByteArray(\n offset: Long,\n destination: UByteArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n) {\n copyTo(destination.asByteArray(), offset, count, destinationOffset)\n}\n\n/**\n * Copies shorts integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic expect fun Memory.loadShortArray(\n offset: Int,\n destination: ShortArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n)\n\n/**\n * Copies shorts integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic expect fun Memory.loadShortArray(\n offset: Long,\n destination: ShortArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n)\n\n/**\n * Copies unsigned shorts integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic inline fun Memory.loadUShortArray(\n offset: Int,\n destination: UShortArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n) {\n loadShortArray(offset, destination.asShortArray(), destinationOffset, count)\n}\n\n/**\n * Copies unsigned shorts integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic inline fun Memory.loadUShortArray(\n offset: Long,\n destination: UShortArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n) {\n loadShortArray(offset, destination.asShortArray(), destinationOffset, count)\n}\n\n/**\n * Copies regular integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic expect fun Memory.loadIntArray(\n offset: Int,\n destination: IntArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n)\n\n/**\n * Copies regular integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic expect fun Memory.loadIntArray(\n offset: Long,\n destination: IntArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n)\n\n/**\n * Copies unsigned integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic inline fun Memory.loadUIntArray(\n offset: Int,\n destination: UIntArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n) {\n loadIntArray(offset, destination.asIntArray(), destinationOffset, count)\n}\n\n/**\n * Copies unsigned integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic inline fun Memory.loadUIntArray(\n offset: Long,\n destination: UIntArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n) {\n loadIntArray(offset, destination.asIntArray(), destinationOffset, count)\n}\n\n/**\n * Copies long integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic expect fun Memory.loadLongArray(\n offset: Int,\n destination: LongArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n)\n\n/**\n * Copies long integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic expect fun Memory.loadLongArray(\n offset: Long,\n destination: LongArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n)\n\n/**\n * Copies unsigned long integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic inline fun Memory.loadULongArray(\n offset: Int,\n destination: ULongArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n) {\n loadLongArray(offset, destination.asLongArray(), destinationOffset, count)\n}\n\n/**\n * Copies unsigned long integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic inline fun Memory.loadULongArray(\n offset: Long,\n destination: ULongArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n) {\n loadLongArray(offset, destination.asLongArray(), destinationOffset, count)\n}\n\n/**\n * Copies floating point numbers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic expect fun Memory.loadFloatArray(\n offset: Int,\n destination: FloatArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n)\n\n/**\n * Copies floating point numbers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic expect fun Memory.loadFloatArray(\n offset: Long,\n destination: FloatArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n)\n\n/**\n * Copies floating point numbers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic expect fun Memory.loadDoubleArray(\n offset: Int,\n destination: DoubleArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n)\n\n/**\n * Copies floating point numbers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic expect fun Memory.loadDoubleArray(\n offset: Long,\n destination: DoubleArray,\n destinationOffset: Int = 0,\n count: Int = destination.size - destinationOffset\n)\n\n/**\n * Copies unsigned shorts integers from the [source] array at [sourceOffset] to this memory at the specified [offset].\n * @param sourceOffset items\n */\npublic inline fun Memory.storeByteArray(\n offset: Int,\n source: ByteArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n) {\n source.useMemory(sourceOffset, count) { sourceMemory ->\n sourceMemory.copyTo(this, 0, count, offset)\n }\n}\n\n/**\n * Copies unsigned shorts integers from the [source] array at [sourceOffset] to this memory at the specified [offset].\n * @param sourceOffset items\n */\npublic inline fun Memory.storeByteArray(\n offset: Long,\n source: ByteArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n) {\n source.useMemory(sourceOffset, count) { sourceMemory ->\n sourceMemory.copyTo(this, 0L, count.toLong(), offset)\n }\n}\n\n/**\n * Copies unsigned shorts integers from the [source] array at [sourceOffset] to this memory at the specified [offset].\n * @param sourceOffset items\n */\npublic inline fun Memory.storeUByteArray(\n offset: Int,\n source: UByteArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n) {\n storeByteArray(offset, source.asByteArray(), sourceOffset, count)\n}\n\n/**\n * Copies unsigned shorts integers from the [source] array at [sourceOffset] to this memory at the specified [offset].\n * @param sourceOffset items\n */\npublic inline fun Memory.storeUByteArray(\n offset: Long,\n source: UByteArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n) {\n storeByteArray(offset, source.asByteArray(), sourceOffset, count)\n}\n\n/**\n * Copies shorts integers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic expect fun Memory.storeShortArray(\n offset: Int,\n source: ShortArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n)\n\n/**\n * Copies shorts integers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic expect fun Memory.storeShortArray(\n offset: Long,\n source: ShortArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n)\n\n/**\n * Copies unsigned shorts integers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic inline fun Memory.storeUShortArray(\n offset: Int,\n source: UShortArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n) {\n storeShortArray(offset, source.asShortArray(), sourceOffset, count)\n}\n\n/**\n * Copies unsigned shorts integers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic inline fun Memory.storeUShortArray(\n offset: Long,\n source: UShortArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n) {\n storeShortArray(offset, source.asShortArray(), sourceOffset, count)\n}\n\n/**\n * Copies regular integers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic expect fun Memory.storeIntArray(\n offset: Int,\n source: IntArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n)\n\n/**\n * Copies regular integers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic expect fun Memory.storeIntArray(\n offset: Long,\n source: IntArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n)\n\n/**\n * Copies unsigned integers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic inline fun Memory.storeUIntArray(\n offset: Int,\n source: UIntArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n) {\n storeIntArray(offset, source.asIntArray(), sourceOffset, count)\n}\n\n/**\n * Copies unsigned integers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic inline fun Memory.storeUIntArray(\n offset: Long,\n source: UIntArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n) {\n storeIntArray(offset, source.asIntArray(), sourceOffset, count)\n}\n\n/**\n * Copies long integers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic expect fun Memory.storeLongArray(\n offset: Int,\n source: LongArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n)\n\n/**\n * Copies long integers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic expect fun Memory.storeLongArray(\n offset: Long,\n source: LongArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n)\n\n/**\n * Copies unsigned long integers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic inline fun Memory.storeULongArray(\n offset: Int,\n source: ULongArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n) {\n storeLongArray(offset, source.asLongArray(), sourceOffset, count)\n}\n\n/**\n * Copies unsigned long integers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic inline fun Memory.storeULongArray(\n offset: Long,\n source: ULongArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n) {\n storeLongArray(offset, source.asLongArray(), sourceOffset, count)\n}\n\n/**\n * Copies floating point numbers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic expect fun Memory.storeFloatArray(\n offset: Int,\n source: FloatArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n)\n\n/**\n * Copies floating point numbers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic expect fun Memory.storeFloatArray(\n offset: Long,\n source: FloatArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n)\n\n/**\n * Copies floating point numbers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic expect fun Memory.storeDoubleArray(\n offset: Int,\n source: DoubleArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n)\n\n/**\n * Copies floating point numbers from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic expect fun Memory.storeDoubleArray(\n offset: Long,\n source: DoubleArray,\n sourceOffset: Int = 0,\n count: Int = source.size - sourceOffset\n)\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"UArraysKt\")\n@file:kotlin.jvm.JvmPackageName(\"kotlin.collections.unsigned\")\n\npackage kotlin.collections\n\n//\n// NOTE: THIS FILE IS AUTO-GENERATED by the GenerateStandardLib.kt\n// See: https://github.com/JetBrains/kotlin/tree/master/libraries/stdlib\n//\n\nimport kotlin.random.*\nimport kotlin.ranges.contains\nimport kotlin.ranges.reversed\n\n/**\n * Returns 1st *element* from the array.\n * \n * If the size of this array is less than 1, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UIntArray.component1(): UInt {\n return get(0)\n}\n\n/**\n * Returns 1st *element* from the array.\n * \n * If the size of this array is less than 1, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun ULongArray.component1(): ULong {\n return get(0)\n}\n\n/**\n * Returns 1st *element* from the array.\n * \n * If the size of this array is less than 1, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UByteArray.component1(): UByte {\n return get(0)\n}\n\n/**\n * Returns 1st *element* from the array.\n * \n * If the size of this array is less than 1, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UShortArray.component1(): UShort {\n return get(0)\n}\n\n/**\n * Returns 2nd *element* from the array.\n * \n * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UIntArray.component2(): UInt {\n return get(1)\n}\n\n/**\n * Returns 2nd *element* from the array.\n * \n * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun ULongArray.component2(): ULong {\n return get(1)\n}\n\n/**\n * Returns 2nd *element* from the array.\n * \n * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UByteArray.component2(): UByte {\n return get(1)\n}\n\n/**\n * Returns 2nd *element* from the array.\n * \n * If the size of this array is less than 2, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UShortArray.component2(): UShort {\n return get(1)\n}\n\n/**\n * Returns 3rd *element* from the array.\n * \n * If the size of this array is less than 3, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UIntArray.component3(): UInt {\n return get(2)\n}\n\n/**\n * Returns 3rd *element* from the array.\n * \n * If the size of this array is less than 3, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun ULongArray.component3(): ULong {\n return get(2)\n}\n\n/**\n * Returns 3rd *element* from the array.\n * \n * If the size of this array is less than 3, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UByteArray.component3(): UByte {\n return get(2)\n}\n\n/**\n * Returns 3rd *element* from the array.\n * \n * If the size of this array is less than 3, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UShortArray.component3(): UShort {\n return get(2)\n}\n\n/**\n * Returns 4th *element* from the array.\n * \n * If the size of this array is less than 4, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UIntArray.component4(): UInt {\n return get(3)\n}\n\n/**\n * Returns 4th *element* from the array.\n * \n * If the size of this array is less than 4, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun ULongArray.component4(): ULong {\n return get(3)\n}\n\n/**\n * Returns 4th *element* from the array.\n * \n * If the size of this array is less than 4, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UByteArray.component4(): UByte {\n return get(3)\n}\n\n/**\n * Returns 4th *element* from the array.\n * \n * If the size of this array is less than 4, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UShortArray.component4(): UShort {\n return get(3)\n}\n\n/**\n * Returns 5th *element* from the array.\n * \n * If the size of this array is less than 5, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UIntArray.component5(): UInt {\n return get(4)\n}\n\n/**\n * Returns 5th *element* from the array.\n * \n * If the size of this array is less than 5, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun ULongArray.component5(): ULong {\n return get(4)\n}\n\n/**\n * Returns 5th *element* from the array.\n * \n * If the size of this array is less than 5, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UByteArray.component5(): UByte {\n return get(4)\n}\n\n/**\n * Returns 5th *element* from the array.\n * \n * If the size of this array is less than 5, throws an [IndexOutOfBoundsException] except in Kotlin/JS\n * where the behavior is unspecified.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UShortArray.component5(): UShort {\n return get(4)\n}\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic expect fun UIntArray.elementAt(index: Int): UInt\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic expect fun ULongArray.elementAt(index: Int): ULong\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic expect fun UByteArray.elementAt(index: Int): UByte\n\n/**\n * Returns an element at the given [index] or throws an [IndexOutOfBoundsException] if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAt\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic expect fun UShortArray.elementAt(index: Int): UShort\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.elementAtOrElse(index: Int, defaultValue: (Int) -> UInt): UInt {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.elementAtOrElse(index: Int, defaultValue: (Int) -> ULong): ULong {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.elementAtOrElse(index: Int, defaultValue: (Int) -> UByte): UByte {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrElse\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.elementAtOrElse(index: Int, defaultValue: (Int) -> UShort): UShort {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.elementAtOrNull(index: Int): UInt? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.elementAtOrNull(index: Int): ULong? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.elementAtOrNull(index: Int): UByte? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.elementAtOrNull\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.elementAtOrNull(index: Int): UShort? {\n return this.getOrNull(index)\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.find(predicate: (UInt) -> Boolean): UInt? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.find(predicate: (ULong) -> Boolean): ULong? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.find(predicate: (UByte) -> Boolean): UByte? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.find(predicate: (UShort) -> Boolean): UShort? {\n return firstOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.findLast(predicate: (UInt) -> Boolean): UInt? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.findLast(predicate: (ULong) -> Boolean): ULong? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.findLast(predicate: (UByte) -> Boolean): UByte? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.find\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.findLast(predicate: (UShort) -> Boolean): UShort? {\n return lastOrNull(predicate)\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.first(): UInt {\n return storage.first().toUInt()\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.first(): ULong {\n return storage.first().toULong()\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.first(): UByte {\n return storage.first().toUByte()\n}\n\n/**\n * Returns first element.\n * @throws [NoSuchElementException] if the array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.first(): UShort {\n return storage.first().toUShort()\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.first(predicate: (UInt) -> Boolean): UInt {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.first(predicate: (ULong) -> Boolean): ULong {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.first(predicate: (UByte) -> Boolean): UByte {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element matching the given [predicate].\n * @throws [NoSuchElementException] if no such element is found.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.first(predicate: (UShort) -> Boolean): UShort {\n for (element in this) if (predicate(element)) return element\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the first element, or `null` if the array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.firstOrNull(): UInt? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first element, or `null` if the array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.firstOrNull(): ULong? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first element, or `null` if the array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.firstOrNull(): UByte? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first element, or `null` if the array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.firstOrNull(): UShort? {\n return if (isEmpty()) null else this[0]\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.firstOrNull(predicate: (UInt) -> Boolean): UInt? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.firstOrNull(predicate: (ULong) -> Boolean): ULong? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.firstOrNull(predicate: (UByte) -> Boolean): UByte? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns the first element matching the given [predicate], or `null` if element was not found.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.firstOrNull(predicate: (UShort) -> Boolean): UShort? {\n for (element in this) if (predicate(element)) return element\n return null\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.getOrElse(index: Int, defaultValue: (Int) -> UInt): UInt {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.getOrElse(index: Int, defaultValue: (Int) -> ULong): ULong {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.getOrElse(index: Int, defaultValue: (Int) -> UByte): UByte {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or the result of calling the [defaultValue] function if the [index] is out of bounds of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.getOrElse(index: Int, defaultValue: (Int) -> UShort): UShort {\n return if (index >= 0 && index <= lastIndex) get(index) else defaultValue(index)\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.getOrNull(index: Int): UInt? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.getOrNull(index: Int): ULong? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.getOrNull(index: Int): UByte? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns an element at the given [index] or `null` if the [index] is out of bounds of this array.\n * \n * @sample samples.collections.Collections.Elements.getOrNull\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.getOrNull(index: Int): UShort? {\n return if (index >= 0 && index <= lastIndex) get(index) else null\n}\n\n/**\n * Returns first index of [element], or -1 if the array does not contain element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.indexOf(element: UInt): Int {\n return storage.indexOf(element.toInt())\n}\n\n/**\n * Returns first index of [element], or -1 if the array does not contain element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.indexOf(element: ULong): Int {\n return storage.indexOf(element.toLong())\n}\n\n/**\n * Returns first index of [element], or -1 if the array does not contain element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.indexOf(element: UByte): Int {\n return storage.indexOf(element.toByte())\n}\n\n/**\n * Returns first index of [element], or -1 if the array does not contain element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.indexOf(element: UShort): Int {\n return storage.indexOf(element.toShort())\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.indexOfFirst(predicate: (UInt) -> Boolean): Int {\n return storage.indexOfFirst { predicate(it.toUInt()) }\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.indexOfFirst(predicate: (ULong) -> Boolean): Int {\n return storage.indexOfFirst { predicate(it.toULong()) }\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.indexOfFirst(predicate: (UByte) -> Boolean): Int {\n return storage.indexOfFirst { predicate(it.toUByte()) }\n}\n\n/**\n * Returns index of the first element matching the given [predicate], or -1 if the array does not contain such element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.indexOfFirst(predicate: (UShort) -> Boolean): Int {\n return storage.indexOfFirst { predicate(it.toUShort()) }\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.indexOfLast(predicate: (UInt) -> Boolean): Int {\n return storage.indexOfLast { predicate(it.toUInt()) }\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.indexOfLast(predicate: (ULong) -> Boolean): Int {\n return storage.indexOfLast { predicate(it.toULong()) }\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.indexOfLast(predicate: (UByte) -> Boolean): Int {\n return storage.indexOfLast { predicate(it.toUByte()) }\n}\n\n/**\n * Returns index of the last element matching the given [predicate], or -1 if the array does not contain such element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.indexOfLast(predicate: (UShort) -> Boolean): Int {\n return storage.indexOfLast { predicate(it.toUShort()) }\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.last(): UInt {\n return storage.last().toUInt()\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.last(): ULong {\n return storage.last().toULong()\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.last(): UByte {\n return storage.last().toUByte()\n}\n\n/**\n * Returns the last element.\n * \n * @throws NoSuchElementException if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.last(): UShort {\n return storage.last().toUShort()\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.last(predicate: (UInt) -> Boolean): UInt {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.last(predicate: (ULong) -> Boolean): ULong {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.last(predicate: (UByte) -> Boolean): UByte {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns the last element matching the given [predicate].\n * \n * @throws NoSuchElementException if no such element is found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.last(predicate: (UShort) -> Boolean): UShort {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n}\n\n/**\n * Returns last index of [element], or -1 if the array does not contain element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.lastIndexOf(element: UInt): Int {\n return storage.lastIndexOf(element.toInt())\n}\n\n/**\n * Returns last index of [element], or -1 if the array does not contain element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.lastIndexOf(element: ULong): Int {\n return storage.lastIndexOf(element.toLong())\n}\n\n/**\n * Returns last index of [element], or -1 if the array does not contain element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.lastIndexOf(element: UByte): Int {\n return storage.lastIndexOf(element.toByte())\n}\n\n/**\n * Returns last index of [element], or -1 if the array does not contain element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.lastIndexOf(element: UShort): Int {\n return storage.lastIndexOf(element.toShort())\n}\n\n/**\n * Returns the last element, or `null` if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.lastOrNull(): UInt? {\n return if (isEmpty()) null else this[size - 1]\n}\n\n/**\n * Returns the last element, or `null` if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.lastOrNull(): ULong? {\n return if (isEmpty()) null else this[size - 1]\n}\n\n/**\n * Returns the last element, or `null` if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.lastOrNull(): UByte? {\n return if (isEmpty()) null else this[size - 1]\n}\n\n/**\n * Returns the last element, or `null` if the array is empty.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.lastOrNull(): UShort? {\n return if (isEmpty()) null else this[size - 1]\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.lastOrNull(predicate: (UInt) -> Boolean): UInt? {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.lastOrNull(predicate: (ULong) -> Boolean): ULong? {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.lastOrNull(predicate: (UByte) -> Boolean): UByte? {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns the last element matching the given [predicate], or `null` if no such element was found.\n * \n * @sample samples.collections.Collections.Elements.last\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.lastOrNull(predicate: (UShort) -> Boolean): UShort? {\n for (index in this.indices.reversed()) {\n val element = this[index]\n if (predicate(element)) return element\n }\n return null\n}\n\n/**\n * Returns a random element from this array.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.random(): UInt {\n return random(Random)\n}\n\n/**\n * Returns a random element from this array.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.random(): ULong {\n return random(Random)\n}\n\n/**\n * Returns a random element from this array.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.random(): UByte {\n return random(Random)\n}\n\n/**\n * Returns a random element from this array.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.random(): UShort {\n return random(Random)\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.random(random: Random): UInt {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.random(random: Random): ULong {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.random(random: Random): UByte {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness.\n * \n * @throws NoSuchElementException if this array is empty.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.random(random: Random): UShort {\n if (isEmpty())\n throw NoSuchElementException(\"Array is empty.\")\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.randomOrNull(): UInt? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this array, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.randomOrNull(): ULong? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this array, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.randomOrNull(): UByte? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this array, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.randomOrNull(): UShort? {\n return randomOrNull(Random)\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\npublic fun UIntArray.randomOrNull(random: Random): UInt? {\n if (isEmpty())\n return null\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\npublic fun ULongArray.randomOrNull(random: Random): ULong? {\n if (isEmpty())\n return null\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\npublic fun UByteArray.randomOrNull(random: Random): UByte? {\n if (isEmpty())\n return null\n return get(random.nextInt(size))\n}\n\n/**\n * Returns a random element from this array using the specified source of randomness, or `null` if this array is empty.\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\npublic fun UShortArray.randomOrNull(random: Random): UShort? {\n if (isEmpty())\n return null\n return get(random.nextInt(size))\n}\n\n/**\n * Returns the single element, or throws an exception if the array is empty or has more than one element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.single(): UInt {\n return storage.single().toUInt()\n}\n\n/**\n * Returns the single element, or throws an exception if the array is empty or has more than one element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.single(): ULong {\n return storage.single().toULong()\n}\n\n/**\n * Returns the single element, or throws an exception if the array is empty or has more than one element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.single(): UByte {\n return storage.single().toUByte()\n}\n\n/**\n * Returns the single element, or throws an exception if the array is empty or has more than one element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.single(): UShort {\n return storage.single().toUShort()\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.single(predicate: (UInt) -> Boolean): UInt {\n var single: UInt? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Array contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as UInt\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.single(predicate: (ULong) -> Boolean): ULong {\n var single: ULong? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Array contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as ULong\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.single(predicate: (UByte) -> Boolean): UByte {\n var single: UByte? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Array contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as UByte\n}\n\n/**\n * Returns the single element matching the given [predicate], or throws exception if there is no or more than one matching element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.single(predicate: (UShort) -> Boolean): UShort {\n var single: UShort? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) throw IllegalArgumentException(\"Array contains more than one matching element.\")\n single = element\n found = true\n }\n }\n if (!found) throw NoSuchElementException(\"Array contains no element matching the predicate.\")\n @Suppress(\"UNCHECKED_CAST\")\n return single as UShort\n}\n\n/**\n * Returns single element, or `null` if the array is empty or has more than one element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.singleOrNull(): UInt? {\n return if (size == 1) this[0] else null\n}\n\n/**\n * Returns single element, or `null` if the array is empty or has more than one element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.singleOrNull(): ULong? {\n return if (size == 1) this[0] else null\n}\n\n/**\n * Returns single element, or `null` if the array is empty or has more than one element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.singleOrNull(): UByte? {\n return if (size == 1) this[0] else null\n}\n\n/**\n * Returns single element, or `null` if the array is empty or has more than one element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.singleOrNull(): UShort? {\n return if (size == 1) this[0] else null\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.singleOrNull(predicate: (UInt) -> Boolean): UInt? {\n var single: UInt? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.singleOrNull(predicate: (ULong) -> Boolean): ULong? {\n var single: ULong? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.singleOrNull(predicate: (UByte) -> Boolean): UByte? {\n var single: UByte? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns the single element matching the given [predicate], or `null` if element was not found or more than one element was found.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.singleOrNull(predicate: (UShort) -> Boolean): UShort? {\n var single: UShort? = null\n var found = false\n for (element in this) {\n if (predicate(element)) {\n if (found) return null\n single = element\n found = true\n }\n }\n if (!found) return null\n return single\n}\n\n/**\n * Returns a list containing all elements except first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.drop(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return takeLast((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.drop(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return takeLast((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.drop(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return takeLast((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.drop(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return takeLast((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.dropLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return take((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.dropLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return take((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.dropLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return take((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.dropLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n return take((size - n).coerceAtLeast(0))\n}\n\n/**\n * Returns a list containing all elements except last elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.dropLastWhile(predicate: (UInt) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return take(index + 1)\n }\n }\n return emptyList()\n}\n\n/**\n * Returns a list containing all elements except last elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.dropLastWhile(predicate: (ULong) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return take(index + 1)\n }\n }\n return emptyList()\n}\n\n/**\n * Returns a list containing all elements except last elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.dropLastWhile(predicate: (UByte) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return take(index + 1)\n }\n }\n return emptyList()\n}\n\n/**\n * Returns a list containing all elements except last elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.dropLastWhile(predicate: (UShort) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return take(index + 1)\n }\n }\n return emptyList()\n}\n\n/**\n * Returns a list containing all elements except first elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.dropWhile(predicate: (UInt) -> Boolean): List {\n var yielding = false\n val list = ArrayList()\n for (item in this)\n if (yielding)\n list.add(item)\n else if (!predicate(item)) {\n list.add(item)\n yielding = true\n }\n return list\n}\n\n/**\n * Returns a list containing all elements except first elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.dropWhile(predicate: (ULong) -> Boolean): List {\n var yielding = false\n val list = ArrayList()\n for (item in this)\n if (yielding)\n list.add(item)\n else if (!predicate(item)) {\n list.add(item)\n yielding = true\n }\n return list\n}\n\n/**\n * Returns a list containing all elements except first elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.dropWhile(predicate: (UByte) -> Boolean): List {\n var yielding = false\n val list = ArrayList()\n for (item in this)\n if (yielding)\n list.add(item)\n else if (!predicate(item)) {\n list.add(item)\n yielding = true\n }\n return list\n}\n\n/**\n * Returns a list containing all elements except first elements that satisfy the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.drop\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.dropWhile(predicate: (UShort) -> Boolean): List {\n var yielding = false\n val list = ArrayList()\n for (item in this)\n if (yielding)\n list.add(item)\n else if (!predicate(item)) {\n list.add(item)\n yielding = true\n }\n return list\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.filter(predicate: (UInt) -> Boolean): List {\n return filterTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.filter(predicate: (ULong) -> Boolean): List {\n return filterTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.filter(predicate: (UByte) -> Boolean): List {\n return filterTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.filter(predicate: (UShort) -> Boolean): List {\n return filterTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.filterIndexed(predicate: (index: Int, UInt) -> Boolean): List {\n return filterIndexedTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.filterIndexed(predicate: (index: Int, ULong) -> Boolean): List {\n return filterIndexedTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.filterIndexed(predicate: (index: Int, UByte) -> Boolean): List {\n return filterIndexedTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing only elements matching the given [predicate].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexed\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.filterIndexed(predicate: (index: Int, UShort) -> Boolean): List {\n return filterIndexedTo(ArrayList(), predicate)\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.filterIndexedTo(destination: C, predicate: (index: Int, UInt) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.filterIndexedTo(destination: C, predicate: (index: Int, ULong) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.filterIndexedTo(destination: C, predicate: (index: Int, UByte) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * @param [predicate] function that takes the index of an element and the element itself\n * and returns the result of predicate evaluation on the element.\n * \n * @sample samples.collections.Collections.Filtering.filterIndexedTo\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.filterIndexedTo(destination: C, predicate: (index: Int, UShort) -> Boolean): C {\n forEachIndexed { index, element ->\n if (predicate(index, element)) destination.add(element)\n }\n return destination\n}\n\n/**\n * Returns a list containing all elements not matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.filterNot(predicate: (UInt) -> Boolean): List {\n return filterNotTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing all elements not matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.filterNot(predicate: (ULong) -> Boolean): List {\n return filterNotTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing all elements not matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.filterNot(predicate: (UByte) -> Boolean): List {\n return filterNotTo(ArrayList(), predicate)\n}\n\n/**\n * Returns a list containing all elements not matching the given [predicate].\n * \n * @sample samples.collections.Collections.Filtering.filter\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.filterNot(predicate: (UShort) -> Boolean): List {\n return filterNotTo(ArrayList(), predicate)\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.filterNotTo(destination: C, predicate: (UInt) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.filterNotTo(destination: C, predicate: (ULong) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.filterNotTo(destination: C, predicate: (UByte) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements not matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.filterNotTo(destination: C, predicate: (UShort) -> Boolean): C {\n for (element in this) if (!predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.filterTo(destination: C, predicate: (UInt) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.filterTo(destination: C, predicate: (ULong) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.filterTo(destination: C, predicate: (UByte) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Appends all elements matching the given [predicate] to the given [destination].\n * \n * @sample samples.collections.Collections.Filtering.filterTo\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.filterTo(destination: C, predicate: (UShort) -> Boolean): C {\n for (element in this) if (predicate(element)) destination.add(element)\n return destination\n}\n\n/**\n * Returns a list containing elements at indices in the specified [indices] range.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.slice(indices: IntRange): List {\n if (indices.isEmpty()) return listOf()\n return copyOfRange(indices.start, indices.endInclusive + 1).asList()\n}\n\n/**\n * Returns a list containing elements at indices in the specified [indices] range.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.slice(indices: IntRange): List {\n if (indices.isEmpty()) return listOf()\n return copyOfRange(indices.start, indices.endInclusive + 1).asList()\n}\n\n/**\n * Returns a list containing elements at indices in the specified [indices] range.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.slice(indices: IntRange): List {\n if (indices.isEmpty()) return listOf()\n return copyOfRange(indices.start, indices.endInclusive + 1).asList()\n}\n\n/**\n * Returns a list containing elements at indices in the specified [indices] range.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.slice(indices: IntRange): List {\n if (indices.isEmpty()) return listOf()\n return copyOfRange(indices.start, indices.endInclusive + 1).asList()\n}\n\n/**\n * Returns a list containing elements at specified [indices].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.slice(indices: Iterable): List {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return emptyList()\n val list = ArrayList(size)\n for (index in indices) {\n list.add(get(index))\n }\n return list\n}\n\n/**\n * Returns a list containing elements at specified [indices].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.slice(indices: Iterable): List {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return emptyList()\n val list = ArrayList(size)\n for (index in indices) {\n list.add(get(index))\n }\n return list\n}\n\n/**\n * Returns a list containing elements at specified [indices].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.slice(indices: Iterable): List {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return emptyList()\n val list = ArrayList(size)\n for (index in indices) {\n list.add(get(index))\n }\n return list\n}\n\n/**\n * Returns a list containing elements at specified [indices].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.slice(indices: Iterable): List {\n val size = indices.collectionSizeOrDefault(10)\n if (size == 0) return emptyList()\n val list = ArrayList(size)\n for (index in indices) {\n list.add(get(index))\n }\n return list\n}\n\n/**\n * Returns an array containing elements of this array at specified [indices].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.sliceArray(indices: Collection): UIntArray {\n return UIntArray(storage.sliceArray(indices))\n}\n\n/**\n * Returns an array containing elements of this array at specified [indices].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.sliceArray(indices: Collection): ULongArray {\n return ULongArray(storage.sliceArray(indices))\n}\n\n/**\n * Returns an array containing elements of this array at specified [indices].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.sliceArray(indices: Collection): UByteArray {\n return UByteArray(storage.sliceArray(indices))\n}\n\n/**\n * Returns an array containing elements of this array at specified [indices].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.sliceArray(indices: Collection): UShortArray {\n return UShortArray(storage.sliceArray(indices))\n}\n\n/**\n * Returns an array containing elements at indices in the specified [indices] range.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.sliceArray(indices: IntRange): UIntArray {\n return UIntArray(storage.sliceArray(indices))\n}\n\n/**\n * Returns an array containing elements at indices in the specified [indices] range.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.sliceArray(indices: IntRange): ULongArray {\n return ULongArray(storage.sliceArray(indices))\n}\n\n/**\n * Returns an array containing elements at indices in the specified [indices] range.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.sliceArray(indices: IntRange): UByteArray {\n return UByteArray(storage.sliceArray(indices))\n}\n\n/**\n * Returns an array containing elements at indices in the specified [indices] range.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.sliceArray(indices: IntRange): UShortArray {\n return UShortArray(storage.sliceArray(indices))\n}\n\n/**\n * Returns a list containing first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.take(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n if (n >= size) return toList()\n if (n == 1) return listOf(this[0])\n var count = 0\n val list = ArrayList(n)\n for (item in this) {\n list.add(item)\n if (++count == n)\n break\n }\n return list\n}\n\n/**\n * Returns a list containing first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.take(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n if (n >= size) return toList()\n if (n == 1) return listOf(this[0])\n var count = 0\n val list = ArrayList(n)\n for (item in this) {\n list.add(item)\n if (++count == n)\n break\n }\n return list\n}\n\n/**\n * Returns a list containing first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.take(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n if (n >= size) return toList()\n if (n == 1) return listOf(this[0])\n var count = 0\n val list = ArrayList(n)\n for (item in this) {\n list.add(item)\n if (++count == n)\n break\n }\n return list\n}\n\n/**\n * Returns a list containing first [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.take(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n if (n >= size) return toList()\n if (n == 1) return listOf(this[0])\n var count = 0\n val list = ArrayList(n)\n for (item in this) {\n list.add(item)\n if (++count == n)\n break\n }\n return list\n}\n\n/**\n * Returns a list containing last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.takeLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n val size = size\n if (n >= size) return toList()\n if (n == 1) return listOf(this[size - 1])\n val list = ArrayList(n)\n for (index in size - n until size)\n list.add(this[index])\n return list\n}\n\n/**\n * Returns a list containing last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.takeLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n val size = size\n if (n >= size) return toList()\n if (n == 1) return listOf(this[size - 1])\n val list = ArrayList(n)\n for (index in size - n until size)\n list.add(this[index])\n return list\n}\n\n/**\n * Returns a list containing last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.takeLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n val size = size\n if (n >= size) return toList()\n if (n == 1) return listOf(this[size - 1])\n val list = ArrayList(n)\n for (index in size - n until size)\n list.add(this[index])\n return list\n}\n\n/**\n * Returns a list containing last [n] elements.\n * \n * @throws IllegalArgumentException if [n] is negative.\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.takeLast(n: Int): List {\n require(n >= 0) { \"Requested element count $n is less than zero.\" }\n if (n == 0) return emptyList()\n val size = size\n if (n >= size) return toList()\n if (n == 1) return listOf(this[size - 1])\n val list = ArrayList(n)\n for (index in size - n until size)\n list.add(this[index])\n return list\n}\n\n/**\n * Returns a list containing last elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.takeLastWhile(predicate: (UInt) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return drop(index + 1)\n }\n }\n return toList()\n}\n\n/**\n * Returns a list containing last elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.takeLastWhile(predicate: (ULong) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return drop(index + 1)\n }\n }\n return toList()\n}\n\n/**\n * Returns a list containing last elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.takeLastWhile(predicate: (UByte) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return drop(index + 1)\n }\n }\n return toList()\n}\n\n/**\n * Returns a list containing last elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.takeLastWhile(predicate: (UShort) -> Boolean): List {\n for (index in lastIndex downTo 0) {\n if (!predicate(this[index])) {\n return drop(index + 1)\n }\n }\n return toList()\n}\n\n/**\n * Returns a list containing first elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.takeWhile(predicate: (UInt) -> Boolean): List {\n val list = ArrayList()\n for (item in this) {\n if (!predicate(item))\n break\n list.add(item)\n }\n return list\n}\n\n/**\n * Returns a list containing first elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.takeWhile(predicate: (ULong) -> Boolean): List {\n val list = ArrayList()\n for (item in this) {\n if (!predicate(item))\n break\n list.add(item)\n }\n return list\n}\n\n/**\n * Returns a list containing first elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.takeWhile(predicate: (UByte) -> Boolean): List {\n val list = ArrayList()\n for (item in this) {\n if (!predicate(item))\n break\n list.add(item)\n }\n return list\n}\n\n/**\n * Returns a list containing first elements satisfying the given [predicate].\n * \n * @sample samples.collections.Collections.Transformations.take\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.takeWhile(predicate: (UShort) -> Boolean): List {\n val list = ArrayList()\n for (item in this) {\n if (!predicate(item))\n break\n list.add(item)\n }\n return list\n}\n\n/**\n * Reverses elements in the array in-place.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.reverse(): Unit {\n storage.reverse()\n}\n\n/**\n * Reverses elements in the array in-place.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.reverse(): Unit {\n storage.reverse()\n}\n\n/**\n * Reverses elements in the array in-place.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.reverse(): Unit {\n storage.reverse()\n}\n\n/**\n * Reverses elements in the array in-place.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.reverse(): Unit {\n storage.reverse()\n}\n\n/**\n * Reverses elements of the array in the specified range in-place.\n * \n * @param fromIndex the start of the range (inclusive) to reverse.\n * @param toIndex the end of the range (exclusive) to reverse.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.reverse(fromIndex: Int, toIndex: Int): Unit {\n storage.reverse(fromIndex, toIndex)\n}\n\n/**\n * Reverses elements of the array in the specified range in-place.\n * \n * @param fromIndex the start of the range (inclusive) to reverse.\n * @param toIndex the end of the range (exclusive) to reverse.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.reverse(fromIndex: Int, toIndex: Int): Unit {\n storage.reverse(fromIndex, toIndex)\n}\n\n/**\n * Reverses elements of the array in the specified range in-place.\n * \n * @param fromIndex the start of the range (inclusive) to reverse.\n * @param toIndex the end of the range (exclusive) to reverse.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.reverse(fromIndex: Int, toIndex: Int): Unit {\n storage.reverse(fromIndex, toIndex)\n}\n\n/**\n * Reverses elements of the array in the specified range in-place.\n * \n * @param fromIndex the start of the range (inclusive) to reverse.\n * @param toIndex the end of the range (exclusive) to reverse.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.reverse(fromIndex: Int, toIndex: Int): Unit {\n storage.reverse(fromIndex, toIndex)\n}\n\n/**\n * Returns a list with elements in reversed order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.reversed(): List {\n if (isEmpty()) return emptyList()\n val list = toMutableList()\n list.reverse()\n return list\n}\n\n/**\n * Returns a list with elements in reversed order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.reversed(): List {\n if (isEmpty()) return emptyList()\n val list = toMutableList()\n list.reverse()\n return list\n}\n\n/**\n * Returns a list with elements in reversed order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.reversed(): List {\n if (isEmpty()) return emptyList()\n val list = toMutableList()\n list.reverse()\n return list\n}\n\n/**\n * Returns a list with elements in reversed order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.reversed(): List {\n if (isEmpty()) return emptyList()\n val list = toMutableList()\n list.reverse()\n return list\n}\n\n/**\n * Returns an array with elements of this array in reversed order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.reversedArray(): UIntArray {\n return UIntArray(storage.reversedArray())\n}\n\n/**\n * Returns an array with elements of this array in reversed order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.reversedArray(): ULongArray {\n return ULongArray(storage.reversedArray())\n}\n\n/**\n * Returns an array with elements of this array in reversed order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.reversedArray(): UByteArray {\n return UByteArray(storage.reversedArray())\n}\n\n/**\n * Returns an array with elements of this array in reversed order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.reversedArray(): UShortArray {\n return UShortArray(storage.reversedArray())\n}\n\n/**\n * Randomly shuffles elements in this array in-place.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.shuffle(): Unit {\n shuffle(Random)\n}\n\n/**\n * Randomly shuffles elements in this array in-place.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.shuffle(): Unit {\n shuffle(Random)\n}\n\n/**\n * Randomly shuffles elements in this array in-place.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.shuffle(): Unit {\n shuffle(Random)\n}\n\n/**\n * Randomly shuffles elements in this array in-place.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.shuffle(): Unit {\n shuffle(Random)\n}\n\n/**\n * Randomly shuffles elements in this array in-place using the specified [random] instance as the source of randomness.\n * \n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.shuffle(random: Random): Unit {\n for (i in lastIndex downTo 1) {\n val j = random.nextInt(i + 1)\n val copy = this[i]\n this[i] = this[j]\n this[j] = copy\n }\n}\n\n/**\n * Randomly shuffles elements in this array in-place using the specified [random] instance as the source of randomness.\n * \n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.shuffle(random: Random): Unit {\n for (i in lastIndex downTo 1) {\n val j = random.nextInt(i + 1)\n val copy = this[i]\n this[i] = this[j]\n this[j] = copy\n }\n}\n\n/**\n * Randomly shuffles elements in this array in-place using the specified [random] instance as the source of randomness.\n * \n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.shuffle(random: Random): Unit {\n for (i in lastIndex downTo 1) {\n val j = random.nextInt(i + 1)\n val copy = this[i]\n this[i] = this[j]\n this[j] = copy\n }\n}\n\n/**\n * Randomly shuffles elements in this array in-place using the specified [random] instance as the source of randomness.\n * \n * See: https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.shuffle(random: Random): Unit {\n for (i in lastIndex downTo 1) {\n val j = random.nextInt(i + 1)\n val copy = this[i]\n this[i] = this[j]\n this[j] = copy\n }\n}\n\n/**\n * Sorts elements in the array in-place descending according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.sortDescending(): Unit {\n if (size > 1) {\n sort()\n reverse()\n }\n}\n\n/**\n * Sorts elements in the array in-place descending according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.sortDescending(): Unit {\n if (size > 1) {\n sort()\n reverse()\n }\n}\n\n/**\n * Sorts elements in the array in-place descending according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.sortDescending(): Unit {\n if (size > 1) {\n sort()\n reverse()\n }\n}\n\n/**\n * Sorts elements in the array in-place descending according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.sortDescending(): Unit {\n if (size > 1) {\n sort()\n reverse()\n }\n}\n\n/**\n * Returns a list of all elements sorted according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.sorted(): List {\n return copyOf().apply { sort() }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.sorted(): List {\n return copyOf().apply { sort() }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.sorted(): List {\n return copyOf().apply { sort() }.asList()\n}\n\n/**\n * Returns a list of all elements sorted according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.sorted(): List {\n return copyOf().apply { sort() }.asList()\n}\n\n/**\n * Returns an array with all elements of this array sorted according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.sortedArray(): UIntArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sort() }\n}\n\n/**\n * Returns an array with all elements of this array sorted according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.sortedArray(): ULongArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sort() }\n}\n\n/**\n * Returns an array with all elements of this array sorted according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.sortedArray(): UByteArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sort() }\n}\n\n/**\n * Returns an array with all elements of this array sorted according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.sortedArray(): UShortArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sort() }\n}\n\n/**\n * Returns an array with all elements of this array sorted descending according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.sortedArrayDescending(): UIntArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sortDescending() }\n}\n\n/**\n * Returns an array with all elements of this array sorted descending according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.sortedArrayDescending(): ULongArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sortDescending() }\n}\n\n/**\n * Returns an array with all elements of this array sorted descending according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.sortedArrayDescending(): UByteArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sortDescending() }\n}\n\n/**\n * Returns an array with all elements of this array sorted descending according to their natural sort order.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.sortedArrayDescending(): UShortArray {\n if (isEmpty()) return this\n return this.copyOf().apply { sortDescending() }\n}\n\n/**\n * Returns a list of all elements sorted descending according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.sortedDescending(): List {\n return copyOf().apply { sort() }.reversed()\n}\n\n/**\n * Returns a list of all elements sorted descending according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.sortedDescending(): List {\n return copyOf().apply { sort() }.reversed()\n}\n\n/**\n * Returns a list of all elements sorted descending according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.sortedDescending(): List {\n return copyOf().apply { sort() }.reversed()\n}\n\n/**\n * Returns a list of all elements sorted descending according to their natural sort order.\n * \n * The sort is _stable_. It means that equal elements preserve their order relative to each other after sorting.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.sortedDescending(): List {\n return copyOf().apply { sort() }.reversed()\n}\n\n/**\n * Returns an array of type [ByteArray], which is a view of this array where each element is a signed reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.asByteArray(): ByteArray {\n return storage\n}\n\n/**\n * Returns an array of type [IntArray], which is a view of this array where each element is a signed reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.asIntArray(): IntArray {\n return storage\n}\n\n/**\n * Returns a [List] that wraps the original array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic expect fun UIntArray.asList(): List\n\n/**\n * Returns a [List] that wraps the original array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic expect fun ULongArray.asList(): List\n\n/**\n * Returns a [List] that wraps the original array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic expect fun UByteArray.asList(): List\n\n/**\n * Returns a [List] that wraps the original array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic expect fun UShortArray.asList(): List\n\n/**\n * Returns an array of type [LongArray], which is a view of this array where each element is a signed reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.asLongArray(): LongArray {\n return storage\n}\n\n/**\n * Returns an array of type [ShortArray], which is a view of this array where each element is a signed reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.asShortArray(): ShortArray {\n return storage\n}\n\n/**\n * Returns an array of type [UByteArray], which is a view of this array where each element is an unsigned reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.asUByteArray(): UByteArray {\n return UByteArray(this)\n}\n\n/**\n * Returns an array of type [UIntArray], which is a view of this array where each element is an unsigned reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.asUIntArray(): UIntArray {\n return UIntArray(this)\n}\n\n/**\n * Returns an array of type [ULongArray], which is a view of this array where each element is an unsigned reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.asULongArray(): ULongArray {\n return ULongArray(this)\n}\n\n/**\n * Returns an array of type [UShortArray], which is a view of this array where each element is an unsigned reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.asUShortArray(): UShortArray {\n return UShortArray(this)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.3\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\n@ExperimentalUnsignedTypes\npublic infix fun UIntArray.contentEquals(other: UIntArray): Boolean {\n return this.contentEquals(other)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.3\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\n@ExperimentalUnsignedTypes\npublic infix fun ULongArray.contentEquals(other: ULongArray): Boolean {\n return this.contentEquals(other)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.3\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\n@ExperimentalUnsignedTypes\npublic infix fun UByteArray.contentEquals(other: UByteArray): Boolean {\n return this.contentEquals(other)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.3\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\n@ExperimentalUnsignedTypes\npublic infix fun UShortArray.contentEquals(other: UShortArray): Boolean {\n return this.contentEquals(other)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic infix fun UIntArray?.contentEquals(other: UIntArray?): Boolean {\n return this?.storage.contentEquals(other?.storage)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic infix fun ULongArray?.contentEquals(other: ULongArray?): Boolean {\n return this?.storage.contentEquals(other?.storage)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic infix fun UByteArray?.contentEquals(other: UByteArray?): Boolean {\n return this?.storage.contentEquals(other?.storage)\n}\n\n/**\n * Returns `true` if the two specified arrays are *structurally* equal to one another,\n * i.e. contain the same number of the same elements in the same order.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic infix fun UShortArray?.contentEquals(other: UShortArray?): Boolean {\n return this?.storage.contentEquals(other?.storage)\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.3\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.contentHashCode(): Int {\n return this.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.3\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.contentHashCode(): Int {\n return this.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.3\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.contentHashCode(): Int {\n return this.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.3\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.contentHashCode(): Int {\n return this.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray?.contentHashCode(): Int {\n return this?.storage.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray?.contentHashCode(): Int {\n return this?.storage.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray?.contentHashCode(): Int {\n return this?.storage.contentHashCode()\n}\n\n/**\n * Returns a hash code based on the contents of this array as if it is [List].\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray?.contentHashCode(): Int {\n return this?.storage.contentHashCode()\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.3\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.contentToString(): String {\n return this.contentToString()\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.3\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.contentToString(): String {\n return this.contentToString()\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.3\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.contentToString(): String {\n return this.contentToString()\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@Deprecated(\"Use Kotlin compiler 1.4 to avoid deprecation warning.\")\n@SinceKotlin(\"1.3\")\n@DeprecatedSinceKotlin(hiddenSince = \"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.contentToString(): String {\n return this.contentToString()\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray?.contentToString(): String {\n return this?.joinToString(\", \", \"[\", \"]\") ?: \"null\"\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray?.contentToString(): String {\n return this?.joinToString(\", \", \"[\", \"]\") ?: \"null\"\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray?.contentToString(): String {\n return this?.joinToString(\", \", \"[\", \"]\") ?: \"null\"\n}\n\n/**\n * Returns a string representation of the contents of the specified array as if it is [List].\n * \n * @sample samples.collections.Arrays.ContentOperations.contentToString\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray?.contentToString(): String {\n return this?.joinToString(\", \", \"[\", \"]\") ?: \"null\"\n}\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.copyInto(destination: UIntArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): UIntArray {\n storage.copyInto(destination.storage, destinationOffset, startIndex, endIndex)\n return destination\n}\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.copyInto(destination: ULongArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): ULongArray {\n storage.copyInto(destination.storage, destinationOffset, startIndex, endIndex)\n return destination\n}\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.copyInto(destination: UByteArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): UByteArray {\n storage.copyInto(destination.storage, destinationOffset, startIndex, endIndex)\n return destination\n}\n\n/**\n * Copies this array or its subrange into the [destination] array and returns that array.\n * \n * It's allowed to pass the same array in the [destination] and even specify the subrange so that it overlaps with the destination range.\n * \n * @param destination the array to copy to.\n * @param destinationOffset the position in the [destination] array to copy to, 0 by default.\n * @param startIndex the beginning (inclusive) of the subrange to copy, 0 by default.\n * @param endIndex the end (exclusive) of the subrange to copy, size of this array by default.\n * \n * @throws IndexOutOfBoundsException or [IllegalArgumentException] when [startIndex] or [endIndex] is out of range of this array indices or when `startIndex > endIndex`.\n * @throws IndexOutOfBoundsException when the subrange doesn't fit into the [destination] array starting at the specified [destinationOffset],\n * or when that index is out of the [destination] array indices range.\n * \n * @return the [destination] array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.copyInto(destination: UShortArray, destinationOffset: Int = 0, startIndex: Int = 0, endIndex: Int = size): UShortArray {\n storage.copyInto(destination.storage, destinationOffset, startIndex, endIndex)\n return destination\n}\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.copyOf(): UIntArray {\n return UIntArray(storage.copyOf())\n}\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.copyOf(): ULongArray {\n return ULongArray(storage.copyOf())\n}\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.copyOf(): UByteArray {\n return UByteArray(storage.copyOf())\n}\n\n/**\n * Returns new array which is a copy of the original array.\n * \n * @sample samples.collections.Arrays.CopyOfOperations.copyOf\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.copyOf(): UShortArray {\n return UShortArray(storage.copyOf())\n}\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.copyOf(newSize: Int): UIntArray {\n return UIntArray(storage.copyOf(newSize))\n}\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.copyOf(newSize: Int): ULongArray {\n return ULongArray(storage.copyOf(newSize))\n}\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.copyOf(newSize: Int): UByteArray {\n return UByteArray(storage.copyOf(newSize))\n}\n\n/**\n * Returns new array which is a copy of the original array, resized to the given [newSize].\n * The copy is either truncated or padded at the end with zero values if necessary.\n * \n * - If [newSize] is less than the size of the original array, the copy array is truncated to the [newSize].\n * - If [newSize] is greater than the size of the original array, the extra elements in the copy array are filled with zero values.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.copyOf(newSize: Int): UShortArray {\n return UShortArray(storage.copyOf(newSize))\n}\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.copyOfRange(fromIndex: Int, toIndex: Int): UIntArray {\n return UIntArray(storage.copyOfRange(fromIndex, toIndex))\n}\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.copyOfRange(fromIndex: Int, toIndex: Int): ULongArray {\n return ULongArray(storage.copyOfRange(fromIndex, toIndex))\n}\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.copyOfRange(fromIndex: Int, toIndex: Int): UByteArray {\n return UByteArray(storage.copyOfRange(fromIndex, toIndex))\n}\n\n/**\n * Returns a new array which is a copy of the specified range of the original array.\n * \n * @param fromIndex the start of the range (inclusive) to copy.\n * @param toIndex the end of the range (exclusive) to copy.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.copyOfRange(fromIndex: Int, toIndex: Int): UShortArray {\n return UShortArray(storage.copyOfRange(fromIndex, toIndex))\n}\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.fill(element: UInt, fromIndex: Int = 0, toIndex: Int = size): Unit {\n storage.fill(element.toInt(), fromIndex, toIndex)\n}\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.fill(element: ULong, fromIndex: Int = 0, toIndex: Int = size): Unit {\n storage.fill(element.toLong(), fromIndex, toIndex)\n}\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.fill(element: UByte, fromIndex: Int = 0, toIndex: Int = size): Unit {\n storage.fill(element.toByte(), fromIndex, toIndex)\n}\n\n/**\n * Fills this array or its subrange with the specified [element] value.\n * \n * @param fromIndex the start of the range (inclusive) to fill, 0 by default.\n * @param toIndex the end of the range (exclusive) to fill, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.fill(element: UShort, fromIndex: Int = 0, toIndex: Int = size): Unit {\n storage.fill(element.toShort(), fromIndex, toIndex)\n}\n\n/**\n * Returns the range of valid indices for the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic inline val UIntArray.indices: IntRange\n get() = storage.indices\n\n/**\n * Returns the range of valid indices for the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic inline val ULongArray.indices: IntRange\n get() = storage.indices\n\n/**\n * Returns the range of valid indices for the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic inline val UByteArray.indices: IntRange\n get() = storage.indices\n\n/**\n * Returns the range of valid indices for the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic inline val UShortArray.indices: IntRange\n get() = storage.indices\n\n/**\n * Returns the last valid index for the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic inline val UIntArray.lastIndex: Int\n get() = storage.lastIndex\n\n/**\n * Returns the last valid index for the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic inline val ULongArray.lastIndex: Int\n get() = storage.lastIndex\n\n/**\n * Returns the last valid index for the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic inline val UByteArray.lastIndex: Int\n get() = storage.lastIndex\n\n/**\n * Returns the last valid index for the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic inline val UShortArray.lastIndex: Int\n get() = storage.lastIndex\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UIntArray.plus(element: UInt): UIntArray {\n return UIntArray(storage + element.toInt())\n}\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun ULongArray.plus(element: ULong): ULongArray {\n return ULongArray(storage + element.toLong())\n}\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UByteArray.plus(element: UByte): UByteArray {\n return UByteArray(storage + element.toByte())\n}\n\n/**\n * Returns an array containing all elements of the original array and then the given [element].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UShortArray.plus(element: UShort): UShortArray {\n return UShortArray(storage + element.toShort())\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic operator fun UIntArray.plus(elements: Collection): UIntArray {\n var index = size\n val result = storage.copyOf(size + elements.size)\n for (element in elements) result[index++] = element.toInt()\n return UIntArray(result)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic operator fun ULongArray.plus(elements: Collection): ULongArray {\n var index = size\n val result = storage.copyOf(size + elements.size)\n for (element in elements) result[index++] = element.toLong()\n return ULongArray(result)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic operator fun UByteArray.plus(elements: Collection): UByteArray {\n var index = size\n val result = storage.copyOf(size + elements.size)\n for (element in elements) result[index++] = element.toByte()\n return UByteArray(result)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] collection.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic operator fun UShortArray.plus(elements: Collection): UShortArray {\n var index = size\n val result = storage.copyOf(size + elements.size)\n for (element in elements) result[index++] = element.toShort()\n return UShortArray(result)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UIntArray.plus(elements: UIntArray): UIntArray {\n return UIntArray(storage + elements.storage)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun ULongArray.plus(elements: ULongArray): ULongArray {\n return ULongArray(storage + elements.storage)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UByteArray.plus(elements: UByteArray): UByteArray {\n return UByteArray(storage + elements.storage)\n}\n\n/**\n * Returns an array containing all elements of the original array and then all elements of the given [elements] array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline operator fun UShortArray.plus(elements: UShortArray): UShortArray {\n return UShortArray(storage + elements.storage)\n}\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.sort(): Unit {\n if (size > 1) sortArray(this, 0, size)\n}\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.sort(): Unit {\n if (size > 1) sortArray(this, 0, size)\n}\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.sort(): Unit {\n if (size > 1) sortArray(this, 0, size)\n}\n\n/**\n * Sorts the array in-place.\n * \n * @sample samples.collections.Arrays.Sorting.sortArray\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.sort(): Unit {\n if (size > 1) sortArray(this, 0, size)\n}\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n sortArray(this, fromIndex, toIndex)\n}\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n sortArray(this, fromIndex, toIndex)\n}\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n sortArray(this, fromIndex, toIndex)\n}\n\n/**\n * Sorts a range in the array in-place.\n * \n * @param fromIndex the start of the range (inclusive) to sort, 0 by default.\n * @param toIndex the end of the range (exclusive) to sort, size of this array by default.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n * \n * @sample samples.collections.Arrays.Sorting.sortRangeOfArray\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.sort(fromIndex: Int = 0, toIndex: Int = size): Unit {\n AbstractList.checkRangeIndexes(fromIndex, toIndex, size)\n sortArray(this, fromIndex, toIndex)\n}\n\n/**\n * Sorts elements of the array in the specified range in-place.\n * The elements are sorted descending according to their natural sort order.\n * \n * @param fromIndex the start of the range (inclusive) to sort.\n * @param toIndex the end of the range (exclusive) to sort.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {\n sort(fromIndex, toIndex)\n reverse(fromIndex, toIndex)\n}\n\n/**\n * Sorts elements of the array in the specified range in-place.\n * The elements are sorted descending according to their natural sort order.\n * \n * @param fromIndex the start of the range (inclusive) to sort.\n * @param toIndex the end of the range (exclusive) to sort.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {\n sort(fromIndex, toIndex)\n reverse(fromIndex, toIndex)\n}\n\n/**\n * Sorts elements of the array in the specified range in-place.\n * The elements are sorted descending according to their natural sort order.\n * \n * @param fromIndex the start of the range (inclusive) to sort.\n * @param toIndex the end of the range (exclusive) to sort.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {\n sort(fromIndex, toIndex)\n reverse(fromIndex, toIndex)\n}\n\n/**\n * Sorts elements of the array in the specified range in-place.\n * The elements are sorted descending according to their natural sort order.\n * \n * @param fromIndex the start of the range (inclusive) to sort.\n * @param toIndex the end of the range (exclusive) to sort.\n * \n * @throws IndexOutOfBoundsException if [fromIndex] is less than zero or [toIndex] is greater than the size of this array.\n * @throws IllegalArgumentException if [fromIndex] is greater than [toIndex].\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.sortDescending(fromIndex: Int, toIndex: Int): Unit {\n sort(fromIndex, toIndex)\n reverse(fromIndex, toIndex)\n}\n\n/**\n * Returns an array of type [ByteArray], which is a copy of this array where each element is a signed reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.toByteArray(): ByteArray {\n return storage.copyOf()\n}\n\n/**\n * Returns an array of type [IntArray], which is a copy of this array where each element is a signed reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.toIntArray(): IntArray {\n return storage.copyOf()\n}\n\n/**\n * Returns an array of type [LongArray], which is a copy of this array where each element is a signed reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.toLongArray(): LongArray {\n return storage.copyOf()\n}\n\n/**\n * Returns an array of type [ShortArray], which is a copy of this array where each element is a signed reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.toShortArray(): ShortArray {\n return storage.copyOf()\n}\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.toTypedArray(): Array {\n return Array(size) { index -> this[index] }\n}\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.toTypedArray(): Array {\n return Array(size) { index -> this[index] }\n}\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.toTypedArray(): Array {\n return Array(size) { index -> this[index] }\n}\n\n/**\n * Returns a *typed* object array containing all of the elements of this primitive array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.toTypedArray(): Array {\n return Array(size) { index -> this[index] }\n}\n\n/**\n * Returns an array of UByte containing all of the elements of this generic array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun Array.toUByteArray(): UByteArray {\n return UByteArray(size) { index -> this[index] }\n}\n\n/**\n * Returns an array of type [UByteArray], which is a copy of this array where each element is an unsigned reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ByteArray.toUByteArray(): UByteArray {\n return UByteArray(this.copyOf())\n}\n\n/**\n * Returns an array of UInt containing all of the elements of this generic array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun Array.toUIntArray(): UIntArray {\n return UIntArray(size) { index -> this[index] }\n}\n\n/**\n * Returns an array of type [UIntArray], which is a copy of this array where each element is an unsigned reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun IntArray.toUIntArray(): UIntArray {\n return UIntArray(this.copyOf())\n}\n\n/**\n * Returns an array of ULong containing all of the elements of this generic array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun Array.toULongArray(): ULongArray {\n return ULongArray(size) { index -> this[index] }\n}\n\n/**\n * Returns an array of type [ULongArray], which is a copy of this array where each element is an unsigned reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun LongArray.toULongArray(): ULongArray {\n return ULongArray(this.copyOf())\n}\n\n/**\n * Returns an array of UShort containing all of the elements of this generic array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun Array.toUShortArray(): UShortArray {\n return UShortArray(size) { index -> this[index] }\n}\n\n/**\n * Returns an array of type [UShortArray], which is a copy of this array where each element is an unsigned reinterpretation\n * of the corresponding element of this array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ShortArray.toUShortArray(): UShortArray {\n return UShortArray(this.copyOf())\n}\n\n/**\n * Returns a [Map] where keys are elements from the given array and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.associateWith(valueSelector: (UInt) -> V): Map {\n val result = LinkedHashMap(mapCapacity(size).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Returns a [Map] where keys are elements from the given array and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.associateWith(valueSelector: (ULong) -> V): Map {\n val result = LinkedHashMap(mapCapacity(size).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Returns a [Map] where keys are elements from the given array and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.associateWith(valueSelector: (UByte) -> V): Map {\n val result = LinkedHashMap(mapCapacity(size).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Returns a [Map] where keys are elements from the given array and values are\n * produced by the [valueSelector] function applied to each element.\n * \n * If any two elements are equal, the last one gets added to the map.\n * \n * The returned map preserves the entry iteration order of the original array.\n * \n * @sample samples.collections.Collections.Transformations.associateWith\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.associateWith(valueSelector: (UShort) -> V): Map {\n val result = LinkedHashMap(mapCapacity(size).coerceAtLeast(16))\n return associateWithTo(result, valueSelector)\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given array,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.associateWithTo(destination: M, valueSelector: (UInt) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given array,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.associateWithTo(destination: M, valueSelector: (ULong) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given array,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.associateWithTo(destination: M, valueSelector: (UByte) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Populates and returns the [destination] mutable map with key-value pairs for each element of the given array,\n * where key is the element itself and value is provided by the [valueSelector] function applied to that key.\n * \n * If any two elements are equal, the last one overwrites the former value in the map.\n * \n * @sample samples.collections.Collections.Transformations.associateWithTo\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.associateWithTo(destination: M, valueSelector: (UShort) -> V): M {\n for (element in this) {\n destination.put(element, valueSelector(element))\n }\n return destination\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.flatMap(transform: (UInt) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.flatMap(transform: (ULong) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.flatMap(transform: (UByte) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element of original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMap\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.flatMap(transform: (UShort) -> Iterable): List {\n return flatMapTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.flatMapIndexed(transform: (index: Int, UInt) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.flatMapIndexed(transform: (index: Int, ULong) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.flatMapIndexed(transform: (index: Int, UByte) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Returns a single list of all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array.\n * \n * @sample samples.collections.Collections.Transformations.flatMapIndexed\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.flatMapIndexed(transform: (index: Int, UShort) -> Iterable): List {\n return flatMapIndexedTo(ArrayList(), transform)\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.flatMapIndexedTo(destination: C, transform: (index: Int, UInt) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.flatMapIndexedTo(destination: C, transform: (index: Int, ULong) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.flatMapIndexedTo(destination: C, transform: (index: Int, UByte) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element\n * and its index in the original array, to the given [destination].\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.flatMapIndexedTo(destination: C, transform: (index: Int, UShort) -> Iterable): C {\n var index = 0\n for (element in this) {\n val list = transform(index++, element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.flatMapTo(destination: C, transform: (UInt) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.flatMapTo(destination: C, transform: (ULong) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.flatMapTo(destination: C, transform: (UByte) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Appends all elements yielded from results of [transform] function being invoked on each element of original array, to the given [destination].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.flatMapTo(destination: C, transform: (UShort) -> Iterable): C {\n for (element in this) {\n val list = transform(element)\n destination.addAll(list)\n }\n return destination\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.groupBy(keySelector: (UInt) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.groupBy(keySelector: (ULong) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.groupBy(keySelector: (UByte) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and returns a map where each group key is associated with a list of corresponding elements.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.groupBy(keySelector: (UShort) -> K): Map> {\n return groupByTo(LinkedHashMap>(), keySelector)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.groupBy(keySelector: (UInt) -> K, valueTransform: (UInt) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.groupBy(keySelector: (ULong) -> K, valueTransform: (ULong) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.groupBy(keySelector: (UByte) -> K, valueTransform: (UByte) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and returns a map where each group key is associated with a list of corresponding values.\n * \n * The returned map preserves the entry iteration order of the keys produced from the original array.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.groupBy(keySelector: (UShort) -> K, valueTransform: (UShort) -> V): Map> {\n return groupByTo(LinkedHashMap>(), keySelector, valueTransform)\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun >> UIntArray.groupByTo(destination: M, keySelector: (UInt) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun >> ULongArray.groupByTo(destination: M, keySelector: (ULong) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun >> UByteArray.groupByTo(destination: M, keySelector: (UByte) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups elements of the original array by the key returned by the given [keySelector] function\n * applied to each element and puts to the [destination] map each group key associated with a list of corresponding elements.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupBy\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun >> UShortArray.groupByTo(destination: M, keySelector: (UShort) -> K): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(element)\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun >> UIntArray.groupByTo(destination: M, keySelector: (UInt) -> K, valueTransform: (UInt) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun >> ULongArray.groupByTo(destination: M, keySelector: (ULong) -> K, valueTransform: (ULong) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun >> UByteArray.groupByTo(destination: M, keySelector: (UByte) -> K, valueTransform: (UByte) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Groups values returned by the [valueTransform] function applied to each element of the original array\n * by the key returned by the given [keySelector] function applied to the element\n * and puts to the [destination] map each group key associated with a list of corresponding values.\n * \n * @return The [destination] map.\n * \n * @sample samples.collections.Collections.Transformations.groupByKeysAndValues\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun >> UShortArray.groupByTo(destination: M, keySelector: (UShort) -> K, valueTransform: (UShort) -> V): M {\n for (element in this) {\n val key = keySelector(element)\n val list = destination.getOrPut(key) { ArrayList() }\n list.add(valueTransform(element))\n }\n return destination\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element in the original array.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.map(transform: (UInt) -> R): List {\n return mapTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element in the original array.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.map(transform: (ULong) -> R): List {\n return mapTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element in the original array.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.map(transform: (UByte) -> R): List {\n return mapTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element in the original array.\n * \n * @sample samples.collections.Collections.Transformations.map\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.map(transform: (UShort) -> R): List {\n return mapTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element and its index in the original array.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.mapIndexed(transform: (index: Int, UInt) -> R): List {\n return mapIndexedTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element and its index in the original array.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.mapIndexed(transform: (index: Int, ULong) -> R): List {\n return mapIndexedTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element and its index in the original array.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.mapIndexed(transform: (index: Int, UByte) -> R): List {\n return mapIndexedTo(ArrayList(size), transform)\n}\n\n/**\n * Returns a list containing the results of applying the given [transform] function\n * to each element and its index in the original array.\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.mapIndexed(transform: (index: Int, UShort) -> R): List {\n return mapIndexedTo(ArrayList(size), transform)\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original array\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.mapIndexedTo(destination: C, transform: (index: Int, UInt) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(index++, item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original array\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.mapIndexedTo(destination: C, transform: (index: Int, ULong) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(index++, item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original array\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.mapIndexedTo(destination: C, transform: (index: Int, UByte) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(index++, item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element and its index in the original array\n * and appends the results to the given [destination].\n * @param [transform] function that takes the index of an element and the element itself\n * and returns the result of the transform applied to the element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.mapIndexedTo(destination: C, transform: (index: Int, UShort) -> R): C {\n var index = 0\n for (item in this)\n destination.add(transform(index++, item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original array\n * and appends the results to the given [destination].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.mapTo(destination: C, transform: (UInt) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original array\n * and appends the results to the given [destination].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.mapTo(destination: C, transform: (ULong) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original array\n * and appends the results to the given [destination].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.mapTo(destination: C, transform: (UByte) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Applies the given [transform] function to each element of the original array\n * and appends the results to the given [destination].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.mapTo(destination: C, transform: (UShort) -> R): C {\n for (item in this)\n destination.add(transform(item))\n return destination\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each element of the original array\n * into an [IndexedValue] containing the index of that element and the element itself.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each element of the original array\n * into an [IndexedValue] containing the index of that element and the element itself.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each element of the original array\n * into an [IndexedValue] containing the index of that element and the element itself.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns a lazy [Iterable] that wraps each element of the original array\n * into an [IndexedValue] containing the index of that element and the element itself.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.withIndex(): Iterable> {\n return IndexingIterable { iterator() }\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.all(predicate: (UInt) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.all(predicate: (ULong) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.all(predicate: (UByte) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if all elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.all\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.all(predicate: (UShort) -> Boolean): Boolean {\n for (element in this) if (!predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if array has at least one element.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.any(): Boolean {\n return storage.any()\n}\n\n/**\n * Returns `true` if array has at least one element.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.any(): Boolean {\n return storage.any()\n}\n\n/**\n * Returns `true` if array has at least one element.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.any(): Boolean {\n return storage.any()\n}\n\n/**\n * Returns `true` if array has at least one element.\n * \n * @sample samples.collections.Collections.Aggregates.any\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.any(): Boolean {\n return storage.any()\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.any(predicate: (UInt) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.any(predicate: (ULong) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.any(predicate: (UByte) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns `true` if at least one element matches the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.anyWithPredicate\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.any(predicate: (UShort) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return true\n return false\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.count(predicate: (UInt) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.count(predicate: (ULong) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.count(predicate: (UByte) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Returns the number of elements matching the given [predicate].\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.count(predicate: (UShort) -> Boolean): Int {\n var count = 0\n for (element in this) if (predicate(element)) ++count\n return count\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.fold(initial: R, operation: (acc: R, UInt) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.fold(initial: R, operation: (acc: R, ULong) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.fold(initial: R, operation: (acc: R, UByte) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.fold(initial: R, operation: (acc: R, UShort) -> R): R {\n var accumulator = initial\n for (element in this) accumulator = operation(accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.foldIndexed(initial: R, operation: (index: Int, acc: R, UInt) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(index++, accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.foldIndexed(initial: R, operation: (index: Int, acc: R, ULong) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(index++, accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.foldIndexed(initial: R, operation: (index: Int, acc: R, UByte) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(index++, accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.foldIndexed(initial: R, operation: (index: Int, acc: R, UShort) -> R): R {\n var index = 0\n var accumulator = initial\n for (element in this) accumulator = operation(index++, accumulator, element)\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.foldRight(initial: R, operation: (UInt, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.foldRight(initial: R, operation: (ULong, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.foldRight(initial: R, operation: (UByte, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.foldRight(initial: R, operation: (UShort, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself\n * and current accumulator value, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.foldRightIndexed(initial: R, operation: (index: Int, UInt, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself\n * and current accumulator value, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.foldRightIndexed(initial: R, operation: (index: Int, ULong, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself\n * and current accumulator value, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.foldRightIndexed(initial: R, operation: (index: Int, UByte, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with [initial] value and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns the specified [initial] value if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself\n * and current accumulator value, and calculates the next accumulator value.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.foldRightIndexed(initial: R, operation: (index: Int, UShort, acc: R) -> R): R {\n var index = lastIndex\n var accumulator = initial\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Performs the given [action] on each element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.forEach(action: (UInt) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.forEach(action: (ULong) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.forEach(action: (UByte) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.forEach(action: (UShort) -> Unit): Unit {\n for (element in this) action(element)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.forEachIndexed(action: (index: Int, UInt) -> Unit): Unit {\n var index = 0\n for (item in this) action(index++, item)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.forEachIndexed(action: (index: Int, ULong) -> Unit): Unit {\n var index = 0\n for (item in this) action(index++, item)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.forEachIndexed(action: (index: Int, UByte) -> Unit): Unit {\n var index = 0\n for (item in this) action(index++, item)\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.forEachIndexed(action: (index: Int, UShort) -> Unit): Unit {\n var index = 0\n for (item in this) action(index++, item)\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.max(): UInt? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.max(): ULong? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.max(): UByte? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxOrNull instead.\", ReplaceWith(\"this.maxOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.max(): UShort? {\n return maxOrNull()\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.maxBy(selector: (UInt) -> R): UInt? {\n return maxByOrNull(selector)\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.maxBy(selector: (ULong) -> R): ULong? {\n return maxByOrNull(selector)\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.maxBy(selector: (UByte) -> R): UByte? {\n return maxByOrNull(selector)\n}\n\n@Deprecated(\"Use maxByOrNull instead.\", ReplaceWith(\"this.maxByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.maxBy(selector: (UShort) -> R): UShort? {\n return maxByOrNull(selector)\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.maxByOrNull(selector: (UInt) -> R): UInt? {\n if (isEmpty()) return null\n var maxElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return maxElem\n var maxValue = selector(maxElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n }\n return maxElem\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.maxByOrNull(selector: (ULong) -> R): ULong? {\n if (isEmpty()) return null\n var maxElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return maxElem\n var maxValue = selector(maxElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n }\n return maxElem\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.maxByOrNull(selector: (UByte) -> R): UByte? {\n if (isEmpty()) return null\n var maxElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return maxElem\n var maxValue = selector(maxElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n }\n return maxElem\n}\n\n/**\n * Returns the first element yielding the largest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.maxByOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.maxByOrNull(selector: (UShort) -> R): UShort? {\n if (isEmpty()) return null\n var maxElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return maxElem\n var maxValue = selector(maxElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (maxValue < v) {\n maxElem = e\n maxValue = v\n }\n }\n return maxElem\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.maxOf(selector: (UInt) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.maxOf(selector: (ULong) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.maxOf(selector: (UByte) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.maxOf(selector: (UShort) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.maxOf(selector: (UInt) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.maxOf(selector: (ULong) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.maxOf(selector: (UByte) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.maxOf(selector: (UShort) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.maxOf(selector: (UInt) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.maxOf(selector: (ULong) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.maxOf(selector: (UByte) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.maxOf(selector: (UShort) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.maxOfOrNull(selector: (UInt) -> Double): Double? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.maxOfOrNull(selector: (ULong) -> Double): Double? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.maxOfOrNull(selector: (UByte) -> Double): Double? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.maxOfOrNull(selector: (UShort) -> Double): Double? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.maxOfOrNull(selector: (UInt) -> Float): Float? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.maxOfOrNull(selector: (ULong) -> Float): Float? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.maxOfOrNull(selector: (UByte) -> Float): Float? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.maxOfOrNull(selector: (UShort) -> Float): Float? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n maxValue = maxOf(maxValue, v)\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.maxOfOrNull(selector: (UInt) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.maxOfOrNull(selector: (ULong) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.maxOfOrNull(selector: (UByte) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.maxOfOrNull(selector: (UShort) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (maxValue < v) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.maxOfWith(comparator: Comparator, selector: (UInt) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.maxOfWith(comparator: Comparator, selector: (ULong) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.maxOfWith(comparator: Comparator, selector: (UByte) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.maxOfWith(comparator: Comparator, selector: (UShort) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.maxOfWithOrNull(comparator: Comparator, selector: (UInt) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.maxOfWithOrNull(comparator: Comparator, selector: (ULong) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.maxOfWithOrNull(comparator: Comparator, selector: (UByte) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.maxOfWithOrNull(comparator: Comparator, selector: (UShort) -> R): R? {\n if (isEmpty()) return null\n var maxValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(maxValue, v) < 0) {\n maxValue = v\n }\n }\n return maxValue\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.maxOrNull(): UInt? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (max < e) max = e\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.maxOrNull(): ULong? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (max < e) max = e\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.maxOrNull(): UByte? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (max < e) max = e\n }\n return max\n}\n\n/**\n * Returns the largest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.maxOrNull(): UShort? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (max < e) max = e\n }\n return max\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.maxWith(comparator: Comparator): UInt? {\n return maxWithOrNull(comparator)\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.maxWith(comparator: Comparator): ULong? {\n return maxWithOrNull(comparator)\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.maxWith(comparator: Comparator): UByte? {\n return maxWithOrNull(comparator)\n}\n\n@Deprecated(\"Use maxWithOrNull instead.\", ReplaceWith(\"this.maxWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.maxWith(comparator: Comparator): UShort? {\n return maxWithOrNull(comparator)\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.maxWithOrNull(comparator: Comparator): UInt? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.maxWithOrNull(comparator: Comparator): ULong? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.maxWithOrNull(comparator: Comparator): UByte? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n/**\n * Returns the first element having the largest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.maxWithOrNull(comparator: Comparator): UShort? {\n if (isEmpty()) return null\n var max = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(max, e) < 0) max = e\n }\n return max\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.min(): UInt? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.min(): ULong? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.min(): UByte? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minOrNull instead.\", ReplaceWith(\"this.minOrNull()\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.min(): UShort? {\n return minOrNull()\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.minBy(selector: (UInt) -> R): UInt? {\n return minByOrNull(selector)\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.minBy(selector: (ULong) -> R): ULong? {\n return minByOrNull(selector)\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.minBy(selector: (UByte) -> R): UByte? {\n return minByOrNull(selector)\n}\n\n@Deprecated(\"Use minByOrNull instead.\", ReplaceWith(\"this.minByOrNull(selector)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.minBy(selector: (UShort) -> R): UShort? {\n return minByOrNull(selector)\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.minByOrNull(selector: (UInt) -> R): UInt? {\n if (isEmpty()) return null\n var minElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return minElem\n var minValue = selector(minElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n }\n return minElem\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.minByOrNull(selector: (ULong) -> R): ULong? {\n if (isEmpty()) return null\n var minElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return minElem\n var minValue = selector(minElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n }\n return minElem\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.minByOrNull(selector: (UByte) -> R): UByte? {\n if (isEmpty()) return null\n var minElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return minElem\n var minValue = selector(minElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n }\n return minElem\n}\n\n/**\n * Returns the first element yielding the smallest value of the given function or `null` if there are no elements.\n * \n * @sample samples.collections.Collections.Aggregates.minByOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.minByOrNull(selector: (UShort) -> R): UShort? {\n if (isEmpty()) return null\n var minElem = this[0]\n val lastIndex = this.lastIndex\n if (lastIndex == 0) return minElem\n var minValue = selector(minElem)\n for (i in 1..lastIndex) {\n val e = this[i]\n val v = selector(e)\n if (minValue > v) {\n minElem = e\n minValue = v\n }\n }\n return minElem\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.minOf(selector: (UInt) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.minOf(selector: (ULong) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.minOf(selector: (UByte) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.minOf(selector: (UShort) -> Double): Double {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.minOf(selector: (UInt) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.minOf(selector: (ULong) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.minOf(selector: (UByte) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.minOf(selector: (UShort) -> Float): Float {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.minOf(selector: (UInt) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.minOf(selector: (ULong) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.minOf(selector: (UByte) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.minOf(selector: (UShort) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.minOfOrNull(selector: (UInt) -> Double): Double? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.minOfOrNull(selector: (ULong) -> Double): Double? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.minOfOrNull(selector: (UByte) -> Double): Double? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.minOfOrNull(selector: (UShort) -> Double): Double? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.minOfOrNull(selector: (UInt) -> Float): Float? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.minOfOrNull(selector: (ULong) -> Float): Float? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.minOfOrNull(selector: (UByte) -> Float): Float? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n * \n * If any of values produced by [selector] function is `NaN`, the returned result is `NaN`.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.minOfOrNull(selector: (UShort) -> Float): Float? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n minValue = minOf(minValue, v)\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UIntArray.minOfOrNull(selector: (UInt) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > ULongArray.minOfOrNull(selector: (ULong) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UByteArray.minOfOrNull(selector: (UByte) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value among all values produced by [selector] function\n * applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun > UShortArray.minOfOrNull(selector: (UShort) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (minValue > v) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.minOfWith(comparator: Comparator, selector: (UInt) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.minOfWith(comparator: Comparator, selector: (ULong) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.minOfWith(comparator: Comparator, selector: (UByte) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array.\n * \n * @throws NoSuchElementException if the array is empty.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.minOfWith(comparator: Comparator, selector: (UShort) -> R): R {\n if (isEmpty()) throw NoSuchElementException()\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.minOfWithOrNull(comparator: Comparator, selector: (UInt) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.minOfWithOrNull(comparator: Comparator, selector: (ULong) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.minOfWithOrNull(comparator: Comparator, selector: (UByte) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest value according to the provided [comparator]\n * among all values produced by [selector] function applied to each element in the array or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.minOfWithOrNull(comparator: Comparator, selector: (UShort) -> R): R? {\n if (isEmpty()) return null\n var minValue = selector(this[0])\n for (i in 1..lastIndex) {\n val v = selector(this[i])\n if (comparator.compare(minValue, v) > 0) {\n minValue = v\n }\n }\n return minValue\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.minOrNull(): UInt? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (min > e) min = e\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.minOrNull(): ULong? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (min > e) min = e\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.minOrNull(): UByte? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (min > e) min = e\n }\n return min\n}\n\n/**\n * Returns the smallest element or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.minOrNull(): UShort? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (min > e) min = e\n }\n return min\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.minWith(comparator: Comparator): UInt? {\n return minWithOrNull(comparator)\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.minWith(comparator: Comparator): ULong? {\n return minWithOrNull(comparator)\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.minWith(comparator: Comparator): UByte? {\n return minWithOrNull(comparator)\n}\n\n@Deprecated(\"Use minWithOrNull instead.\", ReplaceWith(\"this.minWithOrNull(comparator)\"))\n@DeprecatedSinceKotlin(warningSince = \"1.4\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.minWith(comparator: Comparator): UShort? {\n return minWithOrNull(comparator)\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UIntArray.minWithOrNull(comparator: Comparator): UInt? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun ULongArray.minWithOrNull(comparator: Comparator): ULong? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UByteArray.minWithOrNull(comparator: Comparator): UByte? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns the first element having the smallest value according to the provided [comparator] or `null` if there are no elements.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\npublic fun UShortArray.minWithOrNull(comparator: Comparator): UShort? {\n if (isEmpty()) return null\n var min = this[0]\n for (i in 1..lastIndex) {\n val e = this[i]\n if (comparator.compare(min, e) > 0) min = e\n }\n return min\n}\n\n/**\n * Returns `true` if the array has no elements.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if the array has no elements.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if the array has no elements.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if the array has no elements.\n * \n * @sample samples.collections.Collections.Aggregates.none\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.none(): Boolean {\n return isEmpty()\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.none(predicate: (UInt) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.none(predicate: (ULong) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.none(predicate: (UByte) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Returns `true` if no elements match the given [predicate].\n * \n * @sample samples.collections.Collections.Aggregates.noneWithPredicate\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.none(predicate: (UShort) -> Boolean): Boolean {\n for (element in this) if (predicate(element)) return false\n return true\n}\n\n/**\n * Performs the given [action] on each element and returns the array itself afterwards.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.onEach(action: (UInt) -> Unit): UIntArray {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each element and returns the array itself afterwards.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.onEach(action: (ULong) -> Unit): ULongArray {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each element and returns the array itself afterwards.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.onEach(action: (UByte) -> Unit): UByteArray {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each element and returns the array itself afterwards.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.onEach(action: (UShort) -> Unit): UShortArray {\n return apply { for (element in this) action(element) }\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element,\n * and returns the array itself afterwards.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.onEachIndexed(action: (index: Int, UInt) -> Unit): UIntArray {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element,\n * and returns the array itself afterwards.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.onEachIndexed(action: (index: Int, ULong) -> Unit): ULongArray {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element,\n * and returns the array itself afterwards.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.onEachIndexed(action: (index: Int, UByte) -> Unit): UByteArray {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Performs the given [action] on each element, providing sequential index with the element,\n * and returns the array itself afterwards.\n * @param [action] function that takes the index of an element and the element itself\n * and performs the action on the element.\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.onEachIndexed(action: (index: Int, UShort) -> Unit): UShortArray {\n return apply { forEachIndexed(action) }\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.reduce(operation: (acc: UInt, UInt) -> UInt): UInt {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.reduce(operation: (acc: ULong, ULong) -> ULong): ULong {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.reduce(operation: (acc: UByte, UByte) -> UByte): UByte {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.reduce(operation: (acc: UShort, UShort) -> UShort): UShort {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.reduceIndexed(operation: (index: Int, acc: UInt, UInt) -> UInt): UInt {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.reduceIndexed(operation: (index: Int, acc: ULong, ULong) -> ULong): ULong {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.reduceIndexed(operation: (index: Int, acc: UByte, UByte) -> UByte): UByte {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduce\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.reduceIndexed(operation: (index: Int, acc: UShort, UShort) -> UShort): UShort {\n if (isEmpty())\n throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.reduceIndexedOrNull(operation: (index: Int, acc: UInt, UInt) -> UInt): UInt? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.reduceIndexedOrNull(operation: (index: Int, acc: ULong, ULong) -> ULong): ULong? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.reduceIndexedOrNull(operation: (index: Int, acc: UByte, UByte) -> UByte): UByte? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element with its index in the original array.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, current accumulator value and the element itself,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.reduceIndexedOrNull(operation: (index: Int, acc: UShort, UShort) -> UShort): UShort? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(index, accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.reduceOrNull(operation: (acc: UInt, UInt) -> UInt): UInt? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.reduceOrNull(operation: (acc: ULong, ULong) -> ULong): ULong? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.reduceOrNull(operation: (acc: UByte, UByte) -> UByte): UByte? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the first element and applying [operation] from left to right\n * to current accumulator value and each element.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes current accumulator value and an element,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.reduceOrNull(operation: (acc: UShort, UShort) -> UShort): UShort? {\n if (isEmpty())\n return null\n var accumulator = this[0]\n for (index in 1..lastIndex) {\n accumulator = operation(accumulator, this[index])\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.reduceRight(operation: (UInt, acc: UInt) -> UInt): UInt {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.reduceRight(operation: (ULong, acc: ULong) -> ULong): ULong {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.reduceRight(operation: (UByte, acc: UByte) -> UByte): UByte {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.reduceRight(operation: (UShort, acc: UShort) -> UShort): UShort {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.reduceRightIndexed(operation: (index: Int, UInt, acc: UInt) -> UInt): UInt {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.reduceRightIndexed(operation: (index: Int, ULong, acc: ULong) -> ULong): ULong {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.reduceRightIndexed(operation: (index: Int, UByte, acc: UByte) -> UByte): UByte {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Throws an exception if this array is empty. If the array can be empty in an expected way,\n * please use [reduceRightIndexedOrNull] instead. It returns `null` when its receiver is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRight\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.reduceRightIndexed(operation: (index: Int, UShort, acc: UShort) -> UShort): UShort {\n var index = lastIndex\n if (index < 0) throw UnsupportedOperationException(\"Empty array can't be reduced.\")\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.reduceRightIndexedOrNull(operation: (index: Int, UInt, acc: UInt) -> UInt): UInt? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.reduceRightIndexedOrNull(operation: (index: Int, ULong, acc: ULong) -> ULong): ULong? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.reduceRightIndexedOrNull(operation: (index: Int, UByte, acc: UByte) -> UByte): UByte? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element with its index in the original array and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes the index of an element, the element itself and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.reduceRightIndexedOrNull(operation: (index: Int, UShort, acc: UShort) -> UShort): UShort? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(index, get(index), accumulator)\n --index\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.reduceRightOrNull(operation: (UInt, acc: UInt) -> UInt): UInt? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.reduceRightOrNull(operation: (ULong, acc: ULong) -> ULong): ULong? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.reduceRightOrNull(operation: (UByte, acc: UByte) -> UByte): UByte? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Accumulates value starting with the last element and applying [operation] from right to left\n * to each element and current accumulator value.\n * \n * Returns `null` if the array is empty.\n * \n * @param [operation] function that takes an element and current accumulator value,\n * and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.reduceRightOrNull\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.reduceRightOrNull(operation: (UShort, acc: UShort) -> UShort): UShort? {\n var index = lastIndex\n if (index < 0) return null\n var accumulator = get(index--)\n while (index >= 0) {\n accumulator = operation(get(index--), accumulator)\n }\n return accumulator\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.runningFold(initial: R, operation: (acc: R, UInt) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.runningFold(initial: R, operation: (acc: R, ULong) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.runningFold(initial: R, operation: (acc: R, UByte) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.runningFold(initial: R, operation: (acc: R, UShort) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (element in this) {\n accumulator = operation(accumulator, element)\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, UInt) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (index in indices) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, ULong) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (index in indices) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, UByte) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (index in indices) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningFold\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.runningFoldIndexed(initial: R, operation: (index: Int, acc: R, UShort) -> R): List {\n if (isEmpty()) return listOf(initial)\n val result = ArrayList(size + 1).apply { add(initial) }\n var accumulator = initial\n for (index in indices) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this array.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.runningReduce(operation: (acc: UInt, UInt) -> UInt): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this array.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.runningReduce(operation: (acc: ULong, ULong) -> ULong): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this array.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.runningReduce(operation: (acc: UByte, UByte) -> UByte): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with the first element of this array.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.runningReduce(operation: (acc: UShort, UShort) -> UShort): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with the first element of this array.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.runningReduceIndexed(operation: (index: Int, acc: UInt, UInt) -> UInt): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with the first element of this array.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.runningReduceIndexed(operation: (index: Int, acc: ULong, ULong) -> ULong): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with the first element of this array.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.runningReduceIndexed(operation: (index: Int, acc: UByte, UByte) -> UByte): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with the first element of this array.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.runningReduce\n */\n@SinceKotlin(\"1.4\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.runningReduceIndexed(operation: (index: Int, acc: UShort, UShort) -> UShort): List {\n if (isEmpty()) return emptyList()\n var accumulator = this[0]\n val result = ArrayList(size).apply { add(accumulator) }\n for (index in 1 until size) {\n accumulator = operation(index, accumulator, this[index])\n result.add(accumulator)\n }\n return result\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.scan(initial: R, operation: (acc: R, UInt) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.scan(initial: R, operation: (acc: R, ULong) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.scan(initial: R, operation: (acc: R, UByte) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes current accumulator value and an element, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.scan(initial: R, operation: (acc: R, UShort) -> R): List {\n return runningFold(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.scanIndexed(initial: R, operation: (index: Int, acc: R, UInt) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.scanIndexed(initial: R, operation: (index: Int, acc: R, ULong) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.scanIndexed(initial: R, operation: (index: Int, acc: R, UByte) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n/**\n * Returns a list containing successive accumulation values generated by applying [operation] from left to right\n * to each element, its index in the original array and current accumulator value that starts with [initial] value.\n * \n * Note that `acc` value passed to [operation] function should not be mutated;\n * otherwise it would affect the previous value in resulting list.\n * \n * @param [operation] function that takes the index of an element, current accumulator value\n * and the element itself, and calculates the next accumulator value.\n * \n * @sample samples.collections.Collections.Aggregates.scan\n */\n@SinceKotlin(\"1.4\")\n@WasExperimental(ExperimentalStdlibApi::class)\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.scanIndexed(initial: R, operation: (index: Int, acc: R, UShort) -> R): List {\n return runningFoldIndexed(initial, operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.scanReduce(operation: (acc: UInt, UInt) -> UInt): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.scanReduce(operation: (acc: ULong, ULong) -> ULong): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.scanReduce(operation: (acc: UByte, UByte) -> UByte): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduce instead.\", ReplaceWith(\"runningReduce(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.scanReduce(operation: (acc: UShort, UShort) -> UShort): List {\n return runningReduce(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.scanReduceIndexed(operation: (index: Int, acc: UInt, UInt) -> UInt): List {\n return runningReduceIndexed(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.scanReduceIndexed(operation: (index: Int, acc: ULong, ULong) -> ULong): List {\n return runningReduceIndexed(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.scanReduceIndexed(operation: (index: Int, acc: UByte, UByte) -> UByte): List {\n return runningReduceIndexed(operation)\n}\n\n@Deprecated(\"Use runningReduceIndexed instead.\", ReplaceWith(\"runningReduceIndexed(operation)\"), level = DeprecationLevel.ERROR)\n@SinceKotlin(\"1.3\")\n@ExperimentalStdlibApi\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.scanReduceIndexed(operation: (index: Int, acc: UShort, UShort) -> UShort): List {\n return runningReduceIndexed(operation)\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.sumBy(selector: (UInt) -> UInt): UInt {\n var sum: UInt = 0u\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.sumBy(selector: (ULong) -> UInt): UInt {\n var sum: UInt = 0u\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.sumBy(selector: (UByte) -> UInt): UInt {\n var sum: UInt = 0u\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.sumBy(selector: (UShort) -> UInt): UInt {\n var sum: UInt = 0u\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.sumByDouble(selector: (UInt) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.sumByDouble(selector: (ULong) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.sumByDouble(selector: (UByte) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.sumByDouble(selector: (UShort) -> Double): Double {\n var sum: Double = 0.0\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.sumOf(selector: (UInt) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.sumOf(selector: (ULong) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.sumOf(selector: (UByte) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfDouble\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.sumOf(selector: (UShort) -> Double): Double {\n var sum: Double = 0.toDouble()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.sumOf(selector: (UInt) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.sumOf(selector: (ULong) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.sumOf(selector: (UByte) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.sumOf(selector: (UShort) -> Int): Int {\n var sum: Int = 0.toInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.sumOf(selector: (UInt) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.sumOf(selector: (ULong) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.sumOf(selector: (UByte) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfLong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.sumOf(selector: (UShort) -> Long): Long {\n var sum: Long = 0.toLong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.sumOf(selector: (UInt) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.sumOf(selector: (ULong) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.sumOf(selector: (UByte) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.sumOf(selector: (UShort) -> UInt): UInt {\n var sum: UInt = 0.toUInt()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.sumOf(selector: (UInt) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.sumOf(selector: (ULong) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.sumOf(selector: (UByte) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns the sum of all values produced by [selector] function applied to each element in the array.\n */\n@SinceKotlin(\"1.4\")\n@OptIn(kotlin.experimental.ExperimentalTypeInference::class)\n@OverloadResolutionByLambdaReturnType\n@Suppress(\"INAPPLICABLE_JVM_NAME\")\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.sumOf(selector: (UShort) -> ULong): ULong {\n var sum: ULong = 0.toULong()\n for (element in this) {\n sum += selector(element)\n }\n return sum\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic infix fun UIntArray.zip(other: Array): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic infix fun ULongArray.zip(other: Array): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic infix fun UByteArray.zip(other: Array): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic infix fun UShortArray.zip(other: Array): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.zip(other: Array, transform: (a: UInt, b: R) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.zip(other: Array, transform: (a: ULong, b: R) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.zip(other: Array, transform: (a: UByte, b: R) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.zip(other: Array, transform: (a: UShort, b: R) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic infix fun UIntArray.zip(other: Iterable): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic infix fun ULongArray.zip(other: Iterable): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic infix fun UByteArray.zip(other: Iterable): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` collection and [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic infix fun UShortArray.zip(other: Iterable): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] collection with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.zip(other: Iterable, transform: (a: UInt, b: R) -> V): List {\n val arraySize = size\n val list = ArrayList(minOf(other.collectionSizeOrDefault(10), arraySize))\n var i = 0\n for (element in other) {\n if (i >= arraySize) break\n list.add(transform(this[i++], element))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] collection with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.zip(other: Iterable, transform: (a: ULong, b: R) -> V): List {\n val arraySize = size\n val list = ArrayList(minOf(other.collectionSizeOrDefault(10), arraySize))\n var i = 0\n for (element in other) {\n if (i >= arraySize) break\n list.add(transform(this[i++], element))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] collection with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.zip(other: Iterable, transform: (a: UByte, b: R) -> V): List {\n val arraySize = size\n val list = ArrayList(minOf(other.collectionSizeOrDefault(10), arraySize))\n var i = 0\n for (element in other) {\n if (i >= arraySize) break\n list.add(transform(this[i++], element))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] collection with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.zip(other: Iterable, transform: (a: UShort, b: R) -> V): List {\n val arraySize = size\n val list = ArrayList(minOf(other.collectionSizeOrDefault(10), arraySize))\n var i = 0\n for (element in other) {\n if (i >= arraySize) break\n list.add(transform(this[i++], element))\n }\n return list\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic infix fun UIntArray.zip(other: UIntArray): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic infix fun ULongArray.zip(other: ULongArray): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic infix fun UByteArray.zip(other: UByteArray): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of pairs built from the elements of `this` array and the [other] array with the same index.\n * The returned list has length of the shortest collection.\n * \n * @sample samples.collections.Iterables.Operations.zipIterable\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic infix fun UShortArray.zip(other: UShortArray): List> {\n return zip(other) { t1, t2 -> t1 to t2 }\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest array.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.zip(other: UIntArray, transform: (a: UInt, b: UInt) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest array.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.zip(other: ULongArray, transform: (a: ULong, b: ULong) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest array.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.zip(other: UByteArray, transform: (a: UByte, b: UByte) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns a list of values built from the elements of `this` array and the [other] array with the same index\n * using the provided [transform] function applied to each pair of elements.\n * The returned list has length of the shortest array.\n * \n * @sample samples.collections.Iterables.Operations.zipIterableWithTransform\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.zip(other: UShortArray, transform: (a: UShort, b: UShort) -> V): List {\n val size = minOf(size, other.size)\n val list = ArrayList(size)\n for (i in 0 until size) {\n list.add(transform(this[i], other[i]))\n }\n return list\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\n@kotlin.jvm.JvmName(\"sumOfUInt\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun Array.sum(): UInt {\n var sum: UInt = 0u\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\n@kotlin.jvm.JvmName(\"sumOfULong\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun Array.sum(): ULong {\n var sum: ULong = 0uL\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\n@kotlin.jvm.JvmName(\"sumOfUByte\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun Array.sum(): UInt {\n var sum: UInt = 0u\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\n@kotlin.jvm.JvmName(\"sumOfUShort\")\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\npublic fun Array.sum(): UInt {\n var sum: UInt = 0u\n for (element in this) {\n sum += element\n }\n return sum\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UIntArray.sum(): UInt {\n return storage.sum().toUInt()\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun ULongArray.sum(): ULong {\n return storage.sum().toULong()\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UByteArray.sum(): UInt {\n return sumBy { it.toUInt() }\n}\n\n/**\n * Returns the sum of all elements in the array.\n */\n@SinceKotlin(\"1.3\")\n@ExperimentalUnsignedTypes\n@kotlin.internal.InlineOnly\npublic inline fun UShortArray.sum(): UInt {\n return sumBy { it.toUInt() }\n}\n\n","package io.ktor.utils.io.bits\n\nimport io.ktor.utils.io.core.internal.*\nimport org.khronos.webgl.*\nimport kotlin.contracts.*\n\n/**\n * Execute [block] of code providing a temporary instance of [Memory] view of this byte array range\n * starting at the specified [offset] and having the specified bytes [length].\n * By default, if neither [offset] nor [length] specified, the whole array is used.\n * An instance of [Memory] provided into the [block] should be never captured and used outside of lambda.\n */\npublic actual inline fun ByteArray.useMemory(offset: Int, length: Int, block: (Memory) -> R): R {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n return Memory.of(this, offset, length).let(block)\n}\n\n/**\n * Create [Memory] view for the specified [array] range starting at [offset] and the specified bytes [length].\n */\npublic fun Memory.Companion.of(array: ByteArray, offset: Int = 0, length: Int = array.size - offset): Memory {\n @Suppress(\"UnsafeCastFromDynamic\")\n val typedArray: Int8Array = array.asDynamic()\n return Memory.of(typedArray, offset, length)\n}\n\n/**\n * Create [Memory] view for the specified [buffer] range starting at [offset] and the specified bytes [length].\n */\npublic fun Memory.Companion.of(buffer: ArrayBuffer, offset: Int = 0, length: Int = buffer.byteLength - offset): Memory {\n return Memory(DataView(buffer, offset, length))\n}\n\n/**\n * Create [Memory] view for the specified [view].\n */\npublic fun Memory.Companion.of(view: DataView): Memory {\n return Memory(view)\n}\n\n/**\n * Create [Memory] view for the specified [view] range starting at [offset] and the specified bytes [length].\n */\npublic fun Memory.Companion.of(view: ArrayBufferView, offset: Int = 0, length: Int = view.byteLength): Memory {\n return Memory.of(view.buffer, view.byteOffset + offset, length)\n}\n\n@PublishedApi\ninternal actual object DefaultAllocator : Allocator {\n override fun alloc(size: Int): Memory = Memory(DataView(ArrayBuffer(size)))\n override fun alloc(size: Long): Memory = Memory(DataView(ArrayBuffer(size.toIntOrFail(\"size\"))))\n override fun free(instance: Memory) {\n }\n}\n","@file:Suppress(\"RedundantModalityModifier\")\n\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.internal.*\nimport io.ktor.utils.io.core.internal.require\nimport io.ktor.utils.io.pool.*\n\n/**\n * The default abstract base class implementing [Input] interface.\n * @see [AbstractInput.fill] and [AbstractInput.closeSource].\n */\npublic abstract class AbstractInput(\n head: ChunkBuffer = ChunkBuffer.Empty,\n remaining: Long = head.remainingAll(),\n public val pool: ObjectPool = ChunkBuffer.Pool\n) : Input {\n private val state = AbstractInputSharedState(head, remaining)\n\n @Suppress(\"DEPRECATION\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public constructor(\n head: IoBuffer = IoBuffer.Empty,\n remaining: Long = head.remainingAll(),\n pool: ObjectPool = ChunkBuffer.Pool\n ) : this(head as ChunkBuffer, remaining, pool)\n\n /**\n * Read the next bytes into the [destination] starting at [offset] at most [length] bytes.\n * May block until at least one byte is available.\n * Usually bypass all exceptions from the underlying source.\n *\n * @param offset in bytes where result should be written\n * @param length should be at least one byte\n *\n * @return number of bytes were copied or `0` if EOF encountered\n */\n protected abstract fun fill(destination: Memory, offset: Int, length: Int): Int\n\n /**\n * Should close the underlying bytes source. Could do nothing or throw exceptions.\n */\n protected abstract fun closeSource()\n\n /**\n * Current head chunk reference\n */\n private final var _head: ChunkBuffer\n get() = state.head\n set(newHead) {\n state.head = newHead\n state.headMemory = newHead.memory\n state.headPosition = newHead.readPosition\n state.headEndExclusive = newHead.writePosition\n }\n\n @PublishedApi\n @Suppress(\"CanBePrimaryConstructorProperty\")\n internal var head: ChunkBuffer\n get() = _head.also { it.discardUntilIndex(headPosition) }\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.ERROR)\n set(newHead) {\n _head = newHead\n }\n\n @PublishedApi\n internal final var headMemory: Memory\n get() = state.headMemory\n set(value) {\n state.headMemory = value\n }\n\n @PublishedApi\n internal final var headPosition: Int\n get() = state.headPosition\n set(value) {\n state.headPosition = value\n }\n\n @PublishedApi\n internal final var headEndExclusive: Int\n get() = state.headEndExclusive\n set(value) {\n state.headEndExclusive = value\n }\n\n @PublishedApi\n @Suppress(\"DEPRECATION_ERROR\")\n internal final var headRemaining: Int\n inline get() = headEndExclusive - headPosition\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n set(newRemaining) {\n updateHeadRemaining(newRemaining)\n }\n\n private var tailRemaining: Long\n get() = state.tailRemaining\n set(newValue) {\n require(newValue >= 0) { \"tailRemaining shouldn't be negative: $newValue\" }\n state.tailRemaining = newValue\n }\n\n @Deprecated(\n \"Not supported anymore. All operations are big endian by default.\",\n level = DeprecationLevel.ERROR\n )\n final override var byteOrder: ByteOrder\n get() = ByteOrder.BIG_ENDIAN\n set(newOrder) {\n if (newOrder != ByteOrder.BIG_ENDIAN) {\n throw IllegalArgumentException(\"Only BIG_ENDIAN is supported.\")\n }\n }\n\n internal final fun prefetch(min: Long): Boolean {\n if (min <= 0) return true\n val headRemaining = headRemaining\n if (headRemaining >= min || headRemaining + tailRemaining >= min) return true\n\n return doPrefetch(min)\n }\n\n final override fun peekTo(destination: Memory, destinationOffset: Long, offset: Long, min: Long, max: Long): Long {\n prefetch(min + offset)\n\n var current: ChunkBuffer = head\n var copied = 0L\n var skip = offset\n var writePosition = destinationOffset\n val maxCopySize = minOf(max, destination.size - destinationOffset)\n\n while (copied < min && copied < maxCopySize) {\n val chunkSize = current.readRemaining\n if (chunkSize > skip) {\n val size = minOf(chunkSize - skip, maxCopySize - copied)\n current.memory.copyTo(\n destination,\n current.readPosition + skip,\n size,\n writePosition\n )\n skip = 0\n copied += size\n writePosition += size\n } else {\n skip -= chunkSize\n }\n\n current = current.next ?: break\n }\n\n return copied\n }\n\n /**\n * @see doFill for similar logic\n * @see appendView for similar logic\n */\n private fun doPrefetch(min: Long): Boolean {\n var tail = _head.findTail()\n var available = headRemaining + tailRemaining\n\n do {\n val next = fill()\n if (next == null) {\n noMoreChunksAvailable = true\n return false\n }\n\n val chunkSize = next.readRemaining\n if (tail === ChunkBuffer.Empty) {\n _head = next\n tail = next\n } else {\n tail.next = next\n tailRemaining += chunkSize\n }\n\n available += chunkSize\n } while (available < min)\n\n return true\n }\n\n /**\n * Number of bytes available for read\n */\n public final val remaining: Long get() = headRemaining.toLong() + tailRemaining\n\n /**\n * @return `true` if there is at least one byte to read\n */\n public final fun canRead(): Boolean = headPosition != headEndExclusive || tailRemaining != 0L\n\n /**\n * @return `true` if there are at least [n] bytes to read\n */\n public final fun hasBytes(n: Int): Boolean = headRemaining + tailRemaining >= n\n\n /**\n * `true` if no bytes available for read\n */\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public final val isEmpty: Boolean\n get() = endOfInput\n\n @Suppress(\"DEPRECATION\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public final val isNotEmpty: Boolean\n get() = isNotEmpty\n\n private var noMoreChunksAvailable = false\n\n final override val endOfInput: Boolean\n get() = headRemaining == 0 && tailRemaining == 0L && (noMoreChunksAvailable || doFill() == null)\n\n /**\n * Release packet. After this function invocation the packet becomes empty.\n * If it has been copied via [ByteReadPacket.copy]\n * then the copy should be released as well.\n */\n public final fun release() {\n val head = head\n val empty = ChunkBuffer.Empty\n\n if (head !== empty) {\n this._head = empty\n tailRemaining = 0\n head.releaseAll(pool)\n }\n }\n\n final override fun close() {\n release()\n if (!noMoreChunksAvailable) {\n noMoreChunksAvailable = true\n }\n closeSource()\n }\n\n internal final fun stealAll(): ChunkBuffer? {\n val head = head\n val empty = ChunkBuffer.Empty\n\n if (head === empty) return null\n this._head = empty\n tailRemaining = 0\n return head\n }\n\n internal final fun steal(): ChunkBuffer? {\n val head = head\n val next = head.next\n val empty = ChunkBuffer.Empty\n if (head === empty) return null\n\n if (next == null) {\n this._head = empty\n this.tailRemaining = 0\n } else {\n this._head = next\n this.tailRemaining -= next.readRemaining\n }\n\n head.next = null\n return head\n }\n\n internal final fun append(chain: ChunkBuffer) {\n if (chain === ChunkBuffer.Empty) return\n\n val size = chain.remainingAll()\n if (_head === ChunkBuffer.Empty) {\n _head = chain\n tailRemaining = size - headRemaining\n } else {\n _head.findTail().next = chain\n tailRemaining += size\n }\n }\n\n internal final fun tryWriteAppend(chain: ChunkBuffer): Boolean {\n val tail = head.findTail()\n val size = chain.readRemaining\n\n if (size == 0 || tail.writeRemaining < size) return false\n tail.writeBufferAppend(chain, size)\n\n if (head === tail) {\n headEndExclusive = tail.writePosition\n } else {\n tailRemaining += size\n }\n\n return true\n }\n\n final override fun readByte(): Byte {\n val index = headPosition\n val nextIndex = index + 1\n if (nextIndex < headEndExclusive) {\n // fast-path when we are not reading the last byte\n headPosition = nextIndex\n return headMemory[index]\n }\n\n return readByteSlow()\n }\n\n private fun readByteSlow(): Byte {\n val index = headPosition\n if (index < headEndExclusive) {\n val value = headMemory[index]\n headPosition = index\n val head = _head\n head.discardUntilIndex(index)\n ensureNext(head)\n return value\n }\n\n val head = prepareRead(1) ?: prematureEndOfStream(1)\n val byte = head.readByte()\n completeReadHead(head)\n return byte\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n final override fun readShort(): Short = readShort()\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n final override fun readFloat(): Float = readFloat()\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n final override fun readDouble(): Double = readDouble()\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n final override fun readInt(): Int {\n return readInt()\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n final override fun readLong(): Long {\n return readLong()\n }\n\n /**\n * Read exactly [length] bytes to [dst] array at specified [offset]\n */\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n final override fun readFully(dst: ByteArray, offset: Int, length: Int) {\n val rc = readAvailable(dst, offset, length)\n if (rc != length) {\n throw EOFException(\"Not enough data in packet to fill buffer: ${length - rc} more bytes required\")\n }\n }\n\n /**\n * Discards at most [n] bytes\n * @return number of bytes has been discarded\n */\n public final fun discard(n: Int): Int {\n require(n >= 0) { \"Negative discard is not allowed: $n\" }\n return discardAsMuchAsPossible(n, 0)\n }\n\n /**\n * Discards exactly [n] bytes or fails with [EOFException]\n */\n public final fun discardExact(n: Int) {\n if (discard(n) != n) throw EOFException(\"Unable to discard $n bytes due to end of packet\")\n }\n\n @PublishedApi\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n internal inline fun read(block: (Buffer) -> Unit) {\n read(block = block)\n }\n\n @PublishedApi\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n internal inline fun read(n: Int, block: (Buffer) -> Unit) {\n read(n, block)\n }\n\n /**\n * Returns next byte (unsigned) or `-1` if no more bytes available\n */\n final override fun tryPeek(): Int {\n val head = head\n if (headRemaining > 0) {\n return head.tryPeekByte()\n }\n\n if (tailRemaining == 0L && noMoreChunksAvailable) return -1\n\n return prepareReadLoop(1, head)?.tryPeekByte() ?: -1\n }\n\n @Suppress(\"DEPRECATION\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n final override fun peekTo(buffer: IoBuffer): Int {\n val head = prepareReadHead(1) ?: return -1\n\n val size = minOf(buffer.writeRemaining, head.readRemaining)\n (buffer as Buffer).writeFully(head, size)\n\n return size\n }\n\n final override fun discard(n: Long): Long {\n if (n <= 0) return 0L\n return discardAsMuchAsPossible(n, 0)\n }\n\n internal fun readAvailableCharacters(destination: CharArray, off: Int, len: Int): Int {\n if (endOfInput) return -1\n\n val out = object : Appendable {\n private var idx = off\n\n override fun append(c: Char): Appendable {\n destination[idx++] = c\n return this\n }\n\n override fun append(csq: CharSequence?): Appendable {\n if (csq is String) {\n csq.getCharsInternal(destination, idx)\n idx += csq.length\n } else if (csq != null) {\n for (i in 0 until csq.length) {\n destination[idx++] = csq[i]\n }\n }\n\n return this\n }\n\n override fun append(csq: CharSequence?, start: Int, end: Int): Appendable {\n throw UnsupportedOperationException()\n }\n }\n\n return readText(out, 0, len)\n }\n\n /**\n * Read at least [min] and at most [max] characters and append them to [out]\n * @return number of characters appended\n */\n public fun readText(out: Appendable, min: Int = 0, max: Int = Int.MAX_VALUE): Int {\n if (max.toLong() >= remaining) {\n val s = readTextExactBytes(bytesCount = remaining.toInt())\n out.append(s)\n return s.length\n }\n return readASCII(out, min, max)\n }\n\n /**\n * Read exactly [exactCharacters] characters and append them to [out]\n */\n public fun readTextExact(out: Appendable, exactCharacters: Int) {\n readText(out, exactCharacters, exactCharacters)\n }\n\n /**\n * Read a string at last [min] and at most [max] characters length\n */\n public fun readText(min: Int = 0, max: Int = Int.MAX_VALUE): String {\n if (min == 0 && (max == 0 || endOfInput)) return \"\"\n val remaining = remaining\n if (remaining > 0 && max.toLong() >= remaining) return readTextExactBytes(bytesCount = remaining.toInt())\n\n return buildString(min.coerceAtLeast(16).coerceAtMost(max)) {\n readASCII(this, min, max)\n }\n }\n\n /**\n * Read a string exactly [exactCharacters] length\n */\n public fun readTextExact(exactCharacters: Int): String {\n return readText(exactCharacters, exactCharacters)\n }\n\n private fun readASCII(out: Appendable, min: Int, max: Int): Int {\n when {\n max == 0 && min == 0 -> return 0\n endOfInput -> if (min == 0) return 0 else atLeastMinCharactersRequire(min)\n max < min -> minShouldBeLess(min, max)\n }\n\n var copied = 0\n var utf8 = false\n\n takeWhile { buffer ->\n val rc = buffer.decodeASCII {\n if (copied == max) false\n else {\n out.append(it)\n copied++\n true\n }\n }\n\n when {\n rc -> true\n copied == max -> false\n else -> {\n utf8 = true\n false\n }\n }\n }\n\n if (utf8) {\n return copied + readUtf8(out, min - copied, max - copied)\n }\n if (copied < min) prematureEndOfStreamChars(min, copied)\n return copied\n }\n\n private fun atLeastMinCharactersRequire(min: Int): Nothing =\n throw EOFException(\"at least $min characters required but no bytes available\")\n\n private fun minShouldBeLess(min: Int, max: Int): Nothing =\n throw IllegalArgumentException(\"min should be less or equal to max but min = $min, max = $max\")\n\n private fun prematureEndOfStreamChars(min: Int, copied: Int): Nothing = throw MalformedUTF8InputException(\n \"Premature end of stream: expected at least $min chars but had only $copied\"\n )\n\n private fun readUtf8(out: Appendable, min: Int, max: Int): Int {\n var copied = 0\n\n takeWhileSize { buffer ->\n val size = buffer.decodeUTF8 {\n if (copied == max) false\n else {\n out.append(it)\n copied++\n true\n }\n }\n\n when {\n size == 0 -> 1\n size > 0 -> size\n else -> 0\n }\n }\n\n if (copied < min) prematureEndOfStreamChars(min, copied)\n\n return copied\n }\n\n private tailrec fun discardAsMuchAsPossible(n: Long, skipped: Long): Long {\n if (n == 0L) return skipped\n val current = prepareRead(1) ?: return skipped\n val size = minOf(current.readRemaining.toLong(), n).toInt()\n current.discardExact(size)\n headPosition += size\n afterRead(current)\n\n return discardAsMuchAsPossible(n - size, skipped + size)\n }\n\n private tailrec fun discardAsMuchAsPossible(n: Int, skipped: Int): Int {\n if (n == 0) return skipped\n val current = prepareRead(1) ?: return skipped\n val size = minOf(current.readRemaining, n)\n current.discardExact(size)\n headPosition += size\n afterRead(current)\n\n return discardAsMuchAsPossible(n - size, skipped + size)\n }\n\n private tailrec fun readAsMuchAsPossible(array: ByteArray, offset: Int, length: Int, copied: Int): Int {\n if (length == 0) return copied\n val current = prepareRead(1) ?: return copied\n val size = minOf(length, current.readRemaining)\n\n current.readFully(array, offset, size)\n headPosition = current.readPosition\n\n return if (size != length || current.readRemaining == 0) {\n afterRead(current)\n readAsMuchAsPossible(array, offset + size, length - size, copied + size)\n } else {\n copied + size\n }\n }\n\n private fun notEnoughBytesAvailable(n: Int): Nothing {\n throw EOFException(\"Not enough data in packet ($remaining) to read $n byte(s)\")\n }\n\n @Deprecated(\"Not supported anymore.\", level = DeprecationLevel.ERROR)\n public fun updateHeadRemaining(remaining: Int) {\n // the only external usages are from readDirect\n // so after using head chunk directly we should fix positions instead\n val newPosition = headEndExclusive - remaining\n\n if (newPosition < 0) {\n throw IllegalArgumentException(\"Unable to update position to negative. newRemaining is too big.\")\n }\n\n headPosition = newPosition\n }\n\n @DangerousInternalIoApi\n public fun prepareReadHead(minSize: Int): ChunkBuffer? = prepareReadLoop(minSize, head)\n\n @DangerousInternalIoApi\n public fun ensureNextHead(current: ChunkBuffer): ChunkBuffer? = ensureNext(current)\n\n @PublishedApi\n internal fun ensureNext(current: ChunkBuffer): ChunkBuffer? = ensureNext(\n current,\n ChunkBuffer.Empty\n )\n\n @DangerousInternalIoApi\n public fun fixGapAfterRead(current: ChunkBuffer) {\n val next = current.next ?: return fixGapAfterReadFallback(current)\n\n val remaining = current.readRemaining\n val overrunSize = minOf(remaining, Buffer.ReservedSize - current.endGap)\n if (next.startGap < overrunSize) {\n return fixGapAfterReadFallback(current)\n }\n\n next.restoreStartGap(overrunSize)\n\n if (remaining > overrunSize) {\n current.releaseEndGap()\n\n this.headEndExclusive = current.writePosition\n this.tailRemaining += overrunSize\n } else {\n this._head = next\n this.tailRemaining -= next.readRemaining - overrunSize\n current.cleanNext()\n current.release(pool)\n }\n }\n\n private fun fixGapAfterReadFallback(current: ChunkBuffer) {\n if (noMoreChunksAvailable && current.next == null) {\n this.headPosition = current.readPosition\n this.headEndExclusive = current.writePosition\n this.tailRemaining = 0\n return\n }\n\n val size = current.readRemaining\n val overrun = minOf(size, Buffer.ReservedSize - current.endGap)\n\n if (size > overrun) {\n fixGapAfterReadFallbackUnreserved(current, size, overrun)\n } else {\n val new = pool.borrow()\n new.reserveEndGap(Buffer.ReservedSize)\n new.next = current.cleanNext()\n\n new.writeBufferAppend(current, size)\n this._head = new\n }\n\n current.release(pool)\n }\n\n private fun fixGapAfterReadFallbackUnreserved(current: ChunkBuffer, size: Int, overrun: Int) {\n // if we have a chunk with no end reservation\n // we can split it into two to fix it\n\n val chunk1 = pool.borrow()\n val chunk2 = pool.borrow()\n\n chunk1.reserveEndGap(Buffer.ReservedSize)\n chunk2.reserveEndGap(Buffer.ReservedSize)\n chunk1.next = chunk2\n chunk2.next = current.cleanNext()\n\n chunk1.writeBufferAppend(current, size - overrun)\n chunk2.writeBufferAppend(current, overrun)\n\n this._head = chunk1\n this.tailRemaining = chunk2.remainingAll()\n }\n\n private tailrec fun ensureNext(current: ChunkBuffer, empty: ChunkBuffer): ChunkBuffer? {\n if (current === empty) {\n return doFill()\n }\n\n val next = current.cleanNext()\n current.release(pool)\n\n return when {\n next == null -> {\n this._head = empty\n this.tailRemaining = 0L\n ensureNext(empty, empty)\n }\n next.canRead() -> {\n _head = next\n tailRemaining -= next.readRemaining\n next\n }\n else -> ensureNext(next, empty)\n }\n }\n\n /**\n * Reads the next chunk suitable for reading or `null` if no more chunks available. It is also allowed\n * to return a chain of chunks linked through [ChunkBuffer.next]. The last chunk should have `null` next reference.\n * Could rethrow exceptions from the underlying source.\n */\n protected open fun fill(): ChunkBuffer? {\n val buffer = pool.borrow()\n try {\n buffer.reserveEndGap(Buffer.ReservedSize)\n val copied = fill(buffer.memory, buffer.writePosition, buffer.writeRemaining)\n\n if (copied == 0) {\n noMoreChunksAvailable = true\n\n if (!buffer.canRead()) {\n buffer.release(pool)\n return null\n }\n }\n\n buffer.commitWritten(copied)\n\n return buffer\n } catch (t: Throwable) {\n buffer.release(pool)\n throw t\n }\n }\n\n protected final fun markNoMoreChunksAvailable() {\n if (!noMoreChunksAvailable) {\n noMoreChunksAvailable = true\n }\n }\n\n /**\n * see [prefetch] for similar logic\n */\n private final fun doFill(): ChunkBuffer? {\n if (noMoreChunksAvailable) return null\n val chunk = fill()\n if (chunk == null) {\n noMoreChunksAvailable = true\n return null\n }\n appendView(chunk)\n return chunk\n }\n\n private final fun appendView(chunk: ChunkBuffer) {\n val tail = _head.findTail()\n if (tail === ChunkBuffer.Empty) {\n _head = chunk\n require(tailRemaining == 0L) {\n throw IllegalStateException(\"It should be no tail remaining bytes if current tail is EmptyBuffer\")\n }\n tailRemaining = chunk.next?.remainingAll() ?: 0L\n } else {\n tail.next = chunk\n tailRemaining += chunk.remainingAll()\n }\n }\n\n @PublishedApi\n internal fun prepareRead(minSize: Int): ChunkBuffer? {\n val head = head\n if (headEndExclusive - headPosition >= minSize) return head\n return prepareReadLoop(minSize, head)\n }\n\n @PublishedApi\n internal final fun prepareRead(minSize: Int, head: ChunkBuffer): ChunkBuffer? {\n if (headEndExclusive - headPosition >= minSize) return head\n return prepareReadLoop(minSize, head)\n }\n\n private tailrec fun prepareReadLoop(minSize: Int, head: ChunkBuffer): ChunkBuffer? {\n val headSize = headRemaining\n if (headSize >= minSize) return head\n\n val next = head.next ?: doFill() ?: return null\n\n if (headSize == 0) {\n if (head !== ChunkBuffer.Empty) {\n releaseHead(head)\n }\n\n return prepareReadLoop(minSize, next)\n } else {\n val desiredExtraBytes = minSize - headSize\n val copied = head.writeBufferAppend(next, desiredExtraBytes)\n headEndExclusive = head.writePosition\n tailRemaining -= copied\n if (!next.canRead()) {\n head.next = null\n head.next = next.cleanNext()\n next.release(pool)\n } else {\n next.reserveStartGap(copied)\n }\n }\n\n if (head.readRemaining >= minSize) return head\n if (minSize > Buffer.ReservedSize) minSizeIsTooBig(minSize)\n\n return prepareReadLoop(minSize, head)\n }\n\n private fun minSizeIsTooBig(minSize: Int): Nothing {\n throw IllegalStateException(\"minSize of $minSize is too big (should be less than ${Buffer.ReservedSize})\")\n }\n\n private fun afterRead(head: ChunkBuffer) {\n if (head.readRemaining == 0) {\n releaseHead(head)\n }\n }\n\n internal final fun releaseHead(head: ChunkBuffer): ChunkBuffer {\n val next = head.cleanNext() ?: ChunkBuffer.Empty\n this._head = next\n this.tailRemaining -= next.readRemaining\n head.release(pool)\n\n return next\n }\n\n public companion object\n}\n","/*\n * Copyright 2016-2017 JetBrains s.r.o.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage io.ktor.utils.io\n\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.*\nimport kotlinx.coroutines.*\n\n/**\n * Channel for asynchronous reading and writing of sequences of bytes.\n * This is a buffered **single-reader single-writer channel**.\n *\n * Read operations can be invoked concurrently with write operations, but multiple reads or multiple writes\n * cannot be invoked concurrently with themselves. Exceptions are [close] and [flush] which can be invoked\n * concurrently with any other operations and between themselves at any time.\n */\npublic interface ByteChannel : ByteReadChannel, ByteWriteChannel {\n public fun attachJob(job: Job)\n}\n\n/**\n * Creates buffered channel for asynchronous reading and writing of sequences of bytes.\n */\npublic expect fun ByteChannel(autoFlush: Boolean = false): ByteChannel\n\n/**\n * Creates channel for reading from the specified byte array. Please note that it could use [content] directly\n * or copy it's bytes depending on the platform.\n */\npublic fun ByteReadChannel(content: ByteArray): ByteReadChannel =\n ByteReadChannel(content, 0, content.size)\n\n/**\n * Creates channel for reading from the specified byte array. Please note that it could use [content] directly\n * or copy it's bytes depending on the platform.\n */\npublic fun ByteReadChannel(content: ByteArray, offset: Int): ByteReadChannel =\n ByteReadChannel(content, offset, content.size)\n\n/**\n * Creates channel for reading from the specified byte array. Please note that it could use [content] directly\n * or copy it's bytes depending on the platform\n */\npublic expect fun ByteReadChannel(content: ByteArray, offset: Int, length: Int): ByteReadChannel\n\npublic fun ByteReadChannel(text: String, charset: Charset = Charsets.UTF_8): ByteReadChannel =\n ByteReadChannel(text.toByteArray(charset)) // TODO optimize to encode parts on demand\n\n/**\n * Byte channel that is always empty.\n */\n@Deprecated(\n \"Use ByteReadChannel.Empty instead\",\n ReplaceWith(\"ByteReadChannel.Empty\"),\n level = DeprecationLevel.ERROR\n)\npublic val EmptyByteReadChannel: ByteReadChannel\n get() = ByteReadChannel.Empty\n","@file:Suppress(\"RedundantModalityModifier\")\n\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.core.internal.*\nimport io.ktor.utils.io.errors.*\nimport io.ktor.utils.io.pool.*\n\n@DangerousInternalIoApi\n@Deprecated(\n \"Will be removed in the future releases. Use Input or AbstractInput instead.\",\n ReplaceWith(\"AbstractInput\", \"io.ktor.utils.io.core.AbstractInput\")\n)\npublic abstract class ByteReadPacketBase(\n head: ChunkBuffer,\n remaining: Long,\n pool: ObjectPool\n) : AbstractInput(head, remaining, pool) {\n\n @Suppress(\"DEPRECATION\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public constructor(\n head: IoBuffer,\n remaining: Long,\n pool: ObjectPool\n ) : this(head as ChunkBuffer, remaining, pool)\n\n public companion object {\n @Deprecated(\n \"Use ByteReadPacket.Empty instead\",\n ReplaceWith(\"ByteReadPacket.Empty\"),\n level = DeprecationLevel.ERROR\n )\n public val Empty: ByteReadPacket\n get() = ByteReadPacket.Empty\n }\n}\n\npublic expect class EOFException(message: String) : IOException\n\n/**\n * For streaming input it should be [Input.endOfInput] instead.\n */\n@Deprecated(\"Use endOfInput property instead\", ReplaceWith(\"endOfInput\"))\npublic inline val Input.isEmpty: Boolean\n get() = endOfInput\n\n/**\n * For streaming input there is no reliable way to detect it without triggering bytes population from the underlying\n * source. Consider using [Input.endOfInput] or use [ByteReadPacket] instead.\n */\n@Deprecated(\n \"This makes no sense for streaming inputs. Some use-cases are covered by endOfInput property\",\n ReplaceWith(\"!endOfInput\")\n)\npublic val Input.isNotEmpty: Boolean\n get() {\n if (endOfInput) return false\n prepareReadFirstHead(1)?.let { found ->\n completeReadHead(found)\n return true\n }\n return false\n }\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic inline val ByteReadPacket.isEmpty: Boolean\n get() = endOfInput\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic inline val ByteReadPacket.isNotEmpty: Boolean\n get() = !endOfInput\n","package io.ktor.utils.io\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.*\n\n/**\n * Channel for asynchronous reading of sequences of bytes.\n * This is a **single-reader channel**.\n *\n * Operations on this channel cannot be invoked concurrently.\n */\npublic expect interface ByteReadChannel {\n /**\n * Returns number of bytes that can be read without suspension. Read operations do no suspend and return\n * immediately when this number is at least the number of bytes requested for read.\n */\n public val availableForRead: Int\n\n /**\n * Returns `true` if the channel is closed and no remaining bytes are available for read.\n * It implies that [availableForRead] is zero.\n */\n public val isClosedForRead: Boolean\n\n public val isClosedForWrite: Boolean\n\n /**\n * Byte order that is used for multi-byte read operations\n * (such as [readShort], [readInt], [readLong], [readFloat], and [readDouble]).\n */\n @Deprecated(\n \"Setting byte order is no longer supported. Read/write in big endian and use reverseByteOrder() extensions.\",\n level = DeprecationLevel.ERROR\n )\n public var readByteOrder: ByteOrder\n\n /**\n * Number of bytes read from the channel.\n * It is not guaranteed to be atomic so could be updated in the middle of long running read operation.\n */\n public val totalBytesRead: Long\n\n /**\n * Reads all available bytes to [dst] buffer and returns immediately or suspends if no bytes available\n * @return number of bytes were read or `-1` if the channel has been closed\n */\n public suspend fun readAvailable(dst: ByteArray, offset: Int, length: Int): Int\n public suspend fun readAvailable(dst: IoBuffer): Int\n\n /**\n * Reads all [length] bytes to [dst] buffer or fails if channel has been closed.\n * Suspends if not enough bytes available.\n */\n public suspend fun readFully(dst: ByteArray, offset: Int, length: Int)\n public suspend fun readFully(dst: IoBuffer, n: Int)\n\n /**\n * Reads the specified amount of bytes and makes a byte packet from them. Fails if channel has been closed\n * and not enough bytes available. Accepts [headerSizeHint] to be provided, see [BytePacketBuilder].\n */\n public suspend fun readPacket(size: Int, headerSizeHint: Int): ByteReadPacket\n\n /**\n * Reads up to [limit] bytes and makes a byte packet or until end of stream encountered.\n * Accepts [headerSizeHint] to be provided, see [BytePacketBuilder].\n */\n public suspend fun readRemaining(limit: Long, headerSizeHint: Int): ByteReadPacket\n\n /**\n * Reads a long number (suspending if not enough bytes available) or fails if channel has been closed\n * and not enough bytes.\n */\n public suspend fun readLong(): Long\n\n /**\n * Reads an int number (suspending if not enough bytes available) or fails if channel has been closed\n * and not enough bytes.\n */\n public suspend fun readInt(): Int\n\n /**\n * Reads a short number (suspending if not enough bytes available) or fails if channel has been closed\n * and not enough bytes.\n */\n public suspend fun readShort(): Short\n\n /**\n * Reads a byte (suspending if no bytes available yet) or fails if channel has been closed\n * and not enough bytes.\n */\n public suspend fun readByte(): Byte\n\n /**\n * Reads a boolean value (suspending if no bytes available yet) or fails if channel has been closed\n * and not enough bytes.\n */\n public suspend fun readBoolean(): Boolean\n\n /**\n * Reads double number (suspending if not enough bytes available) or fails if channel has been closed\n * and not enough bytes.\n */\n public suspend fun readDouble(): Double\n\n /**\n * Reads float number (suspending if not enough bytes available) or fails if channel has been closed\n * and not enough bytes.\n */\n public suspend fun readFloat(): Float\n\n /**\n * Starts non-suspendable read session. After channel preparation [consumer] lambda will be invoked immediately\n * event if there are no bytes available for read yet.\n */\n @Suppress(\"DEPRECATION\")\n @Deprecated(\"Use read { } instead.\")\n public fun readSession(consumer: ReadSession.() -> Unit)\n\n /**\n * Starts a suspendable read session. After channel preparation [consumer] lambda will be invoked immediately\n * even if there are no bytes available for read yet. [consumer] lambda could suspend as much as needed.\n */\n @Suppress(\"DEPRECATION\")\n @Deprecated(\"Use read { } instead.\")\n public suspend fun readSuspendableSession(consumer: suspend SuspendableReadSession.() -> Unit)\n\n /**\n * Reads a line of UTF-8 characters to the specified [out] buffer up to [limit] characters.\n * Supports both CR-LF and LF line endings. No line ending characters will be appended to [out] buffer.\n * Throws an exception if the specified [limit] has been exceeded.\n *\n * @return `true` if line has been read (possibly empty) or `false` if channel has been closed\n * and no characters were read.\n */\n public suspend fun readUTF8LineTo(out: A, limit: Int): Boolean\n\n /**\n * Reads a line of UTF-8 characters up to [limit] characters.\n * Supports both CR-LF and LF line endings.\n * Throws an exception if the specified [limit] has been exceeded.\n *\n * @return a line string with no line endings or `null` of channel has been closed\n * and no characters were read.\n */\n public suspend fun readUTF8Line(limit: Int): String?\n\n /**\n * Close channel with optional [cause] cancellation. Unlike [ByteWriteChannel.close] that could close channel\n * normally, cancel does always close with error so any operations on this channel will always fail\n * and all suspensions will be resumed with exception.\n *\n * Please note that if the channel has been provided by [reader] or [writer] then the corresponding owning\n * coroutine will be cancelled as well\n *\n * @see ByteWriteChannel.close\n */\n public fun cancel(cause: Throwable?): Boolean\n\n /**\n * Discard up to [max] bytes\n *\n * @return number of bytes were discarded\n */\n public suspend fun discard(max: Long): Long\n\n /**\n * Try to copy at least [min] but up to [max] bytes to the specified [destination] buffer from this input\n * skipping [offset] bytes. If there are not enough bytes available to provide [min] bytes after skipping [offset]\n * bytes then it will trigger the underlying source reading first and after that will\n * simply copy available bytes even if EOF encountered so [min] is not a requirement but a desired number of bytes.\n * It is safe to specify [max] greater than the destination free space.\n * `min` shouldn't be bigger than the [destination] free space.\n * This function could trigger the underlying source suspending reading.\n * It is allowed to specify too big [offset] so in this case this function will always return `0` after prefetching\n * all underlying bytes but note that it may lead to significant memory consumption.\n * This function usually copy more bytes than [min] (unless `max = min`) but it is not guaranteed.\n * When `0` is returned with `offset = 0` then it makes sense to check [isClosedForRead].\n *\n * @param destination to write bytes\n * @param offset to skip input\n * @param min bytes to be copied, shouldn't be greater than the buffer free space. Could be `0`.\n * @param max bytes to be copied even if there are more bytes buffered, could be [Int.MAX_VALUE].\n * @return number of bytes copied to the [destination] possibly `0`\n */\n public suspend fun peekTo(\n destination: Memory,\n destinationOffset: Long,\n offset: Long = 0,\n min: Long = 1,\n max: Long = Long.MAX_VALUE\n ): Long\n\n public companion object {\n public val Empty: ByteReadChannel\n }\n}\n\n/**\n * Reads the specified amount of bytes and makes a byte packet from them. Fails if channel has been closed\n * and not enough bytes available.\n */\npublic suspend fun ByteReadChannel.readPacket(size: Int): ByteReadPacket = readPacket(size, 0)\n\n/**\n * Reads up to [limit] bytes and makes a byte packet or until end of stream encountered.\n */\npublic suspend fun ByteReadChannel.readRemaining(limit: Long): ByteReadPacket = readRemaining(limit, 0)\n\n/**\n * Reads all remaining bytes and makes a byte packet\n */\npublic suspend fun ByteReadChannel.readRemaining(): ByteReadPacket = readRemaining(Long.MAX_VALUE, 0)\n\npublic suspend fun ByteReadChannel.readFully(dst: IoBuffer) {\n readFully(dst, dst.writeRemaining)\n}\n\npublic suspend fun ByteReadChannel.readUTF8LineTo(out: Appendable): Boolean {\n return readUTF8LineTo(out, Int.MAX_VALUE)\n}\n\npublic suspend fun ByteReadChannel.readUTF8Line(): String? {\n return readUTF8Line(Int.MAX_VALUE)\n}\n\npublic fun ByteReadChannel.cancel(): Boolean = cancel(null)\n\n/**\n * Discards all bytes in the channel and suspends until end of stream.\n */\npublic suspend fun ByteReadChannel.discard(): Long = discard(Long.MAX_VALUE)\n\n/**\n * Discards exactly [n] bytes or fails if not enough bytes in the channel\n */\npublic suspend inline fun ByteReadChannel.discardExact(n: Long) {\n if (discard(n) != n) throw EOFException(\"Unable to discard $n bytes\")\n}\n\npublic suspend fun ByteReadChannel.readAvailable(dst: ByteArray): Int = readAvailable(dst, 0, dst.size)\n\npublic suspend fun ByteReadChannel.readFully(dst: ByteArray): Unit = readFully(dst, 0, dst.size)\n\npublic expect suspend fun ByteReadChannel.joinTo(dst: ByteWriteChannel, closeOnEnd: Boolean)\n\n/**\n * Reads bytes from receiver channel and writes them to [dst] channel.\n * Closes [dst] channel if fails to read or write with cause exception.\n * @return a number of copied bytes\n */\npublic suspend fun ByteReadChannel.copyTo(dst: ByteWriteChannel): Long = copyTo(dst, limit = Long.MAX_VALUE)\n\n/**\n * Reads up to [limit] bytes from receiver channel and writes them to [dst] channel.\n * Closes [dst] channel if fails to read or write with cause exception.\n * @return a number of copied bytes\n */\npublic expect suspend fun ByteReadChannel.copyTo(dst: ByteWriteChannel, limit: Long): Long\n\n/**\n * Reads all the bytes from receiver channel and writes them to [dst] channel and then closes it.\n * Closes [dst] channel if fails to read or write with cause exception.\n * @return a number of copied bytes\n */\npublic suspend fun ByteReadChannel.copyAndClose(dst: ByteWriteChannel, limit: Long = Long.MAX_VALUE): Long {\n val count = copyTo(dst, limit)\n dst.close()\n return count\n}\n","package io.ktor.utils.io.core\n\nimport io.ktor.utils.io.core.internal.*\nimport io.ktor.utils.io.pool.*\nimport kotlin.contracts.*\n\npublic expect val PACKET_MAX_COPY_SIZE: Int\n\n/**\n * Build a byte packet in [block] lambda. Creates a temporary builder and releases it in case of failure\n */\npublic inline fun buildPacket(headerSizeHint: Int = 0, block: BytePacketBuilder.() -> Unit): ByteReadPacket {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n val builder = BytePacketBuilder(headerSizeHint)\n try {\n block(builder)\n return builder.build()\n } catch (t: Throwable) {\n builder.release()\n throw t\n }\n}\n\npublic expect fun BytePacketBuilder(headerSizeHint: Int = 0): BytePacketBuilder\n\n/**\n * Discard all written bytes and prepare to build another packet.\n */\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun BytePacketBuilder.reset() {\n release()\n}\n\n@DangerousInternalIoApi\n@Deprecated(\"Will be removed in future releases.\", level = DeprecationLevel.ERROR)\n@Suppress(\"DEPRECATION_ERROR\")\npublic abstract class BytePacketBuilderPlatformBase\ninternal constructor(pool: ObjectPool) : BytePacketBuilderBase(pool)\n\n@DangerousInternalIoApi\n@Deprecated(\"Will be removed in future releases\", level = DeprecationLevel.ERROR)\n@Suppress(\"DEPRECATION_ERROR\")\npublic abstract class BytePacketBuilderBase\ninternal constructor(pool: ObjectPool) : AbstractOutput(pool)\n","package io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.internal.*\n\n/**\n * This shouldn't be implemented directly. Inherit [AbstractOutput] instead.\n */\npublic expect interface Output : Appendable, Closeable {\n @Deprecated(\n \"This is no longer supported. All operations are big endian by default. Use writeXXXLittleEndian \" +\n \"to write primitives in little endian order\" +\n \" or do X.reverseByteOrder() and then writeXXX instead.\",\n level = DeprecationLevel.ERROR\n )\n public var byteOrder: ByteOrder\n\n public fun writeByte(v: Byte)\n\n public fun flush()\n\n override fun close()\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun writeShort(v: Short) {\n writeShort(v)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun writeInt(v: Int) {\n writeInt(v)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun writeLong(v: Long) {\n writeLong(v)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun writeFloat(v: Float) {\n writeFloat(v)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun writeDouble(v: Double) {\n writeDouble(v)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun writeFully(src: ByteArray, offset: Int, length: Int) {\n writeFully(src, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun writeFully(src: ShortArray, offset: Int, length: Int) {\n writeFully(src, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun writeFully(src: IntArray, offset: Int, length: Int) {\n writeFully(src, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun writeFully(src: LongArray, offset: Int, length: Int) {\n writeFully(src, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun writeFully(src: FloatArray, offset: Int, length: Int) {\n writeFully(src, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun writeFully(src: DoubleArray, offset: Int, length: Int) {\n writeFully(src, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\", \"DEPRECATION\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun writeFully(src: IoBuffer, length: Int) {\n writeFully(src, length)\n }\n\n public fun append(csq: CharArray, start: Int, end: Int): Appendable\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\", \"DEPRECATION\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun fill(n: Long, v: Byte) {\n fill(n, v)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Output.append(csq: CharSequence, start: Int = 0, end: Int = csq.length): Appendable {\n return append(csq, start, end)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Output.append(csq: CharArray, start: Int = 0, end: Int = csq.size): Appendable {\n return append(csq, start, end)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Output.writeFully(src: ByteArray, offset: Int = 0, length: Int = src.size - offset) {\n writeFullyBytesTemplate(offset, length) { buffer, currentOffset, count ->\n buffer.writeFully(src, currentOffset, count)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Output.writeFully(src: ShortArray, offset: Int = 0, length: Int = src.size - offset) {\n writeFullyTemplate(2, offset, length) { buffer, currentOffset, count ->\n buffer.writeFully(src, currentOffset, count)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Output.writeFully(src: IntArray, offset: Int = 0, length: Int = src.size - offset) {\n writeFullyTemplate(4, offset, length) { buffer, currentOffset, count ->\n buffer.writeFully(src, currentOffset, count)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Output.writeFully(src: LongArray, offset: Int = 0, length: Int = src.size - offset) {\n writeFullyTemplate(8, offset, length) { buffer, currentOffset, count ->\n buffer.writeFully(src, currentOffset, count)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Output.writeFully(src: FloatArray, offset: Int = 0, length: Int = src.size - offset) {\n writeFullyTemplate(4, offset, length) { buffer, currentOffset, count ->\n buffer.writeFully(src, currentOffset, count)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Output.writeFully(src: DoubleArray, offset: Int = 0, length: Int = src.size - offset) {\n writeFullyTemplate(8, offset, length) { buffer, currentOffset, count ->\n buffer.writeFully(src, currentOffset, count)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\npublic fun Output.writeFully(src: IoBuffer, length: Int = src.readRemaining) {\n writeFully(src as Buffer, length)\n}\n\npublic fun Output.writeFully(src: Buffer, length: Int = src.readRemaining) {\n writeFullyBytesTemplate(0, length) { buffer, _, count ->\n buffer.writeFully(src, count)\n }\n}\n\npublic fun Output.writeFully(src: Memory, offset: Int, length: Int) {\n writeFully(src, offset.toLong(), length.toLong())\n}\n\npublic fun Output.writeFully(src: Memory, offset: Long, length: Long) {\n writeFullyBytesTemplate(offset, length) { memory, destinationOffset, sourceOffset, count ->\n src.copyTo(memory, sourceOffset, count, destinationOffset)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Output.fill(times: Long, value: Byte = 0) {\n if (this is AbstractOutput) {\n var written = 0L\n writeWhile { buffer ->\n val partTimes = minOf(buffer.writeRemaining.toLong(), times - written).toInt()\n buffer.fill(partTimes, value)\n written += partTimes\n written < times\n }\n } else {\n fillFallback(times, value)\n }\n}\n\nprivate fun Output.fillFallback(times: Long, value: Byte) {\n for (iterate in 0 until times) {\n writeByte(value)\n }\n}\n\n/**\n * Append number of chunks invoking [block] function while the returned value is true.\n * Depending on the output underlying implementation it could invoke [block] function with the same buffer several times\n * however it is guaranteed that it is always non-empty.\n */\n@DangerousInternalIoApi\npublic inline fun Output.writeWhile(block: (Buffer) -> Boolean) {\n var tail: ChunkBuffer = prepareWriteHead(1, null)\n try {\n while (true) {\n if (!block(tail)) break\n tail = prepareWriteHead(1, tail)\n }\n } finally {\n afterHeadWrite(tail)\n }\n}\n\n/**\n * Append number of chunks invoking [block] function while the returned value is positive.\n * If returned value is positive then it will be invoked again with a buffer having at least requested number of\n * bytes space (could be the same buffer as before if it complies to the restriction).\n * @param initialSize for the first buffer passed to [block] function\n */\n@DangerousInternalIoApi\npublic inline fun Output.writeWhileSize(initialSize: Int = 1, block: (Buffer) -> Int) {\n var tail = prepareWriteHead(initialSize, null)\n\n try {\n var size: Int\n while (true) {\n size = block(tail)\n if (size <= 0) break\n tail = prepareWriteHead(size, tail)\n }\n } finally {\n afterHeadWrite(tail)\n }\n}\n\npublic fun Output.writePacket(packet: ByteReadPacket) {\n @Suppress(\"DEPRECATION_ERROR\")\n if (this is BytePacketBuilderBase) {\n writePacket(packet)\n return\n }\n\n packet.takeWhile { from ->\n writeFully(from)\n true\n }\n}\n\nprivate inline fun Output.writeFullyBytesTemplate(\n offset: Int,\n length: Int,\n block: (Buffer, currentOffset: Int, count: Int) -> Unit\n) {\n var currentOffset = offset\n var remaining = length\n\n writeWhile { buffer ->\n val size = minOf(remaining, buffer.writeRemaining)\n block(buffer, currentOffset, size)\n currentOffset += size\n remaining -= size\n remaining > 0\n }\n}\n\nprivate inline fun Output.writeFullyBytesTemplate(\n initialOffset: Long,\n length: Long,\n block: (destination: Memory, destinationOffset: Long, currentOffset: Long, count: Long) -> Unit\n) {\n var currentOffset = initialOffset\n var remaining = length\n\n writeWhile { buffer ->\n val size = minOf(remaining, buffer.writeRemaining.toLong())\n block(buffer.memory, buffer.writePosition.toLong(), currentOffset, size)\n buffer.commitWritten(size.toInt())\n currentOffset += size\n remaining -= size\n remaining > 0\n }\n}\n\nprivate inline fun Output.writeFullyTemplate(\n componentSize: Int,\n offset: Int,\n length: Int,\n block: (Buffer, currentOffset: Int, count: Int) -> Unit\n) {\n var currentOffset = offset\n var remaining = length\n\n writeWhileSize(componentSize) { buffer ->\n val size = minOf(remaining, buffer.writeRemaining)\n block(buffer, currentOffset, size)\n currentOffset += size\n remaining -= size\n remaining * componentSize\n }\n}\n","@file:Suppress(\"NOTHING_TO_INLINE\")\n\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.concurrent.*\nimport io.ktor.utils.io.core.internal.*\nimport io.ktor.utils.io.errors.EOFException\nimport kotlin.contracts.*\n\n/**\n * Represents a buffer with read and write positions.\n *\n * Concurrent unsafe: the same memory could be shared between different instances of [Buffer] however you can't\n * read/write using the same [Buffer] instance from different threads.\n */\n@DangerousInternalIoApi\npublic open class Buffer(public val memory: Memory) {\n private val bufferState: BufferSharedState = BufferSharedState(memory.size32)\n\n /**\n * Current read position. It is always non-negative and will never run ahead of the [writePosition].\n * It is usually greater or equal to [startGap] reservation.\n * This position is affected by [discard], [rewind], [resetForRead], [resetForWrite], [reserveStartGap]\n * and [reserveEndGap].\n */\n public var readPosition: Int\n get() = bufferState.readPosition\n private set(value) {\n bufferState.readPosition = value\n }\n\n /**\n * Current write position. It is always non-negative and will never run ahead of the [limit].\n * It is always greater or equal to the [readPosition].\n * * This position is affected by [resetForRead], [resetForWrite], [reserveStartGap]\n * and [reserveEndGap].\n */\n public var writePosition: Int\n get() = bufferState.writePosition\n private set(value) {\n bufferState.writePosition = value\n }\n /**\n * Start gap is a reserved space in the beginning. The reserved space is usually used to write a packet length\n * in the case when it's not known before the packet constructed.\n */\n public var startGap: Int\n get() = bufferState.startGap\n private set(value) {\n bufferState.startGap = value\n }\n\n /**\n * Write position limit. No bytes could be written ahead of this limit. When the limit is less than the [capacity]\n * then this means that there are reserved bytes in the end ([endGap]). Such a reserved space in the end could be used\n * to write size, hash and so on. Also it is useful when several buffers are connected into a chain and some\n * primitive value (e.g. `kotlin.Int`) is separated into two chunks so bytes from the second chain could be copied\n * to the reserved space of the first chunk and then the whole value could be read at once.\n */\n public var limit: Int\n get() = bufferState.limit\n private set(value) {\n bufferState.limit = value\n }\n\n /**\n * Number of bytes reserved in the end.\n */\n public inline val endGap: Int get() = capacity - limit\n\n /**\n * Buffer's capacity (including reserved [startGap] and [endGap]. Value for released buffer is unspecified.\n */\n public val capacity: Int = memory.size32\n\n /**\n * Number of bytes available for reading.\n */\n public inline val readRemaining: Int get() = writePosition - readPosition\n\n /**\n * Size of the free space available for writing in bytes.\n */\n public inline val writeRemaining: Int get() = limit - writePosition\n\n /**\n * User data: could be a session, connection or anything useful\n */\n @Deprecated(\"Will be removed. Inherit Buffer and add required fields instead.\")\n @ExperimentalIoApi\n public var attachment: Any?\n get() = bufferState.attachment\n set(value) {\n bufferState.attachment = value\n }\n\n /**\n * Discard [count] readable bytes.\n *\n * @throws EOFException if [count] is bigger than available bytes.\n */\n public fun discardExact(count: Int = readRemaining) {\n if (count == 0) return\n\n val newReadPosition = readPosition + count\n if (count < 0 || newReadPosition > writePosition) {\n discardFailed(count, readRemaining)\n }\n readPosition = newReadPosition\n }\n\n @Deprecated(\"Use discardExact instead.\", level = DeprecationLevel.ERROR)\n public fun discard(count: Int): Int {\n val size = minOf(count, readRemaining)\n discardExact(size)\n return size\n }\n\n @Deprecated(\"Use discardExact instead.\", level = DeprecationLevel.ERROR)\n public final fun discard(count: Long): Long {\n val size = minOf(count, readRemaining.toLong()).toInt()\n discardExact(size)\n return size.toLong()\n }\n\n @DangerousInternalIoApi\n public fun commitWritten(count: Int) {\n val newWritePosition = writePosition + count\n if (count < 0 || newWritePosition > limit) {\n commitWrittenFailed(count, writeRemaining)\n }\n writePosition = newWritePosition\n }\n\n /**\n * @return `true` if there is free space\n */\n @PublishedApi\n internal fun commitWrittenUntilIndex(position: Int): Boolean {\n val limit = limit\n if (position < writePosition) {\n commitWrittenFailed(position - writePosition, writeRemaining)\n }\n if (position >= limit) {\n if (position == limit) {\n writePosition = position\n return false\n }\n commitWrittenFailed(position - writePosition, writeRemaining)\n }\n\n writePosition = position\n return true\n }\n\n internal fun discardUntilIndex(position: Int) {\n if (position < 0 || position > writePosition) {\n discardFailed(position - readPosition, readRemaining)\n }\n\n if (readPosition != position) {\n readPosition = position\n }\n }\n\n /**\n * Rewind [readPosition] backward to make [count] bytes available for reading again.\n * @throws IllegalArgumentException when [count] is too big and not enough bytes available before the [readPosition]\n */\n public fun rewind(count: Int = readPosition - startGap) {\n val newReadPosition = readPosition - count\n if (newReadPosition < startGap) {\n rewindFailed(count, readPosition - startGap)\n }\n readPosition = newReadPosition\n }\n\n /**\n * Reserve [startGap] bytes in the beginning.\n * May move [readPosition] and [writePosition] if no bytes available for reading.\n */\n public fun reserveStartGap(startGap: Int) {\n require(startGap >= 0) { \"startGap shouldn't be negative: $startGap\" }\n\n if (readPosition >= startGap) {\n this.startGap = startGap\n return\n }\n\n if (readPosition == writePosition) {\n if (startGap > limit) {\n startGapReservationFailedDueToLimit(startGap)\n }\n\n this.writePosition = startGap\n this.readPosition = startGap\n this.startGap = startGap\n return\n }\n\n startGapReservationFailed(startGap)\n }\n\n /**\n * Reserve [endGap] bytes in the end.\n * Could move [readPosition] and [writePosition] to reserve space but only when no bytes were written or\n * all written bytes are marked as consumed (were read or discarded).\n */\n public fun reserveEndGap(endGap: Int) {\n require(endGap >= 0) { \"endGap shouldn't be negative: $endGap\" }\n\n val newLimit = capacity - endGap\n if (newLimit >= writePosition) {\n limit = newLimit\n return\n }\n\n if (newLimit < 0) {\n endGapReservationFailedDueToCapacity(endGap)\n }\n if (newLimit < startGap) {\n endGapReservationFailedDueToStartGap(endGap)\n }\n\n if (readPosition == writePosition) {\n limit = newLimit\n readPosition = newLimit\n writePosition = newLimit\n return\n }\n\n endGapReservationFailedDueToContent(endGap)\n }\n\n /**\n * Marks the whole buffer available for read and no for write\n */\n public fun resetForRead() {\n startGap = 0\n readPosition = 0\n\n val capacity = capacity\n writePosition = capacity\n }\n\n /**\n * Marks all capacity writable except the start gap reserved before. The end gap reservation is discarded.\n */\n public fun resetForWrite() {\n resetForWrite(capacity - startGap)\n }\n\n /**\n * Marks up to [limit] bytes of the buffer available for write and no bytes for read.\n * It does respect [startGap] already reserved. All extra bytes after the specified [limit]\n * are considered as [endGap].\n */\n public fun resetForWrite(limit: Int) {\n val startGap = startGap\n readPosition = startGap\n writePosition = startGap\n this.limit = limit\n }\n\n /**\n * Forget start/end gap reservations.\n */\n internal fun releaseGaps() {\n releaseStartGap(0)\n releaseEndGap()\n }\n\n internal fun releaseEndGap() {\n limit = capacity\n }\n\n internal fun releaseStartGap(newReadPosition: Int) {\n require(newReadPosition >= 0) { \"newReadPosition shouldn't be negative: $newReadPosition\" }\n require(newReadPosition <= readPosition) {\n \"newReadPosition shouldn't be ahead of the read position: $newReadPosition > $readPosition\"\n }\n\n readPosition = newReadPosition\n if (startGap > newReadPosition) {\n startGap = newReadPosition\n }\n }\n\n protected open fun duplicateTo(copy: Buffer) {\n copy.limit = limit\n copy.startGap = startGap\n copy.readPosition = readPosition\n copy.writePosition = writePosition\n }\n\n /**\n * Create a new [Buffer] instance pointing to the same memory and having the same positions.\n */\n public open fun duplicate(): Buffer = Buffer(memory).apply {\n duplicateTo(this)\n }\n\n /**\n * Peek the next unsigned byte or return `-1` if no more bytes available for reading. No bytes will be marked\n * as consumed in any case.\n * @return an unsigned byte or `-1` if not even a byte is available for reading.\n * @see tryReadByte\n * @see readByte\n */\n public fun tryPeekByte(): Int {\n val readPosition = readPosition\n if (readPosition == writePosition) return -1\n return memory[readPosition].toInt() and 0xff\n }\n\n /**\n * Read the next unsigned byte or return `-1` if no more bytes available for reading. The returned byte is marked\n * as consumed.\n * @return an unsigned byte or `-1` if not even a byte is available for reading.\n * @see tryPeekByte\n * @see readByte\n */\n public fun tryReadByte(): Int {\n val readPosition = readPosition\n if (readPosition == writePosition) return -1\n this.readPosition = readPosition + 1\n return memory[readPosition].toInt() and 0xff\n }\n\n /**\n * Read the next byte or fail with [EOFException] if it's not available. The returned byte is marked\n * as consumed.\n * @throws EOFException when not even a byte is available for reading.\n * @see tryPeekByte\n * @see tryReadByte\n */\n public fun readByte(): Byte {\n val readPosition = readPosition\n if (readPosition == writePosition) {\n throw EOFException(\"No readable bytes available.\")\n }\n this.readPosition = readPosition + 1\n return memory[readPosition]\n }\n\n /**\n * Write a byte [value] at [writePosition] (incremented when written successfully).\n * @throws InsufficientSpaceException when no free space in the buffer.\n */\n public fun writeByte(value: Byte) {\n val writePosition = writePosition\n if (writePosition == limit) {\n throw InsufficientSpaceException(\"No free space in the buffer to write a byte\")\n }\n memory[writePosition] = value\n this.writePosition = writePosition + 1\n }\n\n /**\n * Clear buffer's state: read/write positions, gaps and so on. Byte content is not cleaned-up.\n */\n public open fun reset() {\n releaseGaps()\n resetForWrite()\n }\n\n override fun toString(): String {\n return \"Buffer($readRemaining used, $writeRemaining free, ${startGap + endGap} reserved of $capacity)\"\n }\n\n public companion object {\n /**\n * Number of bytes usually reserved in the end of chunk\n * when several instances of [io.ktor.utils.io.core.internal.ChunkBuffer] are connected into a chain (usually inside of [ByteReadPacket]\n * or [BytePacketBuilder])\n */\n @DangerousInternalIoApi\n public const val ReservedSize: Int = 8\n\n /**\n * The empty buffer singleton: it has zero capacity for read and write.\n */\n @Suppress(\"DEPRECATION\")\n public val Empty: Buffer get() = IoBuffer.Empty\n }\n}\n\n/**\n * @return `true` if there are available bytes to be read\n */\npublic inline fun Buffer.canRead(): Boolean = writePosition > readPosition\n\n/**\n * @return `true` if there is free room to for write\n */\npublic inline fun Buffer.canWrite(): Boolean = limit > writePosition\n\n/**\n * Apply [block] of code with buffer's memory providing read range indices. The returned value of [block] lambda should\n * return number of bytes to be marked as consumed.\n * No read/write functions on this buffer should be called inside of [block] otherwise an undefined behaviour may occur\n * including data damage.\n */\n@DangerousInternalIoApi\npublic inline fun Buffer.read(block: (memory: Memory, start: Int, endExclusive: Int) -> Int): Int {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n val rc = block(memory, readPosition, writePosition)\n discardExact(rc)\n return rc\n}\n\n/**\n * Apply [block] of code with buffer's memory providing write range indices. The returned value of [block] lambda should\n * return number of bytes were written.\n * o read/write functions on this buffer should be called inside of [block] otherwise an undefined behaviour may occur\n * including data damage.\n */\n@DangerousInternalIoApi\npublic inline fun Buffer.write(block: (memory: Memory, start: Int, endExclusive: Int) -> Int): Int {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n val rc = block(memory, writePosition, limit)\n commitWritten(rc)\n return rc\n}\n\ninternal fun discardFailed(count: Int, readRemaining: Int): Nothing {\n throw EOFException(\"Unable to discard $count bytes: only $readRemaining available for reading\")\n}\n\ninternal fun commitWrittenFailed(count: Int, writeRemaining: Int): Nothing {\n throw EOFException(\"Unable to discard $count bytes: only $writeRemaining available for writing\")\n}\n\ninternal fun rewindFailed(count: Int, rewindRemaining: Int): Nothing {\n throw IllegalArgumentException(\"Unable to rewind $count bytes: only $rewindRemaining could be rewinded\")\n}\n\ninternal fun Buffer.startGapReservationFailedDueToLimit(startGap: Int): Nothing {\n if (startGap > capacity) {\n throw IllegalArgumentException(\"Start gap $startGap is bigger than the capacity $capacity\")\n }\n\n throw IllegalStateException(\n \"Unable to reserve $startGap start gap: there are already $endGap bytes reserved in the end\"\n )\n}\n\ninternal fun Buffer.startGapReservationFailed(startGap: Int): Nothing {\n throw IllegalStateException(\n \"Unable to reserve $startGap start gap: \" +\n \"there are already $readRemaining content bytes starting at offset $readPosition\"\n )\n}\n\ninternal fun Buffer.endGapReservationFailedDueToCapacity(endGap: Int) {\n throw IllegalArgumentException(\"End gap $endGap is too big: capacity is $capacity\")\n}\n\ninternal fun Buffer.endGapReservationFailedDueToStartGap(endGap: Int) {\n throw IllegalArgumentException(\n \"End gap $endGap is too big: there are already $startGap bytes reserved in the beginning\"\n )\n}\n\ninternal fun Buffer.endGapReservationFailedDueToContent(endGap: Int) {\n throw IllegalArgumentException(\n \"Unable to reserve end gap $endGap:\" +\n \" there are already $readRemaining content bytes at offset $readPosition\"\n )\n}\n\ninternal fun Buffer.restoreStartGap(size: Int) {\n releaseStartGap(readPosition - size)\n}\n\n@ExperimentalIoApi\npublic class InsufficientSpaceException(message: String = \"Not enough free space\") : Exception(message) {\n public constructor(\n size: Int,\n availableSpace: Int\n ) : this(\"Not enough free space to write $size bytes, available $availableSpace bytes.\")\n\n public constructor(\n name: String,\n size: Int,\n availableSpace: Int\n ) : this(\"Not enough free space to write $name of $size bytes, available $availableSpace bytes.\")\n\n public constructor(\n size: Long,\n availableSpace: Long\n ) : this(\"Not enough free space to write $size bytes, available $availableSpace bytes.\")\n}\n","@file:Suppress(\"NOTHING_TO_INLINE\")\n\npackage io.ktor.utils.io.bits\n\nimport io.ktor.utils.io.core.internal.*\nimport org.khronos.webgl.*\nimport kotlin.require\n\n/**\n * Represents a linear range of bytes.\n */\npublic actual class Memory @DangerousInternalIoApi constructor(public val view: DataView) {\n /**\n * Size of memory range in bytes.\n */\n public actual inline val size: Long get() = view.byteLength.toLong()\n\n /**\n * Size of memory range in bytes represented as signed 32bit integer\n * @throws IllegalStateException when size doesn't fit into a signed 32bit integer\n */\n public actual inline val size32: Int get() = view.byteLength\n\n /**\n * Returns byte at [index] position.\n */\n public actual inline fun loadAt(index: Int): Byte {\n return view.getInt8(index)\n }\n\n /**\n * Returns byte at [index] position.\n */\n public actual inline fun loadAt(index: Long): Byte {\n return view.getInt8(index.toIntOrFail(\"index\"))\n }\n\n /**\n * Write [value] at the specified [index].\n */\n public actual inline fun storeAt(index: Int, value: Byte) {\n view.setInt8(index, value)\n }\n\n /**\n * Write [value] at the specified [index]\n */\n public actual inline fun storeAt(index: Long, value: Byte) {\n view.setInt8(index.toIntOrFail(\"index\"), value)\n }\n\n /**\n * Returns memory's subrange. On some platforms it could do range checks but it is not guaranteed to be safe.\n * It also could lead to memory allocations on some platforms.\n */\n public actual fun slice(offset: Int, length: Int): Memory {\n require(offset >= 0) { \"offset shouldn't be negative: $offset\" }\n require(length >= 0) { \"length shouldn't be negative: $length\" }\n if (offset + length > size) {\n throw IndexOutOfBoundsException(\"offset + length > size: $offset + $length > $size\")\n }\n\n return Memory(\n DataView(\n view.buffer,\n view.byteOffset + offset,\n length\n )\n )\n }\n\n /**\n * Returns memory's subrange. On some platforms it could do range checks but it is not guaranteed to be safe.\n * It also could lead to memory allocations on some platforms.\n */\n public actual fun slice(offset: Long, length: Long): Memory {\n return slice(offset.toIntOrFail(\"offset\"), length.toIntOrFail(\"length\"))\n }\n\n /**\n * Copies bytes from this memory range from the specified [offset] and [length]\n * to the [destination] at [destinationOffset].\n * Copying bytes from a memory to itself is allowed.\n */\n public actual fun copyTo(\n destination: Memory,\n offset: Int,\n length: Int,\n destinationOffset: Int\n ) {\n val src = Int8Array(view.buffer, view.byteOffset + offset, length)\n val dst = Int8Array(destination.view.buffer, destination.view.byteOffset + destinationOffset, length)\n\n dst.set(src)\n }\n\n /**\n * Copies bytes from this memory range from the specified [offset] and [length]\n * to the [destination] at [destinationOffset].\n * Copying bytes from a memory to itself is allowed.\n */\n public actual fun copyTo(\n destination: Memory,\n offset: Long,\n length: Long,\n destinationOffset: Long\n ) {\n copyTo(\n destination,\n offset.toIntOrFail(\"offset\"),\n length.toIntOrFail(\"length\"),\n destinationOffset.toIntOrFail(\"destinationOffset\")\n )\n }\n\n public actual companion object {\n /**\n * Represents an empty memory region\n */\n public actual val Empty: Memory = Memory(DataView(ArrayBuffer(0)))\n }\n}\n\n/**\n * Copies bytes from this memory range from the specified [offset] and [length]\n * to the [destination] at [destinationOffset].\n */\npublic actual fun Memory.copyTo(\n destination: ByteArray,\n offset: Int,\n length: Int,\n destinationOffset: Int\n) {\n @Suppress(\"UnsafeCastFromDynamic\")\n val to: Int8Array = destination.asDynamic()\n\n val from = Int8Array(view.buffer, view.byteOffset + offset, length)\n\n to.set(from, destinationOffset)\n}\n\n/**\n * Copies bytes from this memory range from the specified [offset] and [length]\n * to the [destination] at [destinationOffset].\n */\npublic actual fun Memory.copyTo(\n destination: ByteArray,\n offset: Long,\n length: Int,\n destinationOffset: Int\n) {\n copyTo(destination, offset.toIntOrFail(\"offset\"), length, destinationOffset)\n}\n\n/**\n * Fill memory range starting at the specified [offset] with [value] repeated [count] times.\n */\npublic actual fun Memory.fill(offset: Int, count: Int, value: Byte) {\n for (index in offset until offset + count) {\n this[index] = value\n }\n}\n\n/**\n * Fill memory range starting at the specified [offset] with [value] repeated [count] times.\n */\npublic actual fun Memory.fill(offset: Long, count: Long, value: Byte) {\n fill(offset.toIntOrFail(\"offset\"), count.toIntOrFail(\"count\"), value)\n}\n\n/**\n * Copies bytes from this memory range from the specified [offset] and [length]\n * to the [destination] at [destinationOffset].\n */\npublic fun Memory.copyTo(destination: ArrayBuffer, offset: Int, length: Int, destinationOffset: Int) {\n @Suppress(\"UnsafeCastFromDynamic\")\n val to = Int8Array(destination, destinationOffset, length)\n val from = Int8Array(view.buffer, view.byteOffset + offset, length)\n\n to.set(from, 0)\n}\n\n/**\n * Copies bytes from this memory range from the specified [offset] and [length]\n * to the [destination] at [destinationOffset].\n */\npublic fun Memory.copyTo(destination: ArrayBufferView, offset: Int, length: Int, destinationOffset: Int) {\n @Suppress(\"UnsafeCastFromDynamic\")\n val to = Int8Array(destination.buffer, destinationOffset + destination.byteOffset, length)\n val from = Int8Array(view.buffer, view.byteOffset + offset, length)\n\n to.set(from, 0)\n}\n\n/**\n * Copies bytes from this memory range from the specified [offset] and [length]\n * to the [destination] at [destinationOffset].\n */\npublic fun ArrayBuffer.copyTo(destination: Memory, offset: Int, length: Int, destinationOffset: Int) {\n val from = Int8Array(this, offset, length)\n val to = Int8Array(destination.view.buffer, destination.view.byteOffset + destinationOffset, length)\n\n to.set(from, 0)\n}\n\n/**\n * Copies bytes from this memory range from the specified [offset] and [length]\n * to the [destination] at [destinationOffset].\n */\npublic fun ArrayBufferView.copyTo(destination: Memory, offset: Int, length: Int, destinationOffset: Int) {\n buffer.copyTo(destination, offset + byteOffset, length, destinationOffset)\n}\n\ninternal val Memory.Int8ArrayView: Int8Array get() = Int8Array(view.buffer, view.byteOffset, view.byteLength)\n","package io.ktor.utils.io.core\n\nimport kotlin.contracts.*\n\n@PublishedApi\ninternal inline fun AbstractInput.read(n: Int = 1, block: (Buffer) -> Unit) {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n val buffer = prepareRead(n) ?: prematureEndOfStream(n)\n val positionBefore = buffer.readPosition\n try {\n block(buffer)\n } finally {\n val positionAfter = buffer.readPosition\n if (positionAfter < positionBefore) {\n throw IllegalStateException(\"Buffer's position shouldn't be rewinded\")\n }\n if (positionAfter == buffer.writePosition) {\n ensureNext(buffer)\n } else {\n headPosition = positionAfter\n }\n }\n}\n","package io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.Memory\nimport io.ktor.utils.io.bits.get\nimport io.ktor.utils.io.core.internal.*\nimport kotlin.jvm.JvmName\n\n/**\n * Usually shouldn't be implemented directly. Inherit [AbstractInput] instead.\n */\npublic expect interface Input : Closeable {\n @Deprecated(\n \"Not supported anymore. All operations are big endian by default. \" +\n \"Use readXXXLittleEndian or readXXX then X.reverseByteOrder() instead.\",\n level = DeprecationLevel.ERROR\n )\n public var byteOrder: ByteOrder\n\n /**\n * It is `true` when it is known that no more bytes will be available. When it is `false` then this means that\n * it is not known yet or there are available bytes.\n * Please note that `false` value doesn't guarantee that there are available bytes so `readByte()` may fail.\n */\n public val endOfInput: Boolean\n\n /**\n * Read the next upcoming byte\n * @throws EOFException if no more bytes available.\n */\n public fun readByte(): Byte\n\n /*\n * Returns next byte (unsigned) or `-1` if no more bytes available\n */\n public fun tryPeek(): Int\n\n /**\n * Try to copy at least [min] but up to [max] bytes to the specified [destination] buffer from this input\n * skipping [offset] bytes. If there are not enough bytes available to provide [min] bytes after skipping [offset]\n * bytes then it will trigger the underlying source reading first and after that will\n * simply copy available bytes even if EOF encountered so [min] is not a requirement but a desired number of bytes.\n * It is safe to specify [max] greater than the destination free space.\n * `min` shouldn't be bigger than the [destination] free space.\n * This function could trigger the underlying source reading that may lead to blocking I/O.\n * It is allowed to specify too big [offset] so in this case this function will always return `0` after prefetching\n * all underlying bytes but note that it may lead to significant memory consumption.\n * This function usually copy more bytes than [min] (unless `max = min`) but it is not guaranteed.\n * When `0` is returned with `offset = 0` then it makes sense to check [endOfInput].\n *\n * @param destination to write bytes\n * @param offset to skip input\n * @param min bytes to be copied, shouldn't be greater than the buffer free space. Could be `0`.\n * @param max bytes to be copied even if there are more bytes buffered, could be [Int.MAX_VALUE].\n * @return number of bytes copied to the [destination] possibly `0`\n */\n public fun peekTo(\n destination: Memory,\n destinationOffset: Long,\n offset: Long = 0,\n min: Long = 1,\n max: Long = Long.MAX_VALUE\n ): Long\n\n /**\n * Discard at most [n] bytes\n */\n public fun discard(n: Long): Long\n\n /**\n * Close input including the underlying source. All pending bytes will be discarded.\n * It is not recommended to invoke it with read operations in-progress concurrently.\n */\n override fun close()\n\n /**\n * Copy available bytes to the specified [buffer] but keep them available.\n * The underlying implementation could trigger\n * bytes population from the underlying source and block until any bytes available.\n *\n * Very similar to [readAvailable] but don't discard copied bytes.\n *\n * @return number of bytes were copied\n */\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\", \"DEPRECATION\")\n public fun peekTo(buffer: IoBuffer): Int {\n return peekTo(buffer)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readShort(): Short {\n return readShort()\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readInt(): Int {\n return readInt()\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readLong(): Long {\n return readLong()\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readFloat(): Float {\n return readFloat()\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readDouble(): Double {\n return readDouble()\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readFully(dst: ByteArray, offset: Int, length: Int) {\n readFully(dst, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readFully(dst: ShortArray, offset: Int, length: Int) {\n readFully(dst, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readFully(dst: IntArray, offset: Int, length: Int) {\n readFully(dst, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readFully(dst: LongArray, offset: Int, length: Int) {\n readFully(dst, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readFully(dst: FloatArray, offset: Int, length: Int) {\n readFully(dst, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readFully(dst: DoubleArray, offset: Int, length: Int) {\n readFully(dst, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\", \"DEPRECATION\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readFully(dst: IoBuffer, length: Int) {\n readFully(dst, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readAvailable(dst: ByteArray, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readAvailable(dst: ShortArray, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readAvailable(dst: IntArray, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readAvailable(dst: LongArray, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readAvailable(dst: FloatArray, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readAvailable(dst: DoubleArray, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n @Suppress(\"EXPECTED_DECLARATION_WITH_BODY\", \"DEPRECATION\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readAvailable(dst: IoBuffer, length: Int): Int {\n return readAvailable(dst, length)\n }\n}\n\n/**\n * Discard all remaining bytes.\n * @return number of bytes were discarded\n */\npublic fun Input.discard(): Long {\n return discard(Long.MAX_VALUE)\n}\n\n/**\n * Discard exactly [n] bytes or fail if not enough bytes in the input to be discarded.\n */\npublic fun Input.discardExact(n: Long) {\n val discarded = discard(n)\n if (discarded != n) {\n throw IllegalStateException(\"Only $discarded bytes were discarded of $n requested\")\n }\n}\n\n/**\n * Discard exactly [n] bytes or fail if not enough bytes in the input to be discarded.\n */\npublic fun Input.discardExact(n: Int) {\n discardExact(n.toLong())\n}\n\n/**\n * Invoke [block] function for every chunk until end of input or [block] function return `false`\n * [block] function returns `true` to request more chunks or `false` to stop loop\n *\n * It is not guaranteed that every chunk will have fixed size but it will be never empty.\n * [block] function should never release provided buffer and should not write to it otherwise an undefined behaviour\n * could be observed\n */\n@DangerousInternalIoApi\npublic inline fun Input.takeWhile(block: (Buffer) -> Boolean) {\n var release = true\n var current = prepareReadFirstHead(1) ?: return\n\n try {\n do {\n if (!block(current)) {\n break\n }\n release = false\n val next = prepareReadNextHead(current) ?: break\n current = next\n release = true\n } while (true)\n } finally {\n if (release) {\n completeReadHead(current)\n }\n }\n}\n\n/**\n * Invoke [block] function for every chunk until end of input or [block] function return zero\n * [block] function returns number of bytes required to read next primitive and shouldn't require too many bytes at once\n * otherwise it could fail with an exception.\n * It is not guaranteed that every chunk will have fixed size but it will be always at least requested bytes length.\n * [block] function should never release provided buffer and should not write to it otherwise an undefined behaviour\n * could be observed\n */\n@DangerousInternalIoApi\npublic inline fun Input.takeWhileSize(initialSize: Int = 1, block: (Buffer) -> Int) {\n var release = true\n var current = prepareReadFirstHead(initialSize) ?: return\n var size = initialSize\n\n try {\n do {\n val before = current.readRemaining\n val after: Int\n\n if (before >= size) {\n try {\n size = block(current)\n } finally {\n after = current.readRemaining\n }\n } else {\n after = before\n }\n\n release = false\n\n val next = when {\n after == 0 -> prepareReadNextHead(current)\n after < size || current.endGap < Buffer.ReservedSize -> {\n completeReadHead(current)\n prepareReadFirstHead(size)\n }\n else -> current\n }\n\n if (next == null) {\n break\n }\n\n current = next\n release = true\n } while (size > 0)\n } finally {\n if (release) {\n completeReadHead(current)\n }\n }\n}\n\n@ExperimentalIoApi\npublic fun Input.peekCharUtf8(): Char {\n val rc = tryPeek()\n if (rc and 0x80 == 0) return rc.toChar()\n if (rc == -1) throw EOFException(\"Failed to peek a char: end of input\")\n\n return peekCharUtf8Impl(rc)\n}\n\n/**\n * For every byte from this input invokes [block] function giving it as parameter.\n */\n@ExperimentalIoApi\npublic inline fun Input.forEach(block: (Byte) -> Unit) {\n takeWhile { buffer ->\n buffer.forEach(block)\n true\n }\n}\n\nprivate fun Input.peekCharUtf8Impl(first: Int): Char {\n var rc = '?'\n var found = false\n\n takeWhileSize(byteCountUtf8(first)) {\n it.decodeUTF8 { ch ->\n found = true\n rc = ch\n false\n }\n }\n\n if (!found) {\n throw MalformedUTF8InputException(\"No UTF-8 character found\")\n }\n\n return rc\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\npublic fun Input.readAvailable(dst: IoBuffer, size: Int = dst.writeRemaining): Int = readAvailable(dst, size)\n\n@JvmName(\"readAvailable\")\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\npublic fun Input.readAvailableOld(dst: ByteArray, offset: Int = 0, length: Int = dst.size - offset): Int {\n return readAvailable(dst, offset, length)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n@JvmName(\"readAvailable\")\npublic fun Input.readAvailableOld(dst: ShortArray, offset: Int = 0, length: Int = dst.size - offset): Int =\n readAvailable(dst, offset, length)\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n@JvmName(\"readAvailable\")\npublic fun Input.readAvailableOld(dst: IntArray, offset: Int = 0, length: Int = dst.size - offset): Int =\n readAvailable(dst, offset, length)\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n@JvmName(\"readAvailable\")\npublic fun Input.readAvailableOld(dst: LongArray, offset: Int = 0, length: Int = dst.size - offset): Int =\n readAvailable(dst, offset, length)\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n@JvmName(\"readAvailable\")\npublic fun Input.readAvailableOld(dst: FloatArray, offset: Int = 0, length: Int = dst.size - offset): Int =\n readAvailable(dst, offset, length)\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n@JvmName(\"readAvailable\")\npublic fun Input.readAvailableOld(dst: DoubleArray, offset: Int = 0, length: Int = dst.size - offset): Int =\n readAvailable(dst, offset, length)\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\npublic fun Input.readFully(dst: IoBuffer, size: Int = dst.writeRemaining): Unit = readFully(dst, size)\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n@JvmName(\"readFully\")\npublic fun Input.readFullyOld(dst: ByteArray, offset: Int = 0, length: Int = dst.size - offset): Unit =\n readFully(dst, offset, length)\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n@JvmName(\"readFully\")\npublic fun Input.readFullyOld(dst: ShortArray, offset: Int = 0, length: Int = dst.size - offset): Unit =\n readFully(dst, offset, length)\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n@JvmName(\"readFully\")\npublic fun Input.readFullyOld(dst: IntArray, offset: Int = 0, length: Int = dst.size - offset): Unit =\n readFully(dst, offset, length)\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n@JvmName(\"readFully\")\npublic fun Input.readFullyOld(dst: LongArray, offset: Int = 0, length: Int = dst.size - offset): Unit =\n readFully(dst, offset, length)\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n@JvmName(\"readFully\")\npublic fun Input.readFullyOld(dst: FloatArray, offset: Int = 0, length: Int = dst.size - offset): Unit =\n readFully(dst, offset, length)\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n@JvmName(\"readFully\")\npublic fun Input.readFullyOld(dst: DoubleArray, offset: Int = 0, length: Int = dst.size - offset): Unit =\n readFully(dst, offset, length)\n","package io.ktor.utils.io.core.internal\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.*\n\ninternal inline fun Buffer.decodeASCII(consumer: (Char) -> Boolean): Boolean {\n read { memory, start, endExclusive ->\n for (index in start until endExclusive) {\n val codepoint = memory[index].toInt() and 0xff\n if (codepoint and 0x80 == 0x80 || !consumer(codepoint.toChar())) {\n discardExact(index - start)\n return false\n }\n }\n\n endExclusive - start\n }\n\n return true\n}\n\n@DangerousInternalIoApi\npublic suspend fun decodeUTF8LineLoopSuspend(\n out: Appendable,\n limit: Int,\n nextChunk: suspend (Int) -> AbstractInput?\n): Boolean {\n var decoded = 0\n var size = 1\n var cr = false\n var end = false\n\n while (!end && size != 0) {\n val chunk = nextChunk(size) ?: break\n chunk.takeWhileSize { buffer ->\n var skip = 0\n size = buffer.decodeUTF8 { ch ->\n when (ch) {\n '\\r' -> {\n if (cr) {\n end = true\n return@decodeUTF8 false\n }\n cr = true\n true\n }\n '\\n' -> {\n end = true\n skip = 1\n false\n }\n else -> {\n if (cr) {\n end = true\n return@decodeUTF8 false\n }\n\n if (decoded == limit) {\n throw BufferLimitExceededException(\"Too many characters in line: limit $limit exceeded\")\n }\n decoded++\n out.append(ch)\n true\n }\n }\n }\n\n if (skip > 0) {\n buffer.discardExact(skip)\n }\n\n size = if (end) 0 else size.coerceAtLeast(1)\n\n size\n }\n }\n\n if (size > 1) prematureEndOfStreamUtf(size)\n if (cr) {\n end = true\n }\n\n return decoded > 0 || end\n}\n\nprivate fun prematureEndOfStreamUtf(size: Int): Nothing =\n throw EOFException(\"Premature end of stream: expected $size bytes to decode UTF-8 char\")\n\n@DangerousInternalIoApi\ninternal fun byteCountUtf8(firstByte: Int): Int {\n var byteCount = 0\n var mask = 0x80\n var value = firstByte\n\n for (i in 1..6) {\n if (value and mask != 0) {\n value = value and mask.inv()\n mask = mask shr 1\n byteCount++\n } else {\n break\n }\n }\n\n return byteCount\n}\n\n@Suppress(\"DEPRECATION\")\n@Deprecated(\"Binary compatibility\", level = DeprecationLevel.HIDDEN)\npublic inline fun IoBuffer.decodeUTF8(consumer: (Char) -> Boolean): Int {\n return (this as Buffer).decodeUTF8(consumer)\n}\n\n/**\n * Decodes all the bytes to utf8 applying every character on [consumer] until or consumer return `false`.\n * If a consumer returned false then a character will be pushed back (including all surrogates will be pushed back as well)\n * and [decodeUTF8] returns -1\n * @return number of bytes required to decode incomplete utf8 character or 0 if all bytes were processed\n * or -1 if consumer rejected loop\n */\n@DangerousInternalIoApi\npublic inline fun Buffer.decodeUTF8(consumer: (Char) -> Boolean): Int {\n var byteCount = 0\n var value = 0\n var lastByteCount = 0\n\n read { memory, start, endExclusive ->\n for (index in start until endExclusive) {\n val v = memory[index].toInt() and 0xff\n when {\n v and 0x80 == 0 -> {\n if (byteCount != 0) malformedByteCount(byteCount)\n if (!consumer(v.toChar())) {\n discardExact(index - start)\n return -1\n }\n }\n byteCount == 0 -> {\n // first unicode byte\n\n var mask = 0x80\n value = v\n\n for (i in 1..6) { // TODO do we support 6 bytes unicode?\n if (value and mask != 0) {\n value = value and mask.inv()\n mask = mask shr 1\n byteCount++\n } else {\n break\n }\n }\n\n lastByteCount = byteCount\n byteCount--\n\n if (lastByteCount > endExclusive - index) {\n discardExact(index - start)\n return lastByteCount\n }\n }\n else -> {\n // trailing unicode byte\n value = (value shl 6) or (v and 0x7f)\n byteCount--\n\n if (byteCount == 0) {\n if (isBmpCodePoint(value)) {\n if (!consumer(value.toChar())) {\n discardExact(index - start - lastByteCount + 1)\n return -1\n }\n } else if (!isValidCodePoint(value)) {\n malformedCodePoint(value)\n } else {\n if (!consumer(highSurrogate(value).toChar()) ||\n !consumer(lowSurrogate(value).toChar())\n ) {\n discardExact(index - start - lastByteCount + 1)\n return -1\n }\n }\n\n value = 0\n }\n }\n }\n }\n\n endExclusive - start\n }\n\n return 0\n}\n\n@Suppress(\"RedundantModalityModifier\")\ninternal class CharArraySequence(\n private val array: CharArray,\n private val offset: Int,\n final override val length: Int\n) : CharSequence {\n final override fun get(index: Int): Char {\n if (index >= length) {\n indexOutOfBounds(index)\n }\n return array[index + offset]\n }\n\n final override fun subSequence(startIndex: Int, endIndex: Int): CharSequence {\n require(startIndex >= 0) { \"startIndex shouldn't be negative: $startIndex\" }\n require(startIndex <= length) { \"startIndex is too large: $startIndex > $length\" }\n require(startIndex + endIndex <= length) { \"endIndex is too large: $endIndex > $length\" }\n require(endIndex >= startIndex) { \"endIndex should be greater or equal to startIndex: $startIndex > $endIndex\" }\n\n return CharArraySequence(array, offset + startIndex, endIndex - startIndex)\n }\n\n private fun indexOutOfBounds(index: Int): Nothing {\n throw IndexOutOfBoundsException(\"String index out of bounds: $index > $length\")\n }\n}\n\n@Suppress(\"NOTHING_TO_INLINE\", \"EXPERIMENTAL_FEATURE_WARNING\")\ninternal inline class EncodeResult(val value: Int) {\n constructor(characters: UShort, bytes: UShort) : this(characters.toInt() shl 16 or bytes.toInt())\n\n inline val characters: UShort get() = value.highShort.toUShort()\n inline val bytes: UShort get() = value.lowShort.toUShort()\n\n inline operator fun component1(): UShort = characters\n inline operator fun component2(): UShort = bytes\n}\n\ninternal fun Memory.encodeUTF8(text: CharSequence, from: Int, to: Int, dstOffset: Int, dstLimit: Int): EncodeResult {\n // encode single-byte characters\n val lastCharIndex = minOf(to, from + UShort.MAX_VALUE.toInt())\n val resultLimit = dstLimit.coerceAtMost(UShort.MAX_VALUE.toInt())\n var resultPosition = dstOffset\n var index = from\n\n do {\n if (resultPosition >= resultLimit || index >= lastCharIndex) {\n return EncodeResult((index - from).toUShort(), (resultPosition - dstOffset).toUShort())\n }\n\n val character = text[index++].toInt() and 0xffff\n if (character and 0xff80 == 0) {\n storeAt(resultPosition++, character.toByte())\n } else {\n break\n }\n } while (true)\n\n index--\n return encodeUTF8Stage1(text, index, lastCharIndex, from, resultPosition, resultLimit, dstOffset)\n}\n\n/**\n * Encode UTF-8 multibytes characters when we for sure have enough free space\n */\nprivate fun Memory.encodeUTF8Stage1(\n text: CharSequence,\n index1: Int,\n lastCharIndex: Int,\n from: Int,\n resultPosition1: Int,\n resultLimit: Int,\n dstOffset: Int\n): EncodeResult {\n var index = index1\n var resultPosition: Int = resultPosition1\n val stage1Limit = resultLimit - 3\n\n do {\n val freeSpace = stage1Limit - resultPosition\n if (freeSpace <= 0 || index >= lastCharIndex) {\n break\n }\n\n val character = text[index++]\n val codepoint = when {\n character.isHighSurrogate() -> {\n if (index == lastCharIndex || !text[index].isLowSurrogate()) {\n 63\n } else {\n codePoint(character, text[index++])\n }\n }\n else -> character.toInt()\n }\n val size = putUtf8Char(resultPosition, codepoint)\n\n resultPosition += size\n } while (true)\n\n if (resultPosition == stage1Limit) {\n return encodeUTF8Stage2(text, index, lastCharIndex, from, resultPosition, resultLimit, dstOffset)\n }\n\n return EncodeResult((index - from).toUShort(), (resultPosition - dstOffset).toUShort())\n}\n\nprivate fun Memory.encodeUTF8Stage2(\n text: CharSequence,\n index1: Int,\n lastCharIndex: Int,\n from: Int,\n resultPosition1: Int,\n resultLimit: Int,\n dstOffset: Int\n): EncodeResult {\n var index = index1\n var resultPosition: Int = resultPosition1\n\n do {\n val freeSpace = resultLimit - resultPosition\n if (freeSpace <= 0 || index >= lastCharIndex) {\n break\n }\n\n val character = text[index++]\n val codepoint = when {\n !character.isHighSurrogate() -> character.toInt()\n else -> {\n if (index == lastCharIndex || !text[index].isLowSurrogate()) {\n 63\n } else {\n codePoint(character, text[index++])\n }\n }\n }\n if (charactersSize(codepoint) > freeSpace) {\n index--\n break\n }\n val size = putUtf8Char(resultPosition, codepoint)\n resultPosition += size\n } while (true)\n\n return EncodeResult((index - from).toUShort(), (resultPosition - dstOffset).toUShort())\n}\n\n@Suppress(\"NOTHING_TO_INLINE\")\nprivate inline fun charactersSize(v: Int) = when {\n v in 1..0x7f -> 1\n v in 0x80..0x7ff -> 2\n v in 0x800..0xffff -> 3\n v in 0x10000..0x10ffff -> 4\n else -> malformedCodePoint(v)\n}\n\n// TODO optimize it, now we are simply do naive encoding here\n@Suppress(\"NOTHING_TO_INLINE\")\ninternal inline fun Memory.putUtf8Char(offset: Int, v: Int): Int = when {\n v in 0..0x7f -> {\n storeAt(offset, v.toByte())\n 1\n }\n v in 0x80..0x7ff -> {\n this[offset] = (0xc0 or ((v shr 6) and 0x1f)).toByte()\n this[offset + 1] = (0x80 or (v and 0x3f)).toByte()\n 2\n }\n v in 0x800..0xffff -> {\n this[offset] = (0xe0 or ((v shr 12) and 0x0f)).toByte()\n this[offset + 1] = (0x80 or ((v shr 6) and 0x3f)).toByte()\n this[offset + 2] = (0x80 or (v and 0x3f)).toByte()\n 3\n }\n v in 0x10000..0x10ffff -> {\n this[offset] = (0xf0 or ((v shr 18) and 0x07)).toByte() // 3 bits\n this[offset + 1] = (0x80 or ((v shr 12) and 0x3f)).toByte() // 6 bits\n this[offset + 2] = (0x80 or ((v shr 6) and 0x3f)).toByte() // 6 bits\n this[offset + 3] = (0x80 or (v and 0x3f)).toByte() // 6 bits\n 4\n }\n else -> malformedCodePoint(v)\n}\n\n@PublishedApi\ninternal fun malformedByteCount(byteCount: Int): Nothing =\n throw MalformedUTF8InputException(\"Expected $byteCount more character bytes\")\n\n@PublishedApi\ninternal fun malformedCodePoint(value: Int): Nothing =\n throw IllegalArgumentException(\"Malformed code-point $value found\")\n\nprivate const val MaxCodePoint = 0x10ffff\nprivate const val MinLowSurrogate = 0xdc00\nprivate const val MinHighSurrogate = 0xd800\nprivate const val MinSupplementary = 0x10000\nprivate const val HighSurrogateMagic = MinHighSurrogate - (MinSupplementary ushr 10)\n\n@PublishedApi\ninternal fun isBmpCodePoint(cp: Int): Boolean = cp ushr 16 == 0\n\n@PublishedApi\ninternal fun isValidCodePoint(codePoint: Int): Boolean = codePoint <= MaxCodePoint\n\n@PublishedApi\ninternal fun lowSurrogate(cp: Int): Int = (cp and 0x3ff) + MinLowSurrogate\n\n@PublishedApi\ninternal fun highSurrogate(cp: Int): Int = (cp ushr 10) + HighSurrogateMagic\n\ninternal fun codePoint(high: Char, low: Char): Int {\n// check(high.isHighSurrogate())\n// check(low.isLowSurrogate())\n\n val highValue = high.toInt() - HighSurrogateMagic\n val lowValue = low.toInt() - MinLowSurrogate\n\n return highValue shl 10 or lowValue\n}\n\npublic class MalformedUTF8InputException(message: String) : Exception(message)\n","@file:Suppress(\"LocalVariableName\", \"RedundantModalityModifier\")\n\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.internal.*\nimport io.ktor.utils.io.pool.*\n\n/**\n * The default [Output] implementation.\n * @see flush\n * @see closeDestination\n */\n@ExperimentalIoApi\npublic abstract class AbstractOutput\ninternal constructor(\n private val headerSizeHint: Int,\n protected val pool: ObjectPool\n) : Appendable, Output {\n public constructor(pool: ObjectPool) : this(0, pool)\n\n public constructor() : this(ChunkBuffer.Pool)\n\n /**\n * An implementation should write [source] to the destination exactly [length] bytes.\n * It should never capture the [source] instance\n * longer than this method execution since it may be disposed after return.\n */\n protected abstract fun flush(source: Memory, offset: Int, length: Int)\n\n /**\n * An implementation should only close the destination.\n */\n protected abstract fun closeDestination()\n\n private val state = AbstractOutputSharedState()\n\n private var _head: ChunkBuffer?\n get() = state.head\n set(value) {\n state.head = value\n }\n\n private var _tail: ChunkBuffer?\n get() = state.tail\n set(value) {\n state.tail = value\n }\n\n internal val head: ChunkBuffer\n get() = _head ?: ChunkBuffer.Empty\n\n @PublishedApi\n @Deprecated(\"Will be removed in future releases.\", level = DeprecationLevel.HIDDEN)\n internal val tail: ChunkBuffer\n get() {\n return prepareWriteHead(1)\n }\n\n @Deprecated(\"Will be removed. Override flush(buffer) properly.\", level = DeprecationLevel.ERROR)\n protected var currentTail: ChunkBuffer\n get() = prepareWriteHead(1)\n set(newValue) {\n appendChain(newValue)\n }\n\n internal var tailMemory: Memory\n get() = state.tailMemory\n set(value) {\n state.tailMemory = value\n }\n\n internal var tailPosition\n get() = state.tailPosition\n set(value) {\n state.tailPosition = value\n }\n\n internal var tailEndExclusive\n get() = state.tailEndExclusive\n private set(value) {\n state.tailEndExclusive = value\n }\n\n private var tailInitialPosition\n get() = state.tailInitialPosition\n set(value) {\n state.tailInitialPosition = value\n }\n\n /**\n * Number of bytes buffered in the chain except the tail chunk\n */\n private var chainedSize: Int\n get() = state.chainedSize\n set(value) {\n state.chainedSize = value\n }\n\n internal inline val tailRemaining: Int get() = tailEndExclusive - tailPosition\n\n /**\n * Number of bytes currently buffered (pending).\n */\n protected final var _size: Int\n get() = chainedSize + (tailPosition - tailInitialPosition)\n @Deprecated(\"There is no need to update/reset this value anymore.\")\n set(_) {\n }\n\n /**\n * Byte order (Endianness) to be used by future write functions calls on this builder instance. Doesn't affect any\n * previously written values.\n * @default [ByteOrder.BIG_ENDIAN]\n */\n @Deprecated(\n \"This is no longer supported. All operations are big endian by default. Use readXXXLittleEndian \" +\n \"to read primitives in little endian\",\n level = DeprecationLevel.ERROR\n )\n final override var byteOrder: ByteOrder = ByteOrder.BIG_ENDIAN\n set(value) {\n field = value\n if (value != ByteOrder.BIG_ENDIAN) {\n throw IllegalArgumentException(\n \"Only BIG_ENDIAN is supported. Use corresponding functions to read/write\" +\n \"in the little endian\"\n )\n }\n }\n\n final override fun flush() {\n flushChain()\n }\n\n private fun flushChain() {\n val oldTail = stealAll() ?: return\n\n try {\n oldTail.forEachChunk { chunk ->\n flush(chunk.memory, chunk.readPosition, chunk.readRemaining)\n }\n } finally {\n oldTail.releaseAll(pool)\n }\n }\n\n /**\n * Detach all chunks and cleanup all internal state so builder could be reusable again\n * @return a chain of buffer views or `null` of it is empty\n */\n internal fun stealAll(): ChunkBuffer? {\n val head = this._head ?: return null\n\n _tail?.commitWrittenUntilIndex(tailPosition)\n\n this._head = null\n this._tail = null\n tailPosition = 0\n tailEndExclusive = 0\n tailInitialPosition = 0\n chainedSize = 0\n tailMemory = Memory.Empty\n\n return head\n }\n\n internal fun afterBytesStolen() {\n val head = head\n if (head !== ChunkBuffer.Empty) {\n check(head.next == null)\n head.resetForWrite()\n head.reserveStartGap(headerSizeHint)\n head.reserveEndGap(Buffer.ReservedSize)\n tailPosition = head.writePosition\n tailInitialPosition = tailPosition\n tailEndExclusive = head.limit\n }\n }\n\n internal final fun appendSingleChunk(buffer: ChunkBuffer) {\n check(buffer.next == null) { \"It should be a single buffer chunk.\" }\n appendChainImpl(buffer, buffer, 0)\n }\n\n internal final fun appendChain(head: ChunkBuffer) {\n val tail = head.findTail()\n val chainedSizeDelta = (head.remainingAll() - tail.readRemaining).toIntOrFail(\"total size increase\")\n appendChainImpl(head, tail, chainedSizeDelta)\n }\n\n private fun appendNewChunk(): ChunkBuffer {\n val new = pool.borrow()\n new.reserveEndGap(Buffer.ReservedSize)\n\n appendSingleChunk(new)\n\n return new\n }\n\n private final fun appendChainImpl(head: ChunkBuffer, newTail: ChunkBuffer, chainedSizeDelta: Int) {\n val _tail = _tail\n if (_tail == null) {\n _head = head\n chainedSize = 0\n } else {\n _tail.next = head\n val tailPosition = tailPosition\n _tail.commitWrittenUntilIndex(tailPosition)\n chainedSize += tailPosition - tailInitialPosition\n }\n\n this._tail = newTail\n chainedSize += chainedSizeDelta\n tailMemory = newTail.memory\n tailPosition = newTail.writePosition\n tailInitialPosition = newTail.readPosition\n tailEndExclusive = newTail.limit\n }\n\n final override fun writeByte(v: Byte) {\n val index = tailPosition\n if (index < tailEndExclusive) {\n tailPosition = index + 1\n tailMemory[index] = v\n return\n }\n\n return writeByteFallback(v)\n }\n\n private fun writeByteFallback(v: Byte) {\n appendNewChunk().writeByte(v)\n tailPosition++\n }\n\n /**\n * Should flush and close the destination\n */\n final override fun close() {\n try {\n flush()\n } finally {\n closeDestination() // TODO check what should be done here\n }\n }\n\n /**\n * Append single UTF-8 character\n */\n override fun append(c: Char): AbstractOutput {\n val tailPosition = tailPosition\n if (tailEndExclusive - tailPosition >= 3) {\n val size = tailMemory.putUtf8Char(tailPosition, c.toInt())\n this.tailPosition = tailPosition + size\n return this\n }\n\n appendCharFallback(c)\n return this\n }\n\n private fun appendCharFallback(c: Char) {\n write(3) { buffer ->\n val size = buffer.memory.putUtf8Char(buffer.writePosition, c.toInt())\n buffer.commitWritten(size)\n size\n }\n }\n\n override fun append(csq: CharSequence?): AbstractOutput {\n if (csq == null) {\n append(\"null\", 0, 4)\n } else {\n append(csq, 0, csq.length)\n }\n return this\n }\n\n override fun append(csq: CharSequence?, start: Int, end: Int): AbstractOutput {\n if (csq == null) {\n return append(\"null\", start, end)\n }\n\n writeText(csq, start, end, Charsets.UTF_8)\n\n return this\n }\n\n /**\n * Writes another packet to the end. Please note that the instance [p] gets consumed so you don't need to release it\n */\n public fun writePacket(p: ByteReadPacket) {\n val foreignStolen = p.stealAll()\n if (foreignStolen == null) {\n p.release()\n return\n }\n\n val _tail = _tail\n if (_tail == null) {\n appendChain(foreignStolen)\n return\n }\n\n writePacketMerging(_tail, foreignStolen, p.pool)\n }\n\n /**\n * Write chunk buffer to current [Output]. Assuming that chunk buffer is from current pool.\n */\n internal fun writeChunkBuffer(chunkBuffer: ChunkBuffer) {\n val _tail = _tail\n if (_tail == null) {\n appendChain(chunkBuffer)\n return\n }\n\n writePacketMerging(_tail, chunkBuffer, pool)\n }\n\n private fun writePacketMerging(tail: ChunkBuffer, foreignStolen: ChunkBuffer, pool: ObjectPool) {\n tail.commitWrittenUntilIndex(tailPosition)\n\n val lastSize = tail.readRemaining\n val nextSize = foreignStolen.readRemaining\n\n // at first we evaluate if it is reasonable to merge chunks\n val maxCopySize = PACKET_MAX_COPY_SIZE\n val appendSize = if (nextSize < maxCopySize && nextSize <= (tail.endGap + tail.writeRemaining)) {\n nextSize\n } else -1\n\n val prependSize =\n if (lastSize < maxCopySize && lastSize <= foreignStolen.startGap && foreignStolen.isExclusivelyOwned()) {\n lastSize\n } else -1\n\n if (appendSize == -1 && prependSize == -1) {\n // simply enqueue if there is no reason to merge\n appendChain(foreignStolen)\n } else if (prependSize == -1 || appendSize <= prependSize) {\n // do append\n tail.writeBufferAppend(foreignStolen, tail.writeRemaining + tail.endGap)\n afterHeadWrite()\n foreignStolen.cleanNext()?.let { next ->\n appendChain(next)\n }\n\n foreignStolen.release(pool)\n } else if (appendSize == -1 || prependSize < appendSize) {\n writePacketSlowPrepend(foreignStolen, tail)\n } else {\n throw IllegalStateException(\"prep = $prependSize, app = $appendSize\")\n }\n }\n\n /**\n * Do prepend current [tail] to the beginning of [foreignStolen].\n */\n private fun writePacketSlowPrepend(foreignStolen: ChunkBuffer, tail: ChunkBuffer) {\n foreignStolen.writeBufferPrepend(tail)\n\n val _head = _head ?: error(\"head should't be null since it is already handled in the fast-path\")\n if (_head === tail) {\n this._head = foreignStolen\n } else {\n // we need to fix next reference of the previous chunk before the tail\n // we have to traverse from the beginning to find it\n var pre = _head\n while (true) {\n val next = pre.next!!\n if (next === tail) break\n pre = next\n }\n\n pre.next = foreignStolen\n }\n\n tail.release(pool)\n\n this._tail = foreignStolen.findTail()\n }\n\n /**\n * Write exact [n] bytes from packet to the builder\n */\n public fun writePacket(p: ByteReadPacket, n: Int) {\n var remaining = n\n\n while (remaining > 0) {\n val headRemaining = p.headRemaining\n if (headRemaining <= remaining) {\n remaining -= headRemaining\n appendSingleChunk(p.steal() ?: throw EOFException(\"Unexpected end of packet\"))\n } else {\n p.read { view ->\n writeFully(view, remaining)\n }\n break\n }\n }\n }\n\n /**\n * Write exact [n] bytes from packet to the builder\n */\n public fun writePacket(p: ByteReadPacket, n: Long) {\n var remaining = n\n\n while (remaining > 0L) {\n val headRemaining = p.headRemaining.toLong()\n if (headRemaining <= remaining) {\n remaining -= headRemaining\n appendSingleChunk(p.steal() ?: throw EOFException(\"Unexpected end of packet\"))\n } else {\n p.read { view ->\n writeFully(view, remaining.toInt())\n }\n break\n }\n }\n }\n\n override fun append(csq: CharArray, start: Int, end: Int): Appendable {\n writeText(csq, start, end, Charsets.UTF_8)\n return this\n }\n\n private inline fun appendCharsTemplate(\n start: Int,\n end: Int,\n block: Buffer.(index: Int) -> Int\n ): Int {\n var idx = start\n if (idx >= end) return idx\n idx = prepareWriteHead(1).block(idx)\n afterHeadWrite()\n\n while (idx < end) {\n idx = appendNewChunk().block(idx)\n afterHeadWrite()\n }\n\n return idx\n }\n\n @Deprecated(\"Use writeText instead\", ReplaceWith(\"writeText(s)\"))\n public fun writeStringUtf8(s: String) {\n writeText(s)\n }\n\n @Deprecated(\"Use writeText instead\", ReplaceWith(\"this.writeText(cs)\"))\n public fun writeStringUtf8(cs: CharSequence) {\n writeText(cs)\n }\n\n @Suppress(\"NOTHING_TO_INLINE\")\n private inline fun Buffer.putUtf8Char(v: Int) = when {\n v in 1..0x7f -> {\n writeByte(v.toByte())\n 1\n }\n v > 0x7ff -> {\n writeExact(3, \"3 bytes character\") { memory, offset ->\n memory[offset] = (0xe0 or ((v shr 12) and 0x0f)).toByte()\n memory[offset + 1] = (0x80 or ((v shr 6) and 0x3f)).toByte()\n memory[offset + 2] = (0x80 or (v and 0x3f)).toByte()\n }\n 3\n }\n else -> {\n writeExact(2, \"2 bytes character\") { memory, offset ->\n memory[offset] = (0xc0 or ((v shr 6) and 0x1f)).toByte()\n memory[offset + 1] = (0x80 or (v and 0x3f)).toByte()\n }\n 2\n }\n }\n\n /**\n * Release any resources that the builder holds. Builder shouldn't be used after release\n */\n public final fun release() {\n close()\n }\n\n @DangerousInternalIoApi\n public fun prepareWriteHead(n: Int): ChunkBuffer {\n if (tailRemaining >= n) {\n _tail?.let {\n it.commitWrittenUntilIndex(tailPosition)\n return it\n }\n }\n return appendNewChunk()\n }\n\n @DangerousInternalIoApi\n public fun afterHeadWrite() {\n _tail?.let { tailPosition = it.writePosition }\n }\n\n @PublishedApi\n internal inline fun write(size: Int, block: (Buffer) -> Int): Int {\n val buffer = prepareWriteHead(size)\n try {\n val result = block(buffer)\n check(result >= 0) { \"The returned value shouldn't be negative\" }\n\n return result\n } finally {\n afterHeadWrite()\n }\n }\n\n @PublishedApi\n @Deprecated(\"There is no need to do that anymore.\", level = DeprecationLevel.HIDDEN)\n internal fun addSize(n: Int) {\n check(n >= 0) { \"It should be non-negative size increment: $n\" }\n check(n <= tailRemaining) { \"Unable to mark more bytes than available: $n > $tailRemaining\" }\n\n // For binary compatibility we need to update pointers\n tailPosition += n\n }\n\n @Suppress(\"DEPRECATION\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n internal open fun last(buffer: IoBuffer) {\n appendSingleChunk(buffer as ChunkBuffer)\n }\n\n @Suppress(\"DEPRECATION\")\n @Deprecated(\n \"Use appendNewChunk instead\",\n replaceWith = ReplaceWith(\"appendNewChunk()\"),\n level = DeprecationLevel.HIDDEN\n )\n public fun appendNewBuffer(): IoBuffer = appendNewChunk() as IoBuffer\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public open fun reset() {\n }\n}\n","@file:Suppress(\"NOTHING_TO_INLINE\")\n\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.internal.*\nimport kotlin.contracts.*\n\n/**\n * For every byte from this buffer invokes [block] function giving it as parameter.\n */\n@ExperimentalIoApi\npublic inline fun Buffer.forEach(block: (Byte) -> Unit) {\n read { memory, start, endExclusive ->\n for (index in start until endExclusive) {\n block(memory[index])\n }\n endExclusive - start\n }\n}\n\n/**\n * Read an unsigned byte or fail if no bytes available for reading.\n */\npublic fun Buffer.readUByte(): UByte = readByte().toUByte()\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Input instead.\")\npublic inline fun IoBuffer.readUByte(): UByte = (this as Buffer).readUByte()\n\n/**\n * Write an unsigned byte or fail if not enough space available for writing.\n */\npublic fun Buffer.writeUByte(value: UByte) {\n writeByte(value.toByte())\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Output instead.\")\npublic fun IoBuffer.writeUByte(value: UByte) {\n (this as Buffer).writeUByte(value)\n}\n\n/**\n * Read a short integer or fail if no bytes available for reading.\n * The numeric value is decoded in the network order (Big Endian).\n */\npublic fun Buffer.readShort(): Short = readExact(2, \"short integer\") { memory, offset ->\n memory.loadShortAt(offset)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Input instead.\")\npublic inline fun IoBuffer.readShort(): Short = (this as Buffer).readShort()\n\n/**\n * Read an unsigned short integer or fail if not enough bytes available for reading.\n * The numeric value is decoded in the network order (Big Endian).\n */\npublic fun Buffer.readUShort(): UShort = readExact(2, \"short unsigned integer\") { memory, offset ->\n memory.loadUShortAt(offset)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Input instead.\")\npublic inline fun IoBuffer.readUShort(): UShort = (this as Buffer).readUShort()\n\n/**\n * Read an integer or fail if not enough bytes available for reading.\n * The numeric value is decoded in the network order (Big Endian).\n */\npublic fun Buffer.readInt(): Int = readExact(4, \"regular integer\") { memory, offset ->\n memory.loadIntAt(offset)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Input instead.\")\npublic inline fun IoBuffer.readInt(): Int = (this as Buffer).readInt()\n\n/**\n * Read an unsigned integer or fail if not enough bytes available for reading.\n * The numeric value is decoded in the network order (Big Endian).\n */\npublic fun Buffer.readUInt(): UInt = readExact(4, \"regular unsigned integer\") { memory, offset ->\n memory.loadUIntAt(offset)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Input instead.\")\npublic inline fun IoBuffer.readUInt(): UInt = (this as Buffer).readUInt()\n\n/**\n * Read a long integer or fail if not enough bytes available for reading.\n * The numeric value is decoded in the network order (Big Endian).\n */\npublic fun Buffer.readLong(): Long = readExact(8, \"long integer\") { memory, offset ->\n memory.loadLongAt(offset)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Input instead.\")\npublic inline fun IoBuffer.readLong(): Long = (this as Buffer).readLong()\n\n/**\n * Read an unsigned long integer or fail if not enough bytes available for reading.\n * The numeric value is decoded in the network order (Big Endian).\n */\npublic fun Buffer.readULong(): ULong = readExact(8, \"long unsigned integer\") { memory, offset ->\n memory.loadULongAt(offset)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Input instead.\")\npublic inline fun IoBuffer.readULong(): ULong = (this as Buffer).readULong()\n\n/**\n * Read a floating point number or fail if not enough bytes available for reading.\n * The numeric value is decoded in the network order (Big Endian).\n */\npublic fun Buffer.readFloat(): Float = readExact(4, \"floating point number\") { memory, offset ->\n memory.loadFloatAt(offset)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Input instead.\")\npublic inline fun IoBuffer.readFloat(): Float = (this as Buffer).readFloat()\n\n/**\n * Read a floating point number or fail if not enough bytes available for reading.\n * The numeric value is decoded in the network order (Big Endian).\n */\npublic fun Buffer.readDouble(): Double = readExact(8, \"long floating point number\") { memory, offset ->\n memory.loadDoubleAt(offset)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Input instead.\")\npublic inline fun IoBuffer.readDouble(): Double = (this as Buffer).readDouble()\n\n/**\n * Write a short integer or fail if not enough space available for writing.\n * The numeric value is encoded in the network order (Big Endian).\n */\npublic fun Buffer.writeShort(value: Short): Unit = writeExact(2, \"short integer\") { memory, offset ->\n memory.storeShortAt(offset, value)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Output instead.\")\npublic inline fun IoBuffer.writeShort(value: Short): Unit = (this as Buffer).writeShort(value)\n\n/**\n * Write an unsigned short integer or fail if not enough space available for writing.\n * The numeric value is encoded in the network order (Big Endian).\n */\npublic fun Buffer.writeUShort(value: UShort): Unit =\n writeExact(2, \"short unsigned integer\") { memory, offset ->\n memory.storeUShortAt(offset, value)\n }\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Output instead.\")\npublic inline fun IoBuffer.writeUShort(value: UShort): Unit = (this as Buffer).writeUShort(value)\n\n/**\n * Write an integer or fail if not enough space available for writing.\n * The numeric value is encoded in the network order (Big Endian).\n */\npublic fun Buffer.writeInt(value: Int): Unit = writeExact(4, \"regular integer\") { memory, offset ->\n memory.storeIntAt(offset, value)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Output instead.\")\npublic inline fun IoBuffer.writeInt(value: Int): Unit = (this as Buffer).writeInt(value)\n\n/**\n * Write an unsigned integer or fail if not enough space available for writing.\n * The numeric value is encoded in the network order (Big Endian).\n */\npublic fun Buffer.writeUInt(value: UInt): Unit = writeExact(4, \"regular unsigned integer\") { memory, offset ->\n memory.storeUIntAt(offset, value)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Output instead.\")\npublic inline fun IoBuffer.writeUInt(value: UInt): Unit = (this as Buffer).writeUInt(value)\n\n/**\n * Write a long integer or fail if not enough space available for writing.\n * The numeric value is encoded in the network order (Big Endian).\n */\npublic fun Buffer.writeLong(value: Long): Unit = writeExact(8, \"long integer\") { memory, offset ->\n memory.storeLongAt(offset, value)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Output instead.\")\npublic inline fun IoBuffer.writeLong(value: Long): Unit = (this as Buffer).writeLong(value)\n\n/**\n * Write an unsigned long integer or fail if not enough space available for writing.\n * The numeric value is encoded in the network order (Big Endian).\n */\npublic fun Buffer.writeULong(value: ULong): Unit = writeExact(8, \"long unsigned integer\") { memory, offset ->\n memory.storeULongAt(offset, value)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Output instead.\")\npublic inline fun IoBuffer.writeULong(value: ULong): Unit = (this as Buffer).writeULong(value)\n\n/**\n * Write a floating point number or fail if not enough space available for writing.\n * The numeric value is encoded in the network order (Big Endian).\n */\npublic fun Buffer.writeFloat(value: Float): Unit = writeExact(4, \"floating point number\") { memory, offset ->\n memory.storeFloatAt(offset, value)\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Output instead.\")\npublic inline fun IoBuffer.writeFloat(value: Float): Unit = (this as Buffer).writeFloat(value)\n\n/**\n * Write a floating point number or fail if not enough space available for writing.\n * The numeric value is encoded in the network order (Big Endian).\n */\npublic fun Buffer.writeDouble(value: Double): Unit =\n writeExact(8, \"long floating point number\") { memory, offset ->\n memory.storeDoubleAt(offset, value)\n }\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Output instead.\")\npublic inline fun IoBuffer.writeDouble(value: Double): Unit = (this as Buffer).writeDouble(value)\n\n/**\n * Read from this buffer to the [destination] array to [offset] and [length] bytes.\n */\npublic fun Buffer.readFully(destination: ByteArray, offset: Int = 0, length: Int = destination.size - offset) {\n readExact(length, \"byte array\") { memory, srcOffset ->\n memory.loadByteArray(srcOffset, destination, offset, length)\n }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Input instead.\")\npublic inline fun IoBuffer.readFully(destination: ByteArray, offset: Int = 0, length: Int = destination.size - offset) {\n (this as Buffer).readFully(destination, offset, length)\n}\n\n/**\n * Read from this buffer to the [destination] array to [offset] and [length] bytes.\n */\npublic fun Buffer.readFully(destination: UByteArray, offset: Int = 0, length: Int = destination.size - offset) {\n readFully(destination.asByteArray(), offset, length)\n}\n\n/**\n * Read available for read bytes to the [destination] array range starting at array [offset] and [length] bytes.\n * If less than [length] bytes available then less bytes will be copied and the corresponding number\n * will be returned as result.\n * @return number of bytes copied to the [destination] or `-1` if the buffer is empty\n */\npublic fun Buffer.readAvailable(destination: ByteArray, offset: Int = 0, length: Int = destination.size - offset): Int {\n require(offset >= 0) { \"offset shouldn't be negative: $offset\" }\n require(length >= 0) { \"length shouldn't be negative: $length\" }\n require(offset + length <= destination.size) {\n \"offset + length should be less than the destination size: $offset\" +\n \" + $length > ${destination.size}\"\n }\n\n if (!canRead()) return -1\n val toBeRead = minOf(length, readRemaining)\n readFully(destination, offset, toBeRead)\n return toBeRead\n}\n\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Input instead.\")\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\npublic inline fun IoBuffer.readAvailable(\n destination: ByteArray,\n offset: Int = 0,\n length: Int = destination.size - offset\n): Int {\n return (this as Buffer).readAvailable(destination, offset, length)\n}\n\n/**\n * Read available for read bytes to the [destination] array range starting at array [offset] and [length] bytes.\n * If less than [length] bytes available then less bytes will be copied and the corresponding number\n * will be returned as result.\n * @return number of bytes copied to the [destination] or `-1` if the buffer is empty\n */\npublic fun Buffer.readAvailable(\n destination: UByteArray,\n offset: Int = 0,\n length: Int = destination.size - offset\n): Int {\n return readAvailable(destination.asByteArray(), offset, length)\n}\n\n/**\n * Write the whole [source] array range staring at [offset] and having the specified bytes [length].\n */\npublic fun Buffer.writeFully(source: ByteArray, offset: Int = 0, length: Int = source.size - offset) {\n writeExact(length, \"byte array\") { memory, dstOffset ->\n memory.storeByteArray(dstOffset, source, offset, length)\n }\n}\n\n@Deprecated(\"IoBuffer is deprecated. Use Memory or Output instead.\")\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\", \"DEPRECATION\")\npublic inline fun IoBuffer.writeFully(source: ByteArray, offset: Int = 0, length: Int = source.size - offset) {\n (this as Buffer).writeFully(source, offset, length)\n}\n\n/**\n * Write the whole [source] array range staring at [offset] and having the specified bytes [length].\n */\npublic fun Buffer.writeFully(source: UByteArray, offset: Int = 0, length: Int = source.size - offset) {\n writeFully(source.asByteArray(), offset, length)\n}\n\n/**\n * Read from this buffer to the [destination] array to [offset] and [length] bytes.\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.readFully(destination: ShortArray, offset: Int = 0, length: Int = destination.size - offset) {\n readExact(length * 2, \"short integers array\") { memory, srcOffset ->\n memory.loadShortArray(srcOffset, destination, offset, length)\n }\n}\n\n/**\n * Read from this buffer to the [destination] array to [offset] and [length] bytes.\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.readFully(destination: UShortArray, offset: Int = 0, length: Int = destination.size - offset) {\n readFully(destination.asShortArray(), offset, length)\n}\n\n/**\n * Read available for read bytes to the [destination] array range starting at array [offset] and [length] elements.\n * If less than [length] elements available then less elements will be copied and the corresponding number\n * will be returned as result (possibly zero).\n *\n * @return number of elements copied to the [destination] or `-1` if the buffer is empty,\n * `0` - not enough bytes for at least an element\n */\npublic fun Buffer.readAvailable(\n destination: ShortArray,\n offset: Int = 0,\n length: Int = destination.size - offset\n): Int {\n require(offset >= 0) { \"offset shouldn't be negative: $offset\" }\n require(length >= 0) { \"length shouldn't be negative: $length\" }\n require(offset + length <= destination.size) {\n \"offset + length should be less than the destination size: $offset\" +\n \" + $length > ${destination.size}\"\n }\n\n if (!canRead()) return -1\n val toBeRead = minOf(length / 2, readRemaining)\n readFully(destination, offset, toBeRead)\n return toBeRead\n}\n\n/**\n * Read available for read bytes to the [destination] array range starting at array [offset] and [length] elements.\n * If less than [length] elements available then less elements will be copied and the corresponding number\n * will be returned as result (possibly zero).\n *\n * @return number of elements copied to the [destination] or `-1` if the buffer is empty,\n * `0` - not enough bytes for at least an element\n */\npublic fun Buffer.readAvailable(\n destination: UShortArray,\n offset: Int = 0,\n length: Int = destination.size - offset\n): Int {\n return readAvailable(destination.asShortArray(), offset, length)\n}\n\n/**\n * Write the whole [source] array range staring at [offset] and having the specified items [length].\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.writeFully(source: ShortArray, offset: Int = 0, length: Int = source.size - offset) {\n writeExact(length * 2, \"short integers array\") { memory, dstOffset ->\n memory.storeShortArray(dstOffset, source, offset, length)\n }\n}\n\n/**\n * Write the whole [source] array range staring at [offset] and having the specified items [length].\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.writeFully(source: UShortArray, offset: Int = 0, length: Int = source.size - offset) {\n writeFully(source.asShortArray(), offset, length)\n}\n\n/**\n * Read from this buffer to the [destination] array to [offset] and [length] bytes.\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.readFully(destination: IntArray, offset: Int = 0, length: Int = destination.size - offset) {\n readExact(length * 4, \"integers array\") { memory, srcOffset ->\n memory.loadIntArray(srcOffset, destination, offset, length)\n }\n}\n\n/**\n * Read from this buffer to the [destination] array to [offset] and [length] bytes.\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.readFully(destination: UIntArray, offset: Int = 0, length: Int = destination.size - offset) {\n readFully(destination.asIntArray(), offset, length)\n}\n\n/**\n * Read available for read bytes to the [destination] array range starting at array [offset] and [length] elements.\n * If less than [length] elements available then less elements will be copied and the corresponding number\n * will be returned as result (possibly zero).\n *\n * @return number of elements copied to the [destination] or `-1` if the buffer is empty,\n * `0` - not enough bytes for at least an element\n */\npublic fun Buffer.readAvailable(destination: IntArray, offset: Int = 0, length: Int = destination.size - offset): Int {\n require(offset >= 0) { \"offset shouldn't be negative: $offset\" }\n require(length >= 0) { \"length shouldn't be negative: $length\" }\n require(offset + length <= destination.size) {\n \"offset + length should be less than the destination size: $offset\" +\n \" + $length > ${destination.size}\"\n }\n\n if (!canRead()) return -1\n val toBeRead = minOf(length / 4, readRemaining)\n readFully(destination, offset, toBeRead)\n return toBeRead\n}\n\n/**\n * Read available for read bytes to the [destination] array range starting at array [offset] and [length] elements.\n * If less than [length] elements available then less elements will be copied and the corresponding number\n * will be returned as result (possibly zero).\n *\n * @return number of elements copied to the [destination] or `-1` if the buffer is empty,\n * `0` - not enough bytes for at least an element\n */\npublic fun Buffer.readAvailable(destination: UIntArray, offset: Int = 0, length: Int = destination.size - offset): Int {\n return readAvailable(destination.asIntArray(), offset, length)\n}\n\n/**\n * Write the whole [source] array range staring at [offset] and having the specified items [length].\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.writeFully(source: IntArray, offset: Int = 0, length: Int = source.size - offset) {\n writeExact(length * 4, \"integers array\") { memory, dstOffset ->\n memory.storeIntArray(dstOffset, source, offset, length)\n }\n}\n\n/**\n * Write the whole [source] array range staring at [offset] and having the specified items [length].\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.writeFully(source: UIntArray, offset: Int = 0, length: Int = source.size - offset) {\n writeFully(source.asIntArray(), offset, length)\n}\n\n/**\n * Read from this buffer to the [destination] array to [offset] and [length] bytes.\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.readFully(destination: LongArray, offset: Int = 0, length: Int = destination.size - offset) {\n readExact(length * 8, \"long integers array\") { memory, srcOffset ->\n memory.loadLongArray(srcOffset, destination, offset, length)\n }\n}\n\n/**\n * Read from this buffer to the [destination] array to [offset] and [length] bytes.\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.readFully(destination: ULongArray, offset: Int = 0, length: Int = destination.size - offset) {\n readFully(destination.asLongArray(), offset, length)\n}\n\n/**\n * Read available for read bytes to the [destination] array range starting at array [offset] and [length] elements.\n * If less than [length] elements available then less elements will be copied and the corresponding number\n * will be returned as result (possibly zero).\n *\n * @return number of elements copied to the [destination] or `-1` if the buffer is empty,\n * `0` - not enough bytes for at least an element\n */\npublic fun Buffer.readAvailable(destination: LongArray, offset: Int = 0, length: Int = destination.size - offset): Int {\n require(offset >= 0) { \"offset shouldn't be negative: $offset\" }\n require(length >= 0) { \"length shouldn't be negative: $length\" }\n require(offset + length <= destination.size) {\n \"offset + length should be less than the destination size: $offset\" +\n \" + $length > ${destination.size}\"\n }\n\n if (!canRead()) return -1\n val toBeRead = minOf(length / 8, readRemaining)\n readFully(destination, offset, toBeRead)\n return toBeRead\n}\n\n/**\n * Read available for read bytes to the [destination] array range starting at array [offset] and [length] elements.\n * If less than [length] elements available then less elements will be copied and the corresponding number\n * will be returned as result (possibly zero).\n *\n * @return number of elements copied to the [destination] or `-1` if the buffer is empty,\n * `0` - not enough bytes for at least an element\n */\npublic fun Buffer.readAvailable(\n destination: ULongArray,\n offset: Int = 0,\n length: Int = destination.size - offset\n): Int {\n return readAvailable(destination.asLongArray(), offset, length)\n}\n\n/**\n * Write the whole [source] array range staring at [offset] and having the specified items [length].\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.writeFully(source: LongArray, offset: Int = 0, length: Int = source.size - offset) {\n writeExact(length * 8, \"long integers array\") { memory, dstOffset ->\n memory.storeLongArray(dstOffset, source, offset, length)\n }\n}\n\n/**\n * Write the whole [source] array range staring at [offset] and having the specified items [length].\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.writeFully(source: ULongArray, offset: Int = 0, length: Int = source.size - offset) {\n writeFully(source.asLongArray(), offset, length)\n}\n\n/**\n * Read from this buffer to the [destination] array to [offset] and [length] bytes.\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.readFully(destination: FloatArray, offset: Int = 0, length: Int = destination.size - offset) {\n readExact(length * 4, \"floating point numbers array\") { memory, srcOffset ->\n memory.loadFloatArray(srcOffset, destination, offset, length)\n }\n}\n\n/**\n * Read available for read bytes to the [destination] array range starting at array [offset] and [length] elements.\n * If less than [length] elements available then less elements will be copied and the corresponding number\n * will be returned as result (possibly zero).\n *\n * @return number of elements copied to the [destination] or `-1` if the buffer is empty,\n * `0` - not enough bytes for at least an element\n */\npublic fun Buffer.readAvailable(\n destination: FloatArray,\n offset: Int = 0,\n length: Int = destination.size - offset\n): Int {\n require(offset >= 0) { \"offset shouldn't be negative: $offset\" }\n require(length >= 0) { \"length shouldn't be negative: $length\" }\n require(offset + length <= destination.size) {\n \"offset + length should be less than the destination size: $offset\" +\n \" + $length > ${destination.size}\"\n }\n\n if (!canRead()) return -1\n val toBeRead = minOf(length / 4, readRemaining)\n readFully(destination, offset, toBeRead)\n return toBeRead\n}\n\n/**\n * Write the whole [source] array range staring at [offset] and having the specified items [length].\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.writeFully(source: FloatArray, offset: Int = 0, length: Int = source.size - offset) {\n writeExact(length * 4, \"floating point numbers array\") { memory, dstOffset ->\n memory.storeFloatArray(dstOffset, source, offset, length)\n }\n}\n\n/**\n * Read from this buffer to the [destination] array to [offset] and [length] bytes.\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.readFully(destination: DoubleArray, offset: Int = 0, length: Int = destination.size - offset) {\n readExact(length * 8, \"floating point numbers array\") { memory, srcOffset ->\n memory.loadDoubleArray(srcOffset, destination, offset, length)\n }\n}\n\n/**\n * Read available for read bytes to the [destination] array range starting at array [offset] and [length] elements.\n * If less than [length] elements available then less elements will be copied and the corresponding number\n * will be returned as result (possibly zero).\n *\n * @return number of elements copied to the [destination] or `-1` if the buffer is empty,\n * `0` - not enough bytes for at least an element\n */\npublic fun Buffer.readAvailable(\n destination: DoubleArray,\n offset: Int = 0,\n length: Int = destination.size - offset\n): Int {\n require(offset >= 0) { \"offset shouldn't be negative: $offset\" }\n require(length >= 0) { \"length shouldn't be negative: $length\" }\n require(offset + length <= destination.size) {\n \"offset + length should be less than the destination size: $offset\" +\n \" + $length > ${destination.size}\"\n }\n\n if (!canRead()) return -1\n val toBeRead = minOf(length / 8, readRemaining)\n readFully(destination, offset, toBeRead)\n return toBeRead\n}\n\n/**\n * Write the whole [source] array range staring at [offset] and having the specified items [length].\n * Numeric values are interpreted in the network byte order (Big Endian).\n */\npublic fun Buffer.writeFully(source: DoubleArray, offset: Int = 0, length: Int = source.size - offset) {\n writeExact(length * 8, \"floating point numbers array\") { memory, dstOffset ->\n memory.storeDoubleArray(dstOffset, source, offset, length)\n }\n}\n\n/**\n * Read at most [length] bytes from this buffer to the [dst] buffer.\n * @return number of bytes copied\n */\npublic fun Buffer.readFully(dst: Buffer, length: Int = dst.writeRemaining): Int {\n require(length >= 0)\n require(length <= dst.writeRemaining)\n\n readExact(length, \"buffer content\") { memory, offset ->\n memory.copyTo(dst.memory, offset, length, dst.writePosition)\n dst.commitWritten(length)\n }\n\n return length\n}\n\n/**\n * Read at most [length] available bytes to the [dst] buffer or `-1` if no bytes available for read.\n * @return number of bytes copied or `-1` if empty\n */\npublic fun Buffer.readAvailable(dst: Buffer, length: Int = dst.writeRemaining): Int {\n if (!canRead()) return -1\n\n val readSize = minOf(dst.writeRemaining, readRemaining, length)\n\n readExact(readSize, \"buffer content\") { memory, offset ->\n memory.copyTo(dst.memory, offset, readSize, dst.writePosition)\n dst.commitWritten(readSize)\n }\n\n return readSize\n}\n\n/**\n * Write all readable bytes from [src] to this buffer. Fails if not enough space available to write all bytes.\n */\npublic fun Buffer.writeFully(src: Buffer) {\n val length = src.readRemaining\n\n writeExact(length, \"buffer readable content\") { memory, offset ->\n src.memory.copyTo(memory, src.readPosition, length, offset)\n src.discardExact(length)\n }\n}\n\n/**\n * Write at most [length] readable bytes from [src] to this buffer.\n * Fails if not enough space available to write all bytes.\n */\npublic fun Buffer.writeFully(src: Buffer, length: Int) {\n require(length >= 0) { \"length shouldn't be negative: $length\" }\n require(length <= src.readRemaining) {\n \"length shouldn't be greater than the source read remaining: $length > ${src.readRemaining}\"\n }\n require(length <= writeRemaining) {\n \"length shouldn't be greater than the destination write remaining space: $length > $writeRemaining\"\n }\n\n writeExact(length, \"buffer readable content\") { memory, offset ->\n src.memory.copyTo(memory, src.readPosition, length, offset)\n src.discardExact(length)\n }\n}\n\n@PublishedApi\ninternal inline fun Buffer.readExact(size: Int, name: String, block: (memory: Memory, offset: Int) -> R): R {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n var value: R\n\n read { memory, start, endExclusive ->\n io.ktor.utils.io.core.internal.require(endExclusive - start >= size) {\n throw EOFException(\"Not enough bytes to read a $name of size $size.\")\n }\n value = block(memory, start)\n size\n }\n\n return value\n}\n\n@PublishedApi\ninternal inline fun Buffer.writeExact(size: Int, name: String, block: (memory: Memory, offset: Int) -> Unit) {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n write { memory, start, endExclusive ->\n val writeRemaining = endExclusive - start\n if (writeRemaining < size) {\n throw InsufficientSpaceException(name, size, writeRemaining)\n }\n block(memory, start)\n size\n }\n}\n","@file:Suppress(\"DeprecatedCallableAddReplaceWith\")\n\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.internal.*\nimport io.ktor.utils.io.core.internal.require\nimport io.ktor.utils.io.pool.*\n\n/**\n * Write byte [value] repeated the specified [times].\n */\npublic fun Buffer.fill(times: Int, value: Byte) {\n require(times >= 0) { \"times shouldn't be negative: $times\" }\n require(times <= writeRemaining) {\n \"times shouldn't be greater than the write remaining space: $times > $writeRemaining\"\n }\n\n memory.fill(writePosition, times, value)\n commitWritten(times)\n}\n\n/**\n * Write unsigned byte [value] repeated the specified [times].\n */\npublic fun Buffer.fill(times: Int, value: UByte) {\n fill(times, value.toByte())\n}\n\n/**\n * Write byte [v] value repeated [n] times.\n */\n@Deprecated(\"Use fill with n with type Int\")\npublic fun Buffer.fill(n: Long, v: Byte) {\n fill(n.toIntOrFail(\"n\"), v)\n}\n\n/**\n * Push back [n] bytes: only possible if there were at least [n] bytes read before this operation.\n */\n@Deprecated(\"Use rewind instead\", ReplaceWith(\"rewind(n)\"))\npublic fun Buffer.pushBack(n: Int): Unit = rewind(n)\n\n@Deprecated(\"Use duplicate instead\", ReplaceWith(\"duplicate()\"))\npublic fun Buffer.makeView(): Buffer = duplicate()\n\n@Deprecated(\"Use duplicate instead\", ReplaceWith(\"duplicate()\"))\npublic fun ChunkBuffer.makeView(): ChunkBuffer = duplicate()\n\n@Deprecated(\"Does nothing.\")\npublic fun Buffer.flush() {\n}\n\ninternal fun Buffer.appendChars(csq: CharArray, start: Int, end: Int): Int {\n return appendChars(CharArraySequence(csq, 0, csq.size), start, end)\n}\n\ninternal fun Buffer.appendChars(csq: CharSequence, start: Int, end: Int): Int {\n var charactersWritten: Int\n\n write { dst, dstStart, dstEndExclusive ->\n val result = dst.encodeUTF8(csq, start, end, dstStart, dstEndExclusive)\n charactersWritten = result.characters.toInt()\n result.bytes.toInt()\n }\n\n return start + charactersWritten\n}\n\n@Deprecated(\"This is no longer supported. Use a packet builder to append characters instead.\")\npublic fun Buffer.append(c: Char): Buffer {\n write { memory, start, endExclusive ->\n val size = memory.putUtf8Char(start, c.toInt())\n when {\n size > endExclusive - start -> appendFailed(1)\n else -> size\n }\n }\n\n return this\n}\n\n@Deprecated(\"This is no longer supported. Use a packet builder to append characters instead.\")\npublic fun Buffer.append(csq: CharSequence?): Buffer {\n if (csq == null) {\n return append(\"null\")\n }\n\n return append(csq, 0, csq.length)\n}\n\n@Deprecated(\"This is no longer supported. Use a packet builder to append characters instead.\")\npublic fun Buffer.append(csq: CharSequence?, start: Int, end: Int): Buffer = apply {\n if (csq == null) {\n return append(\"null\", start, end)\n }\n\n if (appendChars(csq, start, end) != end) {\n appendFailed(end - start)\n }\n}\n\nprivate fun appendFailed(length: Int): Nothing {\n throw BufferLimitExceededException(\"Not enough free space available to write $length character(s).\")\n}\n\n@Deprecated(\"This is no longer supported. Use a packet builder to append characters instead.\")\npublic fun Buffer.append(csq: CharArray, start: Int, end: Int): Buffer {\n return append(CharArraySequence(csq, 0, csq.size), start, end)\n}\n\n@Deprecated(\"This is no longer supported. Read from a packet instead.\")\npublic fun Buffer.readText(\n decoder: CharsetDecoder,\n out: Appendable,\n lastBuffer: Boolean,\n max: Int = Int.MAX_VALUE\n): Int {\n return decoder.decodeBuffer(this, out, lastBuffer, max)\n}\n\n/**\n * releases buffer view and returns it to the [pool] if there are no more usages. Based on simple ref-counting so\n * it is very fragile.\n */\n@Suppress(\"DEPRECATION\")\npublic fun IoBuffer.release(pool: ObjectPool) {\n // TODO ???\n @Suppress(\"UNCHECKED_CAST\")\n (this as ChunkBuffer).release(pool as ObjectPool)\n}\n\n/**\n * Peek the next unsigned byte or return `-1` if no more bytes available for reading. No bytes will be marked\n * as consumed in any case.\n * @see [Buffer.tryPeekByte]\n */\n@Deprecated(\"Use tryPeekByte instead\", replaceWith = ReplaceWith(\"tryPeekByte()\"))\npublic fun Buffer.tryPeek(): Int = tryPeekByte()\n\npublic fun Buffer.readFully(dst: Array, offset: Int = 0, length: Int = dst.size - offset) {\n read { memory, start, endExclusive ->\n if (endExclusive - start < length) {\n throw EOFException(\"Not enough bytes available to read $length bytes\")\n }\n\n for (index in 0 until length) {\n dst[index + offset] = memory[index + start]\n }\n\n length\n }\n}\n\n@Deprecated(\n \"This is no longer supported. All operations are big endian by default. Use readXXXLittleEndian \" +\n \"to read primitives in little endian\",\n level = DeprecationLevel.ERROR\n)\npublic var Buffer.byteOrder: ByteOrder\n get() = ByteOrder.BIG_ENDIAN\n set(newOrder) {\n if (newOrder != ByteOrder.BIG_ENDIAN) throw UnsupportedOperationException(\"Only BIG_ENDIAN is supported\")\n }\n","package io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.internal.ChunkBuffer\nimport io.ktor.utils.io.pool.DefaultPool\nimport io.ktor.utils.io.pool.ObjectPool\nimport kotlin.native.concurrent.ThreadLocal\n\ninternal const val DEFAULT_BUFFER_SIZE: Int = 4096\n\n/**\n * Invoke [block] function with a temporary [Buffer] instance of the specified [size] in bytes.\n * The provided instance shouldn't be captured and used outside of the [block] otherwise an undefined behaviour\n * may occur including crash and/or data corruption.\n */\n@ExperimentalIoApi\npublic inline fun withBuffer(size: Int, block: Buffer.() -> R): R {\n return with(Buffer(DefaultAllocator.alloc(size)), block)\n}\n\n/**\n * Invoke [block] function with a temporary [Buffer] instance taken from the specified [pool].\n * Depending on the pool it may be safe or unsafe to capture and use the provided buffer outside of the [block].\n * Usually it is always recommended to NOT capture an instance outside.\n */\n@ExperimentalIoApi\npublic inline fun withBuffer(pool: ObjectPool, block: Buffer.() -> R): R {\n val instance = pool.borrow()\n return try {\n block(instance)\n } finally {\n pool.recycle(instance)\n }\n}\n\n/**\n * Invoke [block] function with a temporary [Buffer] instance taken from the specified [pool].\n * Depending on the pool it may be safe or unsafe to capture and use the provided buffer outside of the [block].\n * Usually it is always recommended to NOT capture an instance outside.\n * However since [ChunkBuffer] is reference counted, you can create a [Buffer.duplicate] (this is simply a view) and use\n * it outside of the [block] function but it is important to release the duplicate properly once not needed anymore\n * otherwise memory leak may occur on some platforms.\n */\ninternal inline fun withChunkBuffer(pool: ObjectPool, block: ChunkBuffer.() -> R): R {\n val instance = pool.borrow()\n return try {\n block(instance)\n } finally {\n instance.release(pool)\n }\n}\n\n@ThreadLocal\n@Suppress(\"DEPRECATION\")\ninternal val DefaultChunkedBufferPool: ObjectPool = DefaultBufferPool()\n\n@Suppress(\"DEPRECATION\")\ninternal class DefaultBufferPool(\n private val bufferSize: Int = DEFAULT_BUFFER_SIZE,\n\n capacity: Int = 1000,\n private val allocator: Allocator = DefaultAllocator\n) : DefaultPool(capacity) {\n override fun produceInstance(): IoBuffer {\n return IoBuffer(allocator.alloc(bufferSize), null)\n }\n\n override fun disposeInstance(instance: IoBuffer) {\n allocator.free(instance.memory)\n super.disposeInstance(instance)\n instance.unlink()\n }\n\n override fun validateInstance(instance: IoBuffer) {\n super.validateInstance(instance)\n\n if (instance === IoBuffer.Empty) {\n error(\"IoBuffer.Empty couldn't be recycled\")\n }\n\n check(instance !== IoBuffer.Empty) { \"Empty instance couldn't be recycled\" }\n check(instance !== Buffer.Empty) { \"Empty instance couldn't be recycled\" }\n check(instance !== ChunkBuffer.Empty) { \"Empty instance couldn't be recycled\" }\n\n check(instance.referenceCount == 0) { \"Unable to clear buffer: it is still in use.\" }\n check(instance.next == null) { \"Recycled instance shouldn't be a part of a chain.\" }\n check(instance.origin == null) { \"Recycled instance shouldn't be a view or another buffer.\" }\n }\n\n override fun clearInstance(instance: IoBuffer): IoBuffer {\n return super.clearInstance(instance).apply {\n unpark()\n reset()\n }\n }\n}\n","package io.ktor.utils.io.bits\n\nimport io.ktor.utils.io.core.ExperimentalIoApi\n\n/**\n * Reverse number's byte order\n */\npublic expect fun Short.reverseByteOrder(): Short\n\n/**\n * Reverse number's byte order\n */\npublic expect fun Int.reverseByteOrder(): Int\n\n/**\n * Reverse number's byte order\n */\npublic expect fun Long.reverseByteOrder(): Long\n\n/**\n * Reverse number's byte order\n */\npublic expect fun Float.reverseByteOrder(): Float\n\n/**\n * Reverse number's byte order\n */\npublic expect fun Double.reverseByteOrder(): Double\n\n/**\n * Reverse number's byte order\n */\n@ExperimentalUnsignedTypes\npublic fun UShort.reverseByteOrder(): UShort = toShort().reverseByteOrder().toUShort()\n\n/**\n * Reverse number's byte order\n */\n@ExperimentalUnsignedTypes\npublic fun UInt.reverseByteOrder(): UInt = toInt().reverseByteOrder().toUInt()\n\n/**\n * Reverse number's byte order\n */\n@ExperimentalUnsignedTypes\npublic fun ULong.reverseByteOrder(): ULong = toLong().reverseByteOrder().toULong()\n\n@ExperimentalIoApi\npublic inline val Short.highByte: Byte get() = (toInt() ushr 8).toByte()\n\n@ExperimentalIoApi\npublic inline val Short.lowByte: Byte get() = (toInt() and 0xff).toByte()\n\n@ExperimentalIoApi\npublic inline val Int.highShort: Short get() = (this ushr 16).toShort()\n\n@ExperimentalIoApi\npublic inline val Int.lowShort: Short get() = (this and 0xffff).toShort()\n\n@ExperimentalIoApi\npublic inline val Long.highInt: Int get() = (this ushr 32).toInt()\n\n@ExperimentalIoApi\npublic inline val Long.lowInt: Int get() = (this and 0xffffffffL).toInt()\n","@file:Suppress(\"RedundantModalityModifier\")\n\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.internal.*\nimport io.ktor.utils.io.core.internal.require\nimport io.ktor.utils.io.pool.*\nimport kotlin.Boolean\nimport kotlin.Char\nimport kotlin.CharSequence\nimport kotlin.Deprecated\nimport kotlin.DeprecationLevel\nimport kotlin.Int\nimport kotlin.PublishedApi\nimport kotlin.String\nimport kotlin.Suppress\nimport kotlin.jvm.*\n\n/**\n * A builder that provides ability to build byte packets with no knowledge of it's size.\n * Unlike Java's ByteArrayOutputStream it doesn't copy the whole content every time it's internal buffer overflows\n * but chunks buffers instead. Packet building via [build] function is O(1) operation and only does instantiate\n * a new [ByteReadPacket]. Once a byte packet has been built via [build] function call, the builder could be\n * reused again. You also can discard all written bytes via [reset] or [release]. Please note that an instance of\n * builder need to be terminated either via [build] function invocation or via [release] call otherwise it will\n * cause byte buffer leak so that may have performance impact.\n *\n * Byte packet builder is also an [Appendable] so it does append UTF-8 characters to a packet\n *\n * ```\n * buildPacket {\n * listOf(1,2,3).joinTo(this, separator = \",\")\n * }\n * ```\n */\npublic class BytePacketBuilder(private var headerSizeHint: Int = 0, pool: ObjectPool) :\n @Suppress(\"DEPRECATION_ERROR\")\n BytePacketBuilderPlatformBase(pool) {\n init {\n require(headerSizeHint >= 0) { \"shouldn't be negative: headerSizeHint = $headerSizeHint\" }\n }\n\n /**\n * Number of bytes written to the builder after the creation or the last reset.\n */\n public val size: Int\n get() = _size\n\n /**\n * If no bytes were written or the builder has been reset.\n */\n public val isEmpty: Boolean\n get() = _size == 0\n\n /**\n * If at least one byte was written after the creation or the last reset.\n */\n public val isNotEmpty: Boolean\n get() = _size > 0\n\n @PublishedApi\n internal val _pool: ObjectPool\n get() = pool\n\n /**\n * Does nothing for memory-backed output\n */\n final override fun closeDestination() {\n }\n\n /**\n * Does nothing for memory-backed output\n */\n final override fun flush(source: Memory, offset: Int, length: Int) {\n }\n\n override fun append(c: Char): BytePacketBuilder {\n return super.append(c) as BytePacketBuilder\n }\n\n override fun append(csq: CharSequence?): BytePacketBuilder {\n return super.append(csq) as BytePacketBuilder\n }\n\n override fun append(csq: CharSequence?, start: Int, end: Int): BytePacketBuilder {\n return super.append(csq, start, end) as BytePacketBuilder\n }\n\n @Suppress(\"DEPRECATION_ERROR\", \"UNUSED\")\n @Deprecated(\"Binary compatibility\", level = DeprecationLevel.HIDDEN)\n @JvmName(\"append\")\n public fun appendOld(c: Char): BytePacketBuilderBase = append(c)\n\n @Suppress(\"DEPRECATION_ERROR\", \"UNUSED\")\n @Deprecated(\"Binary compatibility\", level = DeprecationLevel.HIDDEN)\n @JvmName(\"append\")\n public fun appendOld(csq: CharSequence?): BytePacketBuilderBase = append(csq)\n\n @Suppress(\"DEPRECATION_ERROR\", \"UNUSED\")\n @Deprecated(\"Binary compatibility\", level = DeprecationLevel.HIDDEN)\n @JvmName(\"append\")\n public fun appendOld(csq: CharSequence?, start: Int, end: Int): BytePacketBuilderBase = append(csq, start, end)\n\n /**\n * Creates a temporary packet view of the packet being build without discarding any bytes from the builder.\n * This is similar to `build().copy()` except that the builder keeps already written bytes untouched.\n * A temporary view packet is passed as argument to [block] function and it shouldn't leak outside of this block\n * otherwise an unexpected behaviour may occur.\n */\n @Suppress(\"unused\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun preview(block: (tmp: ByteReadPacket) -> R): R {\n return preview(block)\n }\n\n /**\n * Builds byte packet instance and resets builder's state to be able to build another one packet if needed\n */\n public fun build(): ByteReadPacket {\n val size = size\n val head = stealAll()\n\n return when (head) {\n null -> ByteReadPacket.Empty\n else -> ByteReadPacket(head, size.toLong(), pool)\n }\n }\n\n /**\n * Discard all written bytes and prepare to build another packet.\n */\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n final override fun reset() {\n release()\n }\n\n @PublishedApi\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"unused\")\n internal fun preview(): ByteReadPacket {\n return preview()\n }\n\n override fun toString(): String {\n return \"BytePacketBuilder($size bytes written)\"\n }\n}\n","@file:Suppress(\"RedundantModalityModifier\", \"FunctionName\")\n\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.internal.*\nimport io.ktor.utils.io.pool.*\n\n/**\n * Read-only immutable byte packet. Could be consumed only once however it does support [copy] that doesn't copy every byte\n * but creates a new view instead. Once packet created it should be either completely read (consumed) or released\n * via [release].\n */\npublic class ByteReadPacket internal constructor(\n head: ChunkBuffer,\n remaining: Long,\n pool: ObjectPool\n) :\n @Suppress(\"DEPRECATION_ERROR\")\n ByteReadPacketPlatformBase(head, remaining, pool),\n Input {\n public constructor(head: ChunkBuffer, pool: ObjectPool) : this(head, head.remainingAll(), pool)\n\n @Suppress(\"DEPRECATION\", \"UNUSED\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public constructor(head: IoBuffer, pool: ObjectPool) : this(head, head.remainingAll(), pool)\n\n init {\n markNoMoreChunksAvailable()\n }\n\n /**\n * Returns a copy of the packet. The original packet and the copy could be used concurrently. Both need to be\n * either completely consumed or released via [release]\n */\n public final fun copy(): ByteReadPacket = ByteReadPacket(head.copyAll(), remaining, pool)\n\n final override fun fill(): ChunkBuffer? = null\n\n final override fun fill(destination: Memory, offset: Int, length: Int): Int {\n return 0\n }\n\n final override fun closeSource() {\n }\n\n override fun toString(): String {\n return \"ByteReadPacket($remaining bytes remaining)\"\n }\n\n public companion object {\n public val Empty: ByteReadPacket = ByteReadPacket(ChunkBuffer.Empty, 0L, ChunkBuffer.EmptyPool)\n\n @DangerousInternalIoApi\n public val ReservedSize: Int\n get() = Buffer.ReservedSize\n }\n}\n\n@Suppress(\"DEPRECATION\")\n@DangerousInternalIoApi\n@Deprecated(\n \"Will be removed in future releases.\",\n level = DeprecationLevel.ERROR,\n replaceWith = ReplaceWith(\"AbstractInput\", \"io.ktor.utils.io.core.AbstractInput\")\n)\npublic abstract class ByteReadPacketPlatformBase protected constructor(\n head: ChunkBuffer,\n remaining: Long,\n pool: ObjectPool\n) : ByteReadPacketBase(head, remaining, pool) {\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public constructor(\n head: IoBuffer,\n remaining: Long,\n pool: ObjectPool\n ) : this(head as ChunkBuffer, remaining, pool)\n}\n\npublic expect fun ByteReadPacket(\n array: ByteArray,\n offset: Int = 0,\n length: Int = array.size,\n block: (ByteArray) -> Unit\n): ByteReadPacket\n\n@Suppress(\"NOTHING_TO_INLINE\")\npublic inline fun ByteReadPacket(array: ByteArray, offset: Int = 0, length: Int = array.size): ByteReadPacket {\n return ByteReadPacket(array, offset, length) {}\n}\n","package io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.internal.*\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readShort(): Short {\n return readPrimitive(2, { memory, index -> memory.loadShortAt(index) }, { readShortFallback() })\n}\n\nprivate fun Input.readShortFallback(): Short {\n return readPrimitiveFallback(2) { it.readShort() }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readInt(): Int {\n return readPrimitive(4, { memory, index -> memory.loadIntAt(index) }, { readIntFallback() })\n}\n\nprivate fun Input.readIntFallback(): Int {\n return readPrimitiveFallback(4) { it.readInt() }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readLong(): Long {\n return readPrimitive(8, { memory, index -> memory.loadLongAt(index) }, { readLongFallback() })\n}\n\nprivate fun Input.readLongFallback(): Long {\n return readPrimitiveFallback(8) { it.readLong() }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readFloat(): Float {\n return readPrimitive(4, { memory, index -> memory.loadFloatAt(index) }, { readFloatFallback() })\n}\n\npublic fun Input.readFloatFallback(): Float {\n return readPrimitiveFallback(4) { it.readFloat() }\n}\n\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic fun Input.readDouble(): Double {\n return readPrimitive(8, { memory, index -> memory.loadDoubleAt(index) }, { readDoubleFallback() })\n}\n\npublic fun Input.readDoubleFallback(): Double {\n return readPrimitiveFallback(8) { it.readDouble() }\n}\n\nprivate inline fun Input.readPrimitive(size: Int, main: (Memory, Int) -> R, fallback: () -> R): R {\n if (this is AbstractInput && headRemaining > size) {\n val index = headPosition\n headPosition = index + size\n return main(headMemory, index)\n }\n\n return fallback()\n}\n\nprivate inline fun Input.readPrimitiveFallback(size: Int, read: (Buffer) -> R): R {\n val head = prepareReadFirstHead(size) ?: prematureEndOfStream(size)\n val value = read(head)\n completeReadHead(head)\n return value\n}\n","@file:Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\n\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\n\npublic fun Output.writeShort(value: Short) {\n if (!writePrimitiveTemplate(2) { memory, index -> memory.storeShortAt(index, value) }) {\n writeShortFallback(value)\n }\n}\n\nprivate fun Output.writeShortFallback(value: Short) {\n if (!writePrimitiveFallbackTemplate(2) { it.writeShort(value) }) {\n writeByte(value.highByte)\n writeByte(value.lowByte)\n }\n}\n\npublic fun Output.writeInt(value: Int) {\n if (!writePrimitiveTemplate(4) { memory, index -> memory.storeIntAt(index, value) }) {\n writeIntFallback(value)\n }\n}\n\nprivate fun Output.writeIntFallback(value: Int) {\n if (!writePrimitiveFallbackTemplate(4) { it.writeInt(value) }) {\n writeIntByteByByte(value)\n }\n}\n\nprivate fun Output.writeIntByteByByte(value: Int) {\n value.highShort.let {\n writeByte(it.highByte)\n writeByte(it.lowByte)\n }\n value.lowShort.let {\n writeByte(it.highByte)\n writeByte(it.lowByte)\n }\n}\n\npublic fun Output.writeLong(value: Long) {\n if (!writePrimitiveTemplate(8) { memory, index -> memory.storeLongAt(index, value) }) {\n writeLongFallback(value)\n }\n}\n\nprivate fun Output.writeLongFallback(value: Long) {\n if (!writePrimitiveFallbackTemplate(8) { it.writeLong(value) }) {\n writeIntByteByByte(value.highInt)\n writeIntByteByByte(value.lowInt)\n }\n}\n\npublic fun Output.writeFloat(value: Float) {\n if (!writePrimitiveTemplate(4) { memory, index -> memory.storeFloatAt(index, value) }) {\n writeIntFallback(value.toRawBits())\n }\n}\n\npublic fun Output.writeDouble(value: Double) {\n if (!writePrimitiveTemplate(8) { memory, index -> memory.storeDoubleAt(index, value) }) {\n writeLongFallback(value.toRawBits())\n }\n}\n\nprivate inline fun Output.writePrimitiveTemplate(\n componentSize: Int,\n block: (Memory, index: Int) -> Unit\n): Boolean {\n if (this is AbstractOutput) {\n val index = tailPosition\n if (tailEndExclusive - index > componentSize) {\n tailPosition = index + componentSize\n block(tailMemory, index)\n return true\n }\n }\n\n return false\n}\n\nprivate inline fun Output.writePrimitiveFallbackTemplate(\n componentSize: Int,\n writeOperation: (Buffer) -> Unit\n): Boolean {\n if (this is AbstractOutput) {\n val tail = prepareWriteHead(componentSize)\n writeOperation(tail)\n afterHeadWrite()\n return true\n }\n\n return false\n}\n","package io.ktor.utils.io.core\n\nimport io.ktor.utils.io.core.internal.*\nimport kotlin.contracts.*\n\n/**\n * Creates a temporary packet view of the packet being build without discarding any bytes from the builder.\n * This is similar to `build().copy()` except that the builder keeps already written bytes untouched.\n * A temporary view packet is passed as argument to [block] function and it shouldn't leak outside of this block\n * otherwise an unexpected behaviour may occur.\n */\n@Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\npublic inline fun BytePacketBuilder.preview(block: (tmp: ByteReadPacket) -> R): R {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n val packet = preview()\n return try {\n block(packet)\n } finally {\n packet.release()\n }\n}\n\n@PublishedApi\ninternal fun BytePacketBuilder.preview(): ByteReadPacket {\n val head = head\n return when {\n head === ChunkBuffer.Empty -> ByteReadPacket.Empty\n else -> ByteReadPacket(head.copyAll(), _pool)\n }\n}\n","package io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\n\n/**\n * Discards bytes until [delimiter] occurred\n * @return number of bytes discarded\n */\npublic fun Input.discardUntilDelimiter(delimiter: Byte): Long {\n var discardedTotal = 0L\n\n takeWhile { chunk ->\n val discarded = chunk.discardUntilDelimiterImpl(delimiter)\n discardedTotal += discarded\n discarded > 0 && !chunk.canRead()\n }\n\n return discardedTotal\n}\n\n/**\n * Discards bytes until of of the specified delimiters [delimiter1] or [delimiter2] occurred\n * @return number of bytes discarded\n */\npublic fun Input.discardUntilDelimiters(delimiter1: Byte, delimiter2: Byte): Long {\n var discardedTotal = 0L\n\n takeWhile { chunk ->\n val discarded = chunk.discardUntilDelimitersImpl(delimiter1, delimiter2)\n discardedTotal += discarded\n discarded > 0 && !chunk.canRead()\n }\n\n return discardedTotal\n}\n\n/**\n * Copies to [dst] array at [offset] at most [length] bytes or until the specified [delimiter] occurred.\n * @return number of bytes copied\n */\npublic fun Input.readUntilDelimiter(delimiter: Byte, dst: ByteArray, offset: Int = 0, length: Int = dst.size): Int {\n var currentOffset = offset\n var dstRemaining = length\n\n takeWhile { chunk ->\n val copied = chunk.readUntilDelimiterImpl(delimiter, dst, currentOffset, dstRemaining)\n currentOffset += copied\n dstRemaining -= copied\n dstRemaining > 0 && !chunk.canRead()\n }\n\n return currentOffset - offset\n}\n\n/**\n * Copies to [dst] array at [offset] at most [length] bytes or until one of the specified delimiters\n * [delimiter1] or [delimiter2] occurred.\n * @return number of bytes copied\n */\npublic fun Input.readUntilDelimiters(\n delimiter1: Byte,\n delimiter2: Byte,\n dst: ByteArray,\n offset: Int = 0,\n length: Int = dst.size\n): Int {\n if (delimiter1 == delimiter2) return readUntilDelimiter(delimiter1, dst, offset, length)\n\n var currentOffset = offset\n var dstRemaining = length\n\n takeWhile { chunk ->\n val copied = chunk.readUntilDelimitersImpl(delimiter1, delimiter2, dst, currentOffset, dstRemaining)\n currentOffset += copied\n dstRemaining -= copied\n !chunk.canRead() && dstRemaining > 0\n }\n\n return currentOffset - offset\n}\n\n/**\n * Copies to [dst] output until the specified [delimiter] occurred.\n * @return number of bytes copied\n */\npublic fun Input.readUntilDelimiter(delimiter: Byte, dst: Output): Long {\n var copiedTotal = 0L\n takeWhile { chunk ->\n val copied = chunk.readUntilDelimiterImpl(delimiter, dst)\n copiedTotal += copied\n !chunk.canRead()\n }\n\n return copiedTotal\n}\n\n/**\n * Copies to [dst] output until one of the specified delimiters\n * [delimiter1] or [delimiter2] occurred.\n * @return number of bytes copied\n */\npublic fun Input.readUntilDelimiters(delimiter1: Byte, delimiter2: Byte, dst: Output): Long {\n var copiedTotal = 0L\n\n takeWhile { chunk ->\n val copied = chunk.readUntilDelimitersImpl(delimiter1, delimiter2, dst)\n copiedTotal += copied\n !chunk.canRead()\n }\n\n return copiedTotal\n}\n\ninternal expect fun Buffer.discardUntilDelimiterImpl(delimiter: Byte): Int\n\ninternal fun discardUntilDelimiterImplMemory(buffer: Buffer, delimiter: Byte): Int {\n val start = buffer.readPosition\n var i = start\n val limit = buffer.writePosition\n val memory = buffer.memory\n\n while (i < limit) {\n if (memory[i] == delimiter) break\n i++\n }\n\n buffer.discardUntilIndex(i)\n return i - start\n}\n\ninternal expect fun Buffer.discardUntilDelimitersImpl(delimiter1: Byte, delimiter2: Byte): Int\n\ninternal fun discardUntilDelimitersImplMemory(buffer: Buffer, delimiter1: Byte, delimiter2: Byte): Int {\n val start = buffer.readPosition\n var i = start\n val limit = buffer.writePosition\n val memory = buffer.memory\n\n while (i < limit) {\n val v = memory[i]\n if (v == delimiter1 || v == delimiter2) break\n i++\n }\n\n buffer.discardUntilIndex(i)\n return i - start\n}\n\ninternal expect fun Buffer.readUntilDelimiterImpl(\n delimiter: Byte,\n dst: ByteArray,\n offset: Int,\n length: Int\n): Int\n\ninternal expect fun Buffer.readUntilDelimitersImpl(\n delimiter1: Byte,\n delimiter2: Byte,\n dst: ByteArray,\n offset: Int,\n length: Int\n): Int\n\ninternal expect fun Buffer.readUntilDelimiterImpl(\n delimiter: Byte,\n dst: Output\n): Int\n\ninternal expect fun Buffer.readUntilDelimitersImpl(\n delimiter1: Byte,\n delimiter2: Byte,\n dst: Output\n): Int\n\ninternal inline fun Buffer.copyUntil(predicate: (Byte) -> Boolean, dst: ByteArray, offset: Int, length: Int): Int {\n val readPosition = readPosition\n var end = minOf(writePosition, readPosition + length)\n val memory = memory\n for (index in readPosition until end) {\n if (predicate(memory.loadAt(index))) {\n end = index\n break\n }\n }\n\n val copySize = end - readPosition\n memory.loadByteArray(readPosition, dst, offset, copySize)\n return copySize\n}\n\ninternal inline fun Buffer.copyUntil(predicate: (Byte) -> Boolean, dst: Output): Int {\n var index = readPosition\n val end = writePosition\n val memory = memory\n do {\n if (index == end || predicate(memory.loadAt(index))) {\n break\n }\n index++\n } while (true)\n\n val size = index - readPosition\n dst.writeFully(this, size)\n return size\n}\n","package io.ktor.utils.io.core\n\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.internal.*\n\n@Suppress(\"NOTHING_TO_INLINE\")\npublic inline fun String.toByteArray(charset: Charset = Charsets.UTF_8): ByteArray =\n charset.newEncoder().encodeToByteArray(this, 0, length)\n\n/**\n * Create an instance of [String] from the specified [bytes] range starting at [offset] and bytes [length]\n * interpreting characters in the specified [charset].\n */\n@Suppress(\"FunctionName\")\npublic expect fun String(\n bytes: ByteArray,\n offset: Int = 0,\n length: Int = bytes.size,\n charset: Charset = Charsets.UTF_8\n): String\n\n/**\n * Read a string line considering optionally specified [estimate] but up to optional [limit] characters length\n * (does fail once limit exceeded) or return `null` if the packet is empty\n */\npublic fun ByteReadPacket.readUTF8Line(estimate: Int = 16, limit: Int = Int.MAX_VALUE): String? {\n if (isEmpty) return null\n val sb = StringBuilder(estimate)\n return if (readUTF8LineTo(sb, limit)) sb.toString() else null\n}\n\n/**\n * Read a string line considering optionally specified [estimate] but up to optional [limit] characters length\n * (does fail once limit exceeded) or return `null` if the packet is empty\n */\npublic fun Input.readUTF8Line(estimate: Int = 16, limit: Int = Int.MAX_VALUE): String? {\n val sb = StringBuilder(estimate)\n return if (readUTF8LineTo(sb, limit)) sb.toString() else null\n}\n\n/**\n * Read UTF-8 line and append all line characters to [out] except line endings. Does support CR, LF and CR+LF\n * @return `true` if some characters were appended or line ending reached (empty line) or `false` if packet\n * if empty\n */\npublic fun Input.readUTF8LineTo(out: Appendable, limit: Int): Boolean {\n var decoded = 0\n var size = 1\n var cr = false\n var end = false\n\n takeWhileSize { buffer ->\n var skip = 0\n size = buffer.decodeUTF8 { ch ->\n when (ch) {\n '\\r' -> {\n if (cr) {\n end = true\n return@decodeUTF8 false\n }\n cr = true\n true\n }\n '\\n' -> {\n end = true\n skip = 1\n false\n }\n else -> {\n if (cr) {\n end = true\n return@decodeUTF8 false\n }\n\n if (decoded == limit) bufferLimitExceeded(limit)\n decoded++\n out.append(ch)\n true\n }\n }\n }\n\n if (skip > 0) {\n buffer.discardExact(skip)\n }\n\n if (end) 0 else size.coerceAtLeast(1)\n }\n\n if (size > 1) prematureEndOfStream(size)\n\n return decoded > 0 || !endOfInput\n}\n\n/**\n * Reads UTF-8 characters until one of the specified [delimiters] found, [limit] exceeded or end of stream encountered\n *\n * @throws BufferLimitExceededException\n * @returns a string of characters read before delimiter\n */\npublic fun Input.readUTF8UntilDelimiter(delimiters: String, limit: Int = Int.MAX_VALUE): String {\n return buildString {\n readUTF8UntilDelimiterTo(this, delimiters, limit)\n }\n}\n\n/**\n * Reads UTF-8 characters to [out] buffer until one of the specified [delimiters] found, [limit] exceeded\n * or end of stream encountered\n *\n * @throws BufferLimitExceededException\n * @returns number of characters copied (possibly zero)\n */\npublic fun Input.readUTF8UntilDelimiterTo(out: Appendable, delimiters: String, limit: Int = Int.MAX_VALUE): Int {\n var decoded = 0\n var delimiter = false\n\n takeWhile { buffer ->\n buffer.decodeASCII { ch ->\n if (ch in delimiters) {\n delimiter = true\n false\n } else {\n if (decoded == limit) bufferLimitExceeded(limit)\n decoded++\n out.append(ch)\n true\n }\n }\n }\n\n if (!delimiter) {\n decoded = readUTF8UntilDelimiterToSlowUtf8(out, delimiters, limit, decoded)\n }\n\n return decoded\n}\n\n/**\n * Reads UTF-8 characters to [out] buffer until one of the specified [delimiters] found, [limit] exceeded\n * or end of stream encountered\n *\n * @throws BufferLimitExceededException\n * @returns number of characters copied (possibly zero)\n */\npublic fun Input.readUTF8UntilDelimiterTo(out: Output, delimiters: String, limit: Int = Int.MAX_VALUE): Int {\n val delimitersCount = delimiters.length\n if (delimitersCount == 1 && delimiters[0].isAsciiChar()) {\n return readUntilDelimiter(delimiters[0].toByte(), out).toInt()\n } else if (delimitersCount == 2 && delimiters[0].isAsciiChar() && delimiters[1].isAsciiChar()) {\n return readUntilDelimiters(delimiters[0].toByte(), delimiters[1].toByte(), out).toInt()\n }\n\n return readUTFUntilDelimiterToSlowAscii(delimiters, limit, out)\n}\n\n@Suppress(\"unused\", \"DEPRECATION_ERROR\")\n@Deprecated(\"Use Output version instead\", level = DeprecationLevel.HIDDEN)\npublic fun Input.readUTF8UntilDelimiterTo(\n out: BytePacketBuilderBase,\n delimiters: String,\n limit: Int = Int.MAX_VALUE\n): Int {\n return readUTF8UntilDelimiterTo(out as Output, delimiters, limit)\n}\n\n/**\n * Read exactly [n] bytes (consumes all remaining if [n] is not specified but up to [Int.MAX_VALUE] bytes).\n * Does fail if not enough bytes remaining.\n */\npublic fun ByteReadPacket.readBytes(\n n: Int = remaining.coerceAtMostMaxIntOrFail(\"Unable to convert to a ByteArray: packet is too big\")\n): ByteArray = when {\n n != 0 -> ByteArray(n).also { readFully(it, 0, n) }\n else -> EmptyByteArray\n}\n\n/**\n * Reads exactly [n] bytes from the input or fails if not enough bytes available.\n */\npublic fun Input.readBytes(n: Int): ByteArray = readBytesOf(n, n)\n\n/**\n * Reads all remaining bytes from the input\n */\npublic fun Input.readBytes(): ByteArray = readBytesOf()\n\n/**\n * Reads at least [min] but no more than [max] bytes from the input to a new byte array\n * @throws EOFException if not enough bytes available to get [min] bytes\n */\npublic fun Input.readBytesOf(min: Int = 0, max: Int = Int.MAX_VALUE): ByteArray = if (min == max && min == 0) {\n EmptyByteArray\n} else if (min == max) {\n ByteArray(min).also { readFully(it, 0, min) }\n} else {\n var array = ByteArray(max.toLong().coerceAtMost(sizeEstimate()).coerceAtLeast(min.toLong()).toInt())\n var size = 0\n\n while (size < max) {\n val partSize = minOf(max, array.size) - size\n val rc = readAvailable(array, size, partSize)\n if (rc <= 0) break\n size += rc\n if (array.size == size) {\n array = array.copyOf(size * 2)\n }\n }\n\n if (size < min) {\n throw EOFException(\"Not enough bytes available to read $min bytes: ${min - size} more required\")\n }\n\n if (size == array.size) array else array.copyOf(size)\n}\n\n/**\n * Reads at most [max] characters decoding bytes with specified [decoder]. Extra character bytes will remain unconsumed\n * @return number of characters copied to [out]\n */\n@Deprecated(\n \"Use CharsetDecoder.decode instead\",\n ReplaceWith(\"decoder.decode(this, out, max)\", \"io.ktor.utils.io.charsets.decode\"),\n level = DeprecationLevel.ERROR\n)\npublic fun Input.readText(out: Appendable, decoder: CharsetDecoder, max: Int = Int.MAX_VALUE): Int {\n return decoder.decode(this, out, max)\n}\n\n/**\n * Reads at most [max] characters decoding bytes with specified [charset]. Extra character bytes will remain unconsumed\n * @return number of characters copied to [out]\n */\npublic fun Input.readText(out: Appendable, charset: Charset = Charsets.UTF_8, max: Int = Int.MAX_VALUE): Int {\n return charset.newDecoder().decode(this, out, max)\n}\n\n/**\n * Reads at most [max] characters decoding bytes with specified [decoder]. Extra character bytes will remain unconsumed\n * @return a decoded string\n */\n@Deprecated(\n \"Use CharsetDecoder.decode instead\",\n ReplaceWith(\"decoder.decode(this, max)\", \"io.ktor.utils.io.charsets.decode\")\n)\npublic fun Input.readText(decoder: CharsetDecoder, max: Int = Int.MAX_VALUE): String {\n return decoder.decode(this, max)\n}\n\n/**\n * Reads at most [max] characters decoding bytes with specified [charset]. Extra character bytes will remain unconsumed\n * @return a decoded string\n */\npublic fun Input.readText(charset: Charset = Charsets.UTF_8, max: Int = Int.MAX_VALUE): String {\n return charset.newDecoder().decode(this, max)\n}\n\n/**\n * Reads at most [max] characters decoding bytes with specified [charset]. Extra character bytes will remain unconsumed\n * @return a decoded string\n */\npublic fun Buffer.readText(charset: Charset = Charsets.UTF_8, max: Int = Int.MAX_VALUE): String = buildString {\n charset.newDecoder().decodeBuffer(this@readText, this, true, max)\n}\n\n/**\n * Read exactly [n] characters interpreting bytes in the specified [charset].\n */\n@Deprecated(\n \"Use readTextExactCharacters instead.\",\n ReplaceWith(\"readTextExactCharacters(n, charset)\")\n)\npublic fun Input.readTextExact(charset: Charset = Charsets.UTF_8, n: Int): String {\n return readTextExactCharacters(n, charset)\n}\n\n/**\n * Read exactly [charactersCount] characters interpreting bytes in the specified [charset].\n */\npublic fun Input.readTextExactCharacters(charactersCount: Int, charset: Charset = Charsets.UTF_8): String {\n val s = readText(charset, charactersCount)\n if (s.length < charactersCount) {\n prematureEndOfStreamToReadChars(charactersCount)\n }\n return s\n}\n\n/**\n * Read exactly the specified number of [bytes]\n * interpreting bytes in the specified [charset] (optional, UTF-8 by default).\n */\n@Deprecated(\"Parameters order is changed.\", ReplaceWith(\"readTextExactBytes(bytes, charset)\"))\npublic fun Input.readTextExactBytes(charset: Charset = Charsets.UTF_8, bytes: Int): String {\n return readTextExactBytes(bytes, charset)\n}\n\n/**\n * Read exactly [bytesCount] interpreting bytes in the specified [charset] (optional, UTF-8 by default).\n */\npublic fun Input.readTextExactBytes(bytesCount: Int, charset: Charset = Charsets.UTF_8): String {\n return charset.newDecoder().decodeExactBytes(this, inputLength = bytesCount)\n}\n\n/**\n * Writes [text] characters in range \\[[fromIndex] .. [toIndex]) with the specified [encoder]\n */\n@Deprecated(\n \"Use the implementation with Charset instead\",\n ReplaceWith(\n \"writeText(text, fromIndex, toIndex, encoder.charset)\",\n \"io.ktor.utils.io.charsets.charset\"\n ),\n level = DeprecationLevel.ERROR\n)\npublic fun Output.writeText(\n text: CharSequence,\n fromIndex: Int = 0,\n toIndex: Int = text.length,\n encoder: CharsetEncoder\n) {\n encoder.encodeToImpl(this, text, fromIndex, toIndex)\n}\n\n/**\n * Writes [text] characters in range \\[[fromIndex] .. [toIndex]) with the specified [charset]\n */\npublic fun Output.writeText(\n text: CharSequence,\n fromIndex: Int = 0,\n toIndex: Int = text.length,\n charset: Charset = Charsets.UTF_8\n) {\n if (charset === Charsets.UTF_8) {\n return writeTextUtf8(text, fromIndex, toIndex)\n }\n\n charset.newEncoder().encodeToImpl(this, text, fromIndex, toIndex)\n}\n\n/**\n * Writes [text] characters in range \\[[fromIndex] .. [toIndex]) with the specified [charset]\n */\npublic fun Output.writeText(\n text: CharArray,\n fromIndex: Int = 0,\n toIndex: Int = text.size,\n charset: Charset = Charsets.UTF_8\n) {\n if (charset === Charsets.UTF_8) {\n return writeTextUtf8(CharArraySequence(text, 0, text.size), fromIndex, toIndex)\n }\n\n charset.newEncoder().encode(text, fromIndex, toIndex, this)\n}\n\nprivate fun Output.writeTextUtf8(text: CharSequence, fromIndex: Int, toIndex: Int) {\n var index = fromIndex\n writeWhileSize(1) { buffer ->\n val memory = buffer.memory\n val dstOffset = buffer.writePosition\n val dstLimit = buffer.limit\n\n val (characters, bytes) = memory.encodeUTF8(text, index, toIndex, dstOffset, dstLimit)\n\n index += characters.toInt()\n buffer.commitWritten(bytes.toInt())\n\n when {\n characters.toInt() == 0 && index < toIndex -> 8\n index < toIndex -> 1\n else -> 0\n }\n }\n}\n\ninternal expect fun String.getCharsInternal(dst: CharArray, dstOffset: Int)\n\n@Suppress(\"NOTHING_TO_INLINE\")\nprivate inline fun Char.isAsciiChar() = toInt() <= 0x7f\n\nprivate fun Input.readUTFUntilDelimiterToSlowAscii(delimiters: String, limit: Int, out: Output): Int {\n var decoded = 0\n var delimiter = false\n\n takeWhile { buffer ->\n val before = buffer.readRemaining\n\n val rc = buffer.decodeASCII { ch ->\n if (ch in delimiters) {\n delimiter = true\n false\n } else {\n if (decoded == limit) bufferLimitExceeded(limit)\n decoded++\n true\n }\n }\n\n val delta = before - buffer.readRemaining\n if (delta > 0) {\n buffer.rewind(delta)\n out.writeFully(buffer, delta)\n }\n\n rc\n }\n\n if (!delimiter && !endOfInput) {\n decoded = readUTF8UntilDelimiterToSlowUtf8(out, delimiters, limit, decoded)\n }\n\n return decoded\n}\n\nprivate fun Input.readUTF8UntilDelimiterToSlowUtf8(\n out: Output,\n delimiters: String,\n limit: Int,\n decoded0: Int\n): Int {\n var decoded = decoded0\n var size = 1\n\n takeWhileSize { buffer ->\n val before = buffer.readRemaining\n\n size = buffer.decodeUTF8 { ch ->\n if (ch in delimiters) {\n false\n } else {\n if (decoded == limit) {\n bufferLimitExceeded(limit)\n }\n decoded++\n true\n }\n }\n\n val delta = before - buffer.readRemaining\n if (delta > 0) {\n buffer.rewind(delta)\n out.writeFully(buffer, delta)\n }\n\n size = if (size == -1) 0 else size.coerceAtLeast(1)\n size\n }\n\n if (size > 1) prematureEndOfStream(size)\n\n return decoded\n}\n\nprivate fun Input.readUTF8UntilDelimiterToSlowUtf8(\n out: Appendable,\n delimiters: String,\n limit: Int,\n decoded0: Int\n): Int {\n var decoded = decoded0\n var size = 1\n\n takeWhileSize { buffer ->\n size = buffer.decodeUTF8 { ch ->\n if (ch in delimiters) {\n false\n } else {\n if (decoded == limit) {\n bufferLimitExceeded(limit)\n }\n decoded++\n out.append(ch)\n true\n }\n }\n\n size = if (size == -1) 0 else size.coerceAtLeast(1)\n size\n }\n\n if (size > 1) prematureEndOfStream(size)\n\n return decoded\n}\n\nprivate fun bufferLimitExceeded(limit: Int): Nothing {\n throw BufferLimitExceededException(\"Too many characters before delimiter: limit $limit exceeded\")\n}\n\n@PublishedApi\ninternal fun prematureEndOfStream(size: Int): Nothing =\n throw EOFException(\"Premature end of stream: expected $size bytes\")\n\n@PublishedApi\ninternal fun prematureEndOfStream(size: Long): Nothing =\n throw EOFException(\"Premature end of stream: expected $size bytes\")\n\nprivate fun prematureEndOfStreamToReadChars(charactersCount: Int): Nothing =\n throw EOFException(\"Not enough input bytes to read $charactersCount characters.\")\n","package io.ktor.utils.io.core.internal\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.bits.DefaultAllocator\nimport io.ktor.utils.io.concurrent.*\nimport io.ktor.utils.io.core.*\nimport io.ktor.utils.io.pool.*\nimport kotlinx.atomicfu.*\n\n@DangerousInternalIoApi\npublic open class ChunkBuffer internal constructor(memory: Memory, origin: ChunkBuffer?) : Buffer(memory) {\n init {\n require(origin !== this) { \"A chunk couldn't be a view of itself.\" }\n }\n\n private val nextRef: AtomicRef = atomic(null)\n private val refCount = atomic(1)\n\n /**\n * Reference to an origin buffer view this was copied from\n */\n public var origin: ChunkBuffer? by shared(origin)\n private set\n\n /**\n * Reference to next buffer view. Useful to chain multiple views.\n * @see appendNext\n * @see cleanNext\n */\n public var next: ChunkBuffer? get() = nextRef.value\n set(newValue) {\n if (newValue == null) {\n cleanNext()\n } else {\n appendNext(newValue)\n }\n }\n\n public val referenceCount: Int get() = refCount.value\n\n private fun appendNext(chunk: ChunkBuffer) {\n if (!nextRef.compareAndSet(null, chunk)) {\n throw IllegalStateException(\"This chunk has already a next chunk.\")\n }\n }\n\n public fun cleanNext(): ChunkBuffer? {\n return nextRef.getAndSet(null)\n }\n\n override fun duplicate(): ChunkBuffer = (origin ?: this).let { newOrigin ->\n newOrigin.acquire()\n ChunkBuffer(memory, newOrigin).also { copy ->\n duplicateTo(copy)\n }\n }\n\n public open fun release(pool: ObjectPool) {\n if (release()) {\n val origin = origin\n if (origin != null) {\n unlink()\n origin.release(pool)\n } else {\n pool.recycle(this)\n }\n }\n }\n\n internal fun unlink() {\n if (!refCount.compareAndSet(0, -1)) {\n throw IllegalStateException(\"Unable to unlink: buffer is in use.\")\n }\n\n cleanNext()\n origin = null\n }\n\n /**\n * Increase ref-count. May fail if already released.\n */\n internal fun acquire() {\n refCount.update { old ->\n if (old <= 0) throw IllegalStateException(\"Unable to acquire chunk: it is already released.\")\n old + 1\n }\n }\n\n /**\n * Invoked by a pool before return the instance to a user.\n */\n internal fun unpark() {\n refCount.update { old ->\n if (old < 0) {\n throw IllegalStateException(\"This instance is already disposed and couldn't be borrowed.\")\n }\n if (old > 0) {\n throw IllegalStateException(\"This instance is already in use but somehow appeared in the pool.\")\n }\n\n 1\n }\n }\n\n /**\n * Release ref-count.\n * @return `true` if the last usage was released\n */\n internal fun release(): Boolean {\n return refCount.updateAndGet { old ->\n if (old <= 0) throw IllegalStateException(\"Unable to release: it is already released.\")\n old - 1\n } == 0\n }\n\n final override fun reset() {\n require(origin == null) { \"Unable to reset buffer with origin\" }\n\n super.reset()\n @Suppress(\"DEPRECATION\")\n attachment = null\n nextRef.value = null\n }\n\n public companion object {\n public val Pool: ObjectPool = object : ObjectPool {\n override val capacity: Int\n get() = DefaultChunkedBufferPool.capacity\n\n override fun borrow(): ChunkBuffer {\n return DefaultChunkedBufferPool.borrow()\n }\n\n @Suppress(\"DEPRECATION\")\n override fun recycle(instance: ChunkBuffer) {\n if (instance !is IoBuffer) {\n throw IllegalArgumentException(\"Only IoBuffer instances can be recycled.\")\n }\n\n DefaultChunkedBufferPool.recycle(instance)\n }\n\n override fun dispose() {\n DefaultChunkedBufferPool.dispose()\n }\n }\n\n @Suppress(\"DEPRECATION\")\n public val Empty: ChunkBuffer get() = IoBuffer.Empty\n\n /**\n * A pool that always returns [ChunkBuffer.Empty]\n */\n public val EmptyPool: ObjectPool = object : ObjectPool {\n override val capacity: Int get() = 1\n\n override fun borrow() = Empty\n\n override fun recycle(instance: ChunkBuffer) {\n require(instance === ChunkBuffer.Empty) { \"Only ChunkBuffer.Empty instance could be recycled.\" }\n }\n\n override fun dispose() {\n }\n }\n\n @Suppress(\"DEPRECATION\")\n internal val NoPool: ObjectPool = object : NoPoolImpl() {\n override fun borrow(): ChunkBuffer {\n return IoBuffer(DefaultAllocator.alloc(DEFAULT_BUFFER_SIZE), null)\n }\n\n override fun recycle(instance: ChunkBuffer) {\n if (instance !is IoBuffer) {\n throw IllegalArgumentException(\"Only IoBuffer instances can be recycled.\")\n }\n\n DefaultAllocator.free(instance.memory)\n }\n }\n\n internal val NoPoolManuallyManaged: ObjectPool = object : NoPoolImpl() {\n override fun borrow(): ChunkBuffer {\n throw UnsupportedOperationException(\"This pool doesn't support borrow\")\n }\n\n override fun recycle(instance: ChunkBuffer) {\n // do nothing: manually managed objects should be disposed manually\n }\n }\n }\n}\n\n/**\n * @return `true` if and only if the are no buffer views that share the same actual buffer. This actually does\n * refcount and only work guaranteed if other views created/not created via [Buffer.duplicate] function.\n * One can instantiate multiple buffers with the same buffer and this function will return `true` in spite of\n * the fact that the buffer is actually shared.\n */\ninternal fun ChunkBuffer.isExclusivelyOwned(): Boolean = referenceCount == 1\n","@file:Suppress(\"KDocMissingDocumentation\")\n\npackage io.ktor.utils.io.core.internal\n\nimport io.ktor.utils.io.core.*\nimport kotlin.jvm.*\nimport kotlin.native.concurrent.*\n\n/**\n * API marked with this annotation is internal and extremely fragile and not intended to be used by library users.\n * Such API could be changed without notice including rename, removal and behaviour change.\n * Also using API marked with this annotation could cause data loss or any other damage.\n */\n@Suppress(\"DEPRECATION\")\n@RequiresOptIn(level = RequiresOptIn.Level.ERROR)\n@Experimental(level = Experimental.Level.ERROR)\npublic annotation class DangerousInternalIoApi\n\n@DangerousInternalIoApi\npublic fun ByteReadPacket.`$unsafeAppend$`(builder: BytePacketBuilder) {\n val builderHead = builder.stealAll() ?: return\n val builderSize = builder.size\n\n if (builderSize <= PACKET_MAX_COPY_SIZE && builderHead.next == null && tryWriteAppend(builderHead)) {\n builder.afterBytesStolen()\n return\n }\n\n append(builderHead)\n}\n\ninternal fun ByteReadPacket.unsafeAppend(builder: BytePacketBuilder): Int {\n val builderSize = builder.size\n val builderHead = builder.stealAll() ?: return 0\n\n if (builderSize <= PACKET_MAX_COPY_SIZE && builderHead.next == null && tryWriteAppend(builderHead)) {\n builder.afterBytesStolen()\n return builderSize\n }\n\n append(builderHead)\n return builderSize\n}\n\n@Suppress(\"DEPRECATION\", \"UNUSED\")\n@JvmName(\"prepareReadFirstHead\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\npublic fun Input.prepareReadFirstHeadOld(minSize: Int): IoBuffer? {\n return prepareReadFirstHead(minSize) as IoBuffer?\n}\n\n@DangerousInternalIoApi\npublic fun Input.prepareReadFirstHead(minSize: Int): ChunkBuffer? {\n if (this is AbstractInput) {\n return prepareReadHead(minSize)\n }\n if (this is ChunkBuffer) {\n return if (canRead()) this else null\n }\n\n return prepareReadHeadFallback(minSize)\n}\n\nprivate fun Input.prepareReadHeadFallback(minSize: Int): ChunkBuffer? {\n if (endOfInput) return null\n\n val buffer = ChunkBuffer.Pool.borrow()\n val copied = peekTo(\n buffer.memory,\n buffer.writePosition.toLong(),\n 0L,\n minSize.toLong(),\n buffer.writeRemaining.toLong()\n ).toInt()\n buffer.commitWritten(copied)\n\n if (copied < minSize) {\n prematureEndOfStream(minSize)\n }\n\n return buffer\n}\n\n@Suppress(\"UNUSED\", \"DEPRECATION\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\npublic fun Input.completeReadHead(current: IoBuffer) {\n completeReadHead(current)\n}\n\n@DangerousInternalIoApi\npublic fun Input.completeReadHead(current: ChunkBuffer) {\n if (current === this) {\n return\n }\n if (this is AbstractInput) {\n if (!current.canRead()) {\n ensureNext(current)\n } else if (current.endGap < Buffer.ReservedSize) {\n fixGapAfterRead(current)\n } else {\n headPosition = current.readPosition\n }\n return\n }\n\n completeReadHeadFallback(current)\n}\n\nprivate fun Input.completeReadHeadFallback(current: ChunkBuffer) {\n val discardAmount = current.capacity - current.writeRemaining - current.readRemaining\n discardExact(discardAmount)\n current.release(ChunkBuffer.Pool)\n}\n\n@Suppress(\"DEPRECATION\", \"UNUSED\")\n@JvmName(\"prepareReadNextHead\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\npublic fun Input.prepareReadNextHeadOld(current: IoBuffer): IoBuffer? {\n return prepareReadNextHead(current) as IoBuffer?\n}\n\n@DangerousInternalIoApi\npublic fun Input.prepareReadNextHead(current: ChunkBuffer): ChunkBuffer? {\n if (current === this) {\n return if (canRead()) this else null\n }\n if (this is AbstractInput) {\n return ensureNextHead(current)\n }\n\n return prepareNextReadHeadFallback(current)\n}\n\nprivate fun Input.prepareNextReadHeadFallback(current: ChunkBuffer): ChunkBuffer? {\n val discardAmount = current.capacity - current.writeRemaining - current.readRemaining\n discardExact(discardAmount)\n current.resetForWrite()\n\n if (endOfInput || peekTo(current) <= 0) {\n current.release(ChunkBuffer.Pool)\n return null\n }\n\n return current\n}\n\n@Suppress(\"DEPRECATION\", \"UNUSED\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\npublic fun Output.prepareWriteHead(capacity: Int, current: IoBuffer?): IoBuffer {\n return prepareWriteHead(capacity, current) as IoBuffer\n}\n\n@DangerousInternalIoApi\npublic fun Output.prepareWriteHead(capacity: Int, current: ChunkBuffer?): ChunkBuffer {\n if (this is AbstractOutput) {\n if (current != null) {\n afterHeadWrite()\n }\n return prepareWriteHead(capacity)\n }\n\n return prepareWriteHeadFallback(current)\n}\n\nprivate fun Output.prepareWriteHeadFallback(current: ChunkBuffer?): ChunkBuffer {\n if (current != null) {\n writeFully(current)\n current.resetForWrite()\n return current\n }\n\n return ChunkBuffer.Pool.borrow()\n}\n\n@Suppress(\"DEPRECATION\", \"UNUSED\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\npublic fun Output.afterHeadWrite(current: IoBuffer) {\n return afterHeadWrite(current)\n}\n\n@DangerousInternalIoApi\npublic fun Output.afterHeadWrite(current: ChunkBuffer) {\n if (this is AbstractOutput) {\n return afterHeadWrite()\n }\n\n afterWriteHeadFallback(current)\n}\n\n@JvmField\n@SharedImmutable\ninternal val EmptyByteArray = ByteArray(0)\n\nprivate fun Output.afterWriteHeadFallback(current: ChunkBuffer) {\n writeFully(current)\n current.release(ChunkBuffer.Pool)\n}\n","package io.ktor.utils.io.errors\n\nimport io.ktor.utils.io.core.*\n\npublic expect open class IOException(message: String, cause: Throwable?) : Exception {\n public constructor(message: String)\n}\n\npublic expect open class EOFException(message: String) : IOException\n\n@Suppress(\"DeprecatedCallableAddReplaceWith\")\n@Deprecated(\"Not implemented.\", level = DeprecationLevel.ERROR)\npublic fun TODO_ERROR(value: R): Nothing = TODO(\"Not implemented. Value is $value\")\n\n@Suppress(\"DeprecatedCallableAddReplaceWith\")\n@Deprecated(\"Not implemented.\", level = DeprecationLevel.ERROR)\npublic fun TODO_ERROR(): Nothing = TODO(\"Not implemented.\")\n\ninternal fun checkPeekTo(destination: Buffer, offset: Int, min: Int, max: Int) {\n io.ktor.utils.io.core.internal.require(offset >= 0) { \"offset shouldn't be negative: $offset.\" }\n io.ktor.utils.io.core.internal.require(min >= 0) { \"min shouldn't be negative: $min.\" }\n io.ktor.utils.io.core.internal.require(max >= min) { \"max should't be less than min: max = $max, min = $min.\" }\n io.ktor.utils.io.core.internal.require(min <= destination.writeRemaining) {\n \"Not enough free space in the destination buffer \" +\n \"to write the specified minimum number of bytes: min = $min, free = ${destination.writeRemaining}.\"\n }\n}\n\n@PublishedApi\ninternal fun incompatibleVersionError(): Nothing = throw Error(\n \"This API is no longer supported. \" +\n \"Please downgrade kotlinx-io or recompile your project/dependencies with new kotlinx-io.\"\n)\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.utils.io.internal\n\nimport io.ktor.utils.io.*\nimport kotlinx.atomicfu.*\nimport kotlinx.coroutines.*\n\n/**\n * Exclusive slot for waiting.\n * Only one waiter allowed.\n *\n * TODO: replace [Job] -> [Continuation] when all coroutines problems are fixed.\n */\ninternal class AwaitingSlot {\n private val suspension: AtomicRef = atomic(null)\n\n init {\n makeShared()\n }\n\n /**\n * Wait for other [sleep] or resume.\n */\n public suspend fun sleep() {\n if (trySuspend()) {\n return\n }\n\n resume()\n }\n\n /**\n * Resume waiter.\n */\n public fun resume() {\n suspension.getAndSet(null)?.complete()\n }\n\n /**\n * Cancel waiter.\n */\n public fun cancel(cause: Throwable?) {\n val continuation = suspension.getAndSet(null) ?: return\n\n if (cause != null) {\n continuation.completeExceptionally(cause)\n } else {\n continuation.complete()\n }\n }\n\n private suspend fun trySuspend(): Boolean {\n var suspended = false\n\n val job = Job()\n if (suspension.compareAndSet(null, job)) {\n suspended = true\n job.join()\n }\n\n return suspended\n }\n}\n","package io.ktor.utils.io.internal\n\nimport io.ktor.utils.io.ByteChannelSequentialBase\nimport io.ktor.utils.io.close\nimport io.ktor.utils.io.core.internal.ChunkBuffer\n\ninternal suspend fun ByteChannelSequentialBase.joinToImpl(dst: ByteChannelSequentialBase, closeOnEnd: Boolean) {\n copyToSequentialImpl(dst, Long.MAX_VALUE)\n if (closeOnEnd) dst.close()\n}\n\n/**\n * Reads up to [limit] bytes from receiver channel and writes them to [dst] channel.\n * Closes [dst] channel if fails to read or write with cause exception.\n * @return a number of copied bytes\n */\ninternal suspend fun ByteChannelSequentialBase.copyToSequentialImpl(dst: ByteChannelSequentialBase, limit: Long): Long {\n require(this !== dst)\n if (closedCause != null) {\n dst.close(closedCause)\n return 0L\n }\n\n var remainingLimit = limit\n\n while (remainingLimit > 0) {\n if (!awaitInternalAtLeast1()) {\n break\n }\n val transferred = transferTo(dst, remainingLimit)\n\n val copied = if (transferred == 0L) {\n val tail = copyToTail(dst, remainingLimit)\n if (tail == 0L) {\n break\n }\n\n tail\n } else {\n if (dst.availableForWrite == 0) {\n dst.awaitAtLeastNBytesAvailableForWrite(1)\n }\n\n transferred\n }\n\n remainingLimit -= copied\n }\n\n return limit - remainingLimit\n}\n\nprivate suspend fun ByteChannelSequentialBase.copyToTail(dst: ByteChannelSequentialBase, limit: Long): Long {\n val lastPiece = ChunkBuffer.Pool.borrow()\n try {\n lastPiece.resetForWrite(limit.coerceAtMost(lastPiece.capacity.toLong()).toInt())\n val rc = readAvailable(lastPiece)\n if (rc == -1) {\n lastPiece.release(ChunkBuffer.Pool)\n return 0\n }\n\n dst.writeFully(lastPiece)\n return rc.toLong()\n } finally {\n lastPiece.release(ChunkBuffer.Pool)\n }\n}\n","package io.ktor.utils.io.pool\n\nimport io.ktor.utils.io.core.*\nimport kotlinx.atomicfu.*\nimport kotlin.jvm.*\n\npublic interface ObjectPool : Closeable {\n /**\n * Pool capacity\n */\n public val capacity: Int\n\n /**\n * borrow an instance. Pool can recycle an old instance or create a new one\n */\n public fun borrow(): T\n\n /**\n * Recycle an instance. Should be recycled what was borrowed before otherwise could fail\n */\n public fun recycle(instance: T)\n\n /**\n * Dispose the whole pool. None of borrowed objects could be used after the pool gets disposed\n * otherwise it can result in undefined behaviour\n */\n public fun dispose()\n\n /**\n * Does pool dispose\n */\n override fun close() {\n dispose()\n }\n}\n\n/**\n * A pool implementation of zero capacity that always creates new instances\n */\npublic abstract class NoPoolImpl : ObjectPool {\n override val capacity: Int\n get() = 0\n\n override fun recycle(instance: T) {\n }\n\n override fun dispose() {\n }\n}\n\n/**\n * A pool that produces at most one instance\n */\npublic abstract class SingleInstancePool : ObjectPool {\n private val borrowed = atomic(0)\n private val disposed = atomic(false)\n\n @Volatile\n private var instance: T? = null\n\n /**\n * Creates a new instance of [T]\n */\n protected abstract fun produceInstance(): T\n\n /**\n * Dispose [instance] and release it's resources\n */\n protected abstract fun disposeInstance(instance: T)\n\n final override val capacity: Int get() = 1\n\n final override fun borrow(): T {\n borrowed.update {\n if (it != 0) throw IllegalStateException(\"Instance is already consumed\")\n 1\n }\n\n val instance = produceInstance()\n this.instance = instance\n\n return instance\n }\n\n final override fun recycle(instance: T) {\n if (this.instance !== instance) {\n if (this.instance == null && borrowed.value != 0) {\n throw IllegalStateException(\"Already recycled or an irrelevant instance tried to be recycled\")\n }\n\n throw IllegalStateException(\"Unable to recycle irrelevant instance\")\n }\n\n this.instance = null\n\n if (!disposed.compareAndSet(false, true)) {\n throw IllegalStateException(\"An instance is already disposed\")\n }\n\n disposeInstance(instance)\n }\n\n final override fun dispose() {\n if (disposed.compareAndSet(false, true)) {\n val instance = this.instance ?: return\n this.instance = null\n\n disposeInstance(instance)\n }\n }\n}\n\n/**\n * Default object pool implementation.\n */\npublic expect abstract class DefaultPool(capacity: Int) : ObjectPool {\n /**\n * Pool capacity.\n */\n final override val capacity: Int\n\n /**\n * Creates a new instance of [T]\n */\n protected abstract fun produceInstance(): T\n\n /**\n * Dispose [instance] and release it's resources\n */\n protected open fun disposeInstance(instance: T)\n\n /**\n * Clear [instance]'s state before reuse: reset pointers, counters and so on\n */\n protected open fun clearInstance(instance: T): T\n\n /**\n * Validate [instance] of [T]. Could verify that the object has been borrowed from this pool\n */\n protected open fun validateInstance(instance: T)\n\n final override fun borrow(): T\n\n final override fun recycle(instance: T)\n\n final override fun dispose()\n}\n\n/**\n * Borrows and instance of [T] from the pool, invokes [block] with it and finally recycles it\n */\n@Deprecated(\"Use useInstance instead\", ReplaceWith(\"useInstance(block)\"))\npublic inline fun ObjectPool.useBorrowed(block: (T) -> R): R {\n return useInstance(block)\n}\n\n/**\n * Borrows and instance of [T] from the pool, invokes [block] with it and finally recycles it\n */\npublic inline fun ObjectPool.useInstance(block: (T) -> R): R {\n val instance = borrow()\n try {\n return block(instance)\n } finally {\n recycle(instance)\n }\n}\n","package io.ktor.utils.io\n\nimport io.ktor.utils.io.core.*\nimport io.ktor.utils.io.internal.*\nimport kotlinx.coroutines.*\nimport org.khronos.webgl.*\n\n/**\n * Creates buffered channel for asynchronous reading and writing of sequences of bytes.\n */\npublic actual fun ByteChannel(autoFlush: Boolean): ByteChannel {\n return ByteChannelJS(IoBuffer.Empty, autoFlush)\n}\n\n/**\n * Creates channel for reading from the specified byte array.\n */\npublic actual fun ByteReadChannel(content: ByteArray, offset: Int, length: Int): ByteReadChannel {\n if (content.isEmpty()) return ByteReadChannel.Empty\n val head = IoBuffer.Pool.borrow()\n var tail = head\n\n var start = offset\n val end = start + length\n while (true) {\n tail.reserveEndGap(8)\n val size = minOf(end - start, tail.writeRemaining)\n (tail as Buffer).writeFully(content, start, size)\n start += size\n\n if (start == end) break\n val current = tail\n tail = IoBuffer.Pool.borrow()\n current.next = tail\n }\n\n return ByteChannelJS(head, false).apply { close() }\n}\n\n/**\n * Creates channel for reading from the specified [ArrayBufferView]\n */\npublic fun ByteReadChannel(content: ArrayBufferView): ByteReadChannel {\n if (content.byteLength == 0) return ByteReadChannel.Empty\n val head = IoBuffer.Pool.borrow()\n var tail = head\n\n var start = 0\n var remaining = content.byteLength - content.byteOffset\n while (true) {\n tail.reserveEndGap(8)\n val size = minOf(remaining, tail.writeRemaining)\n tail.writeFully(content, start, size)\n start += size\n remaining -= size\n\n if (remaining == 0) break\n tail = IoBuffer.Pool.borrow()\n }\n\n return ByteChannelJS(head, false).apply { close() }\n}\n\npublic actual suspend fun ByteReadChannel.joinTo(dst: ByteWriteChannel, closeOnEnd: Boolean) {\n (this as ByteChannelSequentialBase).joinToImpl((dst as ByteChannelSequentialBase), closeOnEnd)\n}\n\n/**\n * Reads up to [limit] bytes from receiver channel and writes them to [dst] channel.\n * Closes [dst] channel if fails to read or write with cause exception.\n * @return a number of copied bytes\n */\npublic actual suspend fun ByteReadChannel.copyTo(dst: ByteWriteChannel, limit: Long): Long {\n return (this as ByteChannelSequentialBase).copyToSequentialImpl((dst as ByteChannelSequentialBase), limit)\n}\n\ninternal class ByteChannelJS(initial: IoBuffer, autoFlush: Boolean) : ByteChannelSequentialBase(initial, autoFlush) {\n private var attachedJob: Job? = null\n\n @OptIn(InternalCoroutinesApi::class)\n override fun attachJob(job: Job) {\n attachedJob?.cancel()\n attachedJob = job\n job.invokeOnCompletion(onCancelling = true) { cause ->\n attachedJob = null\n if (cause != null) {\n cancel(cause)\n }\n }\n }\n\n override suspend fun readAvailable(dst: ArrayBuffer, offset: Int, length: Int): Int {\n return if (readable.isEmpty) {\n readAvailableSuspend(dst, offset, length)\n } else {\n closedCause?.let { throw it }\n readable.readAvailable(dst, offset, length)\n }\n }\n\n private suspend fun readAvailableSuspend(dst: ArrayBuffer, offset: Int, length: Int): Int {\n if (!await(1)) return -1\n return readAvailable(dst, offset, length)\n }\n\n override suspend fun readFully(dst: ArrayBuffer, offset: Int, length: Int) {\n if (availableForRead >= length) {\n closedCause?.let { throw it }\n readable.readFully(dst, offset, length)\n return\n }\n\n return readFullySuspend(dst, offset, length)\n }\n\n private suspend fun readFullySuspend(dst: ArrayBuffer, offset: Int, length: Int) {\n var start = offset\n val end = offset + length\n var remaining = length\n\n while (start < end) {\n val rc = readAvailable(dst, start, remaining)\n if (rc == -1) throw EOFException(\"Premature end of stream: required $remaining more bytes\")\n start += rc\n remaining -= rc\n }\n }\n\n override fun toString(): String = \"ByteChannel[$attachedJob, ${hashCode()}]\"\n}\n","// ktlint-disable filename\n/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.utils.io\n\nimport io.ktor.utils.io.core.*\nimport io.ktor.utils.io.core.internal.*\nimport kotlin.jvm.*\n\ninternal actual class ByteChannelSequentialBaseSharedState actual constructor() {\n actual var closed: Boolean = false\n\n actual var readByteOrder: ByteOrder = ByteOrder.BIG_ENDIAN\n\n actual var writeByteOrder: ByteOrder = ByteOrder.BIG_ENDIAN\n\n actual var totalBytesRead: Long = 0L\n\n actual var totalBytesWritten: Long = 0L\n\n actual var closedCause: Throwable? = null\n\n actual var lastReadAvailable: Int = 0\n\n actual var lastReadView: ChunkBuffer = ChunkBuffer.Empty\n}\n","// ktlint-disable filename\npackage io.ktor.utils.io\n\nimport kotlin.coroutines.*\n\ninternal actual class Condition actual constructor(val predicate: () -> Boolean) {\n private var cont: Continuation? = null\n\n actual fun check(): Boolean {\n return predicate()\n }\n\n actual fun signal() {\n val cont = cont\n if (cont != null && predicate()) {\n this.cont = null\n cont.resume(Unit)\n }\n }\n\n actual suspend fun await(block: () -> Unit) {\n if (predicate()) return\n\n return suspendCoroutine { c ->\n cont = c\n block()\n }\n }\n actual suspend fun await() {\n if (predicate()) return\n\n return suspendCoroutine { c ->\n cont = c\n }\n }\n}\n","@file:Suppress(\"NOTHING_TO_INLINE\")\n\npackage io.ktor.utils.io.bits\n\n/**\n * Reverse number's byte order\n */\npublic actual fun Short.reverseByteOrder(): Short = swap(this)\n\n/**\n * Reverse number's byte order\n */\npublic actual fun Int.reverseByteOrder(): Int = swap(this)\n\n/**\n * Reverse number's byte order\n */\npublic actual fun Long.reverseByteOrder(): Long = swap(this)\n\n/**\n * Reverse number's byte order\n */\npublic actual fun Float.reverseByteOrder(): Float = swap(this)\n\n/**\n * Reverse number's byte order\n */\npublic actual fun Double.reverseByteOrder(): Double = swap(this)\n\nprivate inline fun swap(s: Short): Short = (((s.toInt() and 0xff) shl 8) or ((s.toInt() and 0xffff) ushr 8)).toShort()\n\nprivate inline fun swap(s: Int): Int =\n (swap((s and 0xffff).toShort()).toInt() shl 16) or (swap((s ushr 16).toShort()).toInt() and 0xffff)\n\nprivate inline fun swap(s: Long): Long =\n (swap((s and 0xffffffff).toInt()).toLong() shl 32) or (swap((s ushr 32).toInt()).toLong() and 0xffffffff)\n\nprivate inline fun swap(s: Float): Float = Float.fromBits(swap(s.toRawBits()))\n\nprivate inline fun swap(s: Double): Double = Double.fromBits(swap(s.toRawBits()))\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.utils.io\n\n/**\n * Print exception stacktrace.\n */\npublic actual fun Throwable.printStack() {\n @Suppress(\"UnsafeCastFromDynamic\")\n println(asDynamic().stack)\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.utils.io\n\nimport io.ktor.utils.io.core.internal.*\n\n@DangerousInternalIoApi\npublic actual fun Any.preventFreeze() {\n}\n\n@DangerousInternalIoApi\npublic actual fun Any.makeShared() {\n}\n","@file:Suppress(\"NOTHING_TO_INLINE\")\n\npackage io.ktor.utils.io.bits\n\nimport io.ktor.utils.io.core.*\nimport io.ktor.utils.io.core.internal.*\nimport org.khronos.webgl.*\n\nprivate val isLittleEndianPlatform = ByteOrder.nativeOrder() === ByteOrder.LITTLE_ENDIAN\n\n/**\n * Copies shorts integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic actual fun Memory.loadShortArray(\n offset: Int,\n destination: ShortArray,\n destinationOffset: Int,\n count: Int\n) {\n val typed = Int16Array(view.buffer, view.byteOffset + offset, count)\n\n if (isLittleEndianPlatform) {\n // TODO investigate this implementation vs DataView.getInt16(...)\n repeat(count) { index ->\n destination[index + destinationOffset] = typed[index].reverseByteOrder()\n }\n } else {\n repeat(count) { index ->\n destination[index + destinationOffset] = typed[index]\n }\n }\n}\n\n/**\n * Copies shorts integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic actual fun Memory.loadShortArray(\n offset: Long,\n destination: ShortArray,\n destinationOffset: Int,\n count: Int\n) {\n loadShortArray(offset.toIntOrFail(\"offset\"), destination, destinationOffset, count)\n}\n\n/**\n * Copies regular integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic actual fun Memory.loadIntArray(\n offset: Int,\n destination: IntArray,\n destinationOffset: Int,\n count: Int\n) {\n val typed = Int32Array(view.buffer, view.byteOffset + offset, count)\n\n if (isLittleEndianPlatform) {\n repeat(count) { index ->\n destination[index + destinationOffset] = typed[index].reverseByteOrder()\n }\n } else {\n repeat(count) { index ->\n destination[index + destinationOffset] = typed[index]\n }\n }\n}\n\n/**\n * Copies regular integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic actual fun Memory.loadIntArray(\n offset: Long,\n destination: IntArray,\n destinationOffset: Int,\n count: Int\n) {\n loadIntArray(offset.toIntOrFail(\"offset\"), destination, destinationOffset, count)\n}\n\n/**\n * Copies regular integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic actual fun Memory.loadLongArray(\n offset: Int,\n destination: LongArray,\n destinationOffset: Int,\n count: Int\n) {\n val typed = Int32Array(view.buffer, view.byteOffset + offset, count * 2)\n\n if (isLittleEndianPlatform) {\n for (index in 0 until count * 2 step 2) {\n destination[index / 2 + destinationOffset] =\n (typed[index + 1].reverseByteOrder().toLong() and 0xffffffffL) or\n (typed[index].reverseByteOrder().toLong() shl 32)\n }\n } else {\n for (index in 0 until count * 2 step 2) {\n destination[index / 2 + destinationOffset] = (typed[index].toLong() and 0xffffffffL) or\n (typed[index + 1].toLong() shl 32)\n }\n }\n}\n\n/**\n * Copies regular integers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic actual fun Memory.loadLongArray(\n offset: Long,\n destination: LongArray,\n destinationOffset: Int,\n count: Int\n) {\n loadLongArray(offset.toIntOrFail(\"offset\"), destination, destinationOffset, count)\n}\n\n/**\n * Copies floating point numbers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic actual fun Memory.loadFloatArray(\n offset: Int,\n destination: FloatArray,\n destinationOffset: Int,\n count: Int\n) {\n val typed = Float32Array(view.buffer, view.byteOffset + offset, count)\n\n if (isLittleEndianPlatform) {\n repeat(count) { index ->\n destination[index + destinationOffset] = typed[index].reverseByteOrder()\n }\n } else {\n repeat(count) { index ->\n destination[index + destinationOffset] = typed[index]\n }\n }\n}\n\n/**\n * Copies floating point numbers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic actual fun Memory.loadFloatArray(\n offset: Long,\n destination: FloatArray,\n destinationOffset: Int,\n count: Int\n) {\n loadFloatArray(offset.toIntOrFail(\"offset\"), destination, destinationOffset, count)\n}\n\n/**\n * Copies floating point numbers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic actual fun Memory.loadDoubleArray(\n offset: Int,\n destination: DoubleArray,\n destinationOffset: Int,\n count: Int\n) {\n val typed = Float64Array(view.buffer, view.byteOffset + offset, count)\n\n if (isLittleEndianPlatform) {\n repeat(count) { index ->\n destination[index + destinationOffset] = typed[index].reverseByteOrder()\n }\n } else {\n repeat(count) { index ->\n destination[index + destinationOffset] = typed[index]\n }\n }\n}\n\n/**\n * Copies floating point numbers from this memory range from the specified [offset] and [count]\n * to the [destination] at [destinationOffset] interpreting numbers in the network order (Big Endian).\n * @param destinationOffset items\n */\npublic actual fun Memory.loadDoubleArray(\n offset: Long,\n destination: DoubleArray,\n destinationOffset: Int,\n count: Int\n) {\n loadDoubleArray(offset.toIntOrFail(\"offset\"), destination, destinationOffset, count)\n}\n\n/**\n * Copies shorts integers from from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic actual fun Memory.storeShortArray(\n offset: Int,\n source: ShortArray,\n sourceOffset: Int,\n count: Int\n) {\n val typed = Int16Array(view.buffer, view.byteOffset + offset, count)\n\n if (isLittleEndianPlatform) {\n // TODO investigate this implementation vs DataView.getInt16(...)\n repeat(count) { index ->\n typed[index] = source[index + sourceOffset].reverseByteOrder()\n }\n } else {\n repeat(count) { index ->\n typed[index] = source[index + sourceOffset]\n }\n }\n}\n\n/**\n * Copies shorts integers from from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic actual fun Memory.storeShortArray(\n offset: Long,\n source: ShortArray,\n sourceOffset: Int,\n count: Int\n) {\n storeShortArray(offset.toIntOrFail(\"offset\"), source, sourceOffset, count)\n}\n\n/**\n * Copies regular integers from from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic actual fun Memory.storeIntArray(\n offset: Int,\n source: IntArray,\n sourceOffset: Int,\n count: Int\n) {\n val typed = Int32Array(view.buffer, view.byteOffset + offset, count)\n\n if (isLittleEndianPlatform) {\n repeat(count) { index ->\n typed[index] = source[index + sourceOffset].reverseByteOrder()\n }\n } else {\n repeat(count) { index ->\n typed[index] = source[index + sourceOffset]\n }\n }\n}\n\n/**\n * Copies regular integers from from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic actual fun Memory.storeIntArray(\n offset: Long,\n source: IntArray,\n sourceOffset: Int,\n count: Int\n) {\n storeIntArray(offset.toIntOrFail(\"offset\"), source, sourceOffset, count)\n}\n\n/**\n * Copies regular integers from from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic actual fun Memory.storeLongArray(\n offset: Int,\n source: LongArray,\n sourceOffset: Int,\n count: Int\n) {\n val typed = Int32Array(view.buffer, view.byteOffset + offset, count * 2)\n\n if (isLittleEndianPlatform) {\n for (index in 0 until count * 2 step 2) {\n val sourceIndex = index / 2 + sourceOffset\n val sourceValue = source[sourceIndex]\n typed[index] = (sourceValue ushr 32).toInt().reverseByteOrder()\n typed[index + 1] = (sourceValue and 0xffffffffL).toInt().reverseByteOrder()\n }\n } else {\n for (index in 0 until count * 2 step 2) {\n val sourceIndex = index / 2 + sourceOffset\n val sourceValue = source[sourceIndex]\n typed[index] = (sourceValue ushr 32).toInt()\n typed[index + 1] = (sourceValue and 0xffffffffL).toInt()\n }\n }\n}\n\n/**\n * Copies regular integers from from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic actual fun Memory.storeLongArray(\n offset: Long,\n source: LongArray,\n sourceOffset: Int,\n count: Int\n) {\n storeLongArray(offset.toIntOrFail(\"offset\"), source, sourceOffset, count)\n}\n\n/**\n * Copies floating point numbers from from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic actual fun Memory.storeFloatArray(\n offset: Int,\n source: FloatArray,\n sourceOffset: Int,\n count: Int\n) {\n val typed = Float32Array(view.buffer, view.byteOffset + offset, count)\n\n if (isLittleEndianPlatform) {\n repeat(count) { index ->\n typed[index] = source[index + sourceOffset].reverseByteOrder()\n }\n } else {\n repeat(count) { index ->\n typed[index] = source[index + sourceOffset]\n }\n }\n}\n\n/**\n * Copies floating point numbers from from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic actual fun Memory.storeFloatArray(\n offset: Long,\n source: FloatArray,\n sourceOffset: Int,\n count: Int\n) {\n storeFloatArray(offset.toIntOrFail(\"offset\"), source, sourceOffset, count)\n}\n\n/**\n * Copies floating point numbers from from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic actual fun Memory.storeDoubleArray(\n offset: Int,\n source: DoubleArray,\n sourceOffset: Int,\n count: Int\n) {\n val typed = Float64Array(view.buffer, view.byteOffset + offset, count)\n\n if (isLittleEndianPlatform) {\n repeat(count) { index ->\n typed[index] = source[index + sourceOffset].reverseByteOrder()\n }\n } else {\n repeat(count) { index ->\n typed[index] = source[index + sourceOffset]\n }\n }\n}\n\n/**\n * Copies floating point numbers from from the [source] array at [sourceOffset] to this memory at the specified [offset]\n * interpreting numbers in the network order (Big Endian).\n * @param sourceOffset items\n */\npublic actual fun Memory.storeDoubleArray(\n offset: Long,\n source: DoubleArray,\n sourceOffset: Int,\n count: Int\n) {\n storeDoubleArray(offset.toIntOrFail(\"offset\"), source, sourceOffset, count)\n}\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!\n// See github.com/kotlin/dukat for details\n\npackage org.khronos.webgl\n\nimport kotlin.js.*\nimport org.w3c.css.masking.*\nimport org.w3c.dom.*\nimport org.w3c.dom.clipboard.*\nimport org.w3c.dom.css.*\nimport org.w3c.dom.encryptedmedia.*\nimport org.w3c.dom.events.*\nimport org.w3c.dom.mediacapture.*\nimport org.w3c.dom.mediasource.*\nimport org.w3c.dom.parsing.*\nimport org.w3c.dom.pointerevents.*\nimport org.w3c.dom.svg.*\nimport org.w3c.dom.url.*\nimport org.w3c.fetch.*\nimport org.w3c.files.*\nimport org.w3c.notifications.*\nimport org.w3c.performance.*\nimport org.w3c.workers.*\nimport org.w3c.xhr.*\n\npublic external interface WebGLContextAttributes {\n var alpha: Boolean? /* = true */\n get() = definedExternally\n set(value) = definedExternally\n var depth: Boolean? /* = true */\n get() = definedExternally\n set(value) = definedExternally\n var stencil: Boolean? /* = false */\n get() = definedExternally\n set(value) = definedExternally\n var antialias: Boolean? /* = true */\n get() = definedExternally\n set(value) = definedExternally\n var premultipliedAlpha: Boolean? /* = true */\n get() = definedExternally\n set(value) = definedExternally\n var preserveDrawingBuffer: Boolean? /* = false */\n get() = definedExternally\n set(value) = definedExternally\n var preferLowPowerToHighPerformance: Boolean? /* = false */\n get() = definedExternally\n set(value) = definedExternally\n var failIfMajorPerformanceCaveat: Boolean? /* = false */\n get() = definedExternally\n set(value) = definedExternally\n}\n\n@kotlin.internal.InlineOnly\npublic inline fun WebGLContextAttributes(alpha: Boolean? = true, depth: Boolean? = true, stencil: Boolean? = false, antialias: Boolean? = true, premultipliedAlpha: Boolean? = true, preserveDrawingBuffer: Boolean? = false, preferLowPowerToHighPerformance: Boolean? = false, failIfMajorPerformanceCaveat: Boolean? = false): WebGLContextAttributes {\n val o = js(\"({})\")\n o[\"alpha\"] = alpha\n o[\"depth\"] = depth\n o[\"stencil\"] = stencil\n o[\"antialias\"] = antialias\n o[\"premultipliedAlpha\"] = premultipliedAlpha\n o[\"preserveDrawingBuffer\"] = preserveDrawingBuffer\n o[\"preferLowPowerToHighPerformance\"] = preferLowPowerToHighPerformance\n o[\"failIfMajorPerformanceCaveat\"] = failIfMajorPerformanceCaveat\n return o\n}\n\npublic external abstract class WebGLObject\n\n/**\n * Exposes the JavaScript [WebGLBuffer](https://developer.mozilla.org/en/docs/Web/API/WebGLBuffer) to Kotlin\n */\npublic external abstract class WebGLBuffer : WebGLObject\n\n/**\n * Exposes the JavaScript [WebGLFramebuffer](https://developer.mozilla.org/en/docs/Web/API/WebGLFramebuffer) to Kotlin\n */\npublic external abstract class WebGLFramebuffer : WebGLObject\n\n/**\n * Exposes the JavaScript [WebGLProgram](https://developer.mozilla.org/en/docs/Web/API/WebGLProgram) to Kotlin\n */\npublic external abstract class WebGLProgram : WebGLObject\n\n/**\n * Exposes the JavaScript [WebGLRenderbuffer](https://developer.mozilla.org/en/docs/Web/API/WebGLRenderbuffer) to Kotlin\n */\npublic external abstract class WebGLRenderbuffer : WebGLObject\n\n/**\n * Exposes the JavaScript [WebGLShader](https://developer.mozilla.org/en/docs/Web/API/WebGLShader) to Kotlin\n */\npublic external abstract class WebGLShader : WebGLObject\n\n/**\n * Exposes the JavaScript [WebGLTexture](https://developer.mozilla.org/en/docs/Web/API/WebGLTexture) to Kotlin\n */\npublic external abstract class WebGLTexture : WebGLObject\n\n/**\n * Exposes the JavaScript [WebGLUniformLocation](https://developer.mozilla.org/en/docs/Web/API/WebGLUniformLocation) to Kotlin\n */\npublic external abstract class WebGLUniformLocation\n\n/**\n * Exposes the JavaScript [WebGLActiveInfo](https://developer.mozilla.org/en/docs/Web/API/WebGLActiveInfo) to Kotlin\n */\npublic external abstract class WebGLActiveInfo {\n open val size: Int\n open val type: Int\n open val name: String\n}\n\n/**\n * Exposes the JavaScript [WebGLShaderPrecisionFormat](https://developer.mozilla.org/en/docs/Web/API/WebGLShaderPrecisionFormat) to Kotlin\n */\npublic external abstract class WebGLShaderPrecisionFormat {\n open val rangeMin: Int\n open val rangeMax: Int\n open val precision: Int\n}\n\n@Suppress(\"NESTED_CLASS_IN_EXTERNAL_INTERFACE\")\npublic external interface WebGLRenderingContextBase {\n val canvas: HTMLCanvasElement\n val drawingBufferWidth: Int\n val drawingBufferHeight: Int\n fun getContextAttributes(): WebGLContextAttributes?\n fun isContextLost(): Boolean\n fun getSupportedExtensions(): Array?\n fun getExtension(name: String): dynamic\n fun activeTexture(texture: Int)\n fun attachShader(program: WebGLProgram?, shader: WebGLShader?)\n fun bindAttribLocation(program: WebGLProgram?, index: Int, name: String)\n fun bindBuffer(target: Int, buffer: WebGLBuffer?)\n fun bindFramebuffer(target: Int, framebuffer: WebGLFramebuffer?)\n fun bindRenderbuffer(target: Int, renderbuffer: WebGLRenderbuffer?)\n fun bindTexture(target: Int, texture: WebGLTexture?)\n fun blendColor(red: Float, green: Float, blue: Float, alpha: Float)\n fun blendEquation(mode: Int)\n fun blendEquationSeparate(modeRGB: Int, modeAlpha: Int)\n fun blendFunc(sfactor: Int, dfactor: Int)\n fun blendFuncSeparate(srcRGB: Int, dstRGB: Int, srcAlpha: Int, dstAlpha: Int)\n fun bufferData(target: Int, size: Int, usage: Int)\n fun bufferData(target: Int, data: BufferDataSource?, usage: Int)\n fun bufferSubData(target: Int, offset: Int, data: BufferDataSource?)\n fun checkFramebufferStatus(target: Int): Int\n fun clear(mask: Int)\n fun clearColor(red: Float, green: Float, blue: Float, alpha: Float)\n fun clearDepth(depth: Float)\n fun clearStencil(s: Int)\n fun colorMask(red: Boolean, green: Boolean, blue: Boolean, alpha: Boolean)\n fun compileShader(shader: WebGLShader?)\n fun compressedTexImage2D(target: Int, level: Int, internalformat: Int, width: Int, height: Int, border: Int, data: ArrayBufferView)\n fun compressedTexSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, width: Int, height: Int, format: Int, data: ArrayBufferView)\n fun copyTexImage2D(target: Int, level: Int, internalformat: Int, x: Int, y: Int, width: Int, height: Int, border: Int)\n fun copyTexSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, x: Int, y: Int, width: Int, height: Int)\n fun createBuffer(): WebGLBuffer?\n fun createFramebuffer(): WebGLFramebuffer?\n fun createProgram(): WebGLProgram?\n fun createRenderbuffer(): WebGLRenderbuffer?\n fun createShader(type: Int): WebGLShader?\n fun createTexture(): WebGLTexture?\n fun cullFace(mode: Int)\n fun deleteBuffer(buffer: WebGLBuffer?)\n fun deleteFramebuffer(framebuffer: WebGLFramebuffer?)\n fun deleteProgram(program: WebGLProgram?)\n fun deleteRenderbuffer(renderbuffer: WebGLRenderbuffer?)\n fun deleteShader(shader: WebGLShader?)\n fun deleteTexture(texture: WebGLTexture?)\n fun depthFunc(func: Int)\n fun depthMask(flag: Boolean)\n fun depthRange(zNear: Float, zFar: Float)\n fun detachShader(program: WebGLProgram?, shader: WebGLShader?)\n fun disable(cap: Int)\n fun disableVertexAttribArray(index: Int)\n fun drawArrays(mode: Int, first: Int, count: Int)\n fun drawElements(mode: Int, count: Int, type: Int, offset: Int)\n fun enable(cap: Int)\n fun enableVertexAttribArray(index: Int)\n fun finish()\n fun flush()\n fun framebufferRenderbuffer(target: Int, attachment: Int, renderbuffertarget: Int, renderbuffer: WebGLRenderbuffer?)\n fun framebufferTexture2D(target: Int, attachment: Int, textarget: Int, texture: WebGLTexture?, level: Int)\n fun frontFace(mode: Int)\n fun generateMipmap(target: Int)\n fun getActiveAttrib(program: WebGLProgram?, index: Int): WebGLActiveInfo?\n fun getActiveUniform(program: WebGLProgram?, index: Int): WebGLActiveInfo?\n fun getAttachedShaders(program: WebGLProgram?): Array?\n fun getAttribLocation(program: WebGLProgram?, name: String): Int\n fun getBufferParameter(target: Int, pname: Int): Any?\n fun getParameter(pname: Int): Any?\n fun getError(): Int\n fun getFramebufferAttachmentParameter(target: Int, attachment: Int, pname: Int): Any?\n fun getProgramParameter(program: WebGLProgram?, pname: Int): Any?\n fun getProgramInfoLog(program: WebGLProgram?): String?\n fun getRenderbufferParameter(target: Int, pname: Int): Any?\n fun getShaderParameter(shader: WebGLShader?, pname: Int): Any?\n fun getShaderPrecisionFormat(shadertype: Int, precisiontype: Int): WebGLShaderPrecisionFormat?\n fun getShaderInfoLog(shader: WebGLShader?): String?\n fun getShaderSource(shader: WebGLShader?): String?\n fun getTexParameter(target: Int, pname: Int): Any?\n fun getUniform(program: WebGLProgram?, location: WebGLUniformLocation?): Any?\n fun getUniformLocation(program: WebGLProgram?, name: String): WebGLUniformLocation?\n fun getVertexAttrib(index: Int, pname: Int): Any?\n fun getVertexAttribOffset(index: Int, pname: Int): Int\n fun hint(target: Int, mode: Int)\n fun isBuffer(buffer: WebGLBuffer?): Boolean\n fun isEnabled(cap: Int): Boolean\n fun isFramebuffer(framebuffer: WebGLFramebuffer?): Boolean\n fun isProgram(program: WebGLProgram?): Boolean\n fun isRenderbuffer(renderbuffer: WebGLRenderbuffer?): Boolean\n fun isShader(shader: WebGLShader?): Boolean\n fun isTexture(texture: WebGLTexture?): Boolean\n fun lineWidth(width: Float)\n fun linkProgram(program: WebGLProgram?)\n fun pixelStorei(pname: Int, param: Int)\n fun polygonOffset(factor: Float, units: Float)\n fun readPixels(x: Int, y: Int, width: Int, height: Int, format: Int, type: Int, pixels: ArrayBufferView?)\n fun renderbufferStorage(target: Int, internalformat: Int, width: Int, height: Int)\n fun sampleCoverage(value: Float, invert: Boolean)\n fun scissor(x: Int, y: Int, width: Int, height: Int)\n fun shaderSource(shader: WebGLShader?, source: String)\n fun stencilFunc(func: Int, ref: Int, mask: Int)\n fun stencilFuncSeparate(face: Int, func: Int, ref: Int, mask: Int)\n fun stencilMask(mask: Int)\n fun stencilMaskSeparate(face: Int, mask: Int)\n fun stencilOp(fail: Int, zfail: Int, zpass: Int)\n fun stencilOpSeparate(face: Int, fail: Int, zfail: Int, zpass: Int)\n fun texImage2D(target: Int, level: Int, internalformat: Int, width: Int, height: Int, border: Int, format: Int, type: Int, pixels: ArrayBufferView?)\n fun texImage2D(target: Int, level: Int, internalformat: Int, format: Int, type: Int, source: TexImageSource?)\n fun texParameterf(target: Int, pname: Int, param: Float)\n fun texParameteri(target: Int, pname: Int, param: Int)\n fun texSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, width: Int, height: Int, format: Int, type: Int, pixels: ArrayBufferView?)\n fun texSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, format: Int, type: Int, source: TexImageSource?)\n fun uniform1f(location: WebGLUniformLocation?, x: Float)\n fun uniform1fv(location: WebGLUniformLocation?, v: Float32Array)\n fun uniform1fv(location: WebGLUniformLocation?, v: Array)\n fun uniform1i(location: WebGLUniformLocation?, x: Int)\n fun uniform1iv(location: WebGLUniformLocation?, v: Int32Array)\n fun uniform1iv(location: WebGLUniformLocation?, v: Array)\n fun uniform2f(location: WebGLUniformLocation?, x: Float, y: Float)\n fun uniform2fv(location: WebGLUniformLocation?, v: Float32Array)\n fun uniform2fv(location: WebGLUniformLocation?, v: Array)\n fun uniform2i(location: WebGLUniformLocation?, x: Int, y: Int)\n fun uniform2iv(location: WebGLUniformLocation?, v: Int32Array)\n fun uniform2iv(location: WebGLUniformLocation?, v: Array)\n fun uniform3f(location: WebGLUniformLocation?, x: Float, y: Float, z: Float)\n fun uniform3fv(location: WebGLUniformLocation?, v: Float32Array)\n fun uniform3fv(location: WebGLUniformLocation?, v: Array)\n fun uniform3i(location: WebGLUniformLocation?, x: Int, y: Int, z: Int)\n fun uniform3iv(location: WebGLUniformLocation?, v: Int32Array)\n fun uniform3iv(location: WebGLUniformLocation?, v: Array)\n fun uniform4f(location: WebGLUniformLocation?, x: Float, y: Float, z: Float, w: Float)\n fun uniform4fv(location: WebGLUniformLocation?, v: Float32Array)\n fun uniform4fv(location: WebGLUniformLocation?, v: Array)\n fun uniform4i(location: WebGLUniformLocation?, x: Int, y: Int, z: Int, w: Int)\n fun uniform4iv(location: WebGLUniformLocation?, v: Int32Array)\n fun uniform4iv(location: WebGLUniformLocation?, v: Array)\n fun uniformMatrix2fv(location: WebGLUniformLocation?, transpose: Boolean, value: Float32Array)\n fun uniformMatrix2fv(location: WebGLUniformLocation?, transpose: Boolean, value: Array)\n fun uniformMatrix3fv(location: WebGLUniformLocation?, transpose: Boolean, value: Float32Array)\n fun uniformMatrix3fv(location: WebGLUniformLocation?, transpose: Boolean, value: Array)\n fun uniformMatrix4fv(location: WebGLUniformLocation?, transpose: Boolean, value: Float32Array)\n fun uniformMatrix4fv(location: WebGLUniformLocation?, transpose: Boolean, value: Array)\n fun useProgram(program: WebGLProgram?)\n fun validateProgram(program: WebGLProgram?)\n fun vertexAttrib1f(index: Int, x: Float)\n fun vertexAttrib1fv(index: Int, values: dynamic)\n fun vertexAttrib2f(index: Int, x: Float, y: Float)\n fun vertexAttrib2fv(index: Int, values: dynamic)\n fun vertexAttrib3f(index: Int, x: Float, y: Float, z: Float)\n fun vertexAttrib3fv(index: Int, values: dynamic)\n fun vertexAttrib4f(index: Int, x: Float, y: Float, z: Float, w: Float)\n fun vertexAttrib4fv(index: Int, values: dynamic)\n fun vertexAttribPointer(index: Int, size: Int, type: Int, normalized: Boolean, stride: Int, offset: Int)\n fun viewport(x: Int, y: Int, width: Int, height: Int)\n\n companion object {\n val DEPTH_BUFFER_BIT: Int\n val STENCIL_BUFFER_BIT: Int\n val COLOR_BUFFER_BIT: Int\n val POINTS: Int\n val LINES: Int\n val LINE_LOOP: Int\n val LINE_STRIP: Int\n val TRIANGLES: Int\n val TRIANGLE_STRIP: Int\n val TRIANGLE_FAN: Int\n val ZERO: Int\n val ONE: Int\n val SRC_COLOR: Int\n val ONE_MINUS_SRC_COLOR: Int\n val SRC_ALPHA: Int\n val ONE_MINUS_SRC_ALPHA: Int\n val DST_ALPHA: Int\n val ONE_MINUS_DST_ALPHA: Int\n val DST_COLOR: Int\n val ONE_MINUS_DST_COLOR: Int\n val SRC_ALPHA_SATURATE: Int\n val FUNC_ADD: Int\n val BLEND_EQUATION: Int\n val BLEND_EQUATION_RGB: Int\n val BLEND_EQUATION_ALPHA: Int\n val FUNC_SUBTRACT: Int\n val FUNC_REVERSE_SUBTRACT: Int\n val BLEND_DST_RGB: Int\n val BLEND_SRC_RGB: Int\n val BLEND_DST_ALPHA: Int\n val BLEND_SRC_ALPHA: Int\n val CONSTANT_COLOR: Int\n val ONE_MINUS_CONSTANT_COLOR: Int\n val CONSTANT_ALPHA: Int\n val ONE_MINUS_CONSTANT_ALPHA: Int\n val BLEND_COLOR: Int\n val ARRAY_BUFFER: Int\n val ELEMENT_ARRAY_BUFFER: Int\n val ARRAY_BUFFER_BINDING: Int\n val ELEMENT_ARRAY_BUFFER_BINDING: Int\n val STREAM_DRAW: Int\n val STATIC_DRAW: Int\n val DYNAMIC_DRAW: Int\n val BUFFER_SIZE: Int\n val BUFFER_USAGE: Int\n val CURRENT_VERTEX_ATTRIB: Int\n val FRONT: Int\n val BACK: Int\n val FRONT_AND_BACK: Int\n val CULL_FACE: Int\n val BLEND: Int\n val DITHER: Int\n val STENCIL_TEST: Int\n val DEPTH_TEST: Int\n val SCISSOR_TEST: Int\n val POLYGON_OFFSET_FILL: Int\n val SAMPLE_ALPHA_TO_COVERAGE: Int\n val SAMPLE_COVERAGE: Int\n val NO_ERROR: Int\n val INVALID_ENUM: Int\n val INVALID_VALUE: Int\n val INVALID_OPERATION: Int\n val OUT_OF_MEMORY: Int\n val CW: Int\n val CCW: Int\n val LINE_WIDTH: Int\n val ALIASED_POINT_SIZE_RANGE: Int\n val ALIASED_LINE_WIDTH_RANGE: Int\n val CULL_FACE_MODE: Int\n val FRONT_FACE: Int\n val DEPTH_RANGE: Int\n val DEPTH_WRITEMASK: Int\n val DEPTH_CLEAR_VALUE: Int\n val DEPTH_FUNC: Int\n val STENCIL_CLEAR_VALUE: Int\n val STENCIL_FUNC: Int\n val STENCIL_FAIL: Int\n val STENCIL_PASS_DEPTH_FAIL: Int\n val STENCIL_PASS_DEPTH_PASS: Int\n val STENCIL_REF: Int\n val STENCIL_VALUE_MASK: Int\n val STENCIL_WRITEMASK: Int\n val STENCIL_BACK_FUNC: Int\n val STENCIL_BACK_FAIL: Int\n val STENCIL_BACK_PASS_DEPTH_FAIL: Int\n val STENCIL_BACK_PASS_DEPTH_PASS: Int\n val STENCIL_BACK_REF: Int\n val STENCIL_BACK_VALUE_MASK: Int\n val STENCIL_BACK_WRITEMASK: Int\n val VIEWPORT: Int\n val SCISSOR_BOX: Int\n val COLOR_CLEAR_VALUE: Int\n val COLOR_WRITEMASK: Int\n val UNPACK_ALIGNMENT: Int\n val PACK_ALIGNMENT: Int\n val MAX_TEXTURE_SIZE: Int\n val MAX_VIEWPORT_DIMS: Int\n val SUBPIXEL_BITS: Int\n val RED_BITS: Int\n val GREEN_BITS: Int\n val BLUE_BITS: Int\n val ALPHA_BITS: Int\n val DEPTH_BITS: Int\n val STENCIL_BITS: Int\n val POLYGON_OFFSET_UNITS: Int\n val POLYGON_OFFSET_FACTOR: Int\n val TEXTURE_BINDING_2D: Int\n val SAMPLE_BUFFERS: Int\n val SAMPLES: Int\n val SAMPLE_COVERAGE_VALUE: Int\n val SAMPLE_COVERAGE_INVERT: Int\n val COMPRESSED_TEXTURE_FORMATS: Int\n val DONT_CARE: Int\n val FASTEST: Int\n val NICEST: Int\n val GENERATE_MIPMAP_HINT: Int\n val BYTE: Int\n val UNSIGNED_BYTE: Int\n val SHORT: Int\n val UNSIGNED_SHORT: Int\n val INT: Int\n val UNSIGNED_INT: Int\n val FLOAT: Int\n val DEPTH_COMPONENT: Int\n val ALPHA: Int\n val RGB: Int\n val RGBA: Int\n val LUMINANCE: Int\n val LUMINANCE_ALPHA: Int\n val UNSIGNED_SHORT_4_4_4_4: Int\n val UNSIGNED_SHORT_5_5_5_1: Int\n val UNSIGNED_SHORT_5_6_5: Int\n val FRAGMENT_SHADER: Int\n val VERTEX_SHADER: Int\n val MAX_VERTEX_ATTRIBS: Int\n val MAX_VERTEX_UNIFORM_VECTORS: Int\n val MAX_VARYING_VECTORS: Int\n val MAX_COMBINED_TEXTURE_IMAGE_UNITS: Int\n val MAX_VERTEX_TEXTURE_IMAGE_UNITS: Int\n val MAX_TEXTURE_IMAGE_UNITS: Int\n val MAX_FRAGMENT_UNIFORM_VECTORS: Int\n val SHADER_TYPE: Int\n val DELETE_STATUS: Int\n val LINK_STATUS: Int\n val VALIDATE_STATUS: Int\n val ATTACHED_SHADERS: Int\n val ACTIVE_UNIFORMS: Int\n val ACTIVE_ATTRIBUTES: Int\n val SHADING_LANGUAGE_VERSION: Int\n val CURRENT_PROGRAM: Int\n val NEVER: Int\n val LESS: Int\n val EQUAL: Int\n val LEQUAL: Int\n val GREATER: Int\n val NOTEQUAL: Int\n val GEQUAL: Int\n val ALWAYS: Int\n val KEEP: Int\n val REPLACE: Int\n val INCR: Int\n val DECR: Int\n val INVERT: Int\n val INCR_WRAP: Int\n val DECR_WRAP: Int\n val VENDOR: Int\n val RENDERER: Int\n val VERSION: Int\n val NEAREST: Int\n val LINEAR: Int\n val NEAREST_MIPMAP_NEAREST: Int\n val LINEAR_MIPMAP_NEAREST: Int\n val NEAREST_MIPMAP_LINEAR: Int\n val LINEAR_MIPMAP_LINEAR: Int\n val TEXTURE_MAG_FILTER: Int\n val TEXTURE_MIN_FILTER: Int\n val TEXTURE_WRAP_S: Int\n val TEXTURE_WRAP_T: Int\n val TEXTURE_2D: Int\n val TEXTURE: Int\n val TEXTURE_CUBE_MAP: Int\n val TEXTURE_BINDING_CUBE_MAP: Int\n val TEXTURE_CUBE_MAP_POSITIVE_X: Int\n val TEXTURE_CUBE_MAP_NEGATIVE_X: Int\n val TEXTURE_CUBE_MAP_POSITIVE_Y: Int\n val TEXTURE_CUBE_MAP_NEGATIVE_Y: Int\n val TEXTURE_CUBE_MAP_POSITIVE_Z: Int\n val TEXTURE_CUBE_MAP_NEGATIVE_Z: Int\n val MAX_CUBE_MAP_TEXTURE_SIZE: Int\n val TEXTURE0: Int\n val TEXTURE1: Int\n val TEXTURE2: Int\n val TEXTURE3: Int\n val TEXTURE4: Int\n val TEXTURE5: Int\n val TEXTURE6: Int\n val TEXTURE7: Int\n val TEXTURE8: Int\n val TEXTURE9: Int\n val TEXTURE10: Int\n val TEXTURE11: Int\n val TEXTURE12: Int\n val TEXTURE13: Int\n val TEXTURE14: Int\n val TEXTURE15: Int\n val TEXTURE16: Int\n val TEXTURE17: Int\n val TEXTURE18: Int\n val TEXTURE19: Int\n val TEXTURE20: Int\n val TEXTURE21: Int\n val TEXTURE22: Int\n val TEXTURE23: Int\n val TEXTURE24: Int\n val TEXTURE25: Int\n val TEXTURE26: Int\n val TEXTURE27: Int\n val TEXTURE28: Int\n val TEXTURE29: Int\n val TEXTURE30: Int\n val TEXTURE31: Int\n val ACTIVE_TEXTURE: Int\n val REPEAT: Int\n val CLAMP_TO_EDGE: Int\n val MIRRORED_REPEAT: Int\n val FLOAT_VEC2: Int\n val FLOAT_VEC3: Int\n val FLOAT_VEC4: Int\n val INT_VEC2: Int\n val INT_VEC3: Int\n val INT_VEC4: Int\n val BOOL: Int\n val BOOL_VEC2: Int\n val BOOL_VEC3: Int\n val BOOL_VEC4: Int\n val FLOAT_MAT2: Int\n val FLOAT_MAT3: Int\n val FLOAT_MAT4: Int\n val SAMPLER_2D: Int\n val SAMPLER_CUBE: Int\n val VERTEX_ATTRIB_ARRAY_ENABLED: Int\n val VERTEX_ATTRIB_ARRAY_SIZE: Int\n val VERTEX_ATTRIB_ARRAY_STRIDE: Int\n val VERTEX_ATTRIB_ARRAY_TYPE: Int\n val VERTEX_ATTRIB_ARRAY_NORMALIZED: Int\n val VERTEX_ATTRIB_ARRAY_POINTER: Int\n val VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: Int\n val IMPLEMENTATION_COLOR_READ_TYPE: Int\n val IMPLEMENTATION_COLOR_READ_FORMAT: Int\n val COMPILE_STATUS: Int\n val LOW_FLOAT: Int\n val MEDIUM_FLOAT: Int\n val HIGH_FLOAT: Int\n val LOW_INT: Int\n val MEDIUM_INT: Int\n val HIGH_INT: Int\n val FRAMEBUFFER: Int\n val RENDERBUFFER: Int\n val RGBA4: Int\n val RGB5_A1: Int\n val RGB565: Int\n val DEPTH_COMPONENT16: Int\n val STENCIL_INDEX: Int\n val STENCIL_INDEX8: Int\n val DEPTH_STENCIL: Int\n val RENDERBUFFER_WIDTH: Int\n val RENDERBUFFER_HEIGHT: Int\n val RENDERBUFFER_INTERNAL_FORMAT: Int\n val RENDERBUFFER_RED_SIZE: Int\n val RENDERBUFFER_GREEN_SIZE: Int\n val RENDERBUFFER_BLUE_SIZE: Int\n val RENDERBUFFER_ALPHA_SIZE: Int\n val RENDERBUFFER_DEPTH_SIZE: Int\n val RENDERBUFFER_STENCIL_SIZE: Int\n val FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: Int\n val FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: Int\n val FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: Int\n val FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: Int\n val COLOR_ATTACHMENT0: Int\n val DEPTH_ATTACHMENT: Int\n val STENCIL_ATTACHMENT: Int\n val DEPTH_STENCIL_ATTACHMENT: Int\n val NONE: Int\n val FRAMEBUFFER_COMPLETE: Int\n val FRAMEBUFFER_INCOMPLETE_ATTACHMENT: Int\n val FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: Int\n val FRAMEBUFFER_INCOMPLETE_DIMENSIONS: Int\n val FRAMEBUFFER_UNSUPPORTED: Int\n val FRAMEBUFFER_BINDING: Int\n val RENDERBUFFER_BINDING: Int\n val MAX_RENDERBUFFER_SIZE: Int\n val INVALID_FRAMEBUFFER_OPERATION: Int\n val UNPACK_FLIP_Y_WEBGL: Int\n val UNPACK_PREMULTIPLY_ALPHA_WEBGL: Int\n val CONTEXT_LOST_WEBGL: Int\n val UNPACK_COLORSPACE_CONVERSION_WEBGL: Int\n val BROWSER_DEFAULT_WEBGL: Int\n }\n}\n\n/**\n * Exposes the JavaScript [WebGLRenderingContext](https://developer.mozilla.org/en/docs/Web/API/WebGLRenderingContext) to Kotlin\n */\npublic external abstract class WebGLRenderingContext : WebGLRenderingContextBase, RenderingContext {\n companion object {\n val DEPTH_BUFFER_BIT: Int\n val STENCIL_BUFFER_BIT: Int\n val COLOR_BUFFER_BIT: Int\n val POINTS: Int\n val LINES: Int\n val LINE_LOOP: Int\n val LINE_STRIP: Int\n val TRIANGLES: Int\n val TRIANGLE_STRIP: Int\n val TRIANGLE_FAN: Int\n val ZERO: Int\n val ONE: Int\n val SRC_COLOR: Int\n val ONE_MINUS_SRC_COLOR: Int\n val SRC_ALPHA: Int\n val ONE_MINUS_SRC_ALPHA: Int\n val DST_ALPHA: Int\n val ONE_MINUS_DST_ALPHA: Int\n val DST_COLOR: Int\n val ONE_MINUS_DST_COLOR: Int\n val SRC_ALPHA_SATURATE: Int\n val FUNC_ADD: Int\n val BLEND_EQUATION: Int\n val BLEND_EQUATION_RGB: Int\n val BLEND_EQUATION_ALPHA: Int\n val FUNC_SUBTRACT: Int\n val FUNC_REVERSE_SUBTRACT: Int\n val BLEND_DST_RGB: Int\n val BLEND_SRC_RGB: Int\n val BLEND_DST_ALPHA: Int\n val BLEND_SRC_ALPHA: Int\n val CONSTANT_COLOR: Int\n val ONE_MINUS_CONSTANT_COLOR: Int\n val CONSTANT_ALPHA: Int\n val ONE_MINUS_CONSTANT_ALPHA: Int\n val BLEND_COLOR: Int\n val ARRAY_BUFFER: Int\n val ELEMENT_ARRAY_BUFFER: Int\n val ARRAY_BUFFER_BINDING: Int\n val ELEMENT_ARRAY_BUFFER_BINDING: Int\n val STREAM_DRAW: Int\n val STATIC_DRAW: Int\n val DYNAMIC_DRAW: Int\n val BUFFER_SIZE: Int\n val BUFFER_USAGE: Int\n val CURRENT_VERTEX_ATTRIB: Int\n val FRONT: Int\n val BACK: Int\n val FRONT_AND_BACK: Int\n val CULL_FACE: Int\n val BLEND: Int\n val DITHER: Int\n val STENCIL_TEST: Int\n val DEPTH_TEST: Int\n val SCISSOR_TEST: Int\n val POLYGON_OFFSET_FILL: Int\n val SAMPLE_ALPHA_TO_COVERAGE: Int\n val SAMPLE_COVERAGE: Int\n val NO_ERROR: Int\n val INVALID_ENUM: Int\n val INVALID_VALUE: Int\n val INVALID_OPERATION: Int\n val OUT_OF_MEMORY: Int\n val CW: Int\n val CCW: Int\n val LINE_WIDTH: Int\n val ALIASED_POINT_SIZE_RANGE: Int\n val ALIASED_LINE_WIDTH_RANGE: Int\n val CULL_FACE_MODE: Int\n val FRONT_FACE: Int\n val DEPTH_RANGE: Int\n val DEPTH_WRITEMASK: Int\n val DEPTH_CLEAR_VALUE: Int\n val DEPTH_FUNC: Int\n val STENCIL_CLEAR_VALUE: Int\n val STENCIL_FUNC: Int\n val STENCIL_FAIL: Int\n val STENCIL_PASS_DEPTH_FAIL: Int\n val STENCIL_PASS_DEPTH_PASS: Int\n val STENCIL_REF: Int\n val STENCIL_VALUE_MASK: Int\n val STENCIL_WRITEMASK: Int\n val STENCIL_BACK_FUNC: Int\n val STENCIL_BACK_FAIL: Int\n val STENCIL_BACK_PASS_DEPTH_FAIL: Int\n val STENCIL_BACK_PASS_DEPTH_PASS: Int\n val STENCIL_BACK_REF: Int\n val STENCIL_BACK_VALUE_MASK: Int\n val STENCIL_BACK_WRITEMASK: Int\n val VIEWPORT: Int\n val SCISSOR_BOX: Int\n val COLOR_CLEAR_VALUE: Int\n val COLOR_WRITEMASK: Int\n val UNPACK_ALIGNMENT: Int\n val PACK_ALIGNMENT: Int\n val MAX_TEXTURE_SIZE: Int\n val MAX_VIEWPORT_DIMS: Int\n val SUBPIXEL_BITS: Int\n val RED_BITS: Int\n val GREEN_BITS: Int\n val BLUE_BITS: Int\n val ALPHA_BITS: Int\n val DEPTH_BITS: Int\n val STENCIL_BITS: Int\n val POLYGON_OFFSET_UNITS: Int\n val POLYGON_OFFSET_FACTOR: Int\n val TEXTURE_BINDING_2D: Int\n val SAMPLE_BUFFERS: Int\n val SAMPLES: Int\n val SAMPLE_COVERAGE_VALUE: Int\n val SAMPLE_COVERAGE_INVERT: Int\n val COMPRESSED_TEXTURE_FORMATS: Int\n val DONT_CARE: Int\n val FASTEST: Int\n val NICEST: Int\n val GENERATE_MIPMAP_HINT: Int\n val BYTE: Int\n val UNSIGNED_BYTE: Int\n val SHORT: Int\n val UNSIGNED_SHORT: Int\n val INT: Int\n val UNSIGNED_INT: Int\n val FLOAT: Int\n val DEPTH_COMPONENT: Int\n val ALPHA: Int\n val RGB: Int\n val RGBA: Int\n val LUMINANCE: Int\n val LUMINANCE_ALPHA: Int\n val UNSIGNED_SHORT_4_4_4_4: Int\n val UNSIGNED_SHORT_5_5_5_1: Int\n val UNSIGNED_SHORT_5_6_5: Int\n val FRAGMENT_SHADER: Int\n val VERTEX_SHADER: Int\n val MAX_VERTEX_ATTRIBS: Int\n val MAX_VERTEX_UNIFORM_VECTORS: Int\n val MAX_VARYING_VECTORS: Int\n val MAX_COMBINED_TEXTURE_IMAGE_UNITS: Int\n val MAX_VERTEX_TEXTURE_IMAGE_UNITS: Int\n val MAX_TEXTURE_IMAGE_UNITS: Int\n val MAX_FRAGMENT_UNIFORM_VECTORS: Int\n val SHADER_TYPE: Int\n val DELETE_STATUS: Int\n val LINK_STATUS: Int\n val VALIDATE_STATUS: Int\n val ATTACHED_SHADERS: Int\n val ACTIVE_UNIFORMS: Int\n val ACTIVE_ATTRIBUTES: Int\n val SHADING_LANGUAGE_VERSION: Int\n val CURRENT_PROGRAM: Int\n val NEVER: Int\n val LESS: Int\n val EQUAL: Int\n val LEQUAL: Int\n val GREATER: Int\n val NOTEQUAL: Int\n val GEQUAL: Int\n val ALWAYS: Int\n val KEEP: Int\n val REPLACE: Int\n val INCR: Int\n val DECR: Int\n val INVERT: Int\n val INCR_WRAP: Int\n val DECR_WRAP: Int\n val VENDOR: Int\n val RENDERER: Int\n val VERSION: Int\n val NEAREST: Int\n val LINEAR: Int\n val NEAREST_MIPMAP_NEAREST: Int\n val LINEAR_MIPMAP_NEAREST: Int\n val NEAREST_MIPMAP_LINEAR: Int\n val LINEAR_MIPMAP_LINEAR: Int\n val TEXTURE_MAG_FILTER: Int\n val TEXTURE_MIN_FILTER: Int\n val TEXTURE_WRAP_S: Int\n val TEXTURE_WRAP_T: Int\n val TEXTURE_2D: Int\n val TEXTURE: Int\n val TEXTURE_CUBE_MAP: Int\n val TEXTURE_BINDING_CUBE_MAP: Int\n val TEXTURE_CUBE_MAP_POSITIVE_X: Int\n val TEXTURE_CUBE_MAP_NEGATIVE_X: Int\n val TEXTURE_CUBE_MAP_POSITIVE_Y: Int\n val TEXTURE_CUBE_MAP_NEGATIVE_Y: Int\n val TEXTURE_CUBE_MAP_POSITIVE_Z: Int\n val TEXTURE_CUBE_MAP_NEGATIVE_Z: Int\n val MAX_CUBE_MAP_TEXTURE_SIZE: Int\n val TEXTURE0: Int\n val TEXTURE1: Int\n val TEXTURE2: Int\n val TEXTURE3: Int\n val TEXTURE4: Int\n val TEXTURE5: Int\n val TEXTURE6: Int\n val TEXTURE7: Int\n val TEXTURE8: Int\n val TEXTURE9: Int\n val TEXTURE10: Int\n val TEXTURE11: Int\n val TEXTURE12: Int\n val TEXTURE13: Int\n val TEXTURE14: Int\n val TEXTURE15: Int\n val TEXTURE16: Int\n val TEXTURE17: Int\n val TEXTURE18: Int\n val TEXTURE19: Int\n val TEXTURE20: Int\n val TEXTURE21: Int\n val TEXTURE22: Int\n val TEXTURE23: Int\n val TEXTURE24: Int\n val TEXTURE25: Int\n val TEXTURE26: Int\n val TEXTURE27: Int\n val TEXTURE28: Int\n val TEXTURE29: Int\n val TEXTURE30: Int\n val TEXTURE31: Int\n val ACTIVE_TEXTURE: Int\n val REPEAT: Int\n val CLAMP_TO_EDGE: Int\n val MIRRORED_REPEAT: Int\n val FLOAT_VEC2: Int\n val FLOAT_VEC3: Int\n val FLOAT_VEC4: Int\n val INT_VEC2: Int\n val INT_VEC3: Int\n val INT_VEC4: Int\n val BOOL: Int\n val BOOL_VEC2: Int\n val BOOL_VEC3: Int\n val BOOL_VEC4: Int\n val FLOAT_MAT2: Int\n val FLOAT_MAT3: Int\n val FLOAT_MAT4: Int\n val SAMPLER_2D: Int\n val SAMPLER_CUBE: Int\n val VERTEX_ATTRIB_ARRAY_ENABLED: Int\n val VERTEX_ATTRIB_ARRAY_SIZE: Int\n val VERTEX_ATTRIB_ARRAY_STRIDE: Int\n val VERTEX_ATTRIB_ARRAY_TYPE: Int\n val VERTEX_ATTRIB_ARRAY_NORMALIZED: Int\n val VERTEX_ATTRIB_ARRAY_POINTER: Int\n val VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: Int\n val IMPLEMENTATION_COLOR_READ_TYPE: Int\n val IMPLEMENTATION_COLOR_READ_FORMAT: Int\n val COMPILE_STATUS: Int\n val LOW_FLOAT: Int\n val MEDIUM_FLOAT: Int\n val HIGH_FLOAT: Int\n val LOW_INT: Int\n val MEDIUM_INT: Int\n val HIGH_INT: Int\n val FRAMEBUFFER: Int\n val RENDERBUFFER: Int\n val RGBA4: Int\n val RGB5_A1: Int\n val RGB565: Int\n val DEPTH_COMPONENT16: Int\n val STENCIL_INDEX: Int\n val STENCIL_INDEX8: Int\n val DEPTH_STENCIL: Int\n val RENDERBUFFER_WIDTH: Int\n val RENDERBUFFER_HEIGHT: Int\n val RENDERBUFFER_INTERNAL_FORMAT: Int\n val RENDERBUFFER_RED_SIZE: Int\n val RENDERBUFFER_GREEN_SIZE: Int\n val RENDERBUFFER_BLUE_SIZE: Int\n val RENDERBUFFER_ALPHA_SIZE: Int\n val RENDERBUFFER_DEPTH_SIZE: Int\n val RENDERBUFFER_STENCIL_SIZE: Int\n val FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: Int\n val FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: Int\n val FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: Int\n val FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: Int\n val COLOR_ATTACHMENT0: Int\n val DEPTH_ATTACHMENT: Int\n val STENCIL_ATTACHMENT: Int\n val DEPTH_STENCIL_ATTACHMENT: Int\n val NONE: Int\n val FRAMEBUFFER_COMPLETE: Int\n val FRAMEBUFFER_INCOMPLETE_ATTACHMENT: Int\n val FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: Int\n val FRAMEBUFFER_INCOMPLETE_DIMENSIONS: Int\n val FRAMEBUFFER_UNSUPPORTED: Int\n val FRAMEBUFFER_BINDING: Int\n val RENDERBUFFER_BINDING: Int\n val MAX_RENDERBUFFER_SIZE: Int\n val INVALID_FRAMEBUFFER_OPERATION: Int\n val UNPACK_FLIP_Y_WEBGL: Int\n val UNPACK_PREMULTIPLY_ALPHA_WEBGL: Int\n val CONTEXT_LOST_WEBGL: Int\n val UNPACK_COLORSPACE_CONVERSION_WEBGL: Int\n val BROWSER_DEFAULT_WEBGL: Int\n }\n}\n\n/**\n * Exposes the JavaScript [WebGLContextEvent](https://developer.mozilla.org/en/docs/Web/API/WebGLContextEvent) to Kotlin\n */\npublic external open class WebGLContextEvent(type: String, eventInit: WebGLContextEventInit = definedExternally) : Event {\n open val statusMessage: String\n\n companion object {\n val NONE: Short\n val CAPTURING_PHASE: Short\n val AT_TARGET: Short\n val BUBBLING_PHASE: Short\n }\n}\n\npublic external interface WebGLContextEventInit : EventInit {\n var statusMessage: String? /* = \"\" */\n get() = definedExternally\n set(value) = definedExternally\n}\n\n@kotlin.internal.InlineOnly\npublic inline fun WebGLContextEventInit(statusMessage: String? = \"\", bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): WebGLContextEventInit {\n val o = js(\"({})\")\n o[\"statusMessage\"] = statusMessage\n o[\"bubbles\"] = bubbles\n o[\"cancelable\"] = cancelable\n o[\"composed\"] = composed\n return o\n}\n\n/**\n * Exposes the JavaScript [ArrayBuffer](https://developer.mozilla.org/en/docs/Web/API/ArrayBuffer) to Kotlin\n */\npublic external open class ArrayBuffer(length: Int) : BufferDataSource {\n open val byteLength: Int\n fun slice(begin: Int, end: Int = definedExternally): ArrayBuffer\n\n companion object {\n fun isView(value: Any?): Boolean\n }\n}\n\n/**\n * Exposes the JavaScript [ArrayBufferView](https://developer.mozilla.org/en/docs/Web/API/ArrayBufferView) to Kotlin\n */\npublic external interface ArrayBufferView : BufferDataSource {\n val buffer: ArrayBuffer\n val byteOffset: Int\n val byteLength: Int\n}\n\n/**\n * Exposes the JavaScript [Int8Array](https://developer.mozilla.org/en/docs/Web/API/Int8Array) to Kotlin\n */\npublic external open class Int8Array : ArrayBufferView {\n constructor(length: Int)\n constructor(array: Int8Array)\n constructor(array: Array)\n constructor(buffer: ArrayBuffer, byteOffset: Int = definedExternally, length: Int = definedExternally)\n open val length: Int\n override val buffer: ArrayBuffer\n override val byteOffset: Int\n override val byteLength: Int\n fun set(array: Int8Array, offset: Int = definedExternally)\n fun set(array: Array, offset: Int = definedExternally)\n fun subarray(start: Int, end: Int): Int8Array\n\n companion object {\n val BYTES_PER_ELEMENT: Int\n }\n}\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Int8Array.get(index: Int): Byte = asDynamic()[index]\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Int8Array.set(index: Int, value: Byte) { asDynamic()[index] = value }\n\n/**\n * Exposes the JavaScript [Uint8Array](https://developer.mozilla.org/en/docs/Web/API/Uint8Array) to Kotlin\n */\npublic external open class Uint8Array : ArrayBufferView {\n constructor(length: Int)\n constructor(array: Uint8Array)\n constructor(array: Array)\n constructor(buffer: ArrayBuffer, byteOffset: Int = definedExternally, length: Int = definedExternally)\n open val length: Int\n override val buffer: ArrayBuffer\n override val byteOffset: Int\n override val byteLength: Int\n fun set(array: Uint8Array, offset: Int = definedExternally)\n fun set(array: Array, offset: Int = definedExternally)\n fun subarray(start: Int, end: Int): Uint8Array\n\n companion object {\n val BYTES_PER_ELEMENT: Int\n }\n}\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Uint8Array.get(index: Int): Byte = asDynamic()[index]\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Uint8Array.set(index: Int, value: Byte) { asDynamic()[index] = value }\n\n/**\n * Exposes the JavaScript [Uint8ClampedArray](https://developer.mozilla.org/en/docs/Web/API/Uint8ClampedArray) to Kotlin\n */\npublic external open class Uint8ClampedArray : ArrayBufferView {\n constructor(length: Int)\n constructor(array: Uint8ClampedArray)\n constructor(array: Array)\n constructor(buffer: ArrayBuffer, byteOffset: Int = definedExternally, length: Int = definedExternally)\n open val length: Int\n override val buffer: ArrayBuffer\n override val byteOffset: Int\n override val byteLength: Int\n fun set(array: Uint8ClampedArray, offset: Int = definedExternally)\n fun set(array: Array, offset: Int = definedExternally)\n fun subarray(start: Int, end: Int): Uint8ClampedArray\n\n companion object {\n val BYTES_PER_ELEMENT: Int\n }\n}\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Uint8ClampedArray.get(index: Int): Byte = asDynamic()[index]\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Uint8ClampedArray.set(index: Int, value: Byte) { asDynamic()[index] = value }\n\n/**\n * Exposes the JavaScript [Int16Array](https://developer.mozilla.org/en/docs/Web/API/Int16Array) to Kotlin\n */\npublic external open class Int16Array : ArrayBufferView {\n constructor(length: Int)\n constructor(array: Int16Array)\n constructor(array: Array)\n constructor(buffer: ArrayBuffer, byteOffset: Int = definedExternally, length: Int = definedExternally)\n open val length: Int\n override val buffer: ArrayBuffer\n override val byteOffset: Int\n override val byteLength: Int\n fun set(array: Int16Array, offset: Int = definedExternally)\n fun set(array: Array, offset: Int = definedExternally)\n fun subarray(start: Int, end: Int): Int16Array\n\n companion object {\n val BYTES_PER_ELEMENT: Int\n }\n}\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Int16Array.get(index: Int): Short = asDynamic()[index]\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Int16Array.set(index: Int, value: Short) { asDynamic()[index] = value }\n\n/**\n * Exposes the JavaScript [Uint16Array](https://developer.mozilla.org/en/docs/Web/API/Uint16Array) to Kotlin\n */\npublic external open class Uint16Array : ArrayBufferView {\n constructor(length: Int)\n constructor(array: Uint16Array)\n constructor(array: Array)\n constructor(buffer: ArrayBuffer, byteOffset: Int = definedExternally, length: Int = definedExternally)\n open val length: Int\n override val buffer: ArrayBuffer\n override val byteOffset: Int\n override val byteLength: Int\n fun set(array: Uint16Array, offset: Int = definedExternally)\n fun set(array: Array, offset: Int = definedExternally)\n fun subarray(start: Int, end: Int): Uint16Array\n\n companion object {\n val BYTES_PER_ELEMENT: Int\n }\n}\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Uint16Array.get(index: Int): Short = asDynamic()[index]\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Uint16Array.set(index: Int, value: Short) { asDynamic()[index] = value }\n\n/**\n * Exposes the JavaScript [Int32Array](https://developer.mozilla.org/en/docs/Web/API/Int32Array) to Kotlin\n */\npublic external open class Int32Array : ArrayBufferView {\n constructor(length: Int)\n constructor(array: Int32Array)\n constructor(array: Array)\n constructor(buffer: ArrayBuffer, byteOffset: Int = definedExternally, length: Int = definedExternally)\n open val length: Int\n override val buffer: ArrayBuffer\n override val byteOffset: Int\n override val byteLength: Int\n fun set(array: Int32Array, offset: Int = definedExternally)\n fun set(array: Array, offset: Int = definedExternally)\n fun subarray(start: Int, end: Int): Int32Array\n\n companion object {\n val BYTES_PER_ELEMENT: Int\n }\n}\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Int32Array.get(index: Int): Int = asDynamic()[index]\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Int32Array.set(index: Int, value: Int) { asDynamic()[index] = value }\n\n/**\n * Exposes the JavaScript [Uint32Array](https://developer.mozilla.org/en/docs/Web/API/Uint32Array) to Kotlin\n */\npublic external open class Uint32Array : ArrayBufferView {\n constructor(length: Int)\n constructor(array: Uint32Array)\n constructor(array: Array)\n constructor(buffer: ArrayBuffer, byteOffset: Int = definedExternally, length: Int = definedExternally)\n open val length: Int\n override val buffer: ArrayBuffer\n override val byteOffset: Int\n override val byteLength: Int\n fun set(array: Uint32Array, offset: Int = definedExternally)\n fun set(array: Array, offset: Int = definedExternally)\n fun subarray(start: Int, end: Int): Uint32Array\n\n companion object {\n val BYTES_PER_ELEMENT: Int\n }\n}\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Uint32Array.get(index: Int): Int = asDynamic()[index]\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Uint32Array.set(index: Int, value: Int) { asDynamic()[index] = value }\n\n/**\n * Exposes the JavaScript [Float32Array](https://developer.mozilla.org/en/docs/Web/API/Float32Array) to Kotlin\n */\npublic external open class Float32Array : ArrayBufferView {\n constructor(length: Int)\n constructor(array: Float32Array)\n constructor(array: Array)\n constructor(buffer: ArrayBuffer, byteOffset: Int = definedExternally, length: Int = definedExternally)\n open val length: Int\n override val buffer: ArrayBuffer\n override val byteOffset: Int\n override val byteLength: Int\n fun set(array: Float32Array, offset: Int = definedExternally)\n fun set(array: Array, offset: Int = definedExternally)\n fun subarray(start: Int, end: Int): Float32Array\n\n companion object {\n val BYTES_PER_ELEMENT: Int\n }\n}\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Float32Array.get(index: Int): Float = asDynamic()[index]\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Float32Array.set(index: Int, value: Float) { asDynamic()[index] = value }\n\n/**\n * Exposes the JavaScript [Float64Array](https://developer.mozilla.org/en/docs/Web/API/Float64Array) to Kotlin\n */\npublic external open class Float64Array : ArrayBufferView {\n constructor(length: Int)\n constructor(array: Float64Array)\n constructor(array: Array)\n constructor(buffer: ArrayBuffer, byteOffset: Int = definedExternally, length: Int = definedExternally)\n open val length: Int\n override val buffer: ArrayBuffer\n override val byteOffset: Int\n override val byteLength: Int\n fun set(array: Float64Array, offset: Int = definedExternally)\n fun set(array: Array, offset: Int = definedExternally)\n fun subarray(start: Int, end: Int): Float64Array\n\n companion object {\n val BYTES_PER_ELEMENT: Int\n }\n}\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Float64Array.get(index: Int): Double = asDynamic()[index]\n\n@kotlin.internal.InlineOnly\npublic inline operator fun Float64Array.set(index: Int, value: Double) { asDynamic()[index] = value }\n\n/**\n * Exposes the JavaScript [DataView](https://developer.mozilla.org/en/docs/Web/API/DataView) to Kotlin\n */\npublic external open class DataView(buffer: ArrayBuffer, byteOffset: Int = definedExternally, byteLength: Int = definedExternally) : ArrayBufferView {\n override val buffer: ArrayBuffer\n override val byteOffset: Int\n override val byteLength: Int\n fun getInt8(byteOffset: Int): Byte\n fun getUint8(byteOffset: Int): Byte\n fun getInt16(byteOffset: Int, littleEndian: Boolean = definedExternally): Short\n fun getUint16(byteOffset: Int, littleEndian: Boolean = definedExternally): Short\n fun getInt32(byteOffset: Int, littleEndian: Boolean = definedExternally): Int\n fun getUint32(byteOffset: Int, littleEndian: Boolean = definedExternally): Int\n fun getFloat32(byteOffset: Int, littleEndian: Boolean = definedExternally): Float\n fun getFloat64(byteOffset: Int, littleEndian: Boolean = definedExternally): Double\n fun setInt8(byteOffset: Int, value: Byte)\n fun setUint8(byteOffset: Int, value: Byte)\n fun setInt16(byteOffset: Int, value: Short, littleEndian: Boolean = definedExternally)\n fun setUint16(byteOffset: Int, value: Short, littleEndian: Boolean = definedExternally)\n fun setInt32(byteOffset: Int, value: Int, littleEndian: Boolean = definedExternally)\n fun setUint32(byteOffset: Int, value: Int, littleEndian: Boolean = definedExternally)\n fun setFloat32(byteOffset: Int, value: Float, littleEndian: Boolean = definedExternally)\n fun setFloat64(byteOffset: Int, value: Double, littleEndian: Boolean = definedExternally)\n}\n\npublic external interface BufferDataSource\n\npublic external interface TexImageSource","package io.ktor.utils.io.charsets\n\nimport io.ktor.utils.io.core.*\nimport io.ktor.utils.io.js.*\nimport org.khronos.webgl.*\n\npublic actual abstract class Charset(internal val _name: String) {\n public actual abstract fun newEncoder(): CharsetEncoder\n public actual abstract fun newDecoder(): CharsetDecoder\n\n public actual companion object {\n public actual fun forName(name: String): Charset {\n if (name == \"UTF-8\" || name == \"utf-8\" || name == \"UTF8\" || name == \"utf8\") return Charsets.UTF_8\n if (name == \"ISO-8859-1\" || name == \"iso-8859-1\" || name.replace('_', '-').let {\n it == \"iso-8859-1\" || it.toLowerCase() == \"iso-8859-1\"\n } || name == \"latin1\"\n ) {\n return Charsets.ISO_8859_1\n }\n throw IllegalArgumentException(\"Charset $name is not supported\")\n }\n }\n}\n\npublic actual val Charset.name: String get() = _name\n\n// -----------------------\n\npublic actual abstract class CharsetEncoder(internal val _charset: Charset)\nprivate data class CharsetEncoderImpl(private val charset: Charset) : CharsetEncoder(charset)\npublic actual val CharsetEncoder.charset: Charset get() = _charset\n\npublic actual fun CharsetEncoder.encodeToByteArray(input: CharSequence, fromIndex: Int, toIndex: Int): ByteArray =\n encodeToByteArrayImpl1(input, fromIndex, toIndex)\n\ninternal actual fun CharsetEncoder.encodeImpl(input: CharSequence, fromIndex: Int, toIndex: Int, dst: Buffer): Int {\n require(fromIndex <= toIndex)\n if (charset == Charsets.ISO_8859_1) {\n return encodeISO88591(input, fromIndex, toIndex, dst)\n }\n\n require(charset === Charsets.UTF_8) { \"Only UTF-8 encoding is supported in JS\" }\n\n val encoder = TextEncoder() // Only UTF-8 is supported so we know that at most 6 bytes per character is used\n var start = fromIndex\n var dstRemaining = dst.writeRemaining\n\n while (start < toIndex && dstRemaining > 0) {\n val numChars = minOf(toIndex - start, dstRemaining / 6).coerceAtLeast(1)\n val dropLastChar = input[start + numChars - 1].isHighSurrogate()\n val endIndexExclusive = when {\n dropLastChar && numChars == 1 -> start + 2\n dropLastChar -> start + numChars - 1\n else -> start + numChars\n }\n\n val array1 = encoder.encode(input.substring(start, endIndexExclusive))\n if (array1.length > dstRemaining) break\n dst.writeFully(array1)\n start = endIndexExclusive\n dstRemaining -= array1.length\n }\n\n return start - fromIndex\n}\n\npublic actual fun CharsetEncoder.encodeUTF8(input: ByteReadPacket, dst: Output) {\n require(charset === Charsets.UTF_8)\n // we only support UTF-8 so as far as input is UTF-8 encoded string then we simply copy bytes\n dst.writePacket(input)\n}\n\ninternal actual fun CharsetEncoder.encodeComplete(dst: Buffer): Boolean = true\n\n// ----------------------------------------------------------------------\n\npublic actual abstract class CharsetDecoder(internal val _charset: Charset)\n\nprivate data class CharsetDecoderImpl(private val charset: Charset) : CharsetDecoder(charset)\n\npublic actual val CharsetDecoder.charset: Charset get() = _charset\n\ninternal actual fun CharsetDecoder.decodeBuffer(\n input: Buffer,\n out: Appendable,\n lastBuffer: Boolean,\n max: Int\n): Int {\n if (max == 0) return 0\n\n val decoder = Decoder(charset.name)\n val copied: Int\n\n input.readDirectInt8Array { view ->\n val result = view.decodeBufferImpl(decoder, max)\n out.append(result.charactersDecoded)\n copied = result.bytesConsumed\n\n result.bytesConsumed\n }\n\n return copied\n}\n\npublic actual fun CharsetDecoder.decode(input: Input, dst: Appendable, max: Int): Int {\n val decoder = Decoder(charset.name, true)\n var charactersCopied = 0\n\n // use decode stream while we have remaining characters count > buffer size in bytes\n // it is much faster than using decodeBufferImpl\n input.takeWhileSize { buffer ->\n val rem = max - charactersCopied\n val bufferSize = buffer.readRemaining\n if (rem < bufferSize) return@takeWhileSize 0\n\n buffer.readDirectInt8Array { view ->\n val decodedText = decodeWrap {\n decoder.decodeStream(view, stream = true)\n }\n dst.append(decodedText)\n charactersCopied += decodedText.length\n view.byteLength\n }\n\n when {\n charactersCopied == max -> {\n val tail = try {\n decoder.decode()\n } catch (_: dynamic) {\n \"\"\n }\n\n if (tail.isNotEmpty()) {\n // if we have a trailing byte then we can't handle this chunk via fast-path\n // because we don't know how many bytes in the end we need to preserve\n buffer.rewind(bufferSize)\n }\n 0\n }\n charactersCopied < max -> MAX_CHARACTERS_SIZE_IN_BYTES\n else -> 0\n }\n }\n\n if (charactersCopied < max) {\n var size = 1\n input.takeWhileSize(1) { buffer ->\n val rc = buffer.readDirectInt8Array { view ->\n val result = view.decodeBufferImpl(decoder, max - charactersCopied)\n dst.append(result.charactersDecoded)\n charactersCopied += result.charactersDecoded.length\n result.bytesConsumed\n }\n when {\n rc > 0 -> size = 1\n size == MAX_CHARACTERS_SIZE_IN_BYTES -> size = 0\n else -> size++\n }\n\n size\n }\n }\n\n return charactersCopied\n}\n\npublic actual fun CharsetDecoder.decodeExactBytes(input: Input, inputLength: Int): String {\n if (inputLength == 0) return \"\"\n if (input is AbstractInput && input.headRemaining >= inputLength) {\n val decoder = Decoder(charset._name, true)\n\n val head = input.head\n val view = input.headMemory.view\n\n val text = decodeWrap {\n val subView: ArrayBufferView = when {\n head.readPosition == 0 && inputLength == view.byteLength -> view\n else -> DataView(view.buffer, view.byteOffset + head.readPosition, inputLength)\n }\n\n decoder.decode(subView)\n }\n\n input.discardExact(inputLength)\n return text\n }\n\n return decodeExactBytesSlow(input, inputLength)\n}\n\n// -----------------------------------------------------------\n\npublic actual object Charsets {\n public actual val UTF_8: Charset = CharsetImpl(\"UTF-8\")\n public actual val ISO_8859_1: Charset = CharsetImpl(\"ISO-8859-1\")\n}\n\nprivate data class CharsetImpl(val name: String) : Charset(name) {\n override fun newEncoder(): CharsetEncoder = CharsetEncoderImpl(this)\n override fun newDecoder(): CharsetDecoder = CharsetDecoderImpl(this)\n}\n\npublic actual open class MalformedInputException actual constructor(message: String) : Throwable(message)\n\nprivate fun CharsetDecoder.decodeExactBytesSlow(input: Input, inputLength: Int): String {\n val decoder = Decoder(charset.name, true)\n var inputRemaining = inputLength\n val sb = StringBuilder(inputLength)\n\n decodeWrap {\n input.takeWhileSize(6) { buffer ->\n val chunkSize = buffer.readRemaining\n val size = minOf(chunkSize, inputRemaining)\n val text = when {\n buffer.readPosition == 0 && buffer.memory.view.byteLength == size -> decoder.decodeStream(\n buffer.memory.view,\n true\n )\n else -> decoder.decodeStream(\n Int8Array(\n buffer.memory.view.buffer,\n buffer.memory.view.byteOffset + buffer.readPosition,\n size\n ),\n true\n )\n }\n sb.append(text)\n\n buffer.discardExact(size)\n inputRemaining -= size\n\n if (inputRemaining > 0) 6 else 0\n }\n\n if (inputRemaining > 0) {\n input.takeWhile { buffer ->\n val chunkSize = buffer.readRemaining\n val size = minOf(chunkSize, inputRemaining)\n val text = when {\n buffer.readPosition == 0 && buffer.memory.view.byteLength == size -> {\n decoder.decode(buffer.memory.view)\n }\n else -> decoder.decodeStream(\n Int8Array(\n buffer.memory.view.buffer,\n buffer.memory.view.byteOffset + buffer.readPosition,\n size\n ),\n true\n )\n }\n sb.append(text)\n buffer.discardExact(size)\n inputRemaining -= size\n true\n }\n }\n\n sb.append(decoder.decode())\n }\n\n if (inputRemaining > 0) {\n throw EOFException(\n \"Not enough bytes available: had only ${inputLength - inputRemaining} instead of $inputLength\"\n )\n }\n return sb.toString()\n}\n","package io.ktor.utils.io.js\n\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.*\nimport org.khronos.webgl.*\n\n@Deprecated(\n \"Use readText with charset instead\",\n ReplaceWith(\n \"readText(Charset.forName(encoding), max)\",\n \"io.ktor.utils.io.core.readText\",\n \"io.ktor.utils.io.charsets.Charset\"\n )\n)\npublic fun ByteReadPacket.readText(encoding: String, max: Int = Int.MAX_VALUE): String =\n readText(Charset.forName(encoding), max)\n\n@Deprecated(\n \"Use readText with charset instead\",\n ReplaceWith(\n \"readText(out, Charset.forName(encoding), max)\",\n \"io.ktor.utils.io.core.readText\",\n \"io.ktor.utils.io.charsets.Charset\"\n )\n)\npublic fun ByteReadPacket.readText(encoding: String = \"UTF-8\", out: Appendable, max: Int = Int.MAX_VALUE): Int {\n return readText(out, Charset.forName(encoding), max)\n}\n\ninternal inline fun decodeWrap(block: () -> R): R {\n try {\n return block()\n } catch (t: Throwable) {\n throw MalformedInputException(\"Failed to decode bytes: ${t.message ?: \"no cause provided\"}\")\n }\n}\n","/*\n * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.utils.io.js\n\nimport org.khronos.webgl.*\n\ninternal fun Decoder(encoding: String, fatal: Boolean = true): Decoder = try {\n TextDecoder(encoding, textDecoderOptions(fatal)).toKtor()\n} catch (cause: Throwable) {\n TextDecoderFallback(encoding, fatal)\n}\n\ninternal interface Decoder {\n fun decode(): String\n fun decode(buffer: ArrayBufferView): String\n fun decode(buffer: ArrayBufferView, options: dynamic): String\n}\n\ninternal inline fun Decoder.decodeStream(buffer: ArrayBufferView, stream: Boolean): String {\n decodeWrap {\n return decode(buffer, decodeOptions(stream))\n }\n}\n\ninternal fun decodeOptions(stream: Boolean): dynamic = Any().apply {\n with(this.asDynamic()) {\n this.stream = stream\n }\n}\n","package io.ktor.utils.io.charsets\n\nimport io.ktor.utils.io.js.*\nimport org.khronos.webgl.*\n\n// I don't know any characters that have longer characters\ninternal const val MAX_CHARACTERS_SIZE_IN_BYTES: Int = 8\nprivate const val MAX_CHARACTERS_COUNT = Int.MAX_VALUE / MAX_CHARACTERS_SIZE_IN_BYTES\n\ninternal data class DecodeBufferResult(val charactersDecoded: String, val bytesConsumed: Int)\n\ninternal fun Int8Array.decodeBufferImpl(nativeDecoder: Decoder, maxCharacters: Int): DecodeBufferResult {\n if (maxCharacters == 0) {\n return DecodeBufferResult(\"\", 0)\n }\n\n // fast-path: try to assume that we have 1 byte per character content\n try {\n val sizeInBytes = maxCharacters.coerceAtMost(byteLength)\n val text = nativeDecoder.decode(subarray(0, sizeInBytes))\n if (text.length <= maxCharacters) {\n return DecodeBufferResult(text, sizeInBytes)\n }\n } catch (_: dynamic) {\n }\n\n return decodeBufferImplSlow(nativeDecoder, maxCharacters)\n}\n\nprivate fun Int8Array.decodeBufferImplSlow(nativeDecoder: Decoder, maxCharacters: Int): DecodeBufferResult {\n val maxBytes = when {\n maxCharacters >= MAX_CHARACTERS_COUNT -> Int.MAX_VALUE\n else -> maxCharacters * MAX_CHARACTERS_SIZE_IN_BYTES\n }.coerceAtMost(byteLength)\n\n var sizeInBytes = maxBytes\n while (sizeInBytes > MAX_CHARACTERS_SIZE_IN_BYTES) {\n try {\n val text = nativeDecoder.decode(subarray(0, sizeInBytes))\n if (text.length <= maxCharacters) {\n return DecodeBufferResult(text, sizeInBytes)\n }\n } catch (_: dynamic) {\n }\n\n sizeInBytes /= 2\n }\n\n sizeInBytes = MAX_CHARACTERS_SIZE_IN_BYTES\n while (sizeInBytes > 0) {\n try {\n val text = nativeDecoder.decode(subarray(0, sizeInBytes))\n if (text.length <= maxCharacters) {\n return DecodeBufferResult(text, sizeInBytes)\n }\n } catch (_: dynamic) {\n }\n\n sizeInBytes--\n }\n\n // all attempts were failed so most likely we have a broken character but we can't find it for some reason\n // so the following decode most likely will fail\n decodeWrap {\n nativeDecoder.decode(this)\n }\n\n // if it didn't for some reason we have no idea what to do\n throw MalformedInputException(\"Unable to decode buffer\")\n}\n","package io.ktor.utils.io.charsets\n\nimport io.ktor.utils.io.core.*\nimport org.khronos.webgl.*\n\ninternal fun encodeISO88591(input: CharSequence, fromIndex: Int, toIndex: Int, dst: Buffer): Int {\n if (fromIndex >= toIndex) return 0\n\n dst.writeDirect { view ->\n val i8 = Int8Array(view.buffer, view.byteOffset, view.byteLength)\n var writeIndex = 0\n for (index in fromIndex until toIndex) {\n val character = input[index].toInt()\n if (character > 0xff) {\n failedToMapError(character)\n }\n i8[writeIndex++] = character.toByte()\n }\n writeIndex\n }\n return toIndex - fromIndex\n}\n\nprivate fun failedToMapError(ch: Int): Nothing {\n throw MalformedInputException(\"The character with unicode point $ch couldn't be mapped to ISO-8859-1 character\")\n}\n","@file:Suppress(\"ReplaceRangeToWithUntil\", \"RedundantModalityModifier\", \"DEPRECATION\", \"DEPRECATION_ERROR\")\n\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.internal.*\nimport io.ktor.utils.io.pool.*\nimport org.khronos.webgl.*\nimport kotlin.contracts.*\n\n@Suppress(\"DIFFERENT_NAMES_FOR_THE_SAME_PARAMETER_IN_SUPERTYPES\")\n@Deprecated(\"Use Buffer instead.\", replaceWith = ReplaceWith(\"Buffer\", \"io.ktor.utils.io.core.Buffer\"))\npublic actual class IoBuffer actual constructor(\n memory: Memory,\n origin: ChunkBuffer?\n) : Input, Output, ChunkBuffer(memory, origin) {\n private val content: ArrayBuffer get() = memory.view.buffer\n\n override val endOfInput: Boolean get() = writePosition == readPosition\n\n @Deprecated(\n \"Not supported anymore. All operations are big endian by default. \" +\n \"Read/write with readXXXLittleEndian/writeXXXLittleEndian or \" +\n \"do readXXX/writeXXX with X.reverseByteOrder() instead.\",\n level = DeprecationLevel.ERROR\n )\n actual final override var byteOrder: ByteOrder\n get() = ByteOrder.BIG_ENDIAN\n set(newOrder) {\n if (newOrder != ByteOrder.BIG_ENDIAN) {\n throw IllegalArgumentException(\"Only big endian is supported\")\n }\n }\n\n final override fun peekTo(destination: Memory, destinationOffset: Long, offset: Long, min: Long, max: Long): Long {\n return (this as Buffer).peekTo(destination, destinationOffset, offset, min, max)\n }\n\n final override fun tryPeek(): Int {\n return tryPeekByte()\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n final override fun readFully(dst: ArrayBuffer, offset: Int, length: Int) {\n (this as Buffer).readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readAvailable(dst: ArrayBuffer, offset: Int, length: Int): Int {\n return (this as Buffer).readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n final override fun readAvailable(dst: IoBuffer, length: Int): Int {\n return (this as Buffer).readAvailable(dst, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readFully(dst: ArrayBufferView, offset: Int, length: Int) {\n if (readRemaining < length) throw IllegalStateException(\n \"Not enough bytes available ($readRemaining) to read $length bytes\"\n )\n if (length > dst.byteLength) throw IllegalArgumentException(\n \"Destination buffer overflow: length = $length, buffer capacity ${dst.byteLength}\"\n )\n require(offset >= 0) { \"offset should be positive\" }\n require(offset + length <= dst.byteLength) { throw IndexOutOfBoundsException(\"\") }\n\n (this as Buffer).readFully(dst.buffer, dst.byteOffset + offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readAvailable(dst: ArrayBufferView, offset: Int, length: Int): Int {\n val readRemaining = readRemaining\n if (readRemaining == 0) return -1\n val size = minOf(length, readRemaining)\n (this as Buffer).readFully(dst, offset, size)\n return size\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readFully(dst: Int8Array, offset: Int, length: Int) {\n (this as Buffer).readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readAvailable(dst: Int8Array, offset: Int, length: Int): Int {\n return (this as Buffer).readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n final override fun readFully(dst: IoBuffer, length: Int) {\n (this as Buffer).readFully(dst, length)\n }\n\n final override fun append(csq: CharSequence?, start: Int, end: Int): Appendable {\n val idx = appendChars(csq ?: \"null\", start, end)\n if (idx != end) throw IllegalStateException(\"Not enough free space to append char sequence\")\n return this\n }\n\n final override fun append(csq: CharSequence?): Appendable {\n return if (csq == null) append(\"null\") else append(csq, 0, csq.length)\n }\n\n final override fun append(csq: CharArray, start: Int, end: Int): Appendable {\n val idx = appendChars(csq, start, end)\n\n if (idx != end) throw IllegalStateException(\"Not enough free space to append char sequence\")\n return this\n }\n\n override fun append(c: Char): Appendable {\n (this as Buffer).append(c)\n return this\n }\n\n @Deprecated(\n \"Use writeFully instead\",\n ReplaceWith(\"writeFully(array, offset, length)\"),\n level = DeprecationLevel.ERROR\n )\n public fun write(array: ByteArray, offset: Int, length: Int) {\n (this as Buffer).writeFully(array, offset, length)\n }\n\n @Deprecated(\n \"Use writeFully instead\",\n ReplaceWith(\"writeFully(array, offset, length)\"),\n level = DeprecationLevel.ERROR\n )\n public fun write(src: Int8Array, offset: Int, length: Int) {\n (this as Buffer).writeFully(src, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readShort(): Short {\n return (this as Buffer).readShort()\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readInt(): Int {\n return (this as Buffer).readInt()\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readFloat(): Float {\n return (this as Buffer).readFloat()\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readDouble(): Double {\n return (this as Buffer).readDouble()\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readFully(dst: ByteArray, offset: Int, length: Int) {\n (this as Buffer).readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readFully(dst: ShortArray, offset: Int, length: Int) {\n (this as Buffer).readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readFully(dst: IntArray, offset: Int, length: Int) {\n (this as Buffer).readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readFully(dst: LongArray, offset: Int, length: Int) {\n (this as Buffer).readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readFully(dst: FloatArray, offset: Int, length: Int) {\n (this as Buffer).readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readFully(dst: DoubleArray, offset: Int, length: Int) {\n (this as Buffer).readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readAvailable(dst: ByteArray, offset: Int, length: Int): Int {\n return (this as Buffer).readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readAvailable(dst: ShortArray, offset: Int, length: Int): Int {\n return (this as Buffer).readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readAvailable(dst: IntArray, offset: Int, length: Int): Int {\n return (this as Buffer).readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readAvailable(dst: LongArray, offset: Int, length: Int): Int {\n return (this as Buffer).readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readAvailable(dst: FloatArray, offset: Int, length: Int): Int {\n return (this as Buffer).readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun readAvailable(dst: DoubleArray, offset: Int, length: Int): Int {\n return (this as Buffer).readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun peekTo(buffer: IoBuffer): Int {\n return (this as Input).peekTo(buffer)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n final override fun readLong(): Long {\n return (this as Buffer).readLong()\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun writeShort(v: Short) {\n (this as Buffer).writeShort(v)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun writeInt(v: Int) {\n (this as Buffer).writeInt(v)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun writeFloat(v: Float) {\n (this as Buffer).writeFloat(v)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun writeDouble(v: Double) {\n (this as Buffer).writeDouble(v)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun writeFully(src: ByteArray, offset: Int, length: Int) {\n (this as Buffer).writeFully(src, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun writeFully(src: ShortArray, offset: Int, length: Int) {\n (this as Buffer).writeFully(src, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun writeFully(src: IntArray, offset: Int, length: Int) {\n (this as Buffer).writeFully(src, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun writeFully(src: LongArray, offset: Int, length: Int) {\n (this as Buffer).writeFully(src, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun writeFully(src: FloatArray, offset: Int, length: Int) {\n (this as Buffer).writeFully(src, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun writeFully(src: DoubleArray, offset: Int, length: Int) {\n (this as Buffer).writeFully(src, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun writeFully(src: IoBuffer, length: Int) {\n (this as Buffer).writeFully(src, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n override fun fill(n: Long, v: Byte) {\n (this as Buffer).fill(n, v)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n final override fun writeLong(v: Long) {\n (this as Buffer).writeLong(v)\n }\n\n @Deprecated(\"Use writeFully instead\", ReplaceWith(\"writeFully(src, length)\"), level = DeprecationLevel.ERROR)\n public fun writeBuffer(src: IoBuffer, length: Int): Int {\n (this as Buffer).writeFully(src, length)\n return length\n }\n\n actual final override fun flush() {\n }\n\n @PublishedApi\n internal fun readableView(): DataView {\n val readPosition = readPosition\n val writePosition = writePosition\n\n return when {\n readPosition == writePosition -> EmptyDataView\n readPosition == 0 && writePosition == content.byteLength -> memory.view\n else -> DataView(content, readPosition, writePosition - readPosition)\n }\n }\n\n @PublishedApi\n internal fun writableView(): DataView {\n val writePosition = writePosition\n val limit = limit\n\n return when {\n writePosition == limit -> EmptyDataView\n writePosition == 0 && limit == content.byteLength -> memory.view\n else -> DataView(content, writePosition, limit - writePosition)\n }\n }\n\n /**\n * Apply [block] function on a [DataView] of readable bytes.\n * The [block] function should return number of consumed bytes.\n * @return number of bytes consumed\n */\n @ExperimentalIoApi\n public inline fun readDirect(block: (DataView) -> Int): Int {\n val view = readableView()\n val rc = block(view)\n check(rc >= 0) { \"The returned value from block function shouldn't be negative: $rc\" }\n discard(rc)\n return rc\n }\n\n /**\n * Apply [block] function on a [DataView] of the free space.\n * The [block] function should return number of written bytes.\n * @return number of bytes written\n */\n @ExperimentalIoApi\n public inline fun writeDirect(block: (DataView) -> Int): Int {\n val view = writableView()\n val rc = block(view)\n check(rc >= 0) { \"The returned value from block function shouldn't be negative: $rc\" }\n check(rc <= writeRemaining) { \"The returned value from block function is too big: $rc > $writeRemaining\" }\n commitWritten(rc)\n return rc\n }\n\n public actual fun release(pool: ObjectPool) {\n releaseImpl(pool)\n }\n\n actual override fun close() {\n throw UnsupportedOperationException(\"close for buffer view is not supported\")\n }\n\n override fun toString(): String =\n \"Buffer[readable = $readRemaining, writable = $writeRemaining, startGap = $startGap, endGap = $endGap]\"\n\n public actual companion object {\n /**\n * Number of bytes usually reserved in the end of chunk\n * when several instances of [IoBuffer] are connected into a chain (usually inside of [ByteReadPacket]\n * or [BytePacketBuilder])\n */\n @DangerousInternalIoApi\n public actual val ReservedSize: Int\n get() = Buffer.ReservedSize\n\n private val EmptyBuffer = ArrayBuffer(0)\n private val EmptyDataView = DataView(EmptyBuffer)\n\n public actual val Empty: IoBuffer = IoBuffer(Memory.Empty, null)\n\n /**\n * The default buffer pool\n */\n public actual val Pool: ObjectPool = object : DefaultPool(BUFFER_VIEW_POOL_SIZE) {\n override fun produceInstance(): IoBuffer {\n return IoBuffer(DefaultAllocator.alloc(DEFAULT_BUFFER_SIZE), null)\n }\n\n override fun clearInstance(instance: IoBuffer): IoBuffer {\n return super.clearInstance(instance).apply {\n unpark()\n reset()\n }\n }\n\n override fun validateInstance(instance: IoBuffer) {\n super.validateInstance(instance)\n\n require(instance.referenceCount == 0) {\n \"unable to recycle buffer: buffer view is in use (refCount = ${instance.referenceCount})\"\n }\n require(instance.origin == null) {\n \"Unable to recycle buffer view: view copy shouldn't be recycled\"\n }\n }\n\n override fun disposeInstance(instance: IoBuffer) {\n DefaultAllocator.free(instance.memory)\n instance.unlink()\n }\n }\n\n public actual val NoPool: ObjectPool = object : NoPoolImpl() {\n override fun borrow(): IoBuffer {\n return IoBuffer(DefaultAllocator.alloc(DEFAULT_BUFFER_SIZE), null)\n }\n\n override fun recycle(instance: IoBuffer) {\n DefaultAllocator.free(instance.memory)\n }\n }\n\n public actual val EmptyPool: ObjectPool = EmptyBufferPoolImpl\n }\n}\n\npublic fun Buffer.readFully(dst: ArrayBuffer, offset: Int = 0, length: Int = dst.byteLength - offset) {\n read { memory, start, endExclusive ->\n if (endExclusive - start < length) {\n throw EOFException(\"Not enough bytes available to read $length bytes\")\n }\n\n memory.copyTo(dst, start, length, offset)\n length\n }\n}\n\npublic fun Buffer.readFully(dst: ArrayBufferView, offset: Int = 0, length: Int = dst.byteLength - offset) {\n read { memory, start, endExclusive ->\n if (endExclusive - start < length) {\n throw EOFException(\"Not enough bytes available to read $length bytes\")\n }\n\n memory.copyTo(dst, start, length, offset)\n length\n }\n}\n\npublic fun Buffer.readAvailable(dst: ArrayBuffer, offset: Int = 0, length: Int = dst.byteLength - offset): Int {\n if (!canRead()) return -1\n val readSize = minOf(length, readRemaining)\n readFully(dst, offset, readSize)\n return readSize\n}\n\npublic fun Buffer.readAvailable(dst: ArrayBufferView, offset: Int = 0, length: Int = dst.byteLength - offset): Int {\n if (!canRead()) return -1\n val readSize = minOf(length, readRemaining)\n readFully(dst, offset, readSize)\n return readSize\n}\n\npublic fun Buffer.writeFully(src: ArrayBuffer, offset: Int = 0, length: Int = src.byteLength) {\n write { memory, start, endExclusive ->\n if (endExclusive - start < length) {\n throw InsufficientSpaceException(\"Not enough free space to write $length bytes\")\n }\n\n src.copyTo(memory, offset, length, start)\n length\n }\n}\n\npublic fun Buffer.writeFully(src: ArrayBufferView, offset: Int = 0, length: Int = src.byteLength - offset) {\n write { memory, dstOffset, endExclusive ->\n if (endExclusive - dstOffset < length) {\n throw InsufficientSpaceException(\"Not enough free space to write $length bytes\")\n }\n\n src.copyTo(memory, offset, length, dstOffset)\n length\n }\n}\n\npublic inline fun Buffer.writeDirect(block: (DataView) -> Int): Int {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n return write { memory, start, endExclusive ->\n block(memory.slice(start, endExclusive - start).view)\n }\n}\n\npublic inline fun Buffer.readDirect(block: (DataView) -> Int): Int {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n return read { memory, start, endExclusive ->\n block(memory.slice(start, endExclusive - start).view)\n }\n}\n\npublic inline fun Buffer.writeDirectInt8Array(block: (Int8Array) -> Int): Int {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n return write { memory, start, endExclusive ->\n block(Int8Array(memory.view.buffer, memory.view.byteOffset + start, endExclusive - start))\n }\n}\n\npublic inline fun Buffer.readDirectInt8Array(block: (Int8Array) -> Int): Int {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n return read { memory, start, endExclusive ->\n block(Int8Array(memory.view.buffer, memory.view.byteOffset + start, endExclusive - start))\n }\n}\n","// ktlint-disable filename\npackage io.ktor.utils.io.core\n\nimport org.khronos.webgl.*\n\npublic actual enum class ByteOrder {\n BIG_ENDIAN, LITTLE_ENDIAN;\n\n public actual companion object {\n private val native: ByteOrder\n\n init {\n val buffer = ArrayBuffer(4)\n val arr = Int32Array(buffer)\n val view = DataView(buffer)\n\n arr[0] = 0x11223344\n\n native = if (view.getInt32(0, true) == 0x11223344) LITTLE_ENDIAN else BIG_ENDIAN\n }\n\n public actual fun nativeOrder(): ByteOrder = native\n }\n}\n","@file:Suppress(\"FunctionName\")\n\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.internal.*\nimport io.ktor.utils.io.pool.*\nimport org.khronos.webgl.*\n\npublic actual fun ByteReadPacket(\n array: ByteArray,\n offset: Int,\n length: Int,\n block: (ByteArray) -> Unit\n): ByteReadPacket {\n val content = array.asDynamic() as Int8Array\n val sub = when {\n offset == 0 && length == array.size -> content.buffer\n else -> content.buffer.slice(offset, offset + length)\n }\n\n val pool = object : SingleInstancePool() {\n override fun produceInstance(): ChunkBuffer {\n @Suppress(\"DEPRECATION\")\n return IoBuffer(Memory.of(sub), null)\n }\n\n override fun disposeInstance(instance: ChunkBuffer) {\n @Suppress(\"DEPRECATION\")\n check(instance is IoBuffer) { \"Only IoBuffer could be recycled\" }\n block(array)\n }\n }\n\n return ByteReadPacket(pool.borrow().apply { resetForRead() }, pool)\n}\n","package io.ktor.utils.io.core\n\npublic actual interface Closeable {\n public actual fun close()\n}\n\n@PublishedApi\ninternal actual fun Throwable.addSuppressedInternal(other: Throwable) {\n}\n","@file:Suppress(\"EXTENSION_SHADOWED_BY_MEMBER\")\n\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.internal.*\nimport org.khronos.webgl.*\n\npublic fun Input.readFully(dst: Int8Array, offset: Int = 0, length: Int = dst.length - offset) {\n if (this is AbstractInput) {\n return readFully(dst, offset, length)\n }\n\n val rc = readAvailable(dst, offset, length)\n if (rc != length) {\n prematureEndOfStream(length)\n }\n}\n\npublic fun Input.readFully(dst: ArrayBuffer, offset: Int = 0, length: Int = dst.byteLength - offset) {\n if (this is AbstractInput) {\n return readFully(dst, offset, length)\n }\n\n val rc = readAvailable(dst, offset, length)\n if (rc != length) {\n prematureEndOfStream(length)\n }\n}\n\npublic fun Input.readFully(dst: ArrayBufferView, byteOffset: Int = 0, byteLength: Int = dst.byteLength - byteOffset) {\n if (this is AbstractInput) {\n return readFully(dst, byteOffset, byteLength)\n }\n\n val rc = readAvailable(dst, byteOffset, byteLength)\n if (rc != byteLength) {\n prematureEndOfStream(byteLength)\n }\n}\n\npublic fun Input.readAvailable(dst: Int8Array, offset: Int = 0, length: Int = dst.length - offset): Int {\n if (this is AbstractInput) {\n return readAvailable(dst, offset, length)\n }\n\n @Suppress(\"UNCHECKED_CAST_TO_EXTERNAL_INTERFACE\")\n return readAvailable(dst as ArrayBufferView, offset, length)\n}\n\n@Suppress(\"Duplicates\")\npublic fun Input.readAvailable(dst: ArrayBuffer, offset: Int = 0, length: Int = dst.byteLength - offset): Int {\n if (this is AbstractInput) {\n return readAvailable(dst, offset, length)\n }\n\n var bytesCopied = 0\n takeWhile { buffer ->\n val partSize = minOf(buffer.readRemaining, length - bytesCopied)\n buffer.memory.copyTo(dst, buffer.readPosition, partSize, bytesCopied)\n bytesCopied += partSize\n bytesCopied < length\n }\n\n return bytesCopied\n}\n\n@Suppress(\"Duplicates\")\npublic fun Input.readAvailable(\n dst: ArrayBufferView,\n byteOffset: Int = 0,\n byteLength: Int = dst.byteLength - byteOffset\n): Int {\n if (this is AbstractInput) {\n return readAvailable(dst, byteOffset, byteLength)\n }\n\n var bytesCopied = 0\n takeWhile { buffer ->\n val partSize = minOf(buffer.readRemaining, byteLength - bytesCopied)\n buffer.memory.copyTo(dst, buffer.readPosition, partSize, bytesCopied)\n bytesCopied += partSize\n bytesCopied < byteLength\n }\n\n return bytesCopied\n}\n\ninternal fun AbstractInput.readFully(dst: Int8Array, offset: Int, length: Int) {\n @Suppress(\"UNCHECKED_CAST_TO_EXTERNAL_INTERFACE\")\n return readFully(dst as ArrayBufferView, offset, length)\n}\n\ninternal fun AbstractInput.readFully(dst: ArrayBuffer, offset: Int, length: Int) {\n if (remaining < length) throw IllegalArgumentException(\n \"Not enough bytes available ($remaining) to read $length bytes\"\n )\n var copied = 0\n\n takeWhile { buffer: Buffer ->\n val rc = buffer.readAvailable(dst, offset + copied, length - copied)\n if (rc > 0) copied += rc\n copied < length\n }\n}\n\ninternal fun AbstractInput.readFully(dst: ArrayBufferView, offset: Int, length: Int) {\n require(length <= dst.byteLength) {\n throw IndexOutOfBoundsException(\"length $length is greater than view size ${dst.byteLength}\")\n }\n\n return readFully(dst.buffer, dst.byteOffset + offset, length)\n}\n\ninternal fun AbstractInput.readAvailable(dst: Int8Array, offset: Int, length: Int): Int {\n val remaining = remaining\n if (remaining == 0L) return -1\n val size = minOf(remaining, length.toLong()).toInt()\n readFully(dst, offset, size)\n return size\n}\n\ninternal fun AbstractInput.readAvailable(dst: ArrayBuffer, offset: Int, length: Int): Int {\n val remaining = remaining\n if (remaining == 0L) return -1\n val size = minOf(remaining, length.toLong()).toInt()\n readFully(dst, offset, size)\n return size\n}\n\ninternal fun AbstractInput.readAvailable(dst: ArrayBufferView, offset: Int, length: Int): Int {\n val remaining = remaining\n if (remaining == 0L) return -1\n val size = minOf(remaining, length.toLong()).toInt()\n readFully(dst, offset, size)\n return size\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.utils.io.concurrent\n\nimport io.ktor.utils.io.core.internal.*\nimport kotlin.properties.*\nimport kotlin.reflect.*\n\n/**\n * Allows to create mutate property with frozen value.\n * Please note that any assigned value will be frozen.\n *\n * Usage:\n * ```kotlin\n * var myCounter by shared(0)\n * ```\n */\n@Suppress(\"NOTHING_TO_INLINE\")\n@DangerousInternalIoApi\npublic actual inline fun shared(value: T): ReadWriteProperty = object : ReadWriteProperty {\n private var value: T = value\n\n override fun getValue(thisRef: Any, property: KProperty<*>): T {\n return this.value\n }\n\n override fun setValue(thisRef: Any, property: KProperty<*>, value: T) {\n this.value = value\n }\n}\n\n/**\n * Allow to create thread local reference without freezing.\n * Please note that reference is thread-local only in kotlin-native. Otherwise it will be simple [value] reference.\n *\n * This reference is allowed to use only from creation thread. Otherwise it will return null.\n */\n@DangerousInternalIoApi\npublic actual fun threadLocal(value: T): ReadOnlyProperty =\n ReadOnlyProperty { thisRef, property -> value }\n","// ktlint-disable filename\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.Memory\nimport org.khronos.webgl.*\n\n/**\n * Shouldn't be implemented directly. Inherit [AbstractInput] instead.\n */\n@Suppress(\"NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS\")\npublic actual interface Input : Closeable {\n @Deprecated(\n \"Not supported anymore. All operations are big endian by default. \" +\n \"Read and readXXXLittleEndian or readXXX then X.reverseByteOrder() instead.\",\n level = DeprecationLevel.ERROR\n )\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual var byteOrder: ByteOrder\n get() = ByteOrder.BIG_ENDIAN\n set(newValue) {\n if (newValue != ByteOrder.BIG_ENDIAN) {\n throw IllegalArgumentException(\"Only BIG_ENDIAN is supported\")\n }\n }\n\n /**\n * It is `true` when it is known that no more bytes will be available. When it is `false` then this means that\n * it is not known yet or there are available bytes.\n * Please note that `false` value doesn't guarantee that there are available bytes so `readByte()` may fail.\n */\n public actual val endOfInput: Boolean\n\n /**\n * Copy at least [min] but up to [max] bytes to the specified [destination] buffer from this input\n * skipping [offset] bytes. If there are not enough bytes available to provide [min] bytes then\n * it fails with an exception.\n * It is safe to specify `max > destination.writeRemaining` but\n * `min` shouldn't be bigger than the [destination] free space.\n * This function could trigger the underlying source reading that may lead to blocking I/O.\n * It is safe to specify too big [offset] but only if `min = 0`, fails otherwise.\n * This function usually copy more bytes than [min] (unless `max = min`).\n *\n * @param destination to write bytes\n * @param offset to skip input\n * @param min bytes to be copied, shouldn't be greater than the buffer free space. Could be `0`.\n * @param max bytes to be copied even if there are more bytes buffered, could be [Int.MAX_VALUE].\n * @return number of bytes copied to the [destination] possibly `0`\n * @throws Throwable when not enough bytes available to provide\n */\n public actual fun peekTo(\n destination: Memory,\n destinationOffset: Long,\n offset: Long,\n min: Long,\n max: Long\n ): Long\n\n /**\n * Read the next upcoming byte\n * @throws EOFException if no more bytes available.\n */\n public actual fun readByte(): Byte\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readShort(): Short {\n return readShort()\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readInt(): Int {\n return readInt()\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readLong(): Long {\n return readLong()\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readFloat(): Float {\n return readFloat()\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readDouble(): Double {\n return readDouble()\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readFully(dst: ByteArray, offset: Int, length: Int) {\n return readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readFully(dst: ShortArray, offset: Int, length: Int) {\n return readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readFully(dst: IntArray, offset: Int, length: Int) {\n return readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readFully(dst: LongArray, offset: Int, length: Int) {\n return readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readFully(dst: FloatArray, offset: Int, length: Int) {\n return readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readFully(dst: DoubleArray, offset: Int, length: Int) {\n return readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\", \"DEPRECATION\")\n public actual fun readFully(dst: IoBuffer, length: Int) {\n return readFully(dst, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readAvailable(dst: ByteArray, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readAvailable(dst: ShortArray, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readAvailable(dst: IntArray, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readAvailable(dst: LongArray, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readAvailable(dst: FloatArray, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun readAvailable(dst: DoubleArray, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\", \"DEPRECATION\")\n public actual fun readAvailable(dst: IoBuffer, length: Int): Int {\n return readAvailable(dst, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readFully(dst: Int8Array, offset: Int, length: Int) {\n return readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readFully(dst: ArrayBuffer, offset: Int, length: Int) {\n return readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readFully(dst: ArrayBufferView, offset: Int, length: Int) {\n return readFully(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readAvailable(dst: Int8Array, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readAvailable(dst: ArrayBuffer, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun readAvailable(dst: ArrayBufferView, offset: Int, length: Int): Int {\n return readAvailable(dst, offset, length)\n }\n\n /*\n * Returns next byte (unsigned) or `-1` if no more bytes available\n */\n public actual fun tryPeek(): Int\n\n /**\n * Copy available bytes to the specified [buffer] but keep them available.\n * If the underlying implementation could trigger\n * bytes population from the underlying source and block until any bytes available\n *\n * Very similar to [readAvailable] but don't discard copied bytes.\n *\n * @return number of bytes were copied\n */\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"DEPRECATION\", \"ACTUAL_WITHOUT_EXPECT\")\n public actual fun peekTo(buffer: IoBuffer): Int {\n return peekTo(buffer)\n }\n\n public actual fun discard(n: Long): Long\n\n actual override fun close()\n}\n","// ktlint-disable filename\n/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.internal.*\n\ninternal actual class AbstractOutputSharedState {\n actual var head: ChunkBuffer? = null\n\n actual var tail: ChunkBuffer? = null\n\n actual var tailMemory: Memory = Memory.Empty\n\n actual var tailPosition: Int = 0\n\n actual var tailEndExclusive: Int = 0\n\n actual var tailInitialPosition: Int = 0\n\n actual var chainedSize: Int = 0\n}\n","// ktlint-disable filename\n/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.internal.*\n\ninternal actual class AbstractInputSharedState actual constructor(\n actual var head: ChunkBuffer,\n remaining: Long\n) {\n actual var headMemory: Memory = head.memory\n\n actual var headPosition: Int = head.readPosition\n\n actual var headEndExclusive: Int = head.writePosition\n\n actual var tailRemaining: Long = remaining - (headEndExclusive - headPosition)\n}\n","// ktlint-disable filename\n/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.utils.io.core\n\ninternal actual class BufferSharedState actual constructor(actual var limit: Int) {\n actual var readPosition: Int = 0\n\n actual var writePosition: Int = 0\n\n actual var startGap: Int = 0\n\n actual var attachment: Any? = null\n}\n","package io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport org.khronos.webgl.*\n\nprivate fun Memory.asInt8Array(): Int8Array {\n return Int8Array(view.buffer, view.byteOffset, view.byteLength)\n}\n\ninternal actual fun Buffer.discardUntilDelimiterImpl(delimiter: Byte): Int {\n val content = memory.asInt8Array()\n var idx = readPosition\n val end = writePosition\n\n while (idx < end) {\n if (content[idx] == delimiter) break\n idx++\n }\n\n val start = readPosition\n discardUntilIndex(idx)\n return idx - start\n}\n\ninternal actual fun Buffer.discardUntilDelimitersImpl(delimiter1: Byte, delimiter2: Byte): Int {\n val content = memory.asInt8Array()\n var idx = readPosition\n val end = writePosition\n\n while (idx < end) {\n val v = content[idx]\n if (v == delimiter1 || v == delimiter2) break\n idx++\n }\n\n val start = readPosition\n discardUntilIndex(idx)\n return idx - start\n}\n\ninternal actual fun Buffer.readUntilDelimiterImpl(\n delimiter: Byte,\n dst: ByteArray,\n offset: Int,\n length: Int\n): Int {\n check(offset >= 0)\n check(length >= 0)\n check(offset + length <= dst.size)\n\n return readUntilImpl({ it == delimiter }, dst, offset, length)\n}\n\ninternal actual fun Buffer.readUntilDelimitersImpl(\n delimiter1: Byte,\n delimiter2: Byte,\n dst: ByteArray,\n offset: Int,\n length: Int\n): Int {\n check(offset >= 0)\n check(length >= 0)\n check(offset + length <= dst.size)\n check(delimiter1 != delimiter2)\n\n return readUntilImpl({ it == delimiter1 || it == delimiter2 }, dst, offset, length)\n}\n\ninternal actual fun Buffer.readUntilDelimiterImpl(delimiter: Byte, dst: Output): Int {\n return readUntilImpl({ it == delimiter }, dst)\n}\n\ninternal actual fun Buffer.readUntilDelimitersImpl(delimiter1: Byte, delimiter2: Byte, dst: Output): Int {\n check(delimiter1 != delimiter2)\n\n return readUntilImpl({ it == delimiter1 || it == delimiter2 }, dst)\n}\n\nprivate inline fun Buffer.readUntilImpl(\n predicate: (Byte) -> Boolean,\n dst: ByteArray,\n offset: Int,\n length: Int\n): Int {\n val array = memory.asInt8Array()\n val start = readPosition\n var i = start\n val end = i + minOf(length, readRemaining)\n\n while (i < end) {\n if (predicate(array[i])) break\n i++\n }\n\n val copied = i - start\n val dstArray = dst.asDynamic() as Int8Array\n dstArray.set(array.subarray(start, end), offset)\n discardUntilIndex(i)\n\n return copied\n}\n\nprivate inline fun Buffer.readUntilImpl(\n predicate: (Byte) -> Boolean,\n dst: Output\n): Int {\n val array = memory.asInt8Array()\n var i = readPosition\n var copiedTotal = 0\n\n dst.writeWhile { chunk ->\n chunk.writeFully(chunk, 0)\n val start = i\n val end = minOf(i + chunk.writeRemaining, writePosition)\n\n while (i < end) {\n if (predicate(array[i])) break\n i++\n }\n\n val size = i - start\n\n chunk.memory.asInt8Array().set(array.subarray(start, i), chunk.writePosition)\n chunk.commitWritten(size)\n copiedTotal += size\n\n chunk.writeRemaining == 0 && i < end\n }\n\n discardUntilIndex(i)\n return copiedTotal\n}\n","// ktlint-disable filename\npackage io.ktor.utils.io.core\n\n/**\n * This shouldn't be implemented directly. Inherit [AbstractOutput] instead.\n */\n@Suppress(\"NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS\")\npublic actual interface Output : Appendable, Closeable {\n @Deprecated(\"Write with writeXXXLittleEndian or do X.reverseByteOrder() and then writeXXX instead.\")\n public actual var byteOrder: ByteOrder\n\n public actual fun writeByte(v: Byte)\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun writeShort(v: Short) {\n writeShort(v)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun writeInt(v: Int) {\n writeInt(v)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun writeLong(v: Long) {\n writeLong(v)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun writeFloat(v: Float) {\n writeFloat(v)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun writeDouble(v: Double) {\n writeDouble(v)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun writeFully(src: ByteArray, offset: Int, length: Int) {\n writeFully(src, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun writeFully(src: ShortArray, offset: Int, length: Int) {\n writeFully(src, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun writeFully(src: IntArray, offset: Int, length: Int) {\n writeFully(src, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun writeFully(src: LongArray, offset: Int, length: Int) {\n writeFully(src, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun writeFully(src: FloatArray, offset: Int, length: Int) {\n writeFully(src, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun writeFully(src: DoubleArray, offset: Int, length: Int) {\n writeFully(src, offset, length)\n }\n\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n public actual fun writeFully(src: IoBuffer, length: Int) {\n writeFully(src, length)\n }\n\n public actual fun append(csq: CharArray, start: Int, end: Int): Appendable\n\n @Suppress(\"ACTUAL_WITHOUT_EXPECT\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public actual fun fill(n: Long, v: Byte) {\n fill(n, v)\n }\n\n public actual fun flush()\n\n actual override fun close()\n}\n","package io.ktor.utils.io.core\n\nimport io.ktor.utils.io.core.internal.*\n\npublic actual val PACKET_MAX_COPY_SIZE: Int = 200\ninternal const val BUFFER_VIEW_POOL_SIZE = 100\ninternal const val BUFFER_VIEW_SIZE = 4096\n\npublic actual fun BytePacketBuilder(headerSizeHint: Int): BytePacketBuilder =\n BytePacketBuilder(headerSizeHint, ChunkBuffer.Pool)\n\npublic actual typealias EOFException = io.ktor.utils.io.errors.EOFException\n","/*\n * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.utils.io.js\n\nimport org.khronos.webgl.*\n\ninternal external class TextDecoder(encoding: String, options: dynamic = definedExternally) {\n val encoding: String\n\n fun decode(): String\n fun decode(buffer: ArrayBuffer): String\n fun decode(buffer: ArrayBuffer, options: dynamic): String\n fun decode(buffer: ArrayBufferView): String\n fun decode(buffer: ArrayBufferView, options: dynamic): String\n}\n\ninternal fun TextDecoder.toKtor(): Decoder = object : Decoder {\n override fun decode(): String = this@toKtor.decode()\n override fun decode(buffer: ArrayBufferView): String = this@toKtor.decode(buffer)\n override fun decode(buffer: ArrayBufferView, options: dynamic): String = this@toKtor.decode(buffer, options)\n}\n\ninternal fun textDecoderOptions(fatal: Boolean = false): Any = Any().apply {\n with(this.asDynamic()) {\n this.fatal = fatal\n }\n}\n","package io.ktor.utils.io.core\n\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.internal.*\nimport org.khronos.webgl.*\nimport kotlin.require\n\n/**\n * Create an instance of [String] from the specified [bytes] range starting at [offset] and bytes [length]\n * interpreting characters in the specified [charset].\n */\n@Suppress(\"FunctionName\")\npublic actual fun String(bytes: ByteArray, offset: Int, length: Int, charset: Charset): String {\n if (offset < 0 || length < 0 || offset + length > bytes.size) {\n checkIndices(offset, length, bytes)\n }\n\n @Suppress(\"UnsafeCastFromDynamic\")\n val i8: Int8Array = bytes.asDynamic() // we know that K/JS generates Int8Array for ByteBuffer\n val bufferOffset = i8.byteOffset + offset\n val buffer = i8.buffer.slice(bufferOffset, bufferOffset + length)\n\n @Suppress(\"DEPRECATION\")\n val view = IoBuffer(Memory.of(buffer), null)\n view.resetForRead()\n val packet = ByteReadPacket(view, ChunkBuffer.NoPoolManuallyManaged)\n\n return charset.newDecoder().decode(packet, Int.MAX_VALUE)\n}\n\npublic fun checkIndices(offset: Int, length: Int, bytes: ByteArray): Nothing {\n require(offset >= 0) { throw IndexOutOfBoundsException(\"offset ($offset) shouldn't be negative\") }\n require(length >= 0) { throw IndexOutOfBoundsException(\"length ($length) shouldn't be negative\") }\n require(offset + length <= bytes.size) {\n throw IndexOutOfBoundsException(\"offset ($offset) + length ($length) > bytes.size (${bytes.size})\")\n }\n\n throw IndexOutOfBoundsException()\n}\n\ninternal actual fun String.getCharsInternal(dst: CharArray, dstOffset: Int) {\n val length = length\n require(dstOffset + length <= dst.size)\n\n var dstIndex = dstOffset\n for (srcIndex in 0 until length) {\n dst[dstIndex++] = this[srcIndex]\n }\n}\n","package io.ktor.utils.io.errors\n\npublic actual open class IOException actual constructor(message: String, cause: Throwable?) :\n Exception(message, cause) {\n public actual constructor(message: String) : this(message, null)\n}\n\npublic actual open class EOFException actual constructor(message: String) : IOException(message)\n","/*\n * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.utils.io.js\n\nimport io.ktor.utils.io.core.*\nimport org.khronos.webgl.*\n\nprivate val ENCODING_ALIASES = setOf(\n \"ansi_x3.4-1968\",\n \"ascii\",\n \"cp1252\",\n \"cp819\",\n \"csisolatin1\",\n \"ibm819\",\n \"iso-8859-1\",\n \"iso-ir-100\",\n \"iso8859-1\",\n \"iso88591\",\n \"iso_8859-1\",\n \"iso_8859-1:1987\",\n \"l1\",\n \"latin1\",\n \"us-ascii\",\n \"windows-1252\",\n \"x-cp1252\"\n)\n\nprivate val REPLACEMENT = byteArrayOf(0xEF.toByte(), 0xBF.toByte(), 0xBD.toByte())\n\n/**\n * Windows-1252 decoder.\n *\n * According to https://encoding.spec.whatwg.org/, ISO-8859-1 should be treated as windows-1252 for http.\n */\ninternal class TextDecoderFallback(\n encoding: String,\n val fatal: Boolean\n) : Decoder {\n\n init {\n val requestedEncoding = encoding.trim().toLowerCase()\n check(ENCODING_ALIASES.contains(requestedEncoding)) { \"$encoding is not supported.\" }\n }\n\n override fun decode(): String = \"\"\n\n override fun decode(buffer: ArrayBufferView): String = buildPacket {\n val bytes = buffer as Int8Array\n for (index in 0 until bytes.length) {\n val byte = bytes[index]\n val point: Int = byte.toCodePoint()\n\n if (point < 0) {\n check(!fatal) { \"Invalid character: $point\" }\n writeFully(REPLACEMENT)\n continue\n }\n\n if (point > 0xFF) {\n writeByte((point shr 8).toByte())\n }\n\n writeByte((point and 0xFF).toByte())\n }\n }.readBytes().decodeToString()\n\n override fun decode(buffer: ArrayBufferView, options: dynamic): String {\n return decode(buffer)\n }\n}\n\nprivate fun Byte.toCodePoint(): Int {\n val value = toInt() and 0xFF\n if (value.isASCII()) {\n return value\n }\n\n return WIN1252_TABLE[value - 0x80]\n}\n\nprivate fun Int.isASCII(): Boolean = this in 0..0x7F\n","package io.ktor.utils.io.pool\n\npublic actual abstract class DefaultPool\nactual constructor(actual final override val capacity: Int) : ObjectPool {\n\n private val instances = arrayOfNulls(capacity)\n private var size = 0\n\n protected actual abstract fun produceInstance(): T\n protected actual open fun disposeInstance(instance: T) {}\n\n protected actual open fun clearInstance(instance: T): T = instance\n protected actual open fun validateInstance(instance: T) {}\n\n actual final override fun borrow(): T {\n if (size == 0) return produceInstance()\n val idx = --size\n\n @Suppress(\"UNCHECKED_CAST\")\n val instance = instances[idx] as T\n instances[idx] = null\n\n return clearInstance(instance)\n }\n\n actual final override fun recycle(instance: T) {\n validateInstance(instance)\n if (size == capacity) {\n disposeInstance(instance)\n } else {\n instances[size++] = instance\n }\n }\n\n actual final override fun dispose() {\n for (i in 0 until size) {\n @Suppress(\"UNCHECKED_CAST\")\n val instance = instances[i] as T\n instances[i] = null\n disposeInstance(instance)\n }\n size = 0\n }\n}\n","var Buffer = require('safe-buffer').Buffer\nvar Transform = require('stream').Transform\nvar StringDecoder = require('string_decoder').StringDecoder\nvar inherits = require('inherits')\n\nfunction CipherBase (hashMode) {\n Transform.call(this)\n this.hashMode = typeof hashMode === 'string'\n if (this.hashMode) {\n this[hashMode] = this._finalOrDigest\n } else {\n this.final = this._finalOrDigest\n }\n if (this._final) {\n this.__final = this._final\n this._final = null\n }\n this._decoder = null\n this._encoding = null\n}\ninherits(CipherBase, Transform)\n\nCipherBase.prototype.update = function (data, inputEnc, outputEnc) {\n if (typeof data === 'string') {\n data = Buffer.from(data, inputEnc)\n }\n\n var outData = this._update(data)\n if (this.hashMode) return this\n\n if (outputEnc) {\n outData = this._toString(outData, outputEnc)\n }\n\n return outData\n}\n\nCipherBase.prototype.setAutoPadding = function () {}\nCipherBase.prototype.getAuthTag = function () {\n throw new Error('trying to get auth tag in unsupported state')\n}\n\nCipherBase.prototype.setAuthTag = function () {\n throw new Error('trying to set auth tag in unsupported state')\n}\n\nCipherBase.prototype.setAAD = function () {\n throw new Error('trying to set aad in unsupported state')\n}\n\nCipherBase.prototype._transform = function (data, _, next) {\n var err\n try {\n if (this.hashMode) {\n this._update(data)\n } else {\n this.push(this._update(data))\n }\n } catch (e) {\n err = e\n } finally {\n next(err)\n }\n}\nCipherBase.prototype._flush = function (done) {\n var err\n try {\n this.push(this.__final())\n } catch (e) {\n err = e\n }\n\n done(err)\n}\nCipherBase.prototype._finalOrDigest = function (outputEnc) {\n var outData = this.__final() || Buffer.alloc(0)\n if (outputEnc) {\n outData = this._toString(outData, outputEnc, true)\n }\n return outData\n}\n\nCipherBase.prototype._toString = function (value, enc, fin) {\n if (!this._decoder) {\n this._decoder = new StringDecoder(enc)\n this._encoding = enc\n }\n\n if (this._encoding !== enc) throw new Error('can\\'t switch encodings')\n\n var out = this._decoder.write(value)\n if (fin) {\n out += this._decoder.end()\n }\n\n return out\n}\n\nmodule.exports = CipherBase\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\nvar R = typeof Reflect === 'object' ? Reflect : null\nvar ReflectApply = R && typeof R.apply === 'function'\n ? R.apply\n : function ReflectApply(target, receiver, args) {\n return Function.prototype.apply.call(target, receiver, args);\n }\n\nvar ReflectOwnKeys\nif (R && typeof R.ownKeys === 'function') {\n ReflectOwnKeys = R.ownKeys\n} else if (Object.getOwnPropertySymbols) {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target)\n .concat(Object.getOwnPropertySymbols(target));\n };\n} else {\n ReflectOwnKeys = function ReflectOwnKeys(target) {\n return Object.getOwnPropertyNames(target);\n };\n}\n\nfunction ProcessEmitWarning(warning) {\n if (console && console.warn) console.warn(warning);\n}\n\nvar NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {\n return value !== value;\n}\n\nfunction EventEmitter() {\n EventEmitter.init.call(this);\n}\nmodule.exports = EventEmitter;\nmodule.exports.once = once;\n\n// Backwards-compat with node 0.10.x\nEventEmitter.EventEmitter = EventEmitter;\n\nEventEmitter.prototype._events = undefined;\nEventEmitter.prototype._eventsCount = 0;\nEventEmitter.prototype._maxListeners = undefined;\n\n// By default EventEmitters will print a warning if more than 10 listeners are\n// added to it. This is a useful default which helps finding memory leaks.\nvar defaultMaxListeners = 10;\n\nfunction checkListener(listener) {\n if (typeof listener !== 'function') {\n throw new TypeError('The \"listener\" argument must be of type Function. Received type ' + typeof listener);\n }\n}\n\nObject.defineProperty(EventEmitter, 'defaultMaxListeners', {\n enumerable: true,\n get: function() {\n return defaultMaxListeners;\n },\n set: function(arg) {\n if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {\n throw new RangeError('The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received ' + arg + '.');\n }\n defaultMaxListeners = arg;\n }\n});\n\nEventEmitter.init = function() {\n\n if (this._events === undefined ||\n this._events === Object.getPrototypeOf(this)._events) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n }\n\n this._maxListeners = this._maxListeners || undefined;\n};\n\n// Obviously not all Emitters should be limited to 10. This function allows\n// that to be increased. Set to zero for unlimited.\nEventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {\n if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {\n throw new RangeError('The value of \"n\" is out of range. It must be a non-negative number. Received ' + n + '.');\n }\n this._maxListeners = n;\n return this;\n};\n\nfunction _getMaxListeners(that) {\n if (that._maxListeners === undefined)\n return EventEmitter.defaultMaxListeners;\n return that._maxListeners;\n}\n\nEventEmitter.prototype.getMaxListeners = function getMaxListeners() {\n return _getMaxListeners(this);\n};\n\nEventEmitter.prototype.emit = function emit(type) {\n var args = [];\n for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);\n var doError = (type === 'error');\n\n var events = this._events;\n if (events !== undefined)\n doError = (doError && events.error === undefined);\n else if (!doError)\n return false;\n\n // If there is no 'error' event listener then throw.\n if (doError) {\n var er;\n if (args.length > 0)\n er = args[0];\n if (er instanceof Error) {\n // Note: The comments on the `throw` lines are intentional, they show\n // up in Node's output if this results in an unhandled exception.\n throw er; // Unhandled 'error' event\n }\n // At least give some kind of context to the user\n var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));\n err.context = er;\n throw err; // Unhandled 'error' event\n }\n\n var handler = events[type];\n\n if (handler === undefined)\n return false;\n\n if (typeof handler === 'function') {\n ReflectApply(handler, this, args);\n } else {\n var len = handler.length;\n var listeners = arrayClone(handler, len);\n for (var i = 0; i < len; ++i)\n ReflectApply(listeners[i], this, args);\n }\n\n return true;\n};\n\nfunction _addListener(target, type, listener, prepend) {\n var m;\n var events;\n var existing;\n\n checkListener(listener);\n\n events = target._events;\n if (events === undefined) {\n events = target._events = Object.create(null);\n target._eventsCount = 0;\n } else {\n // To avoid recursion in the case that type === \"newListener\"! Before\n // adding it to the listeners, first emit \"newListener\".\n if (events.newListener !== undefined) {\n target.emit('newListener', type,\n listener.listener ? listener.listener : listener);\n\n // Re-assign `events` because a newListener handler could have caused the\n // this._events to be assigned to a new object\n events = target._events;\n }\n existing = events[type];\n }\n\n if (existing === undefined) {\n // Optimize the case of one listener. Don't need the extra array object.\n existing = events[type] = listener;\n ++target._eventsCount;\n } else {\n if (typeof existing === 'function') {\n // Adding the second element, need to change to array.\n existing = events[type] =\n prepend ? [listener, existing] : [existing, listener];\n // If we've already got an array, just append.\n } else if (prepend) {\n existing.unshift(listener);\n } else {\n existing.push(listener);\n }\n\n // Check for listener leak\n m = _getMaxListeners(target);\n if (m > 0 && existing.length > m && !existing.warned) {\n existing.warned = true;\n // No error code for this since it is a Warning\n // eslint-disable-next-line no-restricted-syntax\n var w = new Error('Possible EventEmitter memory leak detected. ' +\n existing.length + ' ' + String(type) + ' listeners ' +\n 'added. Use emitter.setMaxListeners() to ' +\n 'increase limit');\n w.name = 'MaxListenersExceededWarning';\n w.emitter = target;\n w.type = type;\n w.count = existing.length;\n ProcessEmitWarning(w);\n }\n }\n\n return target;\n}\n\nEventEmitter.prototype.addListener = function addListener(type, listener) {\n return _addListener(this, type, listener, false);\n};\n\nEventEmitter.prototype.on = EventEmitter.prototype.addListener;\n\nEventEmitter.prototype.prependListener =\n function prependListener(type, listener) {\n return _addListener(this, type, listener, true);\n };\n\nfunction onceWrapper() {\n if (!this.fired) {\n this.target.removeListener(this.type, this.wrapFn);\n this.fired = true;\n if (arguments.length === 0)\n return this.listener.call(this.target);\n return this.listener.apply(this.target, arguments);\n }\n}\n\nfunction _onceWrap(target, type, listener) {\n var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };\n var wrapped = onceWrapper.bind(state);\n wrapped.listener = listener;\n state.wrapFn = wrapped;\n return wrapped;\n}\n\nEventEmitter.prototype.once = function once(type, listener) {\n checkListener(listener);\n this.on(type, _onceWrap(this, type, listener));\n return this;\n};\n\nEventEmitter.prototype.prependOnceListener =\n function prependOnceListener(type, listener) {\n checkListener(listener);\n this.prependListener(type, _onceWrap(this, type, listener));\n return this;\n };\n\n// Emits a 'removeListener' event if and only if the listener was removed.\nEventEmitter.prototype.removeListener =\n function removeListener(type, listener) {\n var list, events, position, i, originalListener;\n\n checkListener(listener);\n\n events = this._events;\n if (events === undefined)\n return this;\n\n list = events[type];\n if (list === undefined)\n return this;\n\n if (list === listener || list.listener === listener) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else {\n delete events[type];\n if (events.removeListener)\n this.emit('removeListener', type, list.listener || listener);\n }\n } else if (typeof list !== 'function') {\n position = -1;\n\n for (i = list.length - 1; i >= 0; i--) {\n if (list[i] === listener || list[i].listener === listener) {\n originalListener = list[i].listener;\n position = i;\n break;\n }\n }\n\n if (position < 0)\n return this;\n\n if (position === 0)\n list.shift();\n else {\n spliceOne(list, position);\n }\n\n if (list.length === 1)\n events[type] = list[0];\n\n if (events.removeListener !== undefined)\n this.emit('removeListener', type, originalListener || listener);\n }\n\n return this;\n };\n\nEventEmitter.prototype.off = EventEmitter.prototype.removeListener;\n\nEventEmitter.prototype.removeAllListeners =\n function removeAllListeners(type) {\n var listeners, events, i;\n\n events = this._events;\n if (events === undefined)\n return this;\n\n // not listening for removeListener, no need to emit\n if (events.removeListener === undefined) {\n if (arguments.length === 0) {\n this._events = Object.create(null);\n this._eventsCount = 0;\n } else if (events[type] !== undefined) {\n if (--this._eventsCount === 0)\n this._events = Object.create(null);\n else\n delete events[type];\n }\n return this;\n }\n\n // emit removeListener for all listeners on all events\n if (arguments.length === 0) {\n var keys = Object.keys(events);\n var key;\n for (i = 0; i < keys.length; ++i) {\n key = keys[i];\n if (key === 'removeListener') continue;\n this.removeAllListeners(key);\n }\n this.removeAllListeners('removeListener');\n this._events = Object.create(null);\n this._eventsCount = 0;\n return this;\n }\n\n listeners = events[type];\n\n if (typeof listeners === 'function') {\n this.removeListener(type, listeners);\n } else if (listeners !== undefined) {\n // LIFO order\n for (i = listeners.length - 1; i >= 0; i--) {\n this.removeListener(type, listeners[i]);\n }\n }\n\n return this;\n };\n\nfunction _listeners(target, type, unwrap) {\n var events = target._events;\n\n if (events === undefined)\n return [];\n\n var evlistener = events[type];\n if (evlistener === undefined)\n return [];\n\n if (typeof evlistener === 'function')\n return unwrap ? [evlistener.listener || evlistener] : [evlistener];\n\n return unwrap ?\n unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);\n}\n\nEventEmitter.prototype.listeners = function listeners(type) {\n return _listeners(this, type, true);\n};\n\nEventEmitter.prototype.rawListeners = function rawListeners(type) {\n return _listeners(this, type, false);\n};\n\nEventEmitter.listenerCount = function(emitter, type) {\n if (typeof emitter.listenerCount === 'function') {\n return emitter.listenerCount(type);\n } else {\n return listenerCount.call(emitter, type);\n }\n};\n\nEventEmitter.prototype.listenerCount = listenerCount;\nfunction listenerCount(type) {\n var events = this._events;\n\n if (events !== undefined) {\n var evlistener = events[type];\n\n if (typeof evlistener === 'function') {\n return 1;\n } else if (evlistener !== undefined) {\n return evlistener.length;\n }\n }\n\n return 0;\n}\n\nEventEmitter.prototype.eventNames = function eventNames() {\n return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];\n};\n\nfunction arrayClone(arr, n) {\n var copy = new Array(n);\n for (var i = 0; i < n; ++i)\n copy[i] = arr[i];\n return copy;\n}\n\nfunction spliceOne(list, index) {\n for (; index + 1 < list.length; index++)\n list[index] = list[index + 1];\n list.pop();\n}\n\nfunction unwrapListeners(arr) {\n var ret = new Array(arr.length);\n for (var i = 0; i < ret.length; ++i) {\n ret[i] = arr[i].listener || arr[i];\n }\n return ret;\n}\n\nfunction once(emitter, name) {\n return new Promise(function (resolve, reject) {\n function errorListener(err) {\n emitter.removeListener(name, resolver);\n reject(err);\n }\n\n function resolver() {\n if (typeof emitter.removeListener === 'function') {\n emitter.removeListener('error', errorListener);\n }\n resolve([].slice.call(arguments));\n };\n\n eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });\n if (name !== 'error') {\n addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });\n }\n });\n}\n\nfunction addErrorHandlerIfEventEmitter(emitter, handler, flags) {\n if (typeof emitter.on === 'function') {\n eventTargetAgnosticAddListener(emitter, 'error', handler, flags);\n }\n}\n\nfunction eventTargetAgnosticAddListener(emitter, name, listener, flags) {\n if (typeof emitter.on === 'function') {\n if (flags.once) {\n emitter.once(name, listener);\n } else {\n emitter.on(name, listener);\n }\n } else if (typeof emitter.addEventListener === 'function') {\n // EventTarget does not have `error` event semantics like Node\n // EventEmitters, we do not listen for `error` events here.\n emitter.addEventListener(name, function wrapListener(arg) {\n // IE does not have builtin `{ once: true }` support so we\n // have to do it manually.\n if (flags.once) {\n emitter.removeEventListener(name, wrapListener);\n }\n listener(arg);\n });\n } else {\n throw new TypeError('The \"emitter\" argument must be of type EventEmitter. Received type ' + typeof emitter);\n }\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\n/**/\n\nvar isEncoding = Buffer.isEncoding || function (encoding) {\n encoding = '' + encoding;\n switch (encoding && encoding.toLowerCase()) {\n case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':\n return true;\n default:\n return false;\n }\n};\n\nfunction _normalizeEncoding(enc) {\n if (!enc) return 'utf8';\n var retried;\n while (true) {\n switch (enc) {\n case 'utf8':\n case 'utf-8':\n return 'utf8';\n case 'ucs2':\n case 'ucs-2':\n case 'utf16le':\n case 'utf-16le':\n return 'utf16le';\n case 'latin1':\n case 'binary':\n return 'latin1';\n case 'base64':\n case 'ascii':\n case 'hex':\n return enc;\n default:\n if (retried) return; // undefined\n enc = ('' + enc).toLowerCase();\n retried = true;\n }\n }\n};\n\n// Do not cache `Buffer.isEncoding` when checking encoding names as some\n// modules monkey-patch it to support additional encodings\nfunction normalizeEncoding(enc) {\n var nenc = _normalizeEncoding(enc);\n if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);\n return nenc || enc;\n}\n\n// StringDecoder provides an interface for efficiently splitting a series of\n// buffers into a series of JS strings without breaking apart multi-byte\n// characters.\nexports.StringDecoder = StringDecoder;\nfunction StringDecoder(encoding) {\n this.encoding = normalizeEncoding(encoding);\n var nb;\n switch (this.encoding) {\n case 'utf16le':\n this.text = utf16Text;\n this.end = utf16End;\n nb = 4;\n break;\n case 'utf8':\n this.fillLast = utf8FillLast;\n nb = 4;\n break;\n case 'base64':\n this.text = base64Text;\n this.end = base64End;\n nb = 3;\n break;\n default:\n this.write = simpleWrite;\n this.end = simpleEnd;\n return;\n }\n this.lastNeed = 0;\n this.lastTotal = 0;\n this.lastChar = Buffer.allocUnsafe(nb);\n}\n\nStringDecoder.prototype.write = function (buf) {\n if (buf.length === 0) return '';\n var r;\n var i;\n if (this.lastNeed) {\n r = this.fillLast(buf);\n if (r === undefined) return '';\n i = this.lastNeed;\n this.lastNeed = 0;\n } else {\n i = 0;\n }\n if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);\n return r || '';\n};\n\nStringDecoder.prototype.end = utf8End;\n\n// Returns only complete characters in a Buffer\nStringDecoder.prototype.text = utf8Text;\n\n// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer\nStringDecoder.prototype.fillLast = function (buf) {\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);\n this.lastNeed -= buf.length;\n};\n\n// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a\n// continuation byte. If an invalid byte is detected, -2 is returned.\nfunction utf8CheckByte(byte) {\n if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;\n return byte >> 6 === 0x02 ? -1 : -2;\n}\n\n// Checks at most 3 bytes at the end of a Buffer in order to detect an\n// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)\n// needed to complete the UTF-8 character (if applicable) are returned.\nfunction utf8CheckIncomplete(self, buf, i) {\n var j = buf.length - 1;\n if (j < i) return 0;\n var nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 1;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) self.lastNeed = nb - 2;\n return nb;\n }\n if (--j < i || nb === -2) return 0;\n nb = utf8CheckByte(buf[j]);\n if (nb >= 0) {\n if (nb > 0) {\n if (nb === 2) nb = 0;else self.lastNeed = nb - 3;\n }\n return nb;\n }\n return 0;\n}\n\n// Validates as many continuation bytes for a multi-byte UTF-8 character as\n// needed or are available. If we see a non-continuation byte where we expect\n// one, we \"replace\" the validated continuation bytes we've seen so far with\n// a single UTF-8 replacement character ('\\ufffd'), to match v8's UTF-8 decoding\n// behavior. The continuation byte check is included three times in the case\n// where all of the continuation bytes for a character exist in the same buffer.\n// It is also done this way as a slight performance increase instead of using a\n// loop.\nfunction utf8CheckExtraBytes(self, buf, p) {\n if ((buf[0] & 0xC0) !== 0x80) {\n self.lastNeed = 0;\n return '\\ufffd';\n }\n if (self.lastNeed > 1 && buf.length > 1) {\n if ((buf[1] & 0xC0) !== 0x80) {\n self.lastNeed = 1;\n return '\\ufffd';\n }\n if (self.lastNeed > 2 && buf.length > 2) {\n if ((buf[2] & 0xC0) !== 0x80) {\n self.lastNeed = 2;\n return '\\ufffd';\n }\n }\n }\n}\n\n// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.\nfunction utf8FillLast(buf) {\n var p = this.lastTotal - this.lastNeed;\n var r = utf8CheckExtraBytes(this, buf, p);\n if (r !== undefined) return r;\n if (this.lastNeed <= buf.length) {\n buf.copy(this.lastChar, p, 0, this.lastNeed);\n return this.lastChar.toString(this.encoding, 0, this.lastTotal);\n }\n buf.copy(this.lastChar, p, 0, buf.length);\n this.lastNeed -= buf.length;\n}\n\n// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a\n// partial character, the character's bytes are buffered until the required\n// number of bytes are available.\nfunction utf8Text(buf, i) {\n var total = utf8CheckIncomplete(this, buf, i);\n if (!this.lastNeed) return buf.toString('utf8', i);\n this.lastTotal = total;\n var end = buf.length - (total - this.lastNeed);\n buf.copy(this.lastChar, 0, end);\n return buf.toString('utf8', i, end);\n}\n\n// For UTF-8, a replacement character is added when ending on a partial\n// character.\nfunction utf8End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + '\\ufffd';\n return r;\n}\n\n// UTF-16LE typically needs two bytes per character, but even if we have an even\n// number of bytes available, we need to check if we end on a leading/high\n// surrogate. In that case, we need to wait for the next two bytes in order to\n// decode the last character properly.\nfunction utf16Text(buf, i) {\n if ((buf.length - i) % 2 === 0) {\n var r = buf.toString('utf16le', i);\n if (r) {\n var c = r.charCodeAt(r.length - 1);\n if (c >= 0xD800 && c <= 0xDBFF) {\n this.lastNeed = 2;\n this.lastTotal = 4;\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n return r.slice(0, -1);\n }\n }\n return r;\n }\n this.lastNeed = 1;\n this.lastTotal = 2;\n this.lastChar[0] = buf[buf.length - 1];\n return buf.toString('utf16le', i, buf.length - 1);\n}\n\n// For UTF-16LE we do not explicitly append special replacement characters if we\n// end on a partial character, we simply let v8 handle that.\nfunction utf16End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) {\n var end = this.lastTotal - this.lastNeed;\n return r + this.lastChar.toString('utf16le', 0, end);\n }\n return r;\n}\n\nfunction base64Text(buf, i) {\n var n = (buf.length - i) % 3;\n if (n === 0) return buf.toString('base64', i);\n this.lastNeed = 3 - n;\n this.lastTotal = 3;\n if (n === 1) {\n this.lastChar[0] = buf[buf.length - 1];\n } else {\n this.lastChar[0] = buf[buf.length - 2];\n this.lastChar[1] = buf[buf.length - 1];\n }\n return buf.toString('base64', i, buf.length - n);\n}\n\nfunction base64End(buf) {\n var r = buf && buf.length ? this.write(buf) : '';\n if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);\n return r;\n}\n\n// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)\nfunction simpleWrite(buf) {\n return buf.toString(this.encoding);\n}\n\nfunction simpleEnd(buf) {\n return buf && buf.length ? this.write(buf) : '';\n}","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n\n'use strict';\n\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\n/**/\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n for (var key in obj) {\n keys.push(key);\n }return keys;\n};\n/**/\n\nmodule.exports = Duplex;\n\n/**/\nvar util = Object.create(require('core-util-is'));\nutil.inherits = require('inherits');\n/**/\n\nvar Readable = require('./_stream_readable');\nvar Writable = require('./_stream_writable');\n\nutil.inherits(Duplex, Readable);\n\n{\n // avoid scope creep, the keys array can then be collected\n var keys = objectKeys(Writable.prototype);\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n\n Readable.call(this, options);\n Writable.call(this, options);\n\n if (options && options.readable === false) this.readable = false;\n\n if (options && options.writable === false) this.writable = false;\n\n this.allowHalfOpen = true;\n if (options && options.allowHalfOpen === false) this.allowHalfOpen = false;\n\n this.once('end', onend);\n}\n\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._writableState.highWaterMark;\n }\n});\n\n// the no-half-open enforcer\nfunction onend() {\n // if we allow half-open state, or if the writable side ended,\n // then we're ok.\n if (this.allowHalfOpen || this._writableState.ended) return;\n\n // no more data can be written.\n // But allow more writes to happen in this tick.\n pna.nextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n get: function () {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});\n\nDuplex.prototype._destroy = function (err, cb) {\n this.push(null);\n this.end();\n\n pna.nextTick(cb, err);\n};","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\npackage io.ktor.http\n\nimport io.ktor.util.*\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.*\nimport kotlin.native.concurrent.*\n\n@SharedImmutable\nprivate val URL_ALPHABET = (('a'..'z') + ('A'..'Z') + ('0'..'9')).map { it.toByte() }\n\n@SharedImmutable\nprivate val URL_ALPHABET_CHARS = (('a'..'z') + ('A'..'Z') + ('0'..'9'))\n\n@SharedImmutable\nprivate val HEX_ALPHABET = ('a'..'f') + ('A'..'F') + ('0'..'9')\n\n/**\n * https://tools.ietf.org/html/rfc3986#section-2\n */\n@SharedImmutable\nprivate val URL_PROTOCOL_PART = listOf(\n ':', '/', '?', '#', '[', ']', '@', // general\n '!', '$', '&', '\\'', '(', ')', '*', ',', ';', '=', // sub-components\n '-', '.', '_', '~', '+' // unreserved\n).map { it.toByte() }\n\n/**\n * from `pchar` in https://tools.ietf.org/html/rfc3986#section-2\n */\n@SharedImmutable\nprivate val VALID_PATH_PART = listOf(\n ':', '@',\n '!', '$', '&', '\\'', '(', ')', '*', '+', ',', ';', '=',\n '-', '.', '_', '~'\n)\n\n/**\n * Oauth specific percent encoding\n * https://tools.ietf.org/html/rfc5849#section-3.6\n */\n@SharedImmutable\nprivate val OAUTH_SYMBOLS = listOf('-', '.', '_', '~').map { it.toByte() }\n\ninternal val LETTERS_AND_NUMBERS = ('a'..'z').toSet() + ('A'..'Z').toSet() + ('0'..'9').toSet()\n\n/**\n * https://tools.ietf.org/html/rfc7230#section-3.2.6\n */\ninternal val TOKENS: Set =\n setOf('!', '#', '%', '&', '\\'', '*', '+', '-', '.', '^', '_', '`', '|', '~') + LETTERS_AND_NUMBERS\n\n/**\n * Encode url part as specified in\n * https://tools.ietf.org/html/rfc3986#section-2\n */\npublic fun String.encodeURLQueryComponent(\n encodeFull: Boolean = false,\n spaceToPlus: Boolean = false,\n charset: Charset = Charsets.UTF_8\n): String = buildString {\n val content = charset.newEncoder().encode(this@encodeURLQueryComponent)\n content.forEach {\n when {\n it == ' '.toByte() -> if (spaceToPlus) append('+') else append(\"%20\")\n it in URL_ALPHABET || (!encodeFull && it in URL_PROTOCOL_PART) -> append(it.toChar())\n else -> append(it.percentEncode())\n }\n }\n}\n\n/**\n * Encode URL path or component. It escapes all illegal or ambiguous characters\n */\npublic fun String.encodeURLPath(): String = buildString {\n val charset = Charsets.UTF_8\n\n var index = 0\n while (index < this@encodeURLPath.length) {\n val current = this@encodeURLPath[index]\n if (current == '/' || current in URL_ALPHABET_CHARS || current in VALID_PATH_PART) {\n append(current)\n index++\n continue\n }\n\n if (current == '%' &&\n index + 2 < this@encodeURLPath.length &&\n this@encodeURLPath[index + 1] in HEX_ALPHABET &&\n this@encodeURLPath[index + 2] in HEX_ALPHABET\n ) {\n append(current)\n append(this@encodeURLPath[index + 1])\n append(this@encodeURLPath[index + 2])\n\n index += 3\n continue\n }\n\n val symbolSize = if (current.isSurrogate()) 2 else 1\n // we need to call newEncoder() for every symbol, otherwise it won't work\n charset.newEncoder().encode(this@encodeURLPath, index, index + symbolSize).forEach {\n append(it.percentEncode())\n }\n index += symbolSize\n }\n}\n\n/**\n * Encode [this] in percent encoding specified here:\n * https://tools.ietf.org/html/rfc5849#section-3.6\n */\npublic fun String.encodeOAuth(): String = encodeURLParameter()\n\n/**\n * Encode [this] as query parameter key.\n */\npublic fun String.encodeURLParameter(\n spaceToPlus: Boolean = false\n): String = buildString {\n val content = Charsets.UTF_8.newEncoder().encode(this@encodeURLParameter)\n content.forEach {\n when {\n it in URL_ALPHABET || it in OAUTH_SYMBOLS -> append(it.toChar())\n spaceToPlus && it == ' '.toByte() -> append('+')\n else -> append(it.percentEncode())\n }\n }\n}\n\n/**\n * Encode [this] as query parameter value.\n */\ninternal fun String.encodeURLParameterValue(): String = buildString {\n val content = Charsets.UTF_8.newEncoder().encode(this@encodeURLParameterValue)\n content.forEach {\n when {\n it in URL_ALPHABET || it in OAUTH_SYMBOLS || it == '='.toByte() -> append(it.toChar())\n it == ' '.toByte() -> append('+')\n else -> append(it.percentEncode())\n }\n }\n}\n\n/**\n * Decode URL query component\n */\npublic fun String.decodeURLQueryComponent(\n start: Int = 0,\n end: Int = length,\n plusIsSpace: Boolean = false,\n charset: Charset = Charsets.UTF_8\n): String = decodeScan(start, end, plusIsSpace, charset)\n\n/**\n * Decode percent encoded URL part within the specified range [[start], [end]).\n * This function is not intended to decode urlencoded forms so it doesn't decode plus character to space.\n */\npublic fun String.decodeURLPart(\n start: Int = 0,\n end: Int = length,\n charset: Charset = Charsets.UTF_8\n): String = decodeScan(start, end, false, charset)\n\nprivate fun String.decodeScan(start: Int, end: Int, plusIsSpace: Boolean, charset: Charset): String {\n for (index in start until end) {\n val ch = this[index]\n if (ch == '%' || (plusIsSpace && ch == '+')) {\n return decodeImpl(start, end, index, plusIsSpace, charset)\n }\n }\n return if (start == 0 && end == length) toString() else substring(start, end)\n}\n\nprivate fun CharSequence.decodeImpl(\n start: Int,\n end: Int,\n prefixEnd: Int,\n plusIsSpace: Boolean,\n charset: Charset\n): String {\n val length = end - start\n // if length is big, it probably means it is encoded\n val sbSize = if (length > 255) length / 3 else length\n val sb = StringBuilder(sbSize)\n\n if (prefixEnd > start) {\n sb.append(this, start, prefixEnd)\n }\n\n var index = prefixEnd\n\n // reuse ByteArray for hex decoding stripes\n var bytes: ByteArray? = null\n\n while (index < end) {\n val c = this[index]\n when {\n plusIsSpace && c == '+' -> {\n sb.append(' ')\n index++\n }\n c == '%' -> {\n // if ByteArray was not needed before, create it with an estimate of remaining string be all hex\n if (bytes == null) {\n bytes = ByteArray((end - index) / 3)\n }\n\n // fill ByteArray with all the bytes, so Charset can decode text\n var count = 0\n while (index < end && this[index] == '%') {\n if (index + 2 >= end) {\n throw URLDecodeException(\n \"Incomplete trailing HEX escape: ${substring(index)}, in $this at $index\"\n )\n }\n\n val digit1 = charToHexDigit(this[index + 1])\n val digit2 = charToHexDigit(this[index + 2])\n if (digit1 == -1 || digit2 == -1) {\n throw URLDecodeException(\n \"Wrong HEX escape: %${this[index + 1]}${this[index + 2]}, in $this, at $index\"\n )\n }\n\n bytes[count++] = (digit1 * 16 + digit2).toByte()\n index += 3\n }\n\n // Decode chars from bytes and put into StringBuilder\n // Note: Tried using ByteBuffer and using enc.decode() – it's slower\n sb.append(String(bytes, offset = 0, length = count, charset = charset))\n }\n else -> {\n sb.append(c)\n index++\n }\n }\n }\n\n return sb.toString()\n}\n\n/**\n * URL decoder exception\n */\npublic class URLDecodeException(message: String) : Exception(message)\n\nprivate fun Byte.percentEncode(): String = buildString(3) {\n val code = toInt() and 0xff\n append('%')\n append(hexDigitToChar(code shr 4))\n append(hexDigitToChar(code and 0x0f))\n}\n\nprivate fun charToHexDigit(c2: Char) = when (c2) {\n in '0'..'9' -> c2 - '0'\n in 'A'..'F' -> c2 - 'A' + 10\n in 'a'..'f' -> c2 - 'a' + 10\n else -> -1\n}\n\nprivate fun hexDigitToChar(digit: Int): Char = when (digit) {\n in 0..9 -> '0' + digit\n else -> 'A' + digit - 10\n}\n\nprivate fun ByteReadPacket.forEach(block: (Byte) -> Unit) {\n takeWhile { buffer ->\n while (buffer.canRead()) {\n block(buffer.readByte())\n }\n true\n }\n}\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"StringsKt\")\n\npackage kotlin.text\n\n/**\n * Converts the string into a regular expression [Regex] with the default options.\n */\n@kotlin.internal.InlineOnly\npublic inline fun String.toRegex(): Regex = Regex(this)\n\n/**\n * Converts the string into a regular expression [Regex] with the specified single [option].\n */\n@kotlin.internal.InlineOnly\npublic inline fun String.toRegex(option: RegexOption): Regex = Regex(this, option)\n\n/**\n * Converts the string into a regular expression [Regex] with the specified set of [options].\n */\n@kotlin.internal.InlineOnly\npublic inline fun String.toRegex(options: Set): Regex = Regex(this, options)\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\n/**\n * Escapes the characters in a String using HTML entities\n */\npublic fun String.escapeHTML(): String {\n val text = this@escapeHTML\n if (text.isEmpty()) return text\n\n return buildString(length) {\n for (idx in 0 until text.length) {\n val ch = text[idx]\n when (ch) {\n '\\'' -> append(\"'\")\n '\\\"' -> append(\""\")\n '&' -> append(\"&\")\n '<' -> append(\"<\")\n '>' -> append(\">\")\n else -> append(ch)\n }\n }\n }\n}\n\n/**\n * Splits the given string into two parts before and after separator.\n *\n * Useful together with destructuring declarations\n */\npublic inline fun String.chomp(\n separator: String,\n onMissingDelimiter: () -> Pair\n): Pair {\n val idx = indexOf(separator)\n return when (idx) {\n -1 -> onMissingDelimiter()\n else -> substring(0, idx) to substring(idx + 1)\n }\n}\n\n/**\n * Does the same as the regular [toLowerCase] except that locale-specific rules are not applied to ASCII characters\n * so latin characters are converted by the original english rules.\n */\n@InternalAPI\npublic fun String.toLowerCasePreservingASCIIRules(): String {\n val firstIndex = indexOfFirst {\n toLowerCasePreservingASCII(it) != it\n }\n\n if (firstIndex == -1) {\n return this\n }\n\n val original = this\n return buildString(length) {\n append(original, 0, firstIndex)\n\n for (index in firstIndex..original.lastIndex) {\n append(toLowerCasePreservingASCII(original[index]))\n }\n }\n}\n\n/**\n * Does the same as the regular [toUpperCase] except that locale-specific rules are not applied to ASCII characters\n * so latin characters are converted by the original english rules.\n */\n@InternalAPI\npublic fun String.toUpperCasePreservingASCIIRules(): String {\n val firstIndex = indexOfFirst {\n toUpperCasePreservingASCII(it) != it\n }\n\n if (firstIndex == -1) {\n return this\n }\n\n val original = this\n return buildString(length) {\n append(original, 0, firstIndex)\n\n for (index in firstIndex..original.lastIndex) {\n append(toUpperCasePreservingASCII(original[index]))\n }\n }\n}\n\nprivate fun toLowerCasePreservingASCII(ch: Char): Char = when (ch) {\n in 'A'..'Z' -> ch + 32\n in '\\u0000'..'\\u007f' -> ch\n else -> ch.toLowerCase()\n}\n\nprivate fun toUpperCasePreservingASCII(ch: Char): Char = when (ch) {\n in 'a'..'z' -> ch - 32\n in '\\u0000'..'\\u007f' -> ch\n else -> ch.toLowerCase()\n}\n\ninternal fun String.caseInsensitive(): CaseInsensitiveString = CaseInsensitiveString(this)\n\ninternal class CaseInsensitiveString(val content: String) {\n private val hash = content.toLowerCase().hashCode()\n\n override fun equals(other: Any?): Boolean =\n (other as? CaseInsensitiveString)?.content?.equals(content, ignoreCase = true) == true\n\n override fun hashCode(): Int = hash\n\n override fun toString(): String = content\n}\n","package io.ktor.utils.io.core\n\npublic expect interface Closeable {\n public fun close()\n}\n\npublic inline fun C.use(block: (C) -> R): R {\n var closed = false\n\n return try {\n block(this)\n } catch (first: Throwable) {\n try {\n closed = true\n close()\n } catch (second: Throwable) {\n first.addSuppressedInternal(second)\n }\n\n throw first\n } finally {\n if (!closed) {\n close()\n }\n }\n}\n\n@PublishedApi\ninternal expect fun Throwable.addSuppressedInternal(other: Throwable)\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\n/**\n * Represents `Content-Disposition` header value\n */\npublic class ContentDisposition(disposition: String, parameters: List = emptyList()) :\n HeaderValueWithParameters(disposition, parameters) {\n /**\n * Content disposition value without parameters\n */\n public val disposition: String get() = content\n\n /**\n * Content disposition name (from parameter named `name`)\n */\n public val name: String?\n get() = parameter(Parameters.Name)\n\n /**\n * Creates new with parameter appended\n */\n public fun withParameter(key: String, value: String): ContentDisposition =\n ContentDisposition(disposition, parameters + HeaderValueParam(key, value))\n\n /**\n * Creates new with parameters appended\n */\n public fun withParameters(newParameters: List): ContentDisposition =\n ContentDisposition(disposition, parameters + newParameters)\n\n override fun equals(other: Any?): Boolean =\n other is ContentDisposition &&\n disposition == other.disposition &&\n parameters == other.parameters\n\n override fun hashCode(): Int = disposition.hashCode() * 31 + parameters.hashCode()\n\n @Suppress(\"unused\", \"PublicApiImplicitType\")\n public companion object {\n /**\n * `Content-Disposition: file`\n */\n public val File: ContentDisposition = ContentDisposition(\"file\")\n\n /**\n * `Content-Disposition: mixed`\n */\n public val Mixed: ContentDisposition = ContentDisposition(\"mixed\")\n\n /**\n * `Content-Disposition: attachment`\n */\n public val Attachment: ContentDisposition = ContentDisposition(\"attachment\")\n\n /**\n * `Content-Disposition: inline`\n */\n public val Inline: ContentDisposition = ContentDisposition(\"inline\")\n\n /**\n * Parse `Content-Disposition` header [value]\n */\n public fun parse(value: String): ContentDisposition = parse(value) { v, p -> ContentDisposition(v, p) }\n }\n\n /**\n * Frequently used content disposition parameter names\n */\n @Suppress(\"KDocMissingDocumentation\", \"unused\", \"PublicApiImplicitType\")\n public object Parameters {\n public const val FileName: String = \"filename\"\n public const val FileNameAsterisk: String = \"filename*\"\n public const val Name: String = \"name\"\n public const val CreationDate: String = \"creation-date\"\n public const val ModificationDate: String = \"modification-date\"\n public const val ReadDate: String = \"read-date\"\n public const val Size: String = \"size\"\n public const val Handling: String = \"handling\"\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\n/**\n * Set `E-Tag` header\n */\npublic fun HeadersBuilder.etag(entityTag: String): Unit = set(HttpHeaders.ETag, entityTag)\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\n/**\n * Represents a value for a `Cache-Control` header\n *\n * @param visibility specifies an optional visibility such as private or public\n */\npublic sealed class CacheControl(public val visibility: Visibility?) {\n\n /**\n * Controls caching by proxies\n */\n public enum class Visibility(internal val headerValue: String) {\n /**\n * Specifies that the response is cacheable by clients and shared (proxy) caches.\n */\n Public(\"public\"),\n\n /**\n * Specifies that the response is cacheable only on the client and not by shared (proxy server) caches.\n */\n Private(\"private\")\n }\n\n /**\n * Represents a no-cache cache control value\n */\n public class NoCache(visibility: Visibility?) : CacheControl(visibility) {\n override fun toString(): String = if (visibility == null) {\n \"no-cache\"\n } else {\n \"no-cache, ${visibility.headerValue}\"\n }\n\n override fun equals(other: Any?): Boolean {\n return other is NoCache && visibility == other.visibility\n }\n\n override fun hashCode(): Int {\n return visibility.hashCode()\n }\n }\n\n /**\n * Represents a no-store cache control value\n */\n public class NoStore(visibility: Visibility?) : CacheControl(visibility) {\n override fun toString(): String = if (visibility == null) {\n \"no-store\"\n } else {\n \"no-store, ${visibility.headerValue}\"\n }\n\n override fun equals(other: Any?): Boolean {\n return other is NoStore && other.visibility == visibility\n }\n\n override fun hashCode(): Int {\n return visibility.hashCode()\n }\n }\n\n /**\n * Represents a cache control value with the specified max ages and re-validation strategies\n * @property maxAgeSeconds max-age in seconds\n * @property proxyMaxAgeSeconds max-age in seconds for caching proxies\n * @property mustRevalidate `true` if a client must validate in spite of age\n * @property proxyRevalidate `true` if a caching proxy must revalidate in spite of age\n */\n public class MaxAge(\n public val maxAgeSeconds: Int,\n public val proxyMaxAgeSeconds: Int? = null,\n public val mustRevalidate: Boolean = false,\n public val proxyRevalidate: Boolean = false,\n visibility: Visibility? = null\n ) : CacheControl(visibility) {\n override fun toString(): String {\n val parts = ArrayList(5)\n parts.add(\"max-age=$maxAgeSeconds\")\n if (proxyMaxAgeSeconds != null) {\n parts.add(\"s-maxage=$proxyMaxAgeSeconds\")\n }\n if (mustRevalidate) {\n parts.add(\"must-revalidate\")\n }\n if (proxyRevalidate) {\n parts.add(\"proxy-revalidate\")\n }\n if (visibility != null) {\n parts.add(visibility.headerValue)\n }\n\n return parts.joinToString(\", \")\n }\n\n override fun equals(other: Any?): Boolean {\n return other === this || (\n other is MaxAge &&\n other.maxAgeSeconds == maxAgeSeconds &&\n other.proxyMaxAgeSeconds == proxyMaxAgeSeconds &&\n other.mustRevalidate == mustRevalidate &&\n other.proxyRevalidate == proxyRevalidate &&\n other.visibility == visibility\n )\n }\n\n override fun hashCode(): Int {\n var result = maxAgeSeconds\n result = 31 * result + (proxyMaxAgeSeconds ?: 0)\n result = 31 * result + mustRevalidate.hashCode()\n result = 31 * result + proxyRevalidate.hashCode()\n result = 31 * result + visibility.hashCode()\n return result\n }\n }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.util.*\nimport kotlin.native.concurrent.*\n\n/** Separator symbols listed in RFC https://tools.ietf.org/html/rfc2616#section-2.2 */\n@SharedImmutable\nprivate val HeaderFieldValueSeparators =\n setOf('(', ')', '<', '>', '@', ',', ';', ':', '\\\\', '\\\"', '/', '[', ']', '?', '=', '{', '}', ' ', '\\t', '\\n', '\\r')\n\n/**\n * Represents a header value that consist of [content] followed by [parameters].\n * Useful for headers such as `Content-Type`, `Content-Disposition` and so on.\n *\n * @property content header's content without parameters\n * @property parameters\n */\npublic abstract class HeaderValueWithParameters(\n protected val content: String,\n public val parameters: List = emptyList()\n) {\n\n /**\n * The first value for the parameter with [name] comparing case-insensitively or `null` if no such parameters found\n */\n public fun parameter(name: String): String? =\n parameters.firstOrNull { it.name.equals(name, ignoreCase = true) }?.value\n\n override fun toString(): String = when {\n parameters.isEmpty() -> content\n else -> {\n val size = content.length + parameters.sumBy { it.name.length + it.value.length + 3 }\n StringBuilder(size).apply {\n append(content)\n for (index in 0 until parameters.size) {\n val (name, value) = parameters[index]\n append(\"; \")\n append(name)\n append(\"=\")\n value.escapeIfNeededTo(this)\n }\n }.toString()\n }\n }\n\n public companion object {\n /**\n * Parse header with parameter and pass it to [init] function to instantiate particular type\n */\n public inline fun parse(value: String, init: (String, List) -> R): R {\n val headerValue = parseHeaderValue(value).single()\n return init(headerValue.value, headerValue.params)\n }\n }\n}\n\n/**\n * Append formatted header value to the builder\n */\npublic fun StringValuesBuilder.append(name: String, value: HeaderValueWithParameters) {\n append(name, value.toString())\n}\n\n/**\n * Escape using double quotes if needed or keep as is if no dangerous strings found\n */\n@InternalAPI\npublic fun String.escapeIfNeeded(): String = when {\n checkNeedEscape() -> quote()\n else -> this\n}\n\n@Suppress(\"NOTHING_TO_INLINE\")\nprivate inline fun String.escapeIfNeededTo(out: StringBuilder) {\n when {\n checkNeedEscape() -> out.append(this.quote())\n else -> out.append(this)\n }\n}\n\nprivate fun String.checkNeedEscape(): Boolean {\n if (isEmpty()) return true\n if (isQuoted()) return false\n\n for (index in 0 until length) {\n if (HeaderFieldValueSeparators.contains(this[index])) return true\n }\n\n return false\n}\n\nprivate fun String.isQuoted(): Boolean {\n if (length < 2) {\n return false\n }\n if (first() != '\"' || last() != '\"') {\n return false\n }\n var startIndex = 1\n do {\n val index = indexOf('\"', startIndex)\n if (index == lastIndex) {\n break\n }\n\n var slashesCount = 0\n var slashIndex = index - 1\n while (this[slashIndex] == '\\\\') {\n slashesCount++\n slashIndex--\n }\n if (slashesCount % 2 == 0) {\n return false\n }\n\n startIndex = index + 1\n } while (startIndex < length)\n\n return true\n}\n\n/**\n * Escape string using double quotes\n */\n@InternalAPI\npublic fun String.quote(): String = buildString { this@quote.quoteTo(this) }\n\nprivate fun String.quoteTo(out: StringBuilder) {\n out.append(\"\\\"\")\n for (i in 0 until length) {\n val ch = this[i]\n when (ch) {\n '\\\\' -> out.append(\"\\\\\\\\\")\n '\\n' -> out.append(\"\\\\n\")\n '\\r' -> out.append(\"\\\\r\")\n '\\t' -> out.append(\"\\\\t\")\n '\\\"' -> out.append(\"\\\\\\\"\")\n else -> out.append(ch)\n }\n }\n out.append(\"\\\"\")\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.util.*\n\n/**\n * Format `Content-Range` header value\n */\npublic fun contentRangeHeaderValue(\n range: LongRange?,\n fullLength: Long? = null,\n unit: RangeUnits = RangeUnits.Bytes\n): String =\n contentRangeHeaderValue(range, fullLength, unit.unitToken)\n\n/**\n * Format `Content-Range` header value\n */\npublic fun contentRangeHeaderValue(\n range: LongRange?,\n fullLength: Long? = null,\n unit: String = RangeUnits.Bytes.unitToken\n): String = buildString {\n append(unit)\n append(\" \")\n if (range != null) {\n append(range.start)\n append('-')\n append(range.endInclusive)\n } else {\n append('*')\n }\n append('/')\n append(fullLength ?: \"*\")\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.utils.io.charsets.*\n\n/**\n * Represents a value for a `Content-Type` header.\n * @property contentType represents a type part of the media type.\n * @property contentSubtype represents a subtype part of the media type.\n */\npublic class ContentType private constructor(\n public val contentType: String,\n public val contentSubtype: String,\n existingContent: String,\n parameters: List = emptyList()\n) : HeaderValueWithParameters(existingContent, parameters) {\n\n public constructor(\n contentType: String,\n contentSubtype: String,\n parameters: List = emptyList()\n ) : this(\n contentType,\n contentSubtype,\n \"$contentType/$contentSubtype\",\n parameters\n )\n\n /**\n * Creates a copy of `this` type with the added parameter with the [name] and [value].\n */\n public fun withParameter(name: String, value: String): ContentType {\n if (hasParameter(name, value)) return this\n\n return ContentType(contentType, contentSubtype, content, parameters + HeaderValueParam(name, value))\n }\n\n private fun hasParameter(name: String, value: String): Boolean = when (parameters.size) {\n 0 -> false\n 1 -> parameters[0].let { it.name.equals(name, ignoreCase = true) && it.value.equals(value, ignoreCase = true) }\n else -> parameters.any { it.name.equals(name, ignoreCase = true) && it.value.equals(value, ignoreCase = true) }\n }\n\n /**\n * Creates a copy of `this` type without any parameters\n */\n public fun withoutParameters(): ContentType = when {\n parameters.isEmpty() -> this\n else -> ContentType(contentType, contentSubtype)\n }\n\n /**\n * Checks if `this` type matches a [pattern] type taking into account placeholder symbols `*` and parameters.\n */\n public fun match(pattern: ContentType): Boolean {\n if (pattern.contentType != \"*\" && !pattern.contentType.equals(contentType, ignoreCase = true)) {\n return false\n }\n\n if (pattern.contentSubtype != \"*\" && !pattern.contentSubtype.equals(contentSubtype, ignoreCase = true)) {\n return false\n }\n\n for ((patternName, patternValue) in pattern.parameters) {\n val matches = when (patternName) {\n \"*\" -> {\n when (patternValue) {\n \"*\" -> true\n else -> parameters.any { p -> p.value.equals(patternValue, ignoreCase = true) }\n }\n }\n else -> {\n val value = parameter(patternName)\n when (patternValue) {\n \"*\" -> value != null\n else -> value.equals(patternValue, ignoreCase = true)\n }\n }\n }\n\n if (!matches) {\n return false\n }\n }\n return true\n }\n\n /**\n * Checks if `this` type matches a [pattern] type taking into account placeholder symbols `*` and parameters.\n */\n public fun match(pattern: String): Boolean = match(parse(pattern))\n\n override fun equals(other: Any?): Boolean =\n other is ContentType &&\n contentType.equals(other.contentType, ignoreCase = true) &&\n contentSubtype.equals(other.contentSubtype, ignoreCase = true) &&\n parameters == other.parameters\n\n override fun hashCode(): Int {\n var result = contentType.toLowerCase().hashCode()\n result += 31 * result + contentSubtype.toLowerCase().hashCode()\n result += 31 * parameters.hashCode()\n return result\n }\n\n public companion object {\n /**\n * Parses a string representing a `Content-Type` header into a [ContentType] instance.\n */\n public fun parse(value: String): ContentType {\n if (value.isBlank()) return Any\n\n return parse(value) { parts, parameters ->\n val slash = parts.indexOf('/')\n\n if (slash == -1) {\n if (parts.trim() == \"*\") {\n return Any\n }\n\n throw BadContentTypeFormatException(value)\n }\n\n val type = parts.substring(0, slash).trim()\n\n if (type.isEmpty()) {\n throw BadContentTypeFormatException(value)\n }\n\n val subtype = parts.substring(slash + 1).trim()\n\n if (subtype.isEmpty() || subtype.contains('/')) {\n throw BadContentTypeFormatException(value)\n }\n\n ContentType(type, subtype, parameters)\n }\n }\n\n /**\n * Represents a pattern `* / *` to match any content type.\n */\n public val Any: ContentType = ContentType(\"*\", \"*\")\n }\n\n /**\n * Provides a list of standard subtypes of an `application` content type.\n */\n @Suppress(\"KDocMissingDocumentation\", \"unused\")\n public object Application {\n /**\n * Represents a pattern `application / *` to match any application content type.\n */\n public val Any: ContentType = ContentType(\"application\", \"*\")\n public val Atom: ContentType = ContentType(\"application\", \"atom+xml\")\n public val Cbor: ContentType = ContentType(\"application\", \"cbor\")\n public val Json: ContentType = ContentType(\"application\", \"json\")\n public val HalJson: ContentType = ContentType(\"application\", \"hal+json\")\n public val JavaScript: ContentType = ContentType(\"application\", \"javascript\")\n public val OctetStream: ContentType = ContentType(\"application\", \"octet-stream\")\n public val FontWoff: ContentType = ContentType(\"application\", \"font-woff\")\n public val Rss: ContentType = ContentType(\"application\", \"rss+xml\")\n public val Xml: ContentType = ContentType(\"application\", \"xml\")\n public val Xml_Dtd: ContentType = ContentType(\"application\", \"xml-dtd\")\n public val Zip: ContentType = ContentType(\"application\", \"zip\")\n public val GZip: ContentType = ContentType(\"application\", \"gzip\")\n\n public val FormUrlEncoded: ContentType =\n ContentType(\"application\", \"x-www-form-urlencoded\")\n\n public val Pdf: ContentType = ContentType(\"application\", \"pdf\")\n public val ProtoBuf: ContentType = ContentType(\"application\", \"protobuf\")\n public val Wasm: ContentType = ContentType(\"application\", \"wasm\")\n public val ProblemJson: ContentType = ContentType(\"application\", \"problem+json\")\n public val ProblemXml: ContentType = ContentType(\"application\", \"problem+xml\")\n }\n\n /**\n * Provides a list of standard subtypes of an `audio` content type.\n */\n @Suppress(\"KDocMissingDocumentation\", \"unused\")\n public object Audio {\n public val Any: ContentType = ContentType(\"audio\", \"*\")\n public val MP4: ContentType = ContentType(\"audio\", \"mp4\")\n public val MPEG: ContentType = ContentType(\"audio\", \"mpeg\")\n public val OGG: ContentType = ContentType(\"audio\", \"ogg\")\n }\n\n /**\n * Provides a list of standard subtypes of an `image` content type.\n */\n @Suppress(\"KDocMissingDocumentation\", \"unused\")\n public object Image {\n public val Any: ContentType = ContentType(\"image\", \"*\")\n public val GIF: ContentType = ContentType(\"image\", \"gif\")\n public val JPEG: ContentType = ContentType(\"image\", \"jpeg\")\n public val PNG: ContentType = ContentType(\"image\", \"png\")\n public val SVG: ContentType = ContentType(\"image\", \"svg+xml\")\n public val XIcon: ContentType = ContentType(\"image\", \"x-icon\")\n }\n\n /**\n * Provides a list of standard subtypes of a `message` content type.\n */\n @Suppress(\"KDocMissingDocumentation\", \"unused\")\n public object Message {\n public val Any: ContentType = ContentType(\"message\", \"*\")\n public val Http: ContentType = ContentType(\"message\", \"http\")\n }\n\n /**\n * Provides a list of standard subtypes of a `multipart` content type.\n */\n @Suppress(\"KDocMissingDocumentation\", \"unused\")\n public object MultiPart {\n public val Any: ContentType = ContentType(\"multipart\", \"*\")\n public val Mixed: ContentType = ContentType(\"multipart\", \"mixed\")\n public val Alternative: ContentType = ContentType(\"multipart\", \"alternative\")\n public val Related: ContentType = ContentType(\"multipart\", \"related\")\n public val FormData: ContentType = ContentType(\"multipart\", \"form-data\")\n public val Signed: ContentType = ContentType(\"multipart\", \"signed\")\n public val Encrypted: ContentType = ContentType(\"multipart\", \"encrypted\")\n public val ByteRanges: ContentType = ContentType(\"multipart\", \"byteranges\")\n }\n\n /**\n * Provides a list of standard subtypes of a `text` content type.\n */\n @Suppress(\"KDocMissingDocumentation\", \"unused\")\n public object Text {\n public val Any: ContentType = ContentType(\"text\", \"*\")\n public val Plain: ContentType = ContentType(\"text\", \"plain\")\n public val CSS: ContentType = ContentType(\"text\", \"css\")\n public val CSV: ContentType = ContentType(\"text\", \"csv\")\n public val Html: ContentType = ContentType(\"text\", \"html\")\n public val JavaScript: ContentType = ContentType(\"text\", \"javascript\")\n public val VCard: ContentType = ContentType(\"text\", \"vcard\")\n public val Xml: ContentType = ContentType(\"text\", \"xml\")\n public val EventStream: ContentType = ContentType(\"text\", \"event-stream\")\n }\n\n /**\n * Provides a list of standard subtypes of a `video` content type.\n */\n @Suppress(\"KDocMissingDocumentation\", \"unused\")\n public object Video {\n public val Any: ContentType = ContentType(\"video\", \"*\")\n public val MPEG: ContentType = ContentType(\"video\", \"mpeg\")\n public val MP4: ContentType = ContentType(\"video\", \"mp4\")\n public val OGG: ContentType = ContentType(\"video\", \"ogg\")\n public val QuickTime: ContentType = ContentType(\"video\", \"quicktime\")\n }\n}\n\n/**\n * Exception thrown when a content type string is malformed.\n */\npublic class BadContentTypeFormatException(value: String) : Exception(\"Bad Content-Type format: $value\")\n\n/**\n * Creates a copy of `this` type with the added charset parameter with [charset] value.\n */\npublic fun ContentType.withCharset(charset: Charset): ContentType = withParameter(\"charset\", charset.name)\n\n/**\n * Extracts a [Charset] value from the given `Content-Type`, `Content-Disposition` or similar header value.\n */\npublic fun HeaderValueWithParameters.charset(): Charset? = parameter(\"charset\")?.let { Charset.forName(it) }\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.util.*\nimport io.ktor.util.date.*\nimport kotlin.jvm.*\nimport kotlin.native.concurrent.*\n\n/**\n * Represents a cookie with name, content and a set of settings such as expiration, visibility and security.\n * A cookie with neither [expires] nor [maxAge] is a session cookie.\n *\n * @property name\n * @property value\n * @property encoding - cookie encoding type [CookieEncoding]\n * @property maxAge number of seconds to keep cookie\n * @property expires date when it expires\n * @property domain for which it is set\n * @property path for which it is set\n * @property secure send it via secure connection only\n * @property httpOnly only transfer cookie over HTTP, no access from JavaScript\n * @property extensions additional cookie extensions\n */\npublic data class Cookie(\n val name: String,\n val value: String,\n val encoding: CookieEncoding = CookieEncoding.URI_ENCODING,\n @get:JvmName(\"getMaxAgeInt\")\n val maxAge: Int = 0,\n val expires: GMTDate? = null,\n val domain: String? = null,\n val path: String? = null,\n val secure: Boolean = false,\n val httpOnly: Boolean = false,\n val extensions: Map = emptyMap()\n) {\n @Suppress(\"unused\", \"KDocMissingDocumentation\")\n @Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\n public fun getMaxAge(): Int = maxAge\n}\n\n/**\n * Cooke encoding strategy\n */\npublic enum class CookieEncoding {\n /**\n * No encoding (could be dangerous)\n */\n RAW,\n\n /**\n * Double quotes with slash-escaping\n */\n DQUOTES,\n\n /**\n * URI encoding\n */\n URI_ENCODING,\n\n /**\n * BASE64 encoding\n */\n BASE64_ENCODING\n}\n\n@SharedImmutable\nprivate val loweredPartNames = setOf(\"max-age\", \"expires\", \"domain\", \"path\", \"secure\", \"httponly\", \"\\$x-enc\")\n\n/**\n * Parse server's `Set-Cookie` header value\n */\n@KtorExperimentalAPI\npublic fun parseServerSetCookieHeader(cookiesHeader: String): Cookie {\n val asMap = parseClientCookiesHeader(cookiesHeader, false)\n val first = asMap.entries.first { !it.key.startsWith(\"$\") }\n val encoding = asMap[\"\\$x-enc\"]?.let { CookieEncoding.valueOf(it) } ?: CookieEncoding.RAW\n val loweredMap = asMap.mapKeys { it.key.toLowerCasePreservingASCIIRules() }\n\n return Cookie(\n name = first.key,\n value = decodeCookieValue(first.value, encoding),\n encoding = encoding,\n maxAge = loweredMap[\"max-age\"]?.toIntClamping() ?: 0,\n expires = loweredMap[\"expires\"]?.fromCookieToGmtDate(),\n domain = loweredMap[\"domain\"],\n path = loweredMap[\"path\"],\n secure = \"secure\" in loweredMap,\n httpOnly = \"httponly\" in loweredMap,\n extensions = asMap.filterKeys {\n it.toLowerCasePreservingASCIIRules() !in loweredPartNames && it != first.key\n }\n )\n}\n\n@ThreadLocal\nprivate val clientCookieHeaderPattern = \"\"\"(^|;)\\s*([^()<>@;:/\\\\\"\\[\\]\\?=\\{\\}\\s]+)\\s*(=\\s*(\"[^\"]*\"|[^;]*))?\"\"\".toRegex()\n\n/**\n * Parse client's `Cookie` header value\n */\n@KtorExperimentalAPI\npublic fun parseClientCookiesHeader(cookiesHeader: String, skipEscaped: Boolean = true): Map =\n clientCookieHeaderPattern.findAll(cookiesHeader)\n .map { (it.groups[2]?.value ?: \"\") to (it.groups[4]?.value ?: \"\") }\n .filter { !skipEscaped || !it.first.startsWith(\"$\") }\n .map { cookie ->\n if (cookie.second.startsWith(\"\\\"\") && cookie.second.endsWith(\"\\\"\")) {\n cookie.copy(second = cookie.second.removeSurrounding(\"\\\"\"))\n } else {\n cookie\n }\n }\n .toMap()\n\n/**\n * Format `Set-Cookie` header value\n */\n@KtorExperimentalAPI\npublic fun renderSetCookieHeader(cookie: Cookie): String = with(cookie) {\n renderSetCookieHeader(\n name,\n value,\n encoding,\n maxAge,\n expires,\n domain,\n path,\n secure,\n httpOnly,\n extensions\n )\n}\n\n/**\n * Format `Set-Cookie` header value\n */\n@KtorExperimentalAPI\npublic fun renderCookieHeader(cookie: Cookie): String = with(cookie) {\n renderSetCookieHeader(\n name,\n value,\n encoding,\n maxAge,\n expires,\n domain,\n path,\n secure,\n httpOnly,\n extensions,\n includeEncoding = false\n )\n}\n\n/**\n * Format `Set-Cookie` header value\n */\n@KtorExperimentalAPI\npublic fun renderSetCookieHeader(\n name: String,\n value: String,\n encoding: CookieEncoding = CookieEncoding.URI_ENCODING,\n maxAge: Int = 0,\n expires: GMTDate? = null,\n domain: String? = null,\n path: String? = null,\n secure: Boolean = false,\n httpOnly: Boolean = false,\n extensions: Map = emptyMap(),\n includeEncoding: Boolean = true\n): String = (\n listOf(\n cookiePart(name.assertCookieName(), value, encoding),\n cookiePartUnencoded(\"Max-Age\", if (maxAge > 0) maxAge else null),\n cookiePartUnencoded(\"Expires\", expires?.toHttpDate()),\n cookiePart(\"Domain\", domain, CookieEncoding.RAW),\n cookiePart(\"Path\", path, CookieEncoding.RAW),\n\n cookiePartFlag(\"Secure\", secure),\n cookiePartFlag(\"HttpOnly\", httpOnly)\n ) + extensions.map { cookiePartExt(it.key.assertCookieName(), it.value, encoding) } +\n if (includeEncoding) cookiePartExt(\"\\$x-enc\", encoding.name, CookieEncoding.RAW) else \"\"\n ).filter { it.isNotEmpty() }\n .joinToString(\"; \")\n\n/**\n * Encode cookie value using the specified [encoding]\n */\n@KtorExperimentalAPI\npublic fun encodeCookieValue(value: String, encoding: CookieEncoding): String = when (encoding) {\n CookieEncoding.RAW -> when {\n value.any { it.shouldEscapeInCookies() } ->\n throw IllegalArgumentException(\n \"The cookie value contains characters that couldn't be encoded in RAW format. \" +\n \" Consider URL_ENCODING mode\"\n )\n else -> value\n }\n CookieEncoding.DQUOTES -> when {\n value.contains('\"') -> throw IllegalArgumentException(\n \"The cookie value contains characters that couldn't be encoded in DQUOTES format. \" +\n \"Consider URL_ENCODING mode\"\n )\n value.any { it.shouldEscapeInCookies() } -> \"\\\"$value\\\"\"\n else -> value\n }\n CookieEncoding.BASE64_ENCODING -> value.encodeBase64()\n CookieEncoding.URI_ENCODING -> value.encodeURLQueryComponent(encodeFull = true, spaceToPlus = true)\n}\n\n/**\n * Decode cookie value using the specified [encoding]\n */\n@KtorExperimentalAPI\npublic fun decodeCookieValue(encodedValue: String, encoding: CookieEncoding): String = when (encoding) {\n CookieEncoding.RAW, CookieEncoding.DQUOTES -> when {\n encodedValue.trimStart().startsWith(\"\\\"\") && encodedValue.trimEnd().endsWith(\"\\\"\") ->\n encodedValue.trim().removeSurrounding(\"\\\"\")\n else -> encodedValue\n }\n CookieEncoding.URI_ENCODING -> encodedValue.decodeURLQueryComponent(plusIsSpace = true)\n CookieEncoding.BASE64_ENCODING -> encodedValue.decodeBase64String()\n}\n\nprivate fun String.assertCookieName() = when {\n any { it.shouldEscapeInCookies() } -> throw IllegalArgumentException(\"Cookie name is not valid: $this\")\n else -> this\n}\n\n@SharedImmutable\nprivate val cookieCharsShouldBeEscaped = setOf(';', ',', '\"')\n\nprivate fun Char.shouldEscapeInCookies() = isWhitespace() || this < ' ' || this in cookieCharsShouldBeEscaped\n\n@Suppress(\"NOTHING_TO_INLINE\")\nprivate inline fun cookiePart(name: String, value: Any?, encoding: CookieEncoding) =\n if (value != null) \"$name=${encodeCookieValue(value.toString(), encoding)}\" else \"\"\n\n@Suppress(\"NOTHING_TO_INLINE\")\nprivate inline fun cookiePartUnencoded(name: String, value: Any?) =\n if (value != null) \"$name=$value\" else \"\"\n\n@Suppress(\"NOTHING_TO_INLINE\")\nprivate inline fun cookiePartFlag(name: String, value: Boolean) =\n if (value) name else \"\"\n\n@Suppress(\"NOTHING_TO_INLINE\")\nprivate inline fun cookiePartExt(name: String, value: String?, encoding: CookieEncoding) =\n if (value == null) cookiePartFlag(name, true) else cookiePart(name, value, encoding)\n\nprivate fun String.toIntClamping(): Int = toLong().coerceIn(0L, Int.MAX_VALUE.toLong()).toInt()\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.util.*\n\n/**\n * Represents HTTP headers as a map from case-insensitive names to collection of [String] values\n */\npublic interface Headers : StringValues {\n public companion object {\n /**\n * Empty [Headers] instance\n */\n @Suppress(\"DEPRECATION_ERROR\")\n public val Empty: Headers = EmptyHeaders\n\n /**\n * Builds a [Headers] instance with the given [builder] function\n * @param builder specifies a function to build a map\n */\n public inline fun build(builder: HeadersBuilder.() -> Unit): Headers = HeadersBuilder().apply(builder).build()\n }\n}\n\n@Suppress(\"KDocMissingDocumentation\")\npublic class HeadersBuilder(size: Int = 8) : StringValuesBuilder(true, size) {\n override fun build(): Headers {\n require(!built) { \"HeadersBuilder can only build a single Headers instance\" }\n built = true\n return HeadersImpl(values)\n }\n\n override fun validateName(name: String) {\n super.validateName(name)\n HttpHeaders.checkHeaderName(name)\n }\n\n override fun validateValue(value: String) {\n super.validateValue(value)\n HttpHeaders.checkHeaderValue(value)\n }\n}\n\n@Suppress(\"KDocMissingDocumentation\")\n@Deprecated(\n \"Empty headers is internal\",\n replaceWith = ReplaceWith(\"Headers.Empty\"),\n level = DeprecationLevel.ERROR\n)\npublic object EmptyHeaders : Headers {\n override val caseInsensitiveName: Boolean get() = true\n override fun getAll(name: String): List? = null\n override fun names(): Set = emptySet()\n override fun entries(): Set>> = emptySet()\n override fun isEmpty(): Boolean = true\n override fun toString(): String = \"Headers ${entries()}\"\n}\n\n/**\n * Returns empty headers\n */\npublic fun headersOf(): Headers = Headers.Empty\n\n/**\n * Returns [Headers] instance containing only one header with the specified [name] and [value]\n */\npublic fun headersOf(name: String, value: String): Headers = HeadersSingleImpl(name, listOf(value))\n\n/**\n * Returns [Headers] instance containing only one header with the specified [name] and [values]\n */\npublic fun headersOf(name: String, values: List): Headers = HeadersSingleImpl(name, values)\n\n/**\n * Returns [Headers] instance from [pairs]\n */\npublic fun headersOf(vararg pairs: Pair>): Headers = HeadersImpl(pairs.asList().toMap())\n\n@InternalAPI\n@Suppress(\"KDocMissingDocumentation\")\npublic class HeadersImpl(\n values: Map> = emptyMap()\n) : Headers, StringValuesImpl(true, values) {\n override fun toString(): String = \"Headers ${entries()}\"\n}\n\n@InternalAPI\n@Suppress(\"KDocMissingDocumentation\")\npublic class HeadersSingleImpl(\n name: String,\n values: List\n) : Headers, StringValuesSingleImpl(true, name, values) {\n override fun toString(): String = \"Headers ${entries()}\"\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.util.*\n\n/**\n * Represents a single value parameter\n * @property name of parameter\n * @property value of parameter\n */\npublic data class HeaderValueParam(val name: String, val value: String) {\n override fun equals(other: Any?): Boolean {\n return other is HeaderValueParam &&\n other.name.equals(name, ignoreCase = true) &&\n other.value.equals(value, ignoreCase = true)\n }\n\n override fun hashCode(): Int {\n var result = name.toLowerCase().hashCode()\n result += 31 * result + value.toLowerCase().hashCode()\n return result\n }\n}\n\n/**\n * Represents a header value. Similar to [HeaderValueWithParameters]\n * @property value\n * @property params for this value (could be empty)\n */\npublic data class HeaderValue(val value: String, val params: List = listOf()) {\n /**\n * Value's quality according to `q` parameter or `1.0` if missing or invalid\n */\n val quality: Double =\n params.firstOrNull { it.name == \"q\" }?.value?.toDoubleOrNull()?.takeIf { it in 0.0..1.0 } ?: 1.0\n}\n\n/**\n * Parse header value and sort multiple values according to qualities\n */\npublic fun parseAndSortHeader(header: String?): List =\n parseHeaderValue(header).sortedByDescending { it.quality }\n\n/**\n * Parse `Content-Type` header values and sort them by quality and asterisks quantity\n */\npublic fun parseAndSortContentTypeHeader(header: String?): List = parseHeaderValue(header).sortedWith(\n compareByDescending { it.quality }.thenBy {\n val contentType = ContentType.parse(it.value)\n var asterisks = 0\n if (contentType.contentType == \"*\") {\n asterisks += 2\n }\n if (contentType.contentSubtype == \"*\") {\n asterisks++\n }\n asterisks\n }.thenByDescending { it.params.size }\n)\n\n/**\n * Parse header value respecting multi-values\n */\npublic fun parseHeaderValue(text: String?): List {\n return parseHeaderValue(text, false)\n}\n\n/**\n * Parse header value respecting multi-values\n * @param parametersOnly if no header value itself, only parameters\n */\npublic fun parseHeaderValue(text: String?, parametersOnly: Boolean): List {\n if (text == null) {\n return emptyList()\n }\n\n var position = 0\n val items = lazy(LazyThreadSafetyMode.NONE) { arrayListOf() }\n while (position <= text.lastIndex) {\n position = parseHeaderValueItem(text, position, items, parametersOnly)\n }\n return items.valueOrEmpty()\n}\n\n/**\n * Construct a list of [HeaderValueParam] from an iterable of pairs\n */\npublic fun Iterable>.toHeaderParamsList(): List =\n map { HeaderValueParam(it.first, it.second) }\n\nprivate fun Lazy>.valueOrEmpty(): List = if (isInitialized()) value else emptyList()\nprivate fun String.subtrim(start: Int, end: Int): String {\n return substring(start, end).trim()\n}\n\nprivate fun parseHeaderValueItem(\n text: String,\n start: Int,\n items: Lazy>,\n parametersOnly: Boolean\n): Int {\n var position = start\n val parameters = lazy(LazyThreadSafetyMode.NONE) { arrayListOf() }\n var valueEnd: Int? = if (parametersOnly) position else null\n\n while (position <= text.lastIndex) {\n when (text[position]) {\n ',' -> {\n items.value.add(HeaderValue(text.subtrim(start, valueEnd ?: position), parameters.valueOrEmpty()))\n return position + 1\n }\n ';' -> {\n if (valueEnd == null) valueEnd = position\n position = parseHeaderValueParameter(text, position + 1, parameters)\n }\n else -> {\n position = if (parametersOnly) {\n parseHeaderValueParameter(text, position, parameters)\n } else {\n position + 1\n }\n }\n }\n }\n\n items.value.add(HeaderValue(text.subtrim(start, valueEnd ?: position), parameters.valueOrEmpty()))\n return position\n}\n\nprivate fun parseHeaderValueParameter(text: String, start: Int, parameters: Lazy>): Int {\n fun addParam(text: String, start: Int, end: Int, value: String) {\n val name = text.subtrim(start, end)\n if (name.isEmpty()) {\n return\n }\n\n parameters.value.add(HeaderValueParam(name, value))\n }\n\n var position = start\n while (position <= text.lastIndex) {\n when (text[position]) {\n '=' -> {\n val (paramEnd, paramValue) = parseHeaderValueParameterValue(text, position + 1)\n addParam(text, start, position, paramValue)\n return paramEnd\n }\n ';', ',' -> {\n addParam(text, start, position, \"\")\n return position\n }\n else -> position++\n }\n }\n\n addParam(text, start, position, \"\")\n return position\n}\n\nprivate fun parseHeaderValueParameterValue(value: String, start: Int): Pair {\n if (value.length == start) {\n return start to \"\"\n }\n\n var position = start\n if (value[start] == '\"') {\n return parseHeaderValueParameterValueQuoted(value, position + 1)\n }\n\n while (position <= value.lastIndex) {\n when (value[position]) {\n ';', ',' -> return position to value.subtrim(start, position)\n else -> position++\n }\n }\n return position to value.subtrim(start, position)\n}\n\nprivate fun parseHeaderValueParameterValueQuoted(value: String, start: Int): Pair {\n var position = start\n val builder = StringBuilder()\n loop@ while (position <= value.lastIndex) {\n val currentChar = value[position]\n\n when {\n currentChar == '\"' && value.nextIsSemicolonOrEnd(position) -> {\n return position + 1 to builder.toString()\n }\n currentChar == '\\\\' && position < value.lastIndex - 2 -> {\n builder.append(value[position + 1])\n position += 2\n continue@loop\n }\n }\n\n builder.append(currentChar)\n position++\n }\n\n // The value is unquoted here\n return position to '\"' + builder.toString()\n}\n\nprivate fun String.nextIsSemicolonOrEnd(start: Int): Boolean {\n var position = start + 1\n loop@ while (position < length && get(position) == ' ') {\n position += 1\n }\n\n return position == length || get(position) == ';'\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.util.*\n\n@Suppress(\"unused\", \"KDocMissingDocumentation\", \"PublicApiImplicitType\", \"MayBeConstant\")\npublic object HttpHeaders {\n // Permanently registered standard HTTP headers\n // The list is taken from http://www.iana.org/assignments/message-headers/message-headers.xml#perm-headers\n\n public val Accept: String = \"Accept\"\n public val AcceptCharset: String = \"Accept-Charset\"\n public val AcceptEncoding: String = \"Accept-Encoding\"\n public val AcceptLanguage: String = \"Accept-Language\"\n public val AcceptRanges: String = \"Accept-Ranges\"\n public val Age: String = \"Age\"\n public val Allow: String = \"Allow\"\n public val ALPN: String = \"ALPN\" // Application-Layer Protocol Negotiation, HTTP/2\n public val AuthenticationInfo: String = \"Authentication-Info\"\n public val Authorization: String = \"Authorization\"\n public val CacheControl: String = \"Cache-Control\"\n public val Connection: String = \"Connection\"\n public val ContentDisposition: String = \"Content-Disposition\"\n public val ContentEncoding: String = \"Content-Encoding\"\n public val ContentLanguage: String = \"Content-Language\"\n public val ContentLength: String = \"Content-Length\"\n public val ContentLocation: String = \"Content-Location\"\n public val ContentRange: String = \"Content-Range\"\n public val ContentType: String = \"Content-Type\"\n public val Cookie: String = \"Cookie\"\n public val DASL: String = \"DASL\" // WebDAV Search\n public val Date: String = \"Date\"\n public val DAV: String = \"DAV\" // WebDAV\n public val Depth: String = \"Depth\" // WebDAV\n public val Destination: String = \"Destination\"\n public val ETag: String = \"ETag\"\n public val Expect: String = \"Expect\"\n public val Expires: String = \"Expires\"\n public val From: String = \"From\"\n public val Forwarded: String = \"Forwarded\"\n public val Host: String = \"Host\"\n public val HTTP2Settings: String = \"HTTP2-Settings\"\n public val If: String = \"If\"\n public val IfMatch: String = \"If-Match\"\n public val IfModifiedSince: String = \"If-Modified-Since\"\n public val IfNoneMatch: String = \"If-None-Match\"\n public val IfRange: String = \"If-Range\"\n public val IfScheduleTagMatch: String = \"If-Schedule-Tag-Match\"\n public val IfUnmodifiedSince: String = \"If-Unmodified-Since\"\n public val LastModified: String = \"Last-Modified\"\n public val Location: String = \"Location\"\n public val LockToken: String = \"Lock-Token\"\n public val Link: String = \"Link\"\n public val MaxForwards: String = \"Max-Forwards\"\n public val MIMEVersion: String = \"MIME-Version\"\n public val OrderingType: String = \"Ordering-Type\"\n public val Origin: String = \"Origin\"\n public val Overwrite: String = \"Overwrite\"\n public val Position: String = \"Position\"\n public val Pragma: String = \"Pragma\"\n public val Prefer: String = \"Prefer\"\n public val PreferenceApplied: String = \"Preference-Applied\"\n public val ProxyAuthenticate: String = \"Proxy-Authenticate\"\n public val ProxyAuthenticationInfo: String = \"Proxy-Authentication-Info\"\n public val ProxyAuthorization: String = \"Proxy-Authorization\"\n public val PublicKeyPins: String = \"Public-Key-Pins\"\n public val PublicKeyPinsReportOnly: String = \"Public-Key-Pins-Report-Only\"\n public val Range: String = \"Range\"\n public val Referrer: String = \"Referer\"\n public val RetryAfter: String = \"Retry-After\"\n public val ScheduleReply: String = \"Schedule-Reply\"\n public val ScheduleTag: String = \"Schedule-Tag\"\n public val SecWebSocketAccept: String = \"Sec-WebSocket-Accept\"\n public val SecWebSocketExtensions: String = \"Sec-WebSocket-Extensions\"\n public val SecWebSocketKey: String = \"Sec-WebSocket-Key\"\n public val SecWebSocketProtocol: String = \"Sec-WebSocket-Protocol\"\n public val SecWebSocketVersion: String = \"Sec-WebSocket-Version\"\n public val Server: String = \"Server\"\n public val SetCookie: String = \"Set-Cookie\"\n public val SLUG: String = \"SLUG\" // Atom Publishing\n public val StrictTransportSecurity: String = \"Strict-Transport-Security\"\n public val TE: String = \"TE\"\n public val Timeout: String = \"Timeout\"\n public val Trailer: String = \"Trailer\"\n public val TransferEncoding: String = \"Transfer-Encoding\"\n public val Upgrade: String = \"Upgrade\"\n public val UserAgent: String = \"User-Agent\"\n public val Vary: String = \"Vary\"\n public val Via: String = \"Via\"\n public val Warning: String = \"Warning\"\n public val WWWAuthenticate: String = \"WWW-Authenticate\"\n\n // CORS\n public val AccessControlAllowOrigin: String = \"Access-Control-Allow-Origin\"\n public val AccessControlAllowMethods: String = \"Access-Control-Allow-Methods\"\n public val AccessControlAllowCredentials: String = \"Access-Control-Allow-Credentials\"\n public val AccessControlAllowHeaders: String = \"Access-Control-Allow-Headers\"\n\n public val AccessControlRequestMethod: String = \"Access-Control-Request-Method\"\n public val AccessControlRequestHeaders: String = \"Access-Control-Request-Headers\"\n public val AccessControlExposeHeaders: String = \"Access-Control-Expose-Headers\"\n public val AccessControlMaxAge: String = \"Access-Control-Max-Age\"\n\n // Unofficial de-facto headers\n public val XHttpMethodOverride: String = \"X-Http-Method-Override\"\n public val XForwardedHost: String = \"X-Forwarded-Host\"\n public val XForwardedServer: String = \"X-Forwarded-Server\"\n public val XForwardedProto: String = \"X-Forwarded-Proto\"\n public val XForwardedFor: String = \"X-Forwarded-For\"\n\n public val XRequestId: String = \"X-Request-ID\"\n public val XCorrelationId: String = \"X-Correlation-ID\"\n public val XTotalCount: String = \"X-Total-Count\"\n\n /**\n * Check if [header] is unsafe. Header is unsafe if listed in [UnsafeHeadersList]\n */\n public fun isUnsafe(header: String): Boolean = UnsafeHeadersArray.any { it.equals(header, ignoreCase = true) }\n\n private val UnsafeHeadersArray: Array = arrayOf(ContentLength, ContentType, TransferEncoding, Upgrade)\n\n @Deprecated(\"Use UnsafeHeadersList instead.\", replaceWith = ReplaceWith(\"HttpHeaders.UnsafeHeadersList\"))\n public val UnsafeHeaders: Array\n get() = UnsafeHeadersArray.copyOf()\n\n /**\n * A list of header names that are not safe to use unless it is low-level engine implementation.\n */\n public val UnsafeHeadersList: List = UnsafeHeadersArray.asList()\n\n /**\n * Validates header [name] throwing [IllegalHeaderNameException] when the name is not valid.\n */\n public fun checkHeaderName(name: String) {\n name.forEachIndexed { index, ch ->\n if (ch <= ' ' || isDelimiter(ch)) {\n throw IllegalHeaderNameException(name, index)\n }\n }\n }\n\n /**\n * Validates header [value] throwing [IllegalHeaderValueException] when the value is not valid.\n */\n public fun checkHeaderValue(value: String) {\n value.forEachIndexed { index, ch ->\n if (ch == ' ' || ch == '\\u0009') return@forEachIndexed\n if (ch < ' ') {\n throw IllegalHeaderValueException(value, index)\n }\n }\n }\n}\n\n/**\n * Thrown when an attempt to set unsafe header detected. A header is unsafe if listed in [HttpHeaders.UnsafeHeadersList].\n */\npublic class UnsafeHeaderException(header: String) : IllegalArgumentException(\n \"Header(s) $header are controlled by the engine and \" +\n \"cannot be set explicitly\"\n)\n\n/**\n * Thrown when an illegal header name was used.\n * A header name should only consist from visible characters\n * without delimiters \"double quote\" and the following characters: `(),/:;<=>?@[\\]{}`.\n * @property headerName that was tried to use\n * @property position at which validation failed\n */\npublic class IllegalHeaderNameException(public val headerName: String, public val position: Int) :\n IllegalArgumentException(\n \"Header name '$headerName' contains illegal character '${headerName[position]}'\" +\n \" (code ${(headerName[position].toInt() and 0xff)})\"\n )\n\n/**\n * Thrown when an illegal header value was used.\n * A header value should only consist from visible characters, spaces and/or HTAB (0x09).\n * @property headerValue that was tried to use\n * @property position at which validation failed\n */\npublic class IllegalHeaderValueException(public val headerValue: String, public val position: Int) :\n IllegalArgumentException(\n \"Header value '$headerValue' contains illegal character '${headerValue[position]}'\" +\n \" (code ${(headerValue[position].toInt() and 0xff)})\"\n )\n\nprivate fun isDelimiter(ch: Char): Boolean = ch in \"\\\"(),/:;<=>?@[\\\\]{}\"\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\n@file:Suppress(\"unused\")\n\npackage io.ktor.http\n\nimport io.ktor.utils.io.charsets.*\n\n/**\n * Set `Content-Type` header.\n */\npublic fun HttpMessageBuilder.contentType(type: ContentType): Unit =\n headers.set(HttpHeaders.ContentType, type.toString())\n\n@Deprecated(\n \"Content-Length is controlled by underlying engine. Don't specify it explicitly.\",\n level = DeprecationLevel.ERROR\n)\n@Suppress(\"KDocMissingDocumentation\", \"unused\", \"PublicApiImplicitType\", \"DeprecatedCallableAddReplaceWith\")\npublic fun HttpMessageBuilder.contentLength(length: Int): Unit =\n headers.set(HttpHeaders.ContentLength, length.toString())\n\n@Deprecated(\"Use content with particular content type and charset instead\", level = DeprecationLevel.ERROR)\n@Suppress(\"KDocMissingDocumentation\", \"unused\", \"PublicApiImplicitType\", \"DeprecatedCallableAddReplaceWith\")\npublic fun HttpMessageBuilder.charset(charset: Charset): Unit? =\n contentType()?.let { contentType(it.withCharset(charset)) }\n\n/**\n * Append `Max-Age` header value.\n */\npublic fun HttpMessageBuilder.maxAge(seconds: Int): Unit = headers.append(HttpHeaders.CacheControl, \"max-age=$seconds\")\n\n/**\n * Set `If-None-Match` header value.\n */\npublic fun HttpMessageBuilder.ifNoneMatch(value: String): Unit = headers.set(HttpHeaders.IfNoneMatch, value)\n\n/**\n * Set `User-Agent` header value.\n */\npublic fun HttpMessageBuilder.userAgent(content: String): Unit = headers.set(HttpHeaders.UserAgent, content)\n\n/**\n * Parse `Content-Type` header value.\n */\npublic fun HttpMessageBuilder.contentType(): ContentType? =\n headers[HttpHeaders.ContentType]?.let { ContentType.parse(it) }\n\n/**\n * Parse charset from `Content-Type` header value.\n */\npublic fun HttpMessageBuilder.charset(): Charset? = contentType()?.charset()\n\n/**\n * Parse `E-Tag` header value.\n */\npublic fun HttpMessageBuilder.etag(): String? = headers[HttpHeaders.ETag]\n\n/**\n * Parse `Vary` header value.\n */\npublic fun HttpMessageBuilder.vary(): List? = headers[HttpHeaders.Vary]?.split(\",\")?.map { it.trim() }\n\n/**\n * Parse `Content-Length` header value.\n */\npublic fun HttpMessageBuilder.contentLength(): Long? = headers[HttpHeaders.ContentLength]?.toLong()\n\n/**\n * Parse `Content-Type` header value.\n */\npublic fun HttpMessage.contentType(): ContentType? = headers[HttpHeaders.ContentType]?.let { ContentType.parse(it) }\n\n/**\n * Parse charset from `Content-Type` header value.\n */\npublic fun HttpMessage.charset(): Charset? = contentType()?.charset()\n\n/**\n * Parse `E-Tag` header value.\n */\npublic fun HttpMessage.etag(): String? = headers[HttpHeaders.ETag]\n\n/**\n * Parse `Vary` header value.\n */\npublic fun HttpMessage.vary(): List? = headers[HttpHeaders.Vary]?.split(\",\")?.map { it.trim() }\n\n/**\n * Parse `Content-Length` header value.\n */\npublic fun HttpMessage.contentLength(): Long? = headers[HttpHeaders.ContentLength]?.toLong()\n\n/**\n * Parse `Set-Cookie` header value.\n */\npublic fun HttpMessage.setCookie(): List = headers.getAll(HttpHeaders.SetCookie)\n ?.flatMap { it.splitSetCookieHeader() }\n ?.map { parseServerSetCookieHeader(it) }\n ?: emptyList()\n\n/**\n * Parse `Set-Cookie` header value.\n */\npublic fun HttpMessageBuilder.cookies(): List =\n headers.getAll(HttpHeaders.SetCookie)?.map { parseServerSetCookieHeader(it) } ?: emptyList()\n\n/**\n * Parse `CacheControl` header.\n */\npublic fun HttpMessage.cacheControl(): List = headers[HttpHeaders.CacheControl]?.let {\n parseHeaderValue(it)\n} ?: emptyList()\n\ninternal fun String.splitSetCookieHeader(): List {\n var comma = indexOf(',')\n\n if (comma == -1) {\n return listOf(this)\n }\n\n val result = mutableListOf()\n var current = 0\n\n var equals = indexOf('=', comma)\n var semicolon = indexOf(';', comma)\n while (current < length && comma > 0) {\n if (equals < comma) {\n equals = indexOf('=', comma)\n }\n\n var nextComma = indexOf(',', comma + 1)\n while (nextComma >= 0 && nextComma < equals) {\n comma = nextComma\n nextComma = indexOf(',', nextComma + 1)\n }\n\n if (semicolon < comma) {\n semicolon = indexOf(';', comma)\n }\n\n // No more keys remaining.\n if (equals < 0) {\n result += substring(current)\n return result\n }\n\n // No ';' between ',' and '=' => We're on a header border.\n if (semicolon == -1 || semicolon > equals) {\n result += substring(current, comma)\n current = comma + 1\n // Update comma index at the end of loop.\n }\n\n // ',' in value, skip it and find next.\n comma = nextComma\n }\n\n // Add last chunk if no more ',' available.\n if (current < length) {\n result += substring(current)\n }\n\n return result\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\n/**\n * Represents an HTTP method (verb)\n * @property value contains method name\n */\npublic data class HttpMethod(val value: String) {\n @Suppress(\"KDocMissingDocumentation\", \"PublicApiImplicitType\")\n public companion object {\n public val Get: HttpMethod = HttpMethod(\"GET\")\n public val Post: HttpMethod = HttpMethod(\"POST\")\n public val Put: HttpMethod = HttpMethod(\"PUT\")\n public val Patch: HttpMethod = HttpMethod(\"PATCH\") // https://tools.ietf.org/html/rfc5789\n public val Delete: HttpMethod = HttpMethod(\"DELETE\")\n public val Head: HttpMethod = HttpMethod(\"HEAD\")\n public val Options: HttpMethod = HttpMethod(\"OPTIONS\")\n\n /**\n * Parse HTTP method by [method] string\n */\n public fun parse(method: String): HttpMethod {\n return when (method) {\n Get.value -> Get\n Post.value -> Post\n Put.value -> Put\n Patch.value -> Patch\n Delete.value -> Delete\n Head.value -> Head\n Options.value -> Options\n else -> HttpMethod(method)\n }\n }\n\n /**\n * A list of default HTTP methods\n */\n public val DefaultMethods: List = listOf(Get, Post, Put, Patch, Delete, Head, Options)\n }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\n/**\n * Represents an HTTP protocol version.\n * @property name specifies name of the protocol, e.g. \"HTTP\".\n * @property major specifies protocol major version.\n * @property minor specifies protocol minor version.\n */\npublic data class HttpProtocolVersion(val name: String, val major: Int, val minor: Int) {\n @Suppress(\"PublicApiImplicitType\")\n public companion object {\n /**\n * HTTP/2.0 version.\n */\n public val HTTP_2_0: HttpProtocolVersion = HttpProtocolVersion(\"HTTP\", 2, 0)\n\n /**\n * HTTP/1.1 version.\n */\n public val HTTP_1_1: HttpProtocolVersion = HttpProtocolVersion(\"HTTP\", 1, 1)\n\n /**\n * HTTP/1.0 version.\n */\n public val HTTP_1_0: HttpProtocolVersion = HttpProtocolVersion(\"HTTP\", 1, 0)\n\n /**\n * SPDY/3.0 version.\n */\n public val SPDY_3: HttpProtocolVersion = HttpProtocolVersion(\"SPDY\", 3, 0)\n\n /**\n * QUIC/1.0 version.\n */\n public val QUIC: HttpProtocolVersion = HttpProtocolVersion(\"QUIC\", 1, 0)\n\n /**\n * Creates an instance of [HttpProtocolVersion] from the given parameters.\n */\n public fun fromValue(name: String, major: Int, minor: Int): HttpProtocolVersion = when {\n name == \"HTTP\" && major == 1 && minor == 1 -> HTTP_1_1\n name == \"HTTP\" && major == 2 && minor == 0 -> HTTP_2_0\n else -> HttpProtocolVersion(name, major, minor)\n }\n\n /**\n * Create an instance of [HttpProtocolVersion] from http string representation.\n */\n public fun parse(value: CharSequence): HttpProtocolVersion {\n /**\n * Format: protocol/major.minor\n */\n val (protocol, major, minor) = value.split(\"/\", \".\").also {\n check(it.size == 3) {\n \"Failed to parse HttpProtocolVersion. Expected format: protocol/major.minor, but actual: $value\"\n }\n }\n\n return fromValue(protocol, major.toInt(), minor.toInt())\n }\n }\n\n override fun toString(): String = \"$name/$major.$minor\"\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\n/**\n * Represents an HTTP status code and description.\n * @param value is a numeric code.\n * @param description is free form description of a status.\n */\n@Suppress(\"unused\")\npublic data class HttpStatusCode(val value: Int, val description: String) {\n override fun toString(): String = \"$value $description\"\n\n override fun equals(other: Any?): Boolean = other is HttpStatusCode && other.value == value\n\n override fun hashCode(): Int = value.hashCode()\n\n /**\n * Returns a copy of `this` code with a description changed to [value].\n */\n public fun description(value: String): HttpStatusCode = copy(description = value)\n\n @Suppress(\"KDocMissingDocumentation\", \"PublicApiImplicitType\")\n public companion object {\n // =============================================================================================================\n // Disclaimer\n // Adding a new status code here please remember [allStatusCodes] as well\n //\n\n public val Continue: HttpStatusCode = HttpStatusCode(100, \"Continue\")\n public val SwitchingProtocols: HttpStatusCode = HttpStatusCode(101, \"Switching Protocols\")\n public val Processing: HttpStatusCode = HttpStatusCode(102, \"Processing\")\n\n public val OK: HttpStatusCode = HttpStatusCode(200, \"OK\")\n public val Created: HttpStatusCode = HttpStatusCode(201, \"Created\")\n public val Accepted: HttpStatusCode = HttpStatusCode(202, \"Accepted\")\n\n public val NonAuthoritativeInformation: HttpStatusCode =\n HttpStatusCode(203, \"Non-Authoritative Information\")\n\n public val NoContent: HttpStatusCode = HttpStatusCode(204, \"No Content\")\n public val ResetContent: HttpStatusCode = HttpStatusCode(205, \"Reset Content\")\n public val PartialContent: HttpStatusCode = HttpStatusCode(206, \"Partial Content\")\n public val MultiStatus: HttpStatusCode = HttpStatusCode(207, \"Multi-Status\")\n\n public val MultipleChoices: HttpStatusCode = HttpStatusCode(300, \"Multiple Choices\")\n public val MovedPermanently: HttpStatusCode = HttpStatusCode(301, \"Moved Permanently\")\n public val Found: HttpStatusCode = HttpStatusCode(302, \"Found\")\n public val SeeOther: HttpStatusCode = HttpStatusCode(303, \"See Other\")\n public val NotModified: HttpStatusCode = HttpStatusCode(304, \"Not Modified\")\n public val UseProxy: HttpStatusCode = HttpStatusCode(305, \"Use Proxy\")\n public val SwitchProxy: HttpStatusCode = HttpStatusCode(306, \"Switch Proxy\")\n public val TemporaryRedirect: HttpStatusCode = HttpStatusCode(307, \"Temporary Redirect\")\n public val PermanentRedirect: HttpStatusCode = HttpStatusCode(308, \"Permanent Redirect\")\n\n public val BadRequest: HttpStatusCode = HttpStatusCode(400, \"Bad Request\")\n public val Unauthorized: HttpStatusCode = HttpStatusCode(401, \"Unauthorized\")\n public val PaymentRequired: HttpStatusCode = HttpStatusCode(402, \"Payment Required\")\n public val Forbidden: HttpStatusCode = HttpStatusCode(403, \"Forbidden\")\n public val NotFound: HttpStatusCode = HttpStatusCode(404, \"Not Found\")\n public val MethodNotAllowed: HttpStatusCode = HttpStatusCode(405, \"Method Not Allowed\")\n public val NotAcceptable: HttpStatusCode = HttpStatusCode(406, \"Not Acceptable\")\n\n public val ProxyAuthenticationRequired: HttpStatusCode =\n HttpStatusCode(407, \"Proxy Authentication Required\")\n\n public val RequestTimeout: HttpStatusCode = HttpStatusCode(408, \"Request Timeout\")\n public val Conflict: HttpStatusCode = HttpStatusCode(409, \"Conflict\")\n public val Gone: HttpStatusCode = HttpStatusCode(410, \"Gone\")\n public val LengthRequired: HttpStatusCode = HttpStatusCode(411, \"Length Required\")\n public val PreconditionFailed: HttpStatusCode = HttpStatusCode(412, \"Precondition Failed\")\n public val PayloadTooLarge: HttpStatusCode = HttpStatusCode(413, \"Payload Too Large\")\n public val RequestURITooLong: HttpStatusCode = HttpStatusCode(414, \"Request-URI Too Long\")\n\n public val UnsupportedMediaType: HttpStatusCode = HttpStatusCode(415, \"Unsupported Media Type\")\n\n public val RequestedRangeNotSatisfiable: HttpStatusCode =\n HttpStatusCode(416, \"Requested Range Not Satisfiable\")\n\n public val ExpectationFailed: HttpStatusCode = HttpStatusCode(417, \"Expectation Failed\")\n public val UnprocessableEntity: HttpStatusCode = HttpStatusCode(422, \"Unprocessable Entity\")\n public val Locked: HttpStatusCode = HttpStatusCode(423, \"Locked\")\n public val FailedDependency: HttpStatusCode = HttpStatusCode(424, \"Failed Dependency\")\n public val UpgradeRequired: HttpStatusCode = HttpStatusCode(426, \"Upgrade Required\")\n public val TooManyRequests: HttpStatusCode = HttpStatusCode(429, \"Too Many Requests\")\n\n public val RequestHeaderFieldTooLarge: HttpStatusCode =\n HttpStatusCode(431, \"Request Header Fields Too Large\")\n\n public val InternalServerError: HttpStatusCode = HttpStatusCode(500, \"Internal Server Error\")\n public val NotImplemented: HttpStatusCode = HttpStatusCode(501, \"Not Implemented\")\n public val BadGateway: HttpStatusCode = HttpStatusCode(502, \"Bad Gateway\")\n public val ServiceUnavailable: HttpStatusCode = HttpStatusCode(503, \"Service Unavailable\")\n public val GatewayTimeout: HttpStatusCode = HttpStatusCode(504, \"Gateway Timeout\")\n\n public val VersionNotSupported: HttpStatusCode =\n HttpStatusCode(505, \"HTTP Version Not Supported\")\n\n public val VariantAlsoNegotiates: HttpStatusCode = HttpStatusCode(506, \"Variant Also Negotiates\")\n public val InsufficientStorage: HttpStatusCode = HttpStatusCode(507, \"Insufficient Storage\")\n\n /**\n * All known status codes\n */\n public val allStatusCodes: List = allStatusCodes()\n\n private val byValue: Array = Array(1000) { idx ->\n allStatusCodes.firstOrNull { it.value == idx }\n }\n\n /**\n * Creates an instance of [HttpStatusCode] with the given numeric value.\n */\n public fun fromValue(value: Int): HttpStatusCode {\n val knownStatus = if (value in 1 until 1000) byValue[value] else null\n return knownStatus ?: HttpStatusCode(value, \"Unknown Status Code\")\n }\n }\n}\n\n@Suppress(\"UNUSED\", \"KDocMissingDocumentation\")\n@Deprecated(\n \"Use ExpectationFailed instead\",\n ReplaceWith(\"ExpectationFailed\", \"io.ktor.http.HttpStatusCode.Companion.ExpectationFailed\"),\n level = DeprecationLevel.ERROR\n)\npublic inline val HttpStatusCode.Companion.ExceptionFailed: HttpStatusCode\n get() = ExpectationFailed\n\ninternal fun allStatusCodes(): List = listOf(\n HttpStatusCode.Continue,\n HttpStatusCode.SwitchingProtocols,\n HttpStatusCode.Processing,\n HttpStatusCode.OK,\n HttpStatusCode.Created,\n HttpStatusCode.Accepted,\n HttpStatusCode.NonAuthoritativeInformation,\n HttpStatusCode.NoContent,\n HttpStatusCode.ResetContent,\n HttpStatusCode.PartialContent,\n HttpStatusCode.MultiStatus,\n HttpStatusCode.MultipleChoices,\n HttpStatusCode.MovedPermanently,\n HttpStatusCode.Found,\n HttpStatusCode.SeeOther,\n HttpStatusCode.NotModified,\n HttpStatusCode.UseProxy,\n HttpStatusCode.SwitchProxy,\n HttpStatusCode.TemporaryRedirect,\n HttpStatusCode.PermanentRedirect,\n HttpStatusCode.BadRequest,\n HttpStatusCode.Unauthorized,\n HttpStatusCode.PaymentRequired,\n HttpStatusCode.Forbidden,\n HttpStatusCode.NotFound,\n HttpStatusCode.MethodNotAllowed,\n HttpStatusCode.NotAcceptable,\n HttpStatusCode.ProxyAuthenticationRequired,\n HttpStatusCode.RequestTimeout,\n HttpStatusCode.Conflict,\n HttpStatusCode.Gone,\n HttpStatusCode.LengthRequired,\n HttpStatusCode.PreconditionFailed,\n HttpStatusCode.PayloadTooLarge,\n HttpStatusCode.RequestURITooLong,\n HttpStatusCode.UnsupportedMediaType,\n HttpStatusCode.RequestedRangeNotSatisfiable,\n HttpStatusCode.ExpectationFailed,\n HttpStatusCode.UnprocessableEntity,\n HttpStatusCode.Locked,\n HttpStatusCode.FailedDependency,\n HttpStatusCode.UpgradeRequired,\n HttpStatusCode.TooManyRequests,\n HttpStatusCode.RequestHeaderFieldTooLarge,\n HttpStatusCode.InternalServerError,\n HttpStatusCode.NotImplemented,\n HttpStatusCode.BadGateway,\n HttpStatusCode.ServiceUnavailable,\n HttpStatusCode.GatewayTimeout,\n HttpStatusCode.VersionNotSupported,\n HttpStatusCode.VariantAlsoNegotiates,\n HttpStatusCode.InsufficientStorage\n)\n\n/**\n * Checks if a given status code is a success code according to HTTP standards.\n *\n * Codes from 200 to 299 are considered to be successful.\n */\npublic fun HttpStatusCode.isSuccess(): Boolean = value in (200 until 300)\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.utils.io.charsets.*\n\n/**\n * Parse URL query parameters. Shouldn't be used for urlencoded forms because of `+` character.\n */\npublic fun String.parseUrlEncodedParameters(defaultEncoding: Charset = Charsets.UTF_8, limit: Int = 1000): Parameters {\n val parameters: List> =\n split(\"&\", limit = limit).map { it.substringBefore(\"=\") to it.substringAfter(\"=\", \"\") }\n val encoding: String =\n parameters.firstOrNull { it.first == \"_charset_\" }?.second ?: defaultEncoding.name\n\n val charset = Charset.forName(encoding)\n return Parameters.build {\n parameters.forEach { (key, value) ->\n append(\n key.decodeURLQueryComponent(charset = charset),\n value.decodeURLQueryComponent(charset = charset)\n )\n }\n }\n}\n\n/**\n * Encode form parameters from a list of pairs\n */\npublic fun List>.formUrlEncode(): String = StringBuilder().apply {\n formUrlEncodeTo(this)\n}.toString()\n\n/**\n * Encode form parameters from a list of pairs to the specified [out] appendable\n */\npublic fun List>.formUrlEncodeTo(out: Appendable) {\n joinTo(out, \"&\") {\n val key = it.first.encodeURLParameter(spaceToPlus = true)\n if (it.second == null) {\n key\n } else {\n val value = it.second.toString().encodeURLParameterValue()\n \"$key=$value\"\n }\n }\n}\n\n/**\n * Encode form parameters\n */\npublic fun Parameters.formUrlEncode(): String = entries()\n .flatMap { e -> e.value.map { e.key to it } }\n .formUrlEncode()\n\n/**\n * Encode form parameters to the specified [out] appendable\n */\npublic fun Parameters.formUrlEncodeTo(out: Appendable) {\n entries().formUrlEncodeTo(out)\n}\n\ninternal fun ParametersBuilder.formUrlEncodeTo(out: Appendable) {\n entries().formUrlEncodeTo(out)\n}\n\ninternal fun Set>>.formUrlEncodeTo(out: Appendable) {\n flatMap { (key, value) ->\n if (value.isEmpty()) listOf(key to null) else value.map { key to it }\n }.formUrlEncodeTo(out)\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.util.*\n\n/**\n * Represents HTTP parameters as a map from case-insensitive names to collection of [String] values\n */\npublic interface Parameters : StringValues {\n public companion object {\n /**\n * Empty [Parameters] instance\n */\n @Suppress(\"DEPRECATION_ERROR\")\n public val Empty: Parameters = EmptyParameters\n\n /**\n * Builds a [Parameters] instance with the given [builder] function\n * @param builder specifies a function to build a map\n */\n public inline fun build(builder: ParametersBuilder.() -> Unit): Parameters =\n ParametersBuilder().apply(builder).build()\n }\n}\n\n@Suppress(\"KDocMissingDocumentation\")\npublic class ParametersBuilder(size: Int = 8) : StringValuesBuilder(true, size) {\n override fun build(): Parameters {\n require(!built) { \"ParametersBuilder can only build a single Parameters instance\" }\n built = true\n return ParametersImpl(values)\n }\n}\n\n@Suppress(\"KDocMissingDocumentation\")\n@Deprecated(\n \"Empty parameters is internal\",\n replaceWith = ReplaceWith(\"Parameters.Empty\"),\n level = DeprecationLevel.ERROR\n)\npublic object EmptyParameters : Parameters {\n override val caseInsensitiveName: Boolean get() = true\n override fun getAll(name: String): List? = null\n override fun names(): Set = emptySet()\n override fun entries(): Set>> = emptySet()\n override fun isEmpty(): Boolean = true\n override fun toString(): String = \"Parameters ${entries()}\"\n\n override fun equals(other: Any?): Boolean = other is Parameters && other.isEmpty()\n}\n\n/**\n * Returns an empty parameters instance\n */\npublic fun parametersOf(): Parameters = Parameters.Empty\n\n/**\n * Creates a parameters instance containing only single pair\n */\npublic fun parametersOf(name: String, value: String): Parameters = ParametersSingleImpl(name, listOf(value))\n\n/**\n * Creates a parameters instance containing only single pair of [name] with multiple [values]\n */\npublic fun parametersOf(name: String, values: List): Parameters = ParametersSingleImpl(name, values)\n\n/**\n * Creates a parameters instance from the specified [pairs]\n */\npublic fun parametersOf(vararg pairs: Pair>): Parameters = ParametersImpl(pairs.asList().toMap())\n\n@Suppress(\"KDocMissingDocumentation\")\n@InternalAPI\npublic class ParametersImpl(values: Map> = emptyMap()) : Parameters,\n StringValuesImpl(true, values) {\n override fun toString(): String = \"Parameters ${entries()}\"\n}\n\n@Suppress(\"KDocMissingDocumentation\")\n@InternalAPI\npublic class ParametersSingleImpl(name: String, values: List) : Parameters,\n StringValuesSingleImpl(true, name, values) {\n override fun toString(): String = \"Parameters ${entries()}\"\n}\n\n/**\n * Plus operator function that creates a new parameters instance from the original one concatenating with [other]\n */\npublic operator fun Parameters.plus(other: Parameters): Parameters = when {\n caseInsensitiveName == other.caseInsensitiveName -> when {\n this.isEmpty() -> other\n other.isEmpty() -> this\n else -> Parameters.build { appendAll(this@plus); appendAll(other) }\n }\n else -> {\n throw IllegalArgumentException(\n \"Cannot concatenate Parameters with case-sensitive and case-insensitive names\"\n )\n }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\n/**\n * Represents a `Link` header value as per RFC 5988\n */\npublic class LinkHeader(\n uri: String,\n params: List\n) : HeaderValueWithParameters(\"<$uri>\", params) {\n\n @Suppress(\"unused\")\n public constructor(uri: String, rel: String) : this(uri, listOf(HeaderValueParam(Parameters.Rel, rel)))\n\n public constructor(uri: String, vararg rel: String) : this(\n uri,\n listOf(HeaderValueParam(Parameters.Rel, rel.joinToString(\" \")))\n )\n\n @Suppress(\"unused\")\n public constructor(\n uri: String,\n rel: List,\n type: ContentType\n ) : this(\n uri,\n listOf(\n HeaderValueParam(Parameters.Rel, rel.joinToString(\" \")),\n HeaderValueParam(Parameters.Type, type.toString())\n )\n )\n\n /**\n * Link URI part\n */\n public val uri: String\n get() = content.removePrefix(\"<\").removeSuffix(\">\")\n\n /**\n * Known Link header parameters\n */\n @Suppress(\"unused\", \"KDocMissingDocumentation\", \"PublicApiImplicitType\")\n public object Parameters {\n public const val Rel: String = \"rel\"\n public const val Anchor: String = \"anchor\"\n public const val Rev: String = \"Rev\"\n public const val HrefLang: String = \"hreflang\"\n public const val Media: String = \"media\"\n public const val Title: String = \"title\"\n public const val Type: String = \"type\"\n }\n\n /**\n * Known rel parameter values\n */\n @Suppress(\"unused\", \"KDocMissingDocumentation\", \"PublicApiImplicitType\")\n public object Rel {\n public const val Stylesheet: String = \"stylesheet\"\n\n public const val Prefetch: String = \"prefetch\"\n public const val DnsPrefetch: String = \"dns-prefetch\"\n public const val PreConnect: String = \"preconnect\"\n public const val PreLoad: String = \"preload\"\n public const val PreRender: String = \"prerender\"\n public const val Next: String = \"next\"\n }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\n/**\n * Parse query string withing starting at the specified [startIndex] but up to [limit] pairs\n */\npublic fun parseQueryString(query: String, startIndex: Int = 0, limit: Int = 1000): Parameters {\n return if (startIndex > query.lastIndex) {\n Parameters.Empty\n } else {\n Parameters.build { parse(query, startIndex, limit) }\n }\n}\n\nprivate fun ParametersBuilder.parse(query: String, startIndex: Int, limit: Int) {\n var count = 0\n var nameIndex = startIndex\n var equalIndex = -1\n for (index in startIndex..query.lastIndex) {\n if (count == limit) {\n return\n }\n when (query[index]) {\n '&' -> {\n appendParam(query, nameIndex, equalIndex, index)\n nameIndex = index + 1\n equalIndex = -1\n count++\n }\n '=' -> {\n if (equalIndex == -1) {\n equalIndex = index\n }\n }\n }\n }\n if (count == limit) {\n return\n }\n appendParam(query, nameIndex, equalIndex, query.length)\n}\n\nprivate fun ParametersBuilder.appendParam(query: String, nameIndex: Int, equalIndex: Int, endIndex: Int) {\n if (equalIndex == -1) {\n val spaceNameIndex = trimStart(nameIndex, endIndex, query)\n val spaceEndIndex = trimEnd(spaceNameIndex, endIndex, query)\n\n if (spaceEndIndex > spaceNameIndex) {\n val name = query.decodeURLQueryComponent(spaceNameIndex, spaceEndIndex)\n appendAll(name, emptyList())\n }\n } else {\n val spaceNameIndex = trimStart(nameIndex, equalIndex, query)\n val spaceEqualIndex = trimEnd(spaceNameIndex, equalIndex, query)\n if (spaceEqualIndex > spaceNameIndex) {\n val name = query.decodeURLQueryComponent(spaceNameIndex, spaceEqualIndex)\n\n val spaceValueIndex = trimStart(equalIndex + 1, endIndex, query)\n val spaceEndIndex = trimEnd(spaceValueIndex, endIndex, query)\n val value = query.decodeURLQueryComponent(spaceValueIndex, spaceEndIndex, plusIsSpace = true)\n append(name, value)\n }\n }\n}\n\nprivate fun trimEnd(start: Int, end: Int, text: CharSequence): Int {\n var spaceIndex = end\n while (spaceIndex > start && text[spaceIndex - 1].isWhitespace()) spaceIndex--\n return spaceIndex\n}\n\nprivate fun trimStart(start: Int, end: Int, query: CharSequence): Int {\n var spaceIndex = start\n while (spaceIndex < end && query[spaceIndex].isWhitespace()) spaceIndex++\n return spaceIndex\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.util.*\nimport kotlin.math.*\n\n/**\n * Possible content range units: bytes and none\n * @property unitToken Lower-case unit name\n */\npublic enum class RangeUnits(public val unitToken: String) {\n /**\n * Range unit `bytes`\n */\n Bytes(\"bytes\"),\n\n /**\n * Range unit `none`\n */\n None(\"none\");\n}\n\n/**\n * Represents a `Range` header's particular range\n */\npublic sealed class ContentRange {\n /**\n * Represents a `Content-Range` bounded from both sides\n * @property from index from which the content should begin\n * @property to the last index the content should end at (inclusive)\n */\n public data class Bounded(val from: Long, val to: Long) : ContentRange() {\n override fun toString(): String = \"$from-$to\"\n }\n\n /**\n * Represents a `Content-Range` bounded at the beginning (skip first bytes, show tail)\n * @property from index from which the content should begin\n */\n public data class TailFrom(val from: Long) : ContentRange() {\n override fun toString(): String = \"$from-\"\n }\n\n /**\n * Represents a `Content-Range` bounded by tail size\n * @property lastCount number of tail bytes\n */\n public data class Suffix(val lastCount: Long) : ContentRange() {\n override fun toString(): String = \"-$lastCount\"\n }\n}\n\n/**\n * Parse `Range` header value\n */\npublic fun parseRangesSpecifier(rangeSpec: String): RangesSpecifier? {\n try {\n val (unit, allRangesString) = rangeSpec.chomp(\"=\") { return null }\n val allRanges = allRangesString.split(',').map {\n if (it.startsWith(\"-\")) {\n ContentRange.Suffix(it.removePrefix(\"-\").toLong())\n } else {\n val (from, to) = it.chomp(\"-\") { \"\" to \"\" }\n when {\n to.isNotEmpty() -> ContentRange.Bounded(from.toLong(), to.toLong())\n else -> ContentRange.TailFrom(from.toLong())\n }\n }\n }\n\n if (allRanges.isEmpty() || unit.isEmpty()) {\n return null\n }\n\n val spec = RangesSpecifier(unit, allRanges)\n return if (spec.isValid()) spec else null\n } catch (e: Throwable) {\n return null // according to the specification we should ignore syntactically incorrect headers\n }\n}\n\ninternal fun List.toLongRanges(contentLength: Long) = map {\n when (it) {\n is ContentRange.Bounded -> it.from..it.to.coerceAtMost(contentLength - 1)\n is ContentRange.TailFrom -> it.from until contentLength\n is ContentRange.Suffix -> (contentLength - it.lastCount).coerceAtLeast(0L) until contentLength\n }\n}.filterNot { it.isEmpty() }\n\n// O (N^2 + N ln (N) + N)\ninternal fun List.mergeRangesKeepOrder(): List {\n val sortedMerged = sortedBy { it.start }.fold(ArrayList(size)) { acc, range ->\n when {\n acc.isEmpty() -> acc.add(range)\n acc.last().endInclusive < range.start - 1 -> acc.add(range)\n else -> {\n val last = acc.last()\n acc[acc.lastIndex] = last.start..max(last.endInclusive, range.endInclusive)\n }\n }\n acc\n }\n val result = arrayOfNulls(size)\n\n for (range in sortedMerged) {\n for (i in indices) {\n if (this[i] in range) {\n result[i] = range\n break\n }\n }\n }\n\n return result.filterNotNull()\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\n/**\n * Select default port value from protocol.\n */\npublic const val DEFAULT_PORT: Int = 0\n\n/**\n * A URL builder with all mutable components\n *\n * @property protocol URL protocol (scheme)\n * @property host name without port (domain)\n * @property port port number\n * @property user username part (optional)\n * @property password password part (optional)\n * @property encodedPath encoded URL path without query\n * @property parameters URL query parameters\n * @property fragment URL fragment (anchor name)\n * @property trailingQuery keep a trailing question character even if there are no query parameters\n */\npublic class URLBuilder(\n public var protocol: URLProtocol = URLProtocol.HTTP,\n public var host: String = \"localhost\",\n public var port: Int = DEFAULT_PORT,\n public var user: String? = null,\n public var password: String? = null,\n public var encodedPath: String = \"/\",\n public val parameters: ParametersBuilder = ParametersBuilder(),\n public var fragment: String = \"\",\n public var trailingQuery: Boolean = false\n) {\n init {\n originHost?.let { takeFrom(it) }\n\n if (encodedPath.isEmpty()) {\n encodedPath = \"/\"\n }\n }\n\n /**\n * Encode [components] to [encodedPath]\n */\n public fun path(vararg components: String): URLBuilder {\n path(components.asList())\n\n return this\n }\n\n /**\n * Encode [components] to [encodedPath]\n */\n public fun path(components: List): URLBuilder {\n encodedPath = components.joinToString(\"/\", prefix = \"/\") { it.encodeURLPath() }\n\n return this\n }\n\n private fun appendTo(out: A): A {\n out.append(protocol.name)\n\n when (protocol.name) {\n \"file\" -> {\n out.appendFile(host, encodedPath)\n return out\n }\n \"mailto\" -> {\n out.appendMailto(userAndPassword, encodedPath)\n return out\n }\n }\n\n out.append(\"://\")\n out.append(authority)\n\n out.appendUrlFullPath(encodedPath, parameters, trailingQuery)\n\n if (fragment.isNotEmpty()) {\n out.append('#')\n out.append(fragment.encodeURLQueryComponent())\n }\n\n return out\n }\n\n /**\n * Build a URL string\n */\n // note: 256 should fit 99.5% of all urls according to http://www.supermind.org/blog/740/average-length-of-a-url-part-2\n public fun buildString(): String = appendTo(StringBuilder(256)).toString()\n\n /**\n * Build a [Url] instance (everything is copied to a new instance)\n */\n public fun build(): Url = Url(\n protocol, host, port, encodedPath, parameters.build(), fragment, user, password, trailingQuery\n )\n\n // Required to write external extension function\n public companion object\n}\n\n/**\n * Hostname of current origin.\n *\n * It uses \"localhost\" for all platforms except js.\n */\ninternal expect val URLBuilder.Companion.originHost: String?\n\n/**\n * Create a copy of this builder. Modifications in a copy is not reflected in the original instance and vise-versa.\n */\npublic fun URLBuilder.clone(): URLBuilder = URLBuilder().takeFrom(this)\n\n/**\n * Represents an immutable URL\n *\n * @property protocol\n * @property host name without port (domain)\n * @property port the specified port or protocol default port\n * @property specifiedPort port number that was specified to override protocol's default\n * @property encodedPath encoded path without query string\n * @property parameters URL query parameters\n * @property fragment URL fragment (anchor name)\n * @property user username part of URL\n * @property password password part of URL\n * @property trailingQuery keep trailing question character even if there are no query parameters\n */\npublic data class Url(\n val protocol: URLProtocol,\n val host: String,\n val specifiedPort: Int,\n val encodedPath: String,\n val parameters: Parameters,\n val fragment: String,\n val user: String?,\n val password: String?,\n val trailingQuery: Boolean\n) {\n init {\n require(\n specifiedPort in 1..65536 ||\n specifiedPort == DEFAULT_PORT\n ) { \"port must be between 1 and 65536, or $DEFAULT_PORT if not set\" }\n }\n\n val port: Int get() = specifiedPort.takeUnless { it == DEFAULT_PORT } ?: protocol.defaultPort\n\n override fun toString(): String = buildString {\n append(protocol.name)\n\n when (protocol.name) {\n \"file\" -> {\n appendFile(host, encodedPath)\n return@buildString\n }\n \"mailto\" -> {\n val userValue = user ?: error(\"User can't be empty.\")\n appendMailto(userValue, host)\n return@buildString\n }\n }\n\n append(\"://\")\n append(authority)\n append(fullPath)\n\n if (fragment.isNotEmpty()) {\n append('#')\n append(fragment)\n }\n }\n\n public companion object\n}\n\nprivate fun Appendable.appendMailto(user: String, host: String) {\n append(\":\")\n append(user.encodeURLParameter())\n append('@')\n append(host)\n}\n\nprivate fun Appendable.appendFile(host: String, encodedPath: String) {\n append(\"://\")\n append(host)\n append(encodedPath)\n}\n\ninternal val Url.userAndPassword: String\n get() = buildString {\n appendUserAndPassword(user, password)\n }\n\ninternal val URLBuilder.userAndPassword: String\n get() = buildString {\n appendUserAndPassword(user, password)\n }\n\nprivate fun StringBuilder.appendUserAndPassword(user: String?, password: String?) {\n user ?: return\n append(user.encodeURLParameter())\n\n if (password != null) {\n append(':')\n append(password.encodeURLParameter())\n }\n\n append(\"@\")\n}\n\n/**\n * [Url] authority.\n */\npublic val Url.authority: String\n get() = buildString {\n append(userAndPassword)\n\n if (specifiedPort == DEFAULT_PORT) {\n append(host)\n } else {\n append(hostWithPort)\n }\n }\n\n/**\n * [URLBuilder] authority.\n */\npublic val URLBuilder.authority: String\n get() = buildString {\n append(userAndPassword)\n append(host)\n\n if (port != DEFAULT_PORT && port != protocol.defaultPort) {\n append(\":\")\n append(port.toString())\n }\n }\n\n/**\n * Adds [components] to current [encodedPath]\n */\npublic fun URLBuilder.pathComponents(components: List): URLBuilder {\n var paths = components\n .map { part -> part.dropWhile { it == '/' }.dropLastWhile { it == '/' }.encodeURLQueryComponent() }\n .filter { it.isNotEmpty() }\n .joinToString(\"/\")\n\n // make sure that there's a slash separator at the end of current path\n if (!encodedPath.endsWith('/')) {\n paths = \"/$paths\"\n }\n encodedPath += paths\n\n return this\n}\n\n/**\n * Adds [components] to current [encodedPath]\n */\npublic fun URLBuilder.pathComponents(vararg components: String): URLBuilder {\n return pathComponents(components.toList())\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.util.*\n\n/**\n * Take url parts from [urlString]\n * throws [URLParserException]\n */\npublic fun URLBuilder.takeFrom(urlString: String): URLBuilder {\n return try {\n takeFromUnsafe(urlString)\n } catch (cause: Throwable) {\n throw URLParserException(urlString, cause)\n }\n}\n\n/**\n * Thrown when failed to parse URL\n */\npublic class URLParserException(urlString: String, cause: Throwable) : IllegalStateException(\n \"Fail to parse url: $urlString\",\n cause\n)\n\ninternal fun URLBuilder.takeFromUnsafe(urlString: String): URLBuilder {\n var startIndex = urlString.indexOfFirst { !it.isWhitespace() }\n val endIndex = urlString.indexOfLast { !it.isWhitespace() } + 1\n\n val schemeLength = findScheme(urlString, startIndex, endIndex)\n if (schemeLength > 0) {\n val scheme = urlString.substring(startIndex, startIndex + schemeLength)\n\n protocol = URLProtocol.createOrDefault(scheme)\n startIndex += schemeLength + 1\n }\n\n // Auth & Host\n val slashCount = count(urlString, startIndex, endIndex, '/')\n startIndex += slashCount\n\n if (protocol.name == \"file\") {\n parseFile(urlString, startIndex, endIndex, slashCount)\n return this\n }\n\n if (protocol.name == \"mailto\") {\n require(slashCount == 0)\n parseMailto(urlString, startIndex, endIndex)\n return this\n }\n\n if (slashCount >= 2) {\n loop@ while (true) {\n val delimiter = urlString.indexOfAny(\"@/\\\\?#\".toCharArray(), startIndex).takeIf { it > 0 } ?: endIndex\n\n if (delimiter < endIndex && urlString[delimiter] == '@') {\n // user and password check\n val passwordIndex = urlString.indexOfColonInHostPort(startIndex, delimiter)\n if (passwordIndex != -1) {\n user = urlString.substring(startIndex, passwordIndex).decodeURLPart()\n password = urlString.substring(passwordIndex + 1, delimiter).decodeURLPart()\n } else {\n user = urlString.substring(startIndex, delimiter).decodeURLPart()\n }\n startIndex = delimiter + 1\n } else {\n fillHost(urlString, startIndex, delimiter)\n startIndex = delimiter\n break@loop\n }\n }\n }\n\n // Path\n if (startIndex >= endIndex) {\n encodedPath = if (urlString[endIndex - 1] == '/') \"/\" else \"\"\n return this\n }\n\n encodedPath = if (slashCount == 0) {\n // Relative path\n val lastSlashIndex = encodedPath.lastIndexOf('/')\n\n if (lastSlashIndex != encodedPath.length - 1) {\n // Current path does not end in slash, get rid of last path segment.\n if (lastSlashIndex != -1) {\n encodedPath.substring(0, lastSlashIndex + 1)\n } else {\n \"/\"\n }\n } else {\n // keep the whole path\n encodedPath\n }\n } else {\n // overwrite the path\n \"\"\n }\n\n val pathEnd = urlString.indexOfAny(\"?#\".toCharArray(), startIndex).takeIf { it > 0 } ?: endIndex\n val rawPath = urlString.substring(startIndex, pathEnd)\n\n encodedPath += rawPath.encodeURLPath()\n startIndex = pathEnd\n\n // Query\n if (startIndex < endIndex && urlString[startIndex] == '?') {\n startIndex = parseQuery(urlString, startIndex, endIndex)\n }\n\n // Fragment\n parseFragment(urlString, startIndex, endIndex)\n return this\n}\n\nprivate fun URLBuilder.parseFile(urlString: String, startIndex: Int, endIndex: Int, slashCount: Int) {\n when (slashCount) {\n 2 -> {\n val nextSlash = urlString.indexOf('/', startIndex)\n if (nextSlash == -1 || nextSlash == endIndex) {\n host = urlString.substring(startIndex, endIndex)\n return\n }\n\n host = urlString.substring(startIndex, nextSlash)\n encodedPath = urlString.substring(nextSlash, endIndex)\n }\n 3 -> {\n host = \"\"\n encodedPath = \"/\" + urlString.substring(startIndex, endIndex)\n }\n else -> throw IllegalArgumentException(\"Invalid file url: $urlString\")\n }\n}\n\nprivate fun URLBuilder.parseMailto(urlString: String, startIndex: Int, endIndex: Int) {\n val delimiter = urlString.indexOf(\"@\", startIndex)\n if (delimiter == -1) {\n throw IllegalArgumentException(\"Invalid mailto url: $urlString, it should contain '@'.\")\n }\n\n user = urlString.substring(startIndex, delimiter).decodeURLPart()\n host = urlString.substring(delimiter + 1, endIndex)\n}\n\nprivate fun URLBuilder.parseQuery(urlString: String, startIndex: Int, endIndex: Int): Int {\n if (startIndex + 1 == endIndex) {\n trailingQuery = true\n return endIndex\n }\n\n val fragmentStart = urlString.indexOf('#', startIndex + 1).takeIf { it > 0 } ?: endIndex\n\n val rawParameters = parseQueryString(urlString.substring(startIndex + 1, fragmentStart))\n rawParameters.forEach { key, values ->\n parameters.appendAll(key, values)\n }\n\n return fragmentStart\n}\n\nprivate fun URLBuilder.parseFragment(urlString: String, startIndex: Int, endIndex: Int) {\n if (startIndex < endIndex && urlString[startIndex] == '#') {\n fragment = urlString.substring(startIndex + 1, endIndex)\n }\n}\n\nprivate fun URLBuilder.fillHost(urlString: String, startIndex: Int, endIndex: Int) {\n val colonIndex = urlString.indexOfColonInHostPort(startIndex, endIndex).takeIf { it > 0 } ?: endIndex\n\n host = urlString.substring(startIndex, colonIndex)\n\n if (colonIndex + 1 < endIndex) {\n port = urlString.substring(colonIndex + 1, endIndex).toInt()\n } else {\n port = DEFAULT_PORT\n }\n}\n\n/**\n * Finds scheme in the given [urlString]. If there is no scheme found the function returns -1. If the scheme contains\n * illegal characters an [IllegalArgumentException] will be thrown. If the scheme is present and it doesn't contain\n * illegal characters the function returns the length of the scheme.\n */\nprivate fun findScheme(urlString: String, startIndex: Int, endIndex: Int): Int {\n var current = startIndex\n\n // Incorrect scheme position is used to identify the first position at which the character is not allowed in the\n // scheme or the part of the scheme. This number is reported in the exception message.\n var incorrectSchemePosition = -1\n val firstChar = urlString[current]\n if (firstChar !in 'a'..'z' && firstChar !in 'A'..'Z') {\n incorrectSchemePosition = current\n }\n\n while (current < endIndex) {\n val char = urlString[current]\n\n // Character ':' means the end of the scheme and at this point the length of the scheme should be returned or\n // the exception should be thrown in case the scheme contains illegal characters.\n if (char == ':') {\n if (incorrectSchemePosition != -1) {\n throw IllegalArgumentException(\"Illegal character in scheme at position $incorrectSchemePosition\")\n }\n\n return current - startIndex\n }\n\n // If character '/' or '?' or '#' found this is not a scheme.\n if (char == '/' || char == '?' || char == '#') return -1\n\n // Update incorrect scheme position is current char is illegal.\n if (incorrectSchemePosition == -1 &&\n char !in 'a'..'z' &&\n char !in 'A'..'Z' &&\n char !in '0'..'9' &&\n char != '.' &&\n char != '+' &&\n char != '-'\n ) {\n incorrectSchemePosition = current\n }\n\n ++current\n }\n\n return -1\n}\n\nprivate fun count(urlString: String, startIndex: Int, endIndex: Int, char: Char): Int {\n var result = 0\n while (startIndex + result < endIndex) {\n if (urlString[startIndex + result] != char) break\n result++\n }\n\n return result\n}\n\nprivate fun String.indexOfColonInHostPort(startIndex: Int, endIndex: Int): Int {\n var skip = false\n for (index in startIndex until endIndex) {\n when (this[index]) {\n '[' -> skip = true\n ']' -> skip = false\n ':' -> if (!skip) return index\n }\n }\n\n return -1\n}\n\nprivate fun Char.isLetter(): Boolean = toLowerCase() in 'a'..'z'\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.util.*\n\n/**\n * Represents URL protocol\n * @property name of protocol (schema)\n * @property defaultPort default port for protocol or `-1` if not known\n */\npublic data class URLProtocol(val name: String, val defaultPort: Int) {\n init {\n require(name.all { it.isLowerCase() }) { \"All characters should be lower case\" }\n }\n\n @Suppress(\"PublicApiImplicitType\")\n public companion object {\n /**\n * HTTP with port 80\n */\n public val HTTP: URLProtocol = URLProtocol(\"http\", 80)\n\n /**\n * secure HTTPS with port 443\n */\n public val HTTPS: URLProtocol = URLProtocol(\"https\", 443)\n\n /**\n * Web socket over HTTP on port 80\n */\n public val WS: URLProtocol = URLProtocol(\"ws\", 80)\n\n /**\n * Web socket over secure HTTPS on port 443\n */\n public val WSS: URLProtocol = URLProtocol(\"wss\", 443)\n\n /**\n * Socks proxy url protocol.\n */\n public val SOCKS: URLProtocol = URLProtocol(\"socks\", 1080)\n\n /**\n * Protocols by names map\n */\n public val byName: Map = listOf(HTTP, HTTPS, WS, WSS, SOCKS).associateBy { it.name }\n\n /**\n * Create an instance by [name] or use already existing instance\n */\n public fun createOrDefault(name: String): URLProtocol = name.toLowerCasePreservingASCIIRules().let {\n byName[it] ?: URLProtocol(it, DEFAULT_PORT)\n }\n }\n}\n\n/**\n * Check if the protocol is websocket\n */\npublic fun URLProtocol.isWebsocket(): Boolean = name == \"ws\" || name == \"wss\"\n\n/**\n * Check if the protocol is secure\n */\npublic fun URLProtocol.isSecure(): Boolean = name == \"https\" || name == \"wss\"\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.util.*\n\n/**\n * Construct [Url] from [urlString].\n */\n@Suppress(\"FunctionName\")\npublic fun Url(urlString: String): Url = URLBuilder(urlString).build()\n\n/**\n * Construct [Url] from [builder] without building origin.\n */\n@Suppress(\"FunctionName\")\npublic fun Url(builder: URLBuilder): Url = URLBuilder().takeFrom(builder).build()\n\n/**\n * Construct [URLBuilder] from [urlString].\n */\n@Suppress(\"FunctionName\")\npublic fun URLBuilder(urlString: String): URLBuilder = URLBuilder().takeFrom(urlString)\n\n/**\n * Construct [URLBuilder] from [url].\n */\n@Suppress(\"FunctionName\")\npublic fun URLBuilder(url: Url): URLBuilder = URLBuilder().takeFrom(url)\n\n/**\n * Construct [URLBuilder] from [builder].\n */\n@Suppress(\"FunctionName\")\npublic fun URLBuilder(builder: URLBuilder): URLBuilder = URLBuilder().takeFrom(builder)\n\n/**\n * Take components from another [url] builder\n */\npublic fun URLBuilder.takeFrom(url: URLBuilder): URLBuilder {\n protocol = url.protocol\n host = url.host\n port = url.port\n encodedPath = url.encodedPath\n user = url.user\n password = url.password\n parameters.appendAll(url.parameters)\n fragment = url.fragment\n trailingQuery = url.trailingQuery\n\n return this\n}\n\n/**\n * Take components from another [url]\n */\npublic fun URLBuilder.takeFrom(url: Url): URLBuilder {\n protocol = url.protocol\n host = url.host\n port = url.specifiedPort\n encodedPath = url.encodedPath\n user = url.user\n password = url.password\n parameters.appendAll(url.parameters)\n fragment = url.fragment\n trailingQuery = url.trailingQuery\n\n return this\n}\n\n/**\n * Full encoded path with query string but without domain, port and schema\n */\npublic val Url.fullPath: String\n get() = buildString { appendUrlFullPath(encodedPath, parameters, trailingQuery) }\n\n/**\n * Host:port pair, not normalized so port is always specified even if the port is schema's default\n */\npublic val Url.hostWithPort: String get() = \"$host:$port\"\n\ninternal fun Appendable.appendUrlFullPath(\n encodedPath: String,\n queryParameters: Parameters,\n trailingQuery: Boolean\n) {\n if (encodedPath.isNotBlank() && !encodedPath.startsWith(\"/\")) {\n append('/')\n }\n\n append(encodedPath)\n\n if (!queryParameters.isEmpty() || trailingQuery) {\n append(\"?\")\n }\n\n queryParameters.formUrlEncodeTo(this)\n}\n\ninternal fun Appendable.appendUrlFullPath(\n encodedPath: String,\n queryParameters: ParametersBuilder,\n trailingQuery: Boolean\n) {\n if (encodedPath.isNotBlank() && !encodedPath.startsWith(\"/\")) {\n append('/')\n }\n\n append(encodedPath)\n\n if (!queryParameters.isEmpty() || trailingQuery) {\n append(\"?\")\n }\n\n queryParameters.formUrlEncodeTo(this)\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http.auth\n\n/**\n * Describes how a header should be encoded.\n */\npublic enum class HeaderValueEncoding {\n /**\n * The header will be quoted only when required.\n */\n QUOTED_WHEN_REQUIRED,\n\n /**\n * The header will be quoted always.\n */\n QUOTED_ALWAYS,\n\n /**\n * The header will be URI-encoded as described in the RFC-3986:\n *\n * see https://tools.ietf.org/html/rfc3986#page-12\n */\n URI_ENCODE\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http.auth\n\nimport io.ktor.http.*\nimport io.ktor.http.parsing.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.charsets.*\nimport kotlin.native.concurrent.*\n\nprivate const val valuePatternPart = \"\"\"(\"((\\\\.)|[^\\\\\"])*\")|[^\\s,]*\"\"\"\n\n@ThreadLocal\nprivate val token68Pattern = \"[a-zA-Z0-9\\\\-._~+/]+=*\".toRegex()\n\n@ThreadLocal\nprivate val authSchemePattern = \"\\\\S+\".toRegex()\n\n@ThreadLocal\nprivate val parameterPattern = \"\\\\s*,?\\\\s*($token68Pattern)\\\\s*=\\\\s*($valuePatternPart)\\\\s*,?\\\\s*\".toRegex()\n\n@ThreadLocal\nprivate val escapeRegex: Regex = \"\\\\\\\\.\".toRegex()\n\n/**\n * Parses an authorization header [headerValue] into a [HttpAuthHeader].\n * @return [HttpAuthHeader] or `null` if argument string is blank.\n * @throws [ParseException] on invalid header\n */\npublic fun parseAuthorizationHeader(headerValue: String): HttpAuthHeader? {\n val schemeRegion = authSchemePattern.find(headerValue) ?: return null\n val authScheme = schemeRegion.value\n val remaining = headerValue.substringAfterMatch(schemeRegion).trimStart()\n\n val token68 = token68Pattern.find(remaining)\n if (token68 != null && remaining.substringAfterMatch(token68).isBlank()) {\n return HttpAuthHeader.Single(authScheme, token68.value)\n }\n\n val parameters = parameterPattern.findAll(remaining).associateBy(\n { it.groups[1]!!.value },\n { it.groups[2]!!.value.unescapedIfQuoted() }\n )\n\n return HttpAuthHeader.Parameterized(authScheme, parameters)\n}\n\n/**\n * Describes an authentication header with a mandatory [authScheme] that usually is a standard [AuthScheme].\n *\n * This can be of type [HttpAuthHeader.Single] or [HttpAuthHeader.Parameterized].\n *\n * @property authScheme auth scheme, usually one of [AuthScheme]\n */\npublic sealed class HttpAuthHeader(public val authScheme: String) {\n init {\n if (!authScheme.matches(token68Pattern)) {\n throw ParseException(\"invalid authScheme value: it should be token but it is $authScheme\")\n }\n }\n\n /**\n * Describes an authentication header that is represented by a single [blob].\n * @property blob contains single token 68, should consist from digits, letters and one of the following: `-._~+/`\n */\n public class Single(authScheme: String, public val blob: String) : HttpAuthHeader(authScheme) {\n init {\n if (!blob.matches(token68Pattern)) {\n throw ParseException(\"invalid blob value: it should be token68 but it is $blob\")\n }\n }\n\n override fun render(): String = \"$authScheme $blob\"\n override fun render(encoding: HeaderValueEncoding): String = render()\n\n override fun equals(other: Any?): Boolean {\n if (other !is Single) return false\n return other.authScheme.equals(authScheme, ignoreCase = true) &&\n other.blob.equals(blob, ignoreCase = true)\n }\n\n override fun hashCode(): Int {\n return Hash.combine(authScheme.toLowerCase(), blob.toLowerCase())\n }\n }\n\n /**\n * Describes a parameterized authentication header that is represented by a set of [parameters] encoded with [encoding].\n * @property parameters a list of auth parameters\n * @property encoding parameters encoding method, one of [HeaderValueEncoding]\n */\n public class Parameterized(\n authScheme: String,\n public val parameters: List,\n public val encoding: HeaderValueEncoding = HeaderValueEncoding.QUOTED_WHEN_REQUIRED\n ) : HttpAuthHeader(authScheme) {\n public constructor(\n authScheme: String,\n parameters: Map,\n encoding: HeaderValueEncoding = HeaderValueEncoding.QUOTED_WHEN_REQUIRED\n ) : this(authScheme, parameters.entries.map { HeaderValueParam(it.key, it.value) }, encoding)\n\n init {\n parameters.forEach {\n if (!it.name.matches(token68Pattern)) {\n throw ParseException(\"parameter name should be a token but it is ${it.name}\")\n }\n }\n }\n\n /**\n * Copies this [Parameterized] appending a new parameter [name] [value].\n */\n public fun withParameter(name: String, value: String): Parameterized =\n Parameterized(authScheme, this.parameters + HeaderValueParam(name, value), encoding)\n\n /**\n * Copies this [Parameterized] replacing parameters with [name] assigning new [value]\n * or appending if no such parameters found.\n * If there were several pairs they will be reduced into a single pair\n * at position of first occurrence discarding following pairs with this [name].\n */\n public fun withReplacedParameter(name: String, value: String): Parameterized {\n val firstIndex = parameters.indexOfFirst { it.name == name }\n if (firstIndex == -1) return withParameter(name, value)\n\n var replaced = false\n val newParameters = parameters.mapNotNull {\n when {\n it.name != name -> it\n !replaced -> {\n replaced = true\n HeaderValueParam(name, value)\n }\n else -> null\n }\n }\n\n return Parameterized(authScheme, newParameters, encoding)\n }\n\n override fun render(encoding: HeaderValueEncoding): String =\n parameters.joinToString(\", \", prefix = \"$authScheme \") { \"${it.name}=${it.value.encode(encoding)}\" }\n\n /**\n * Tries to extract the first value of a parameter [name]. Returns null when not found.\n */\n public fun parameter(name: String): String? = parameters.firstOrNull { it.name == name }?.value\n\n private fun String.encode(encoding: HeaderValueEncoding) = when (encoding) {\n HeaderValueEncoding.QUOTED_WHEN_REQUIRED -> escapeIfNeeded()\n HeaderValueEncoding.QUOTED_ALWAYS -> quote()\n HeaderValueEncoding.URI_ENCODE -> encodeURLParameter()\n }\n\n override fun render(): String = render(encoding)\n\n override fun equals(other: Any?): Boolean {\n if (other !is Parameterized) return false\n return other.authScheme.equals(authScheme, ignoreCase = true) &&\n other.parameters == parameters\n }\n\n override fun hashCode(): Int {\n return Hash.combine(authScheme.toLowerCase(), parameters)\n }\n }\n\n /**\n * Encodes the header with a specified [encoding].\n */\n public abstract fun render(encoding: HeaderValueEncoding): String\n\n /**\n * Encodes the header with the default [HeaderValueEncoding] for this header.\n */\n public abstract fun render(): String\n\n /**\n * Encodes the header with the default [HeaderValueEncoding] for this header.\n */\n override fun toString(): String {\n return render()\n }\n\n public companion object {\n /**\n * Generates an [AuthScheme.Basic] challenge as a [HttpAuthHeader].\n */\n public fun basicAuthChallenge(realm: String, charset: Charset?): Parameterized = Parameterized(\n AuthScheme.Basic,\n LinkedHashMap().apply {\n put(Parameters.Realm, realm)\n if (charset != null) {\n put(Parameters.Charset, charset.name)\n }\n }\n )\n\n /**\n * Generates an [AuthScheme.Digest] challenge as a [HttpAuthHeader].\n */\n public fun digestAuthChallenge(\n realm: String,\n nonce: String = generateNonce(),\n domain: List = emptyList(),\n opaque: String? = null,\n stale: Boolean? = null,\n algorithm: String = \"MD5\"\n ): Parameterized = Parameterized(\n AuthScheme.Digest,\n linkedMapOf().apply {\n put(\"realm\", realm)\n put(\"nonce\", nonce)\n if (domain.isNotEmpty()) {\n put(\"domain\", domain.joinToString(\" \"))\n }\n if (opaque != null) {\n put(\"opaque\", opaque)\n }\n if (stale != null) {\n put(\"stale\", stale.toString())\n }\n put(\"algorithm\", algorithm)\n },\n HeaderValueEncoding.QUOTED_ALWAYS\n )\n }\n\n /**\n * Standard parameters for [Parameterized] [HttpAuthHeader].\n */\n @Suppress(\"KDocMissingDocumentation\", \"PublicApiImplicitType\")\n public object Parameters {\n public const val Realm: String = \"realm\"\n public const val Charset: String = \"charset\"\n\n public const val OAuthCallback: String = \"oauth_callback\"\n public const val OAuthConsumerKey: String = \"oauth_consumer_key\"\n public const val OAuthNonce: String = \"oauth_nonce\"\n public const val OAuthToken: String = \"oauth_token\"\n public const val OAuthTokenSecret: String = \"oauth_token_secret\"\n public const val OAuthVerifier: String = \"oauth_verifier\"\n public const val OAuthSignatureMethod: String = \"oauth_signature_method\"\n public const val OAuthTimestamp: String = \"oauth_timestamp\"\n public const val OAuthVersion: String = \"oauth_version\"\n public const val OAuthSignature: String = \"oauth_signature\"\n public const val OAuthCallbackConfirmed: String = \"oauth_callback_confirmed\"\n }\n}\n\nprivate fun String.substringAfterMatch(result: MatchResult): String = drop(\n result.range.last + if (result.range.isEmpty()) 0 else 1\n)\n\nprivate fun String.unescapedIfQuoted() = when {\n startsWith('\"') && endsWith('\"') -> {\n removeSurrounding(\"\\\"\").replace(escapeRegex) { it.value.takeLast(1) }\n }\n else -> this\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http.auth\n\n/**\n * Contains the standard auth schemes.\n */\npublic object AuthScheme {\n /**\n * Basic Authentication described in the RFC-7617\n *\n * ```\n * response = base64(\"$user:$password\")\n * ```\n *\n * see https://tools.ietf.org/html/rfc7617)\n */\n public const val Basic: String = \"Basic\"\n\n /**\n * Digest Authentication described in the RFC-2069:\n *\n * ```\n * HA1 = MD5(\"$username:$realm:$password\") // What's usually stored\n * HA2 = MD5(\"$method:$digestURI\")\n * response = MD5(\"$HA1:$nonce:$HA2\") // The client and the server sends and checks this.\n * ```\n *\n * see https://tools.ietf.org/html/rfc2069\n */\n public const val Digest: String = \"Digest\"\n\n /**\n * Described in the RFC-4599:\n *\n * see https://www.ietf.org/rfc/rfc4559.txt\n */\n public const val Negotiate: String = \"Negotiate\"\n\n /**\n * OAuth Authentication described in the RFC-6749:\n *\n * see https://tools.ietf.org/html/rfc6749\n */\n public const val OAuth: String = \"OAuth\"\n\n @Suppress(\"KDocMissingDocumentation\", \"unused\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getBasic(): String = Basic\n\n @Suppress(\"KDocMissingDocumentation\", \"unused\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getDigest(): String = Digest\n\n @Suppress(\"KDocMissingDocumentation\", \"unused\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getNegotiate(): String = Negotiate\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http.content\n\nimport io.ktor.http.*\n\n/**\n * Implementation of the [OutgoingContent.ByteArrayContent] for sending array of bytes\n */\npublic class ByteArrayContent(\n private val bytes: ByteArray,\n override val contentType: ContentType? = null,\n override val status: HttpStatusCode? = null\n) : OutgoingContent.ByteArrayContent() {\n override val contentLength: Long get() = bytes.size.toLong()\n\n override fun bytes(): ByteArray = bytes\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http.content\n\nimport io.ktor.http.*\nimport io.ktor.util.*\nimport io.ktor.util.date.*\n\n/**\n * Specifies caching properties for an [OutgoingContent] such as Cache-Control or Expires\n * @property cacheControl header\n * @property expires header\n */\npublic data class CachingOptions(val cacheControl: CacheControl? = null, val expires: GMTDate? = null)\n\n/**\n * Specifies a key for CacheControl extension property for [OutgoingContent]\n */\npublic val CachingProperty: AttributeKey = AttributeKey(\"Caching\")\n\n/**\n * Gets or sets [CacheControl] instance as an extension property on this content\n */\npublic var OutgoingContent.caching: CachingOptions?\n get() = getProperty(CachingProperty)\n set(value) = setProperty(CachingProperty, value)\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http.content\n\nimport io.ktor.http.*\nimport io.ktor.http.content.PartData.*\nimport io.ktor.utils.io.core.*\n\n/**\n * Represents a multipart/form-data entry. Could be a [FormItem] or [FileItem]\n * @property dispose to be invoked when this part is no longed needed\n * @property headers of this part, could be inaccurate on some engines\n */\npublic sealed class PartData(public val dispose: () -> Unit, public val headers: Headers) {\n /**\n * Represents a multipart form item\n * @property value of this field\n */\n public class FormItem(public val value: String, dispose: () -> Unit, partHeaders: Headers) :\n PartData(dispose, partHeaders)\n\n /**\n * Represents a file item\n * @property provider of content bytes\n */\n public class FileItem(\n public val provider: () -> Input,\n dispose: () -> Unit,\n partHeaders: Headers\n ) : PartData(dispose, partHeaders) {\n /**\n * Original file name if present\n */\n public val originalFileName: String? = contentDisposition?.parameter(ContentDisposition.Parameters.FileName)\n }\n\n /**\n * Represents a binary item\n * @property provider of content bytes\n */\n public class BinaryItem(\n public val provider: () -> Input,\n dispose: () -> Unit,\n partHeaders: Headers\n ) : PartData(dispose, partHeaders)\n\n /**\n * Parsed `Content-Disposition` header or `null` if missing\n */\n public val contentDisposition: ContentDisposition? by lazy(LazyThreadSafetyMode.NONE) {\n headers[HttpHeaders.ContentDisposition]?.let { ContentDisposition.parse(it) }\n }\n\n /**\n * Parsed `Content-Type` header or `null` if missing\n */\n public val contentType: ContentType? by lazy(LazyThreadSafetyMode.NONE) {\n headers[HttpHeaders.ContentType]?.let {\n ContentType.parse(\n it\n )\n }\n }\n\n /**\n * Optional part name based on `Content-Disposition` header\n */\n public val name: String? get() = contentDisposition?.name\n\n @Suppress(\"KDocMissingDocumentation\", \"unused\")\n @Deprecated(\n \"Use name property instead\",\n ReplaceWith(\"name\"),\n level = DeprecationLevel.ERROR\n )\n public val partName: String?\n get() = name\n\n @Suppress(\"KDocMissingDocumentation\", \"unused\")\n @Deprecated(\n \"Use headers property instead\",\n ReplaceWith(\"headers\"),\n level = DeprecationLevel.ERROR\n )\n public val partHeaders: Headers\n get() = headers\n}\n\n/**\n * Represents a multipart data stream that could be received from a call\n */\npublic interface MultiPartData {\n /**\n * Reads next part data or `null` if end of multipart stream encountered\n */\n public suspend fun readPart(): PartData?\n\n /**\n * An empty multipart data stream\n */\n public object Empty : MultiPartData {\n override suspend fun readPart(): PartData? {\n return null\n }\n }\n}\n\n/**\n * Parse multipart data stream and invoke [partHandler] for each [PartData] encountered\n * @param partHandler to be invoked for every part item\n */\npublic suspend fun MultiPartData.forEachPart(partHandler: suspend (PartData) -> Unit) {\n while (true) {\n val part = readPart() ?: break\n partHandler(part)\n }\n}\n\n/**\n * Parse multipart data stream and put all parts into a list\n * @return a list of part data\n */\npublic suspend fun MultiPartData.readAllParts(): List {\n var part = readPart() ?: return emptyList()\n val parts = ArrayList()\n parts.add(part)\n\n do {\n part = readPart() ?: break\n parts.add(part)\n } while (true)\n\n return parts\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http.content\n\nimport io.ktor.http.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.*\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\n\n/**\n * Information about the content to be sent to the peer, recognized by a client or server engine\n */\npublic sealed class OutgoingContent {\n /**\n * Specifies [ContentType] for this resource.\n */\n public open val contentType: ContentType? get() = null\n\n /**\n * Specifies content length in bytes for this resource.\n *\n * If null, the resources will be sent as `Transfer-Encoding: chunked`\n */\n public open val contentLength: Long? get() = null\n\n /**\n * Status code to set when sending this content\n */\n public open val status: HttpStatusCode?\n get() = null\n\n /**\n * Headers to set when sending this content\n */\n public open val headers: Headers\n get() = Headers.Empty\n\n private var extensionProperties: Attributes? = null\n\n /**\n * Gets an extension property for this content\n */\n public open fun getProperty(key: AttributeKey): T? = extensionProperties?.getOrNull(key)\n\n /**\n * Sets an extension property for this content\n */\n public open fun setProperty(key: AttributeKey, value: T?) {\n when {\n value == null && extensionProperties == null -> return\n value == null -> extensionProperties?.remove(key)\n else -> (extensionProperties ?: Attributes()).also { extensionProperties = it }.put(key, value)\n }\n }\n\n /**\n * Variant of a [OutgoingContent] without a payload\n */\n public abstract class NoContent : OutgoingContent()\n\n /**\n * Variant of a [OutgoingContent] with payload read from [ByteReadChannel]\n *\n */\n public abstract class ReadChannelContent : OutgoingContent() {\n /**\n * Provides [ByteReadChannel] for the content\n */\n public abstract fun readFrom(): ByteReadChannel\n\n /**\n * Provides [ByteReadChannel] for the given range of the content\n */\n public open fun readFrom(range: LongRange): ByteReadChannel = if (range.isEmpty()) {\n ByteReadChannel.Empty\n } else {\n GlobalScope.writer(Dispatchers.Unconfined, autoFlush = true) {\n val source = readFrom()\n source.discard(range.start)\n val limit = range.endInclusive - range.start + 1\n source.copyTo(channel, limit)\n }.channel\n }\n }\n\n /**\n * Variant of a [OutgoingContent] with payload written to [ByteWriteChannel]\n */\n public abstract class WriteChannelContent : OutgoingContent() {\n /**\n * Receives [channel] provided by the engine and writes all data to it\n */\n public abstract suspend fun writeTo(channel: ByteWriteChannel)\n }\n\n /**\n * Variant of a [OutgoingContent] with payload represented as [ByteArray]\n */\n public abstract class ByteArrayContent : OutgoingContent() {\n /**\n * Provides [ByteArray] which engine will send to peer\n */\n public abstract fun bytes(): ByteArray\n }\n\n /**\n * Variant of a [OutgoingContent] for upgrading an HTTP connection\n */\n public abstract class ProtocolUpgrade : OutgoingContent() {\n final override val status: HttpStatusCode?\n get() = HttpStatusCode.SwitchingProtocols\n\n /**\n * Upgrades an HTTP connection\n * @param input is a [ByteReadChannel] for an upgraded connection\n * @param output is a [ByteWriteChannel] for an upgraded connection\n * @param engineContext is a [CoroutineContext] to execute non-blocking code, such as parsing or processing\n * @param userContext is a [CoroutineContext] to execute user-provided callbacks or code potentially blocking\n */\n public abstract suspend fun upgrade(\n input: ByteReadChannel,\n output: ByteWriteChannel,\n engineContext: CoroutineContext,\n userContext: CoroutineContext\n ): Job\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http.parsing\n\ninternal fun Grammar.printDebug(offset: Int = 0): Unit = when (this) {\n is StringGrammar -> printlnWithOffset(offset, \"STRING[${Regex.escape(value)}]\")\n is RawGrammar -> printlnWithOffset(offset, \"STRING[$value]\")\n is NamedGrammar -> {\n printlnWithOffset(offset, \"NAMED[$name]\")\n grammar.printDebug(offset + 2)\n }\n is SequenceGrammar -> {\n printlnWithOffset(offset, \"SEQUENCE\")\n grammars.forEach { it.printDebug(offset + 2) }\n }\n is OrGrammar -> {\n printlnWithOffset(offset, \"OR\")\n grammars.forEach { it.printDebug(offset + 2) }\n }\n is MaybeGrammar -> {\n printlnWithOffset(offset, \"MAYBE\")\n grammar.printDebug(offset + 2)\n }\n is ManyGrammar -> {\n printlnWithOffset(offset, \"MANY\")\n grammar.printDebug(offset + 2)\n }\n is AtLeastOne -> {\n printlnWithOffset(offset, \"MANY_NOT_EMPTY\")\n grammar.printDebug(offset + 2)\n }\n is AnyOfGrammar -> printlnWithOffset(offset, \"ANY_OF[${Regex.escape(value)}]\")\n is RangeGrammar -> printlnWithOffset(offset, \"RANGE[$from-$to]\")\n}\n\nprivate fun printlnWithOffset(offset: Int, node: Any) {\n println(\"${\" \".repeat(offset)}${offset / 2}: $node\")\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http.parsing\n\ninternal class GrammarBuilder {\n private val grammars = mutableListOf()\n\n infix fun then(grammar: Grammar): GrammarBuilder {\n grammars += grammar\n return this\n }\n\n infix fun then(value: String): GrammarBuilder {\n grammars += StringGrammar(value)\n return this\n }\n\n operator fun (() -> Grammar).unaryPlus() {\n grammars += this()\n }\n\n operator fun Grammar.unaryPlus() {\n grammars += this\n }\n\n operator fun String.unaryPlus() {\n grammars += StringGrammar(this)\n }\n\n public fun build(): Grammar = if (grammars.size == 1) grammars.first() else SequenceGrammar(grammars)\n}\n\ninternal fun grammar(block: GrammarBuilder.() -> Unit): Grammar = GrammarBuilder().apply(block).build()\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http.parsing\n\ninternal sealed class Grammar\n\ninternal interface ComplexGrammar {\n val grammars: List\n}\n\ninternal interface SimpleGrammar {\n val grammar: Grammar\n}\n\ninternal class StringGrammar(val value: String) : Grammar()\ninternal class AnyOfGrammar(val value: String) : Grammar()\ninternal class RangeGrammar(val from: Char, val to: Char) : Grammar()\ninternal class RawGrammar(val value: String) : Grammar()\n\ninternal class NamedGrammar(val name: String, val grammar: Grammar) : Grammar()\n\ninternal class MaybeGrammar(override val grammar: Grammar) : Grammar(), SimpleGrammar\ninternal class ManyGrammar(override val grammar: Grammar) : Grammar(), SimpleGrammar\ninternal class AtLeastOne(override val grammar: Grammar) : Grammar(), SimpleGrammar\n\ninternal class SequenceGrammar(sourceGrammars: List) : Grammar(), ComplexGrammar {\n override val grammars: List = sourceGrammars.flatten()\n}\n\ninternal class OrGrammar(sourceGrammars: List) : Grammar(), ComplexGrammar {\n override val grammars: List = sourceGrammars.flatten()\n}\n\ninternal fun maybe(grammar: Grammar): Grammar = MaybeGrammar(grammar)\ninternal fun maybe(value: String): Grammar = MaybeGrammar(StringGrammar(value))\ninternal fun maybe(block: GrammarBuilder.() -> Unit): () -> Grammar = { maybe(GrammarBuilder().apply(block).build()) }\n\ninternal infix fun String.then(grammar: Grammar): Grammar = StringGrammar(this) then grammar\ninternal infix fun Grammar.then(grammar: Grammar): Grammar = SequenceGrammar(listOf(this, grammar))\ninternal infix fun Grammar.then(value: String): Grammar = this then StringGrammar(value)\n\ninternal infix fun Grammar.or(grammar: Grammar): Grammar = OrGrammar(listOf(this, grammar))\ninternal infix fun Grammar.or(value: String): Grammar = this or StringGrammar(value)\ninternal infix fun String.or(grammar: Grammar): Grammar = StringGrammar(this) or grammar\n\ninternal fun many(grammar: Grammar): Grammar = ManyGrammar(grammar)\ninternal fun atLeastOne(grammar: Grammar): Grammar = AtLeastOne(grammar)\n\ninternal fun Grammar.named(name: String): Grammar = NamedGrammar(name, this)\n\ninternal fun anyOf(value: String): Grammar = AnyOfGrammar(value)\ninternal infix fun Char.to(other: Char): Grammar = RangeGrammar(this, other)\n\ninternal inline fun List.flatten(): List {\n val result = mutableListOf()\n forEach {\n if (it is T) result += it.grammars else result += it\n }\n return result\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http.parsing.regex\n\nimport io.ktor.http.parsing.*\n\ninternal fun Grammar.buildRegexParser(): Parser {\n val groups = mutableMapOf>()\n val expression = toRegex(groups).regex\n\n return RegexParser(Regex(expression), groups)\n}\n\nprivate class GrammarRegex(\n regexRaw: String,\n groupsCountRaw: Int = 0,\n group: Boolean = false\n) {\n val regex = if (group) \"($regexRaw)\" else regexRaw\n val groupsCount = if (group) groupsCountRaw + 1 else groupsCountRaw\n}\n\nprivate fun Grammar.toRegex(\n groups: MutableMap>,\n offset: Int = 1,\n shouldGroup: Boolean = false\n): GrammarRegex = when (this) {\n is StringGrammar -> GrammarRegex(Regex.escape(value))\n is RawGrammar -> GrammarRegex(value)\n is NamedGrammar -> {\n val nested = grammar.toRegex(groups, offset + 1)\n groups.add(name, offset)\n GrammarRegex(nested.regex, nested.groupsCount, group = true)\n }\n is ComplexGrammar -> {\n val expression = StringBuilder()\n\n var currentOffset = if (shouldGroup) offset + 1 else offset\n grammars.forEachIndexed { index, grammar ->\n val current = grammar.toRegex(groups, currentOffset, shouldGroup = true)\n\n if (index != 0 && this is OrGrammar) expression.append(\"|\")\n expression.append(current.regex)\n currentOffset += current.groupsCount\n }\n\n val groupsCount = if (shouldGroup) currentOffset - offset - 1 else currentOffset - offset\n GrammarRegex(expression.toString(), groupsCount, shouldGroup)\n }\n is SimpleGrammar -> {\n val operator = when (this) {\n is MaybeGrammar -> '?'\n is ManyGrammar -> '*'\n is AtLeastOne -> '+'\n else -> error(\"Unsupported simple grammar element: $this\")\n }\n\n val nested = grammar.toRegex(groups, offset, shouldGroup = true)\n GrammarRegex(\"${nested.regex}$operator\", nested.groupsCount)\n }\n is AnyOfGrammar -> GrammarRegex(\"[${Regex.escape(value)}]\")\n is RangeGrammar -> GrammarRegex(\"[$from-$to]\")\n else -> error(\"Unsupported grammar element: $this\")\n}\n\nprivate fun MutableMap>.add(key: String, value: Int) {\n if (!contains(key)) this[key] = mutableListOf()\n this[key]!! += value\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http.websocket\n\nimport io.ktor.util.*\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.*\n\nprivate const val WEBSOCKET_SERVER_ACCEPT_TAIL = \"258EAFA5-E914-47DA-95CA-C5AB0DC85B11\"\n\n/**\n * Calculates `Sec-WebSocket-Accept` header value\n */\npublic fun websocketServerAccept(nonce: String): String =\n sha1(\"${nonce.trim()}$WEBSOCKET_SERVER_ACCEPT_TAIL\".toByteArray(Charset.forName(\"ISO_8859_1\"))).encodeBase64()\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.util.*\nimport kotlin.browser.*\n\n/**\n * Hostname of current origin.\n *\n * It uses \"localhost\" for all platforms except js.\n */\ninternal actual val URLBuilder.Companion.originHost: String?\n get() = if (PlatformUtils.IS_BROWSER) {\n window.location.origin\n } else null\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http.content\n\nimport io.ktor.http.*\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.*\n\n/**\n * Represents a text content that could be sent\n * @property text to be sent\n */\npublic class TextContent(\n public val text: String,\n override val contentType: ContentType,\n override val status: HttpStatusCode? = null\n) : OutgoingContent.ByteArrayContent() {\n private val bytes = text.toByteArray(contentType.charset() ?: Charsets.UTF_8)\n\n override val contentLength: Long\n get() = bytes.size.toLong()\n\n override fun bytes(): ByteArray = bytes\n\n override fun toString(): String = \"TextContent[$contentType] \\\"${text.take(30)}\\\"\"\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.util.*\nimport io.ktor.utils.io.charsets.*\nimport kotlin.native.concurrent.*\n\n/**\n * Default [ContentType] for [extension]\n */\npublic fun ContentType.Companion.defaultForFileExtension(extension: String): ContentType =\n ContentType.fromFileExtension(extension).selectDefault()\n\n/**\n * Default [ContentType] for file [path]\n */\npublic fun ContentType.Companion.defaultForFilePath(path: String): ContentType =\n ContentType.fromFilePath(path).selectDefault()\n\n/**\n * Recommended content types by file [path]\n */\npublic fun ContentType.Companion.fromFilePath(path: String): List {\n val slashIndex = path.lastIndexOfAny(\"/\\\\\".toCharArray())\n val index = path.indexOf('.', startIndex = slashIndex + 1)\n if (index == -1) {\n return emptyList()\n }\n return fromFileExtension(path.substring(index + 1))\n}\n\n/**\n * Recommended content type by file name extension\n */\npublic fun ContentType.Companion.fromFileExtension(ext: String): List {\n var current = ext.removePrefix(\".\").toLowerCasePreservingASCIIRules()\n while (current.isNotEmpty()) {\n val type = contentTypesByExtensions[current]\n if (type != null) {\n return type\n }\n current = current.substringAfter(\".\", \"\")\n }\n\n return emptyList()\n}\n\n/**\n * Recommended file name extensions for this content type\n */\npublic fun ContentType.fileExtensions(): List = extensionsByContentType[this]\n ?: extensionsByContentType[this.withoutParameters()]\n ?: emptyList()\n\n@ThreadLocal\nprivate val contentTypesByExtensions: Map> by lazy {\n caseInsensitiveMap>().apply { putAll(mimes.asSequence().groupByPairs()) }\n}\n\n@ThreadLocal\nprivate val extensionsByContentType: Map> by lazy {\n mimes.asSequence().map { (first, second) -> second to first }.groupByPairs()\n}\n\ninternal fun List.selectDefault(): ContentType {\n val contentType = firstOrNull() ?: ContentType.Application.OctetStream\n return when {\n contentType.contentType == \"text\" && contentType.charset() == null -> contentType.withCharset(Charsets.UTF_8)\n else -> contentType\n }\n}\n\ninternal fun Sequence>.groupByPairs() = groupBy { it.first }\n .mapValues { e -> e.value.map { it.second } }\n\ninternal fun String.toContentType() = try {\n ContentType.parse(this)\n} catch (e: Throwable) {\n throw IllegalArgumentException(\"Failed to parse $this\", e)\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.util.*\nimport io.ktor.util.date.*\nimport kotlin.native.concurrent.*\n\n@SharedImmutable\nprivate val HTTP_DATE_FORMATS = listOf(\n \"***, dd MMM YYYY hh:mm:ss zzz\",\n \"****, dd-MMM-YYYY hh:mm:ss zzz\",\n \"*** MMM d hh:mm:ss YYYY\",\n \"***, dd-MMM-YYYY hh:mm:ss zzz\",\n \"***, dd-MMM-YYYY hh-mm-ss zzz\",\n \"***, dd MMM YYYY hh:mm:ss zzz\",\n \"*** dd-MMM-YYYY hh:mm:ss zzz\",\n \"*** dd MMM YYYY hh:mm:ss zzz\",\n \"*** dd-MMM-YYYY hh-mm-ss zzz\",\n \"***,dd-MMM-YYYY hh:mm:ss zzz\",\n \"*** MMM d YYYY hh:mm:ss zzz\"\n)\n\n/**\n * Convert valid http date [String] to [GMTDate] trying various http date formats from [HTTP_DATE_FORMATS]\n *\n * Note that only GMT(UTC) date is valid http date.\n */\npublic fun String.fromHttpToGmtDate(): GMTDate = with(trim()) {\n for (format in HTTP_DATE_FORMATS) {\n try {\n val parser = GMTDateParser(format)\n return parser.parse(this@fromHttpToGmtDate)\n } catch (_: InvalidDateStringException) {\n }\n }\n\n error(\"Failed to parse date: $this\")\n}\n\n/**\n * Convert valid cookie date [String] to [GMTDate] trying first the RFC6265 standard, falling back on [fromHttpToGmtDate]\n *\n * @see [fromHttpToGmtDate]\n */\npublic fun String.fromCookieToGmtDate(): GMTDate = with(trim()) {\n try {\n val parser = CookieDateParser()\n return parser.parse(this@with)\n } catch (_: InvalidCookieDateException) {\n }\n\n return fromHttpToGmtDate()\n}\n\n/**\n * Convert [GMTDate] to valid http date [String]\n */\npublic fun GMTDate.toHttpDate(): String = buildString {\n append(\"${dayOfWeek.value}, \")\n append(\"${dayOfMonth.padZero(2)} \")\n append(\"${month.value} \")\n append(year.padZero(4))\n append(\" ${hours.padZero(2)}:${minutes.padZero(2)}:${seconds.padZero(2)} \")\n append(\"GMT\")\n}\n\nprivate fun Int.padZero(length: Int): String = toString().padStart(length, '0')\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.http\n\nimport io.ktor.http.parsing.*\nimport io.ktor.http.parsing.regex.*\nimport kotlin.native.concurrent.*\n\n/**\n * Check if [host] is IPv4 or IPv6 address.\n */\npublic fun hostIsIp(host: String): Boolean = IP_PARSER.match(host)\n\n@SharedImmutable\nprivate val IPv4address = digits then \".\" then digits then \".\" then digits then \".\" then digits\n\n@SharedImmutable\nprivate val IPv6address = \"[\" then atLeastOne(hex or \":\") then \"]\"\n\n@SharedImmutable\nprivate val IP_PARSER = (IPv4address or IPv6address).buildRegexParser()\n","'use strict'\n\n// limit of Crypto.getRandomValues()\n// https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues\nvar MAX_BYTES = 65536\n\n// Node supports requesting up to this number of bytes\n// https://github.com/nodejs/node/blob/master/lib/internal/crypto/random.js#L48\nvar MAX_UINT32 = 4294967295\n\nfunction oldBrowser () {\n throw new Error('Secure random number generation is not supported by this browser.\\nUse Chrome, Firefox or Internet Explorer 11')\n}\n\nvar Buffer = require('safe-buffer').Buffer\nvar crypto = global.crypto || global.msCrypto\n\nif (crypto && crypto.getRandomValues) {\n module.exports = randomBytes\n} else {\n module.exports = oldBrowser\n}\n\nfunction randomBytes (size, cb) {\n // phantomjs needs to throw\n if (size > MAX_UINT32) throw new RangeError('requested too many random bytes')\n\n var bytes = Buffer.allocUnsafe(size)\n\n if (size > 0) { // getRandomValues fails on IE if size == 0\n if (size > MAX_BYTES) { // this is the max bytes crypto.getRandomValues\n // can do at once see https://developer.mozilla.org/en-US/docs/Web/API/window.crypto.getRandomValues\n for (var generated = 0; generated < size; generated += MAX_BYTES) {\n // buffer.slice automatically checks if the end is past the end of\n // the buffer so we don't have to here\n crypto.getRandomValues(bytes.slice(generated, generated + MAX_BYTES))\n }\n } else {\n crypto.getRandomValues(bytes)\n }\n }\n\n if (typeof cb === 'function') {\n return process.nextTick(function () {\n cb(null, bytes)\n })\n }\n\n return bytes\n}\n","'use strict';\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar codes = {};\n\nfunction createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === 'string') {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n\n var NodeError =\n /*#__PURE__*/\n function (_Base) {\n _inheritsLoose(NodeError, _Base);\n\n function NodeError(arg1, arg2, arg3) {\n return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;\n }\n\n return NodeError;\n }(Base);\n\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n codes[code] = NodeError;\n} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js\n\n\nfunction oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function (i) {\n return String(i);\n });\n\n if (len > 2) {\n return \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(', '), \", or \") + expected[len - 1];\n } else if (len === 2) {\n return \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]);\n } else {\n return \"of \".concat(thing, \" \").concat(expected[0]);\n }\n } else {\n return \"of \".concat(thing, \" \").concat(String(expected));\n }\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n\n\nfunction startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\n\n\nfunction includes(str, search, start) {\n if (typeof start !== 'number') {\n start = 0;\n }\n\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n}\n\ncreateErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {\n return 'The value \"' + value + '\" is invalid for option \"' + name + '\"';\n}, TypeError);\ncreateErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {\n // determiner: 'must be' or 'must not be'\n var determiner;\n\n if (typeof expected === 'string' && startsWith(expected, 'not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n var msg;\n\n if (endsWith(name, ' argument')) {\n // For cases like 'first argument'\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } else {\n var type = includes(name, '.') ? 'property' : 'argument';\n msg = \"The \\\"\".concat(name, \"\\\" \").concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n }\n\n msg += \". Received type \".concat(typeof actual);\n return msg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');\ncreateErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {\n return 'The ' + name + ' method is not implemented';\n});\ncreateErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');\ncreateErrorType('ERR_STREAM_DESTROYED', function (name) {\n return 'Cannot call ' + name + ' after a stream was destroyed';\n});\ncreateErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');\ncreateErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');\ncreateErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');\ncreateErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);\ncreateErrorType('ERR_UNKNOWN_ENCODING', function (arg) {\n return 'Unknown encoding: ' + arg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');\nmodule.exports.codes = codes;\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n'use strict';\n/**/\n\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n\n for (var key in obj) {\n keys.push(key);\n }\n\n return keys;\n};\n/**/\n\n\nmodule.exports = Duplex;\n\nvar Readable = require('./_stream_readable');\n\nvar Writable = require('./_stream_writable');\n\nrequire('inherits')(Duplex, Readable);\n\n{\n // Allow the keys array to be GC'ed.\n var keys = objectKeys(Writable.prototype);\n\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n\n if (options) {\n if (options.readable === false) this.readable = false;\n if (options.writable === false) this.writable = false;\n\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once('end', onend);\n }\n }\n}\n\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n}); // the no-half-open enforcer\n\nfunction onend() {\n // If the writable side ended, then we're ok.\n if (this._writableState.ended) return; // no more data can be written.\n // But allow more writes to happen in this tick.\n\n process.nextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});","var Buffer = require('safe-buffer').Buffer\n\n// prototype class for hash functions\nfunction Hash (blockSize, finalSize) {\n this._block = Buffer.alloc(blockSize)\n this._finalSize = finalSize\n this._blockSize = blockSize\n this._len = 0\n}\n\nHash.prototype.update = function (data, enc) {\n if (typeof data === 'string') {\n enc = enc || 'utf8'\n data = Buffer.from(data, enc)\n }\n\n var block = this._block\n var blockSize = this._blockSize\n var length = data.length\n var accum = this._len\n\n for (var offset = 0; offset < length;) {\n var assigned = accum % blockSize\n var remainder = Math.min(length - offset, blockSize - assigned)\n\n for (var i = 0; i < remainder; i++) {\n block[assigned + i] = data[offset + i]\n }\n\n accum += remainder\n offset += remainder\n\n if ((accum % blockSize) === 0) {\n this._update(block)\n }\n }\n\n this._len += length\n return this\n}\n\nHash.prototype.digest = function (enc) {\n var rem = this._len % this._blockSize\n\n this._block[rem] = 0x80\n\n // zero (rem + 1) trailing bits, where (rem + 1) is the smallest\n // non-negative solution to the equation (length + 1 + (rem + 1)) === finalSize mod blockSize\n this._block.fill(0, rem + 1)\n\n if (rem >= this._finalSize) {\n this._update(this._block)\n this._block.fill(0)\n }\n\n var bits = this._len * 8\n\n // uint32\n if (bits <= 0xffffffff) {\n this._block.writeUInt32BE(bits, this._blockSize - 4)\n\n // uint64\n } else {\n var lowBits = (bits & 0xffffffff) >>> 0\n var highBits = (bits - lowBits) / 0x100000000\n\n this._block.writeUInt32BE(highBits, this._blockSize - 8)\n this._block.writeUInt32BE(lowBits, this._blockSize - 4)\n }\n\n this._update(this._block)\n var hash = this._hash()\n\n return enc ? hash.toString(enc) : hash\n}\n\nHash.prototype._update = function () {\n throw new Error('_update must be implemented by subclass')\n}\n\nmodule.exports = Hash\n","'use strict';\n\nfunction _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }\n\nvar codes = {};\n\nfunction createErrorType(code, message, Base) {\n if (!Base) {\n Base = Error;\n }\n\n function getMessage(arg1, arg2, arg3) {\n if (typeof message === 'string') {\n return message;\n } else {\n return message(arg1, arg2, arg3);\n }\n }\n\n var NodeError =\n /*#__PURE__*/\n function (_Base) {\n _inheritsLoose(NodeError, _Base);\n\n function NodeError(arg1, arg2, arg3) {\n return _Base.call(this, getMessage(arg1, arg2, arg3)) || this;\n }\n\n return NodeError;\n }(Base);\n\n NodeError.prototype.name = Base.name;\n NodeError.prototype.code = code;\n codes[code] = NodeError;\n} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js\n\n\nfunction oneOf(expected, thing) {\n if (Array.isArray(expected)) {\n var len = expected.length;\n expected = expected.map(function (i) {\n return String(i);\n });\n\n if (len > 2) {\n return \"one of \".concat(thing, \" \").concat(expected.slice(0, len - 1).join(', '), \", or \") + expected[len - 1];\n } else if (len === 2) {\n return \"one of \".concat(thing, \" \").concat(expected[0], \" or \").concat(expected[1]);\n } else {\n return \"of \".concat(thing, \" \").concat(expected[0]);\n }\n } else {\n return \"of \".concat(thing, \" \").concat(String(expected));\n }\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith\n\n\nfunction startsWith(str, search, pos) {\n return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith\n\n\nfunction endsWith(str, search, this_len) {\n if (this_len === undefined || this_len > str.length) {\n this_len = str.length;\n }\n\n return str.substring(this_len - search.length, this_len) === search;\n} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes\n\n\nfunction includes(str, search, start) {\n if (typeof start !== 'number') {\n start = 0;\n }\n\n if (start + search.length > str.length) {\n return false;\n } else {\n return str.indexOf(search, start) !== -1;\n }\n}\n\ncreateErrorType('ERR_INVALID_OPT_VALUE', function (name, value) {\n return 'The value \"' + value + '\" is invalid for option \"' + name + '\"';\n}, TypeError);\ncreateErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {\n // determiner: 'must be' or 'must not be'\n var determiner;\n\n if (typeof expected === 'string' && startsWith(expected, 'not ')) {\n determiner = 'must not be';\n expected = expected.replace(/^not /, '');\n } else {\n determiner = 'must be';\n }\n\n var msg;\n\n if (endsWith(name, ' argument')) {\n // For cases like 'first argument'\n msg = \"The \".concat(name, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n } else {\n var type = includes(name, '.') ? 'property' : 'argument';\n msg = \"The \\\"\".concat(name, \"\\\" \").concat(type, \" \").concat(determiner, \" \").concat(oneOf(expected, 'type'));\n }\n\n msg += \". Received type \".concat(typeof actual);\n return msg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF');\ncreateErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) {\n return 'The ' + name + ' method is not implemented';\n});\ncreateErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close');\ncreateErrorType('ERR_STREAM_DESTROYED', function (name) {\n return 'Cannot call ' + name + ' after a stream was destroyed';\n});\ncreateErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times');\ncreateErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable');\ncreateErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end');\ncreateErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError);\ncreateErrorType('ERR_UNKNOWN_ENCODING', function (arg) {\n return 'Unknown encoding: ' + arg;\n}, TypeError);\ncreateErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event');\nmodule.exports.codes = codes;\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a duplex stream is just a stream that is both readable and writable.\n// Since JS doesn't have multiple prototypal inheritance, this class\n// prototypally inherits from Readable, and then parasitically from\n// Writable.\n'use strict';\n/**/\n\nvar objectKeys = Object.keys || function (obj) {\n var keys = [];\n\n for (var key in obj) {\n keys.push(key);\n }\n\n return keys;\n};\n/**/\n\n\nmodule.exports = Duplex;\n\nvar Readable = require('./_stream_readable');\n\nvar Writable = require('./_stream_writable');\n\nrequire('inherits')(Duplex, Readable);\n\n{\n // Allow the keys array to be GC'ed.\n var keys = objectKeys(Writable.prototype);\n\n for (var v = 0; v < keys.length; v++) {\n var method = keys[v];\n if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];\n }\n}\n\nfunction Duplex(options) {\n if (!(this instanceof Duplex)) return new Duplex(options);\n Readable.call(this, options);\n Writable.call(this, options);\n this.allowHalfOpen = true;\n\n if (options) {\n if (options.readable === false) this.readable = false;\n if (options.writable === false) this.writable = false;\n\n if (options.allowHalfOpen === false) {\n this.allowHalfOpen = false;\n this.once('end', onend);\n }\n }\n}\n\nObject.defineProperty(Duplex.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\nObject.defineProperty(Duplex.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n}); // the no-half-open enforcer\n\nfunction onend() {\n // If the writable side ended, then we're ok.\n if (this._writableState.ended) return; // no more data can be written.\n // But allow more writes to happen in this tick.\n\n process.nextTick(onEndNT, this);\n}\n\nfunction onEndNT(self) {\n self.end();\n}\n\nObject.defineProperty(Duplex.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined || this._writableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed && this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (this._readableState === undefined || this._writableState === undefined) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n this._writableState.destroyed = value;\n }\n});","(function (root, factory) {\n if (typeof define === 'function' && define.amd)\n define(['exports', 'kotlin'], factory);\n else if (typeof exports === 'object')\n factory(module.exports, require('kotlin'));\n else {\n if (typeof kotlin === 'undefined') {\n throw new Error(\"Error loading module 'kotlin-wrappers-kotlin-extensions-jsLegacy'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'kotlin-wrappers-kotlin-extensions-jsLegacy'.\");\n }root['kotlin-wrappers-kotlin-extensions-jsLegacy'] = factory(typeof this['kotlin-wrappers-kotlin-extensions-jsLegacy'] === 'undefined' ? {} : this['kotlin-wrappers-kotlin-extensions-jsLegacy'], kotlin);\n }\n}(this, function (_, Kotlin) {\n 'use strict';\n var getCallableRef = Kotlin.getCallableRef;\n var defineInlineFunction = Kotlin.defineInlineFunction;\n var wrapFunction = Kotlin.wrapFunction;\n function clone(obj) {\n return Object.assign({}, obj);\n }\n function getOwnPropertyNames($receiver) {\n return Object.getOwnPropertyNames($receiver);\n }\n function invoke_3($receiver, strings, values) {\n var tmp$;\n return (tmp$ = $receiver).call.apply(tmp$, [null, strings].concat(values));\n }\n function invoke_4($receiver, string, values) {\n return invoke_3($receiver, [string], values.slice());\n }\n function invoke_5($receiver, values) {\n return invoke_3($receiver, [], values.slice());\n }\n var package$kotlinext = _.kotlinext || (_.kotlinext = {});\n var package$js = package$kotlinext.js || (package$kotlinext.js = {});\n package$js.clone_issdgt$ = clone;\n package$js.getOwnPropertyNames_s8jyvk$ = getOwnPropertyNames;\n package$js.invoke_z5wujd$ = invoke_3;\n package$js.invoke_dgimx$ = invoke_4;\n package$js.invoke_9p99ed$ = invoke_5;\n return _;\n}));\n\n//# sourceMappingURL=kotlin-wrappers-kotlin-extensions-jsLegacy.js.map\n","package com.arkivanov.mvikotlin.core.store\n\nimport com.arkivanov.mvikotlin.utils.internal.atomic\nimport com.arkivanov.mvikotlin.utils.internal.initialize\nimport com.arkivanov.mvikotlin.utils.internal.requireValue\n\n/**\n * Simple implementation of the [Bootstrapper].\n * Accepts an array of the `Actions` and dispatches them one by one.\n *\n * @param actions an array of the `Actions` to be dispatched\n */\nclass SimpleBootstrapper(\n private vararg val actions: Action\n) : Bootstrapper {\n\n private val actionConsumer = atomic<(Action) -> Unit>()\n\n override fun init(actionConsumer: (Action) -> Unit) {\n this.actionConsumer.initialize(actionConsumer)\n }\n\n override fun dispose() {\n // no-op\n }\n\n override fun invoke() {\n actions.forEach(actionConsumer.requireValue()::invoke)\n }\n}\n","package com.arkivanov.mvikotlin.core.store\n\nenum class StoreEventType {\n\n INTENT, ACTION, RESULT, STATE, LABEL;\n\n val title: String = name.toLowerCase().capitalize()\n\n companion object {\n val VALUES: Set = values().toSet()\n }\n}\n","package com.arkivanov.mvikotlin.core.store\n\nimport com.arkivanov.mvikotlin.core.annotations.MainThread\nimport kotlin.js.JsName\n\n/**\n * Creates instances of [Store]s using the provided components.\n * You can create different [Store] wrappers and combine them depending on circumstances.\n */\ninterface StoreFactory {\n\n @JsName(\"create\")\n @MainThread\n fun create(\n name: String? = null,\n initialState: State,\n bootstrapper: Bootstrapper? = null,\n executorFactory: () -> Executor,\n @Suppress(\"UNCHECKED_CAST\")\n reducer: Reducer = bypassReducer as Reducer\n ): Store\n\n private companion object {\n private val bypassReducer: Reducer =\n object : Reducer {\n override fun Any.reduce(result: Any): Any = this\n }\n }\n}\n","package com.arkivanov.mvikotlin.core.utils\n\nimport com.arkivanov.mvikotlin.core.annotations.MainThread\n\nvar isAssertOnMainThreadEnabled: Boolean\n get() = com.arkivanov.mvikotlin.utils.internal.isAssertOnMainThreadEnabled\n set(value) {\n com.arkivanov.mvikotlin.utils.internal.isAssertOnMainThreadEnabled = value\n }\n\n@MainThread\nfun assertOnMainThread() {\n com.arkivanov.mvikotlin.utils.internal.assertOnMainThread()\n}\n","package com.arkivanov.mvikotlin.utils.internal\n\nimport kotlin.reflect.KProperty\n\nfun AtomicRef.initialize(value: T) {\n if (!compareAndSet(null, value)) {\n throw IllegalStateException(\"Value is already initialized: $this\")\n }\n}\n\nfun AtomicRef.requireValue(): T = requireNotNull(value) { \"Value was not initialized\" }\n\noperator fun AtomicBoolean.getValue(thisRef: Any?, property: KProperty<*>): Boolean = value\n\noperator fun AtomicBoolean.setValue(thisRef: Any?, property: KProperty<*>, value: Boolean) {\n this.value = value\n}\n\noperator fun AtomicInt.getValue(thisRef: Any?, property: KProperty<*>): Int = value\n\noperator fun AtomicInt.setValue(thisRef: Any?, property: KProperty<*>, value: Int) {\n this.value = value\n}\n\noperator fun AtomicRef.getValue(thisRef: Any?, property: KProperty<*>): T = value\n\noperator fun AtomicRef.setValue(thisRef: Any?, property: KProperty<*>, value: T) {\n this.value = value\n}\n\nfun AtomicRef.getAndUpdate(block: (T) -> T): T {\n var oldValue: T\n do {\n oldValue = value\n } while (!compareAndSet(oldValue, block(oldValue)))\n\n return oldValue\n}\n","package com.arkivanov.mvikotlin.utils.internal\n\ninternal const val LOG_TAG = \"MVIKotlin\"\n\nexpect fun logV(text: String)\n\nexpect fun logE(text: String)\n\ninternal fun String.withLogTag(): String = \"[$LOG_TAG]: $this\"\n","package com.arkivanov.mvikotlin.utils.internal\n\nvar isAssertOnMainThreadEnabled: Boolean by atomic(true)\n\nprivate val mainThreadIdRef = atomic(null)\n\nfun assertOnMainThread() {\n if (isAssertOnMainThreadEnabled) {\n require(isMainThread()) {\n \"Not on Main thread, current thread is: ${getCurrentThreadDescription()}\"\n }\n }\n}\n\ninternal expect fun getMainThreadId(): MainThreadId?\n\ninternal expect fun isMainThread(mainThreadId: MainThreadId): Boolean\n\ninternal expect fun getCurrentThreadDescription(): String\n\nprivate fun isMainThread(): Boolean {\n val mainThreadId =\n mainThreadIdRef.initAndGet {\n val id: MainThreadId? = getMainThreadId()\n if (id == null) {\n logE(\"Main thread id is undefined, main thread assert is disabled\")\n }\n MainThreadIdHolder(id)\n }\n\n return mainThreadId.id?.let(::isMainThread) ?: true\n}\n\nprivate inline fun AtomicRef.initAndGet(init: () -> T): T {\n while (true) {\n var v: T? = value\n if (v != null) {\n return v\n }\n\n v = init()\n if (compareAndSet(null, v)) {\n return v\n }\n }\n}\n\ninternal expect class MainThreadId\n\nprivate class MainThreadIdHolder(val id: MainThreadId?)\n","package com.arkivanov.mvikotlin.utils.internal\n\nactual fun atomic(value: T): AtomicRef = AtomicRefImpl(value)\n\nprivate class AtomicRefImpl(\n override var value: T\n) : AtomicRef {\n override fun compareAndSet(expected: T, new: T): Boolean =\n if (this.value === expected) {\n this.value = new\n true\n } else {\n false\n }\n}\n\nactual fun atomic(value: Boolean): AtomicBoolean = AtomicBooleanImpl(value)\n\nprivate class AtomicBooleanImpl(\n override var value: Boolean\n) : AtomicBoolean\n\nactual fun atomic(value: Int): AtomicInt = AtomicIntImpl(value)\n\nprivate class AtomicIntImpl(\n override var value: Int\n) : AtomicInt\n","package com.arkivanov.mvikotlin.utils.internal\n\nactual fun logV(text: String) {\n console.log(text.withLogTag())\n}\n\nactual fun logE(text: String) {\n console.error(text.withLogTag())\n}\n","package com.arkivanov.mvikotlin.utils.internal\n\ninternal actual fun getMainThreadId(): MainThreadId? = MainThreadId()\n\ninternal actual fun isMainThread(mainThreadId: MainThreadId): Boolean = true\n\ninternal actual fun getCurrentThreadDescription(): String = \"Main thread\"\n\ninternal actual class MainThreadId\n","@file:JvmName(\"AtomicJvm\")\n\npackage com.arkivanov.mvikotlin.utils.internal\n\nimport kotlin.jvm.JvmName\n\ninterface AtomicRef {\n\n var value: T\n\n fun compareAndSet(expected: T, new: T): Boolean\n}\n\ninterface AtomicBoolean {\n\n var value: Boolean\n}\n\ninterface AtomicInt {\n\n var value: Int\n}\n\nexpect fun atomic(value: T): AtomicRef\n\nexpect fun atomic(value: Boolean): AtomicBoolean\n\nexpect fun atomic(value: Int): AtomicInt\n\nfun atomic(): AtomicRef = atomic(null)\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.bits.*\nimport io.ktor.utils.io.core.*\nimport kotlinx.coroutines.*\n\nprivate const val CHUNK_BUFFER_SIZE = 4096L\n\n/**\n * Split source [ByteReadChannel] into 2 new one.\n * Cancel of one channel in split(input or both outputs) cancels other channels.\n */\npublic fun ByteReadChannel.split(coroutineScope: CoroutineScope): Pair {\n val first = ByteChannel(autoFlush = true)\n val second = ByteChannel(autoFlush = true)\n\n coroutineScope.launch {\n try {\n while (!isClosedForRead) {\n this@split.readRemaining(CHUNK_BUFFER_SIZE).use { chunk ->\n listOf(\n async { first.writePacket(chunk.copy()) },\n async { second.writePacket(chunk.copy()) }\n ).awaitAll()\n }\n }\n\n if (this is ByteChannel) {\n closedCause?.let { throw it }\n }\n } catch (cause: Throwable) {\n this@split.cancel(cause)\n first.cancel(cause)\n second.cancel(cause)\n } finally {\n first.close()\n second.close()\n }\n }.invokeOnCompletion {\n it ?: return@invokeOnCompletion\n first.cancel(it)\n second.cancel(it)\n }\n\n return first to second\n}\n\n/**\n * Copy source channel to both output channels chunk by chunk.\n */\n@InternalAPI\npublic fun ByteReadChannel.copyToBoth(first: ByteWriteChannel, second: ByteWriteChannel) {\n GlobalScope.launch(Dispatchers.Unconfined) {\n try {\n while (!isClosedForRead && (!first.isClosedForWrite || !second.isClosedForWrite)) {\n readRemaining(CHUNK_BUFFER_SIZE).use {\n try {\n first.writePacket(it.copy())\n second.writePacket(it.copy())\n } catch (cause: Throwable) {\n this@copyToBoth.cancel(cause)\n first.close(cause)\n second.close(cause)\n }\n }\n }\n\n if (this is ByteChannel) {\n closedCause?.let { throw it }\n }\n } catch (cause: Throwable) {\n first.close(cause)\n second.close(cause)\n } finally {\n first.close()\n second.close()\n }\n }.invokeOnCompletion {\n it ?: return@invokeOnCompletion\n first.close(it)\n second.close(it)\n }\n}\n\n/**\n * Read channel to byte array.\n */\npublic suspend fun ByteReadChannel.toByteArray(): ByteArray = readRemaining().readBytes()\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\n\n/**\n * Print [Job] children tree.\n */\n@InternalAPI\npublic fun Job.printDebugTree(offset: Int = 0) {\n println(\" \".repeat(offset) + this)\n\n children.forEach {\n it.printDebugTree(offset + 2)\n }\n\n if (offset == 0) println()\n}\n\n@InternalAPI\n@Suppress(\"NOTHING_TO_INLINE\")\ninternal expect inline fun (suspend R.(A) -> Unit).startCoroutineUninterceptedOrReturn3(\n receiver: R,\n arg: A,\n continuation: Continuation\n): Any?\n\n/**\n * Supervisor with empty coroutine exception handler ignoring all exceptions.\n */\n@InternalAPI\npublic fun SilentSupervisor(parent: Job? = null): CoroutineContext =\n SupervisorJob(parent) + CoroutineExceptionHandler { _, _ -> }\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\n/**\n * Length of this [LongRange]\n */\n@Deprecated(\"Not supported anymore.\", level = DeprecationLevel.ERROR)\npublic val LongRange.length: Long\n get() = (endInclusive - start + 1).coerceAtLeast(0L)\n\n/**\n * Returns `true` if [other] range is fully contained inside [this] range\n */\n@InternalAPI\npublic operator fun LongRange.contains(other: LongRange): Boolean =\n other.start >= start && other.endInclusive <= endInclusive\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.*\nimport kotlin.experimental.*\nimport kotlin.native.concurrent.*\n\nprivate const val BASE64_ALPHABET = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"\nprivate const val BASE64_MASK: Byte = 0x3f\nprivate const val BASE64_PAD = '='\n\n@SharedImmutable\nprivate val BASE64_INVERSE_ALPHABET = IntArray(256) {\n BASE64_ALPHABET.indexOf(it.toChar())\n}\n\n/**\n * Encode [String] in base64 format and UTF-8 character encoding.\n */\n@InternalAPI\npublic fun String.encodeBase64(): String = buildPacket {\n writeText(this@encodeBase64)\n}.encodeBase64()\n\n/**\n * Encode [ByteArray] in base64 format\n */\n@InternalAPI\npublic fun ByteArray.encodeBase64(): String = buildPacket {\n writeFully(this@encodeBase64)\n}.encodeBase64()\n\n/**\n * Encode [ByteReadPacket] in base64 format\n */\n@InternalAPI\npublic fun ByteReadPacket.encodeBase64(): String = buildString {\n val data = ByteArray(3)\n while (remaining > 0) {\n val read = readAvailable(data)\n data.clearFrom(read)\n\n val padSize = (data.size - read) * 8 / 6\n val chunk = ((data[0].toInt() and 0xFF) shl 16) or\n ((data[1].toInt() and 0xFF) shl 8) or\n (data[2].toInt() and 0xFF)\n\n for (index in data.size downTo padSize) {\n val char = (chunk shr (6 * index)) and BASE64_MASK.toInt()\n append(char.toBase64())\n }\n\n repeat(padSize) { append(BASE64_PAD) }\n }\n}\n\n/**\n * Decode [String] from base64 format encoded in UTF-8.\n */\n@InternalAPI\npublic fun String.decodeBase64String(): String = String(decodeBase64Bytes(), charset = Charsets.UTF_8)\n\n/**\n * Decode [String] from base64 format\n */\n@InternalAPI\npublic fun String.decodeBase64Bytes(): ByteArray = buildPacket {\n writeText(dropLastWhile { it == BASE64_PAD })\n}.decodeBase64Bytes().readBytes()\n\n/**\n * Decode [ByteReadPacket] from base64 format\n */\n@InternalAPI\npublic fun ByteReadPacket.decodeBase64Bytes(): Input = buildPacket {\n val data = ByteArray(4)\n\n while (remaining > 0) {\n val read = readAvailable(data)\n\n val chunk = data.foldIndexed(0) { index, result, current ->\n result or (current.fromBase64().toInt() shl ((3 - index) * 6))\n }\n\n for (index in data.size - 2 downTo (data.size - read)) {\n val origin = (chunk shr (8 * index)) and 0xff\n writeByte(origin.toByte())\n }\n }\n}\n\n@Suppress(\"unused\", \"KDocMissingDocumentation\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\npublic fun String.decodeBase64(): String = decodeBase64String()\n\n@Suppress(\"unused\", \"KDocMissingDocumentation\")\n@Deprecated(\"Binary compatibility.\", level = DeprecationLevel.HIDDEN)\npublic fun ByteReadPacket.decodeBase64(): String = decodeBase64Bytes().readText()\n\ninternal fun ByteArray.clearFrom(from: Int) {\n (from until size).forEach { this[it] = 0 }\n}\n\ninternal fun Int.toBase64(): Char = BASE64_ALPHABET[this]\ninternal fun Byte.fromBase64(): Byte = BASE64_INVERSE_ALPHABET[toInt() and 0xff].toByte() and BASE64_MASK\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\n/**\n * A map with case insensitive [String] keys\n */\n@InternalAPI\npublic class CaseInsensitiveMap : MutableMap {\n private val delegate = mutableMapOf()\n\n override val size: Int get() = delegate.size\n\n override fun containsKey(key: String): Boolean = delegate.containsKey(CaseInsensitiveString(key))\n\n override fun containsValue(value: Value): Boolean = delegate.containsValue(value)\n\n override fun get(key: String): Value? = delegate[key.caseInsensitive()]\n\n override fun isEmpty(): Boolean = delegate.isEmpty()\n\n override fun clear() {\n delegate.clear()\n }\n\n override fun put(key: String, value: Value): Value? = delegate.put(key.caseInsensitive(), value)\n\n override fun putAll(from: Map) {\n from.forEach { (key, value) -> put(key, value) }\n }\n\n override fun remove(key: String): Value? = delegate.remove(key.caseInsensitive())\n\n override val keys: MutableSet\n get() = DelegatingMutableSet(\n delegate.keys,\n { content },\n { caseInsensitive() }\n )\n\n override val entries: MutableSet>\n get() = DelegatingMutableSet(\n delegate.entries,\n { Entry(key.content, value) },\n { Entry(key.caseInsensitive(), value) }\n )\n\n override val values: MutableCollection get() = delegate.values\n\n override fun equals(other: Any?): Boolean {\n if (other == null || other !is CaseInsensitiveMap<*>) return false\n return other.delegate == delegate\n }\n\n override fun hashCode(): Int = delegate.hashCode()\n}\n\nprivate class Entry(\n override val key: Key,\n override var value: Value\n) : MutableMap.MutableEntry {\n\n override fun setValue(newValue: Value): Value {\n value = newValue\n return value\n }\n\n override fun hashCode(): Int = 17 * 31 + key!!.hashCode() + value!!.hashCode()\n\n override fun equals(other: Any?): Boolean {\n if (other == null || other !is Map.Entry<*, *>) return false\n return other.key == key && other.value == value\n }\n\n override fun toString(): String = \"$key=$value\"\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\npackage io.ktor.util\n\n@InternalAPI\npublic class CaseInsensitiveSet() : MutableSet {\n private val backingMap = CaseInsensitiveMap()\n\n public constructor(initial: Iterable) : this() {\n addAll(initial)\n }\n\n override fun add(element: String): Boolean {\n if (element in backingMap) {\n return false\n }\n backingMap[element] = true\n return true\n }\n\n override val size: Int\n get() = backingMap.size\n\n override fun remove(element: String): Boolean {\n return backingMap.remove(element) == true\n }\n\n override fun addAll(elements: Collection): Boolean {\n var added = false\n for (element in elements) {\n if (add(element)) {\n added = true\n }\n }\n return added\n }\n\n override fun clear() {\n backingMap.clear()\n }\n\n override fun removeAll(elements: Collection): Boolean {\n return backingMap.keys.removeAll(elements)\n }\n\n override fun retainAll(elements: Collection): Boolean {\n return backingMap.keys.retainAll(elements)\n }\n\n override fun contains(element: String): Boolean {\n return backingMap.contains(element)\n }\n\n override fun containsAll(elements: Collection): Boolean {\n return backingMap.keys.containsAll(elements)\n }\n\n override fun isEmpty(): Boolean {\n return backingMap.isEmpty()\n }\n\n override fun iterator(): MutableIterator = backingMap.keys.iterator()\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\n/**\n * Check if [Char] is in lower case\n */\n@InternalAPI\npublic fun Char.isLowerCase(): Boolean = toLowerCase() == this\n\n/**\n * Convert [String] to [CharArray]\n */\n@InternalAPI\npublic fun String.toCharArray(): CharArray = CharArray(length) { get(it) }\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\ninternal open class DelegatingMutableSet(\n private val delegate: MutableSet,\n private val convertTo: From.() -> To,\n private val convert: To.() -> From\n) : MutableSet {\n\n public open fun Collection.convert(): Collection = map { it.convert() }\n public open fun Collection.convertTo(): Collection = map { it.convertTo() }\n\n override val size: Int = delegate.size\n\n override fun add(element: To): Boolean = delegate.add(element.convert())\n\n override fun addAll(elements: Collection): Boolean = delegate.addAll(elements.convert())\n\n override fun clear() {\n delegate.clear()\n }\n\n override fun remove(element: To): Boolean = delegate.remove(element.convert())\n\n override fun removeAll(elements: Collection): Boolean = delegate.removeAll(elements.convert())\n\n override fun retainAll(elements: Collection): Boolean = delegate.retainAll(elements.convert())\n\n override fun contains(element: To): Boolean = delegate.contains(element.convert())\n\n override fun containsAll(elements: Collection): Boolean = delegate.containsAll(elements.convert())\n\n override fun isEmpty(): Boolean = delegate.isEmpty()\n\n override fun iterator(): MutableIterator = object : MutableIterator {\n val delegateIterator = delegate.iterator()\n\n override fun hasNext(): Boolean = delegateIterator.hasNext()\n\n override fun next(): To = delegateIterator.next().convertTo()\n\n override fun remove() = delegateIterator.remove()\n }\n\n override fun hashCode(): Int = delegate.hashCode()\n\n override fun equals(other: Any?): Boolean {\n if (other == null || other !is Set<*>) return false\n\n val elements = delegate.convertTo()\n return other.containsAll(elements) && elements.containsAll(other)\n }\n\n override fun toString(): String = delegate.convertTo().toString()\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\n/**\n * API marked with this annotation is ktor internal and it is not intended to be used outside.\n * It could be modified or removed without any notice. Using it outside of ktor could cause undefined behaviour and/or\n * any strange effects.\n *\n * We are strongly recommend to not use such API.\n */\n@Suppress(\"DEPRECATION\")\n@RequiresOptIn(\n level = RequiresOptIn.Level.ERROR,\n message = \"This API is internal in ktor and should not be used. It could be removed or changed without notice.\"\n)\n@Experimental(level = Experimental.Level.ERROR)\n@Target(\n AnnotationTarget.CLASS,\n AnnotationTarget.TYPEALIAS,\n AnnotationTarget.FUNCTION,\n AnnotationTarget.PROPERTY,\n AnnotationTarget.FIELD,\n AnnotationTarget.CONSTRUCTOR,\n AnnotationTarget.PROPERTY_SETTER\n)\npublic annotation class InternalAPI\n\n/**\n * API marked with this annotation is experimental and is not guaranteed to be stable.\n */\n@Suppress(\"DEPRECATION\")\n@RequiresOptIn(\n level = RequiresOptIn.Level.WARNING,\n message = \"This API is experimental. \" +\n \"It could be removed or changed in future releases, or its behaviour may be different.\"\n)\n@Experimental(level = Experimental.Level.WARNING)\n@Target(\n AnnotationTarget.CLASS,\n AnnotationTarget.TYPEALIAS,\n AnnotationTarget.FUNCTION,\n AnnotationTarget.PROPERTY,\n AnnotationTarget.FIELD,\n AnnotationTarget.CONSTRUCTOR\n)\npublic annotation class KtorExperimentalAPI\n\n/**\n * API marked with this annotation is intended to become public in the future [version].\n * Usually it means that the API can't be public at the moment of development due to\n * compatibility guarantees restrictions.\n *\n * Marking a public declaration with this annotation makes no sense\n * except for the case when it is also marked with [InternalAPI].\n *\n * Please note that the specified [version] and the fact of making something a candidate is not a guarantee,\n * so the target version could be changed without any notice or even the promotion could be cancelled at all.\n *\n * @property version in which the API is planned to be promoted\n */\n@InternalAPI\n@Retention(AnnotationRetention.SOURCE)\n@Target(\n AnnotationTarget.CLASS,\n AnnotationTarget.ANNOTATION_CLASS,\n AnnotationTarget.CONSTRUCTOR,\n AnnotationTarget.FUNCTION,\n AnnotationTarget.PROPERTY,\n AnnotationTarget.PROPERTY_SETTER,\n AnnotationTarget.TYPEALIAS\n)\npublic annotation class PublicAPICandidate(val version: String)\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\n/**\n * Specifies a key for an attribute in [Attributes]\n * @param T is type of the value stored in the attribute\n * @param name is a name of the attribute for diagnostic purposes\n */\npublic class AttributeKey(public val name: String) {\n override fun toString(): String = if (name.isEmpty()) super.toString() else \"AttributeKey: $name\"\n}\n\n/**\n * Create attributes instance suitable for the particular platform\n */\npublic expect fun Attributes(concurrent: Boolean = false): Attributes\n\n/**\n * Map of attributes accessible by [AttributeKey] in a typed manner\n */\npublic interface Attributes {\n /**\n * Gets a value of the attribute for the specified [key], or throws an exception if an attribute doesn't exist\n */\n public operator fun get(key: AttributeKey): T =\n getOrNull(key) ?: throw IllegalStateException(\"No instance for key $key\")\n\n /**\n * Gets a value of the attribute for the specified [key], or return `null` if an attribute doesn't exist\n */\n public fun getOrNull(key: AttributeKey): T?\n\n /**\n * Checks if an attribute with the specified [key] exists\n */\n public operator fun contains(key: AttributeKey<*>): Boolean\n\n /**\n * Creates or changes an attribute with the specified [key] using [value]\n */\n public fun put(key: AttributeKey, value: T)\n\n /**\n * Removes an attribute with the specified [key]\n */\n public fun remove(key: AttributeKey)\n\n /**\n * Removes an attribute with the specified [key] and returns its current value, throws an exception if an attribute doesn't exist\n */\n public fun take(key: AttributeKey): T = get(key).also { remove(key) }\n\n /**\n * Removes an attribute with the specified [key] and returns its current value, returns `null` if an attribute doesn't exist\n */\n public fun takeOrNull(key: AttributeKey): T? = getOrNull(key).also { remove(key) }\n\n /**\n * Gets a value of the attribute for the specified [key], or calls supplied [block] to compute its value\n */\n public fun computeIfAbsent(key: AttributeKey, block: () -> T): T\n\n /**\n * Returns [List] of all [AttributeKey] instances in this map\n */\n public val allKeys: List>\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\n/**\n * Read [Short] in network order(BE) with specified [offset] from [ByteArray].\n */\n@InternalAPI\npublic fun ByteArray.readShort(offset: Int): Short {\n val result = ((this[offset].toInt() and 0xFF) shl 8) or (this[offset + 1].toInt() and 0xFF)\n return result.toShort()\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\n@file:kotlin.jvm.JvmMultifileClass\n@file:kotlin.jvm.JvmName(\"CryptoKt\")\n\npackage io.ktor.util\n\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.*\nimport kotlin.native.concurrent.*\n\n@SharedImmutable\nprivate val digits = \"0123456789abcdef\".toCharArray()\n\n/**\n * Encode [bytes] as a HEX string with no spaces, newlines and `0x` prefixes.\n */\npublic fun hex(bytes: ByteArray): String {\n val result = CharArray(bytes.size * 2)\n var resultIndex = 0\n val digits = digits\n\n for (index in 0 until bytes.size) {\n val b = bytes[index].toInt() and 0xff\n result[resultIndex++] = digits[b shr 4]\n result[resultIndex++] = digits[b and 0x0f]\n }\n\n return result.concatToString()\n}\n\n/**\n * Decode bytes from HEX string. It should be no spaces and `0x` prefixes.\n */\npublic fun hex(s: String): ByteArray {\n val result = ByteArray(s.length / 2)\n for (idx in 0 until result.size) {\n val srcIdx = idx * 2\n val high = s[srcIdx].toString().toInt(16) shl 4\n val low = s[srcIdx + 1].toString().toInt(16)\n result[idx] = (high or low).toByte()\n }\n\n return result\n}\n\n/**\n * Generates a nonce string. Could block if the system's entropy source is empty\n */\n@InternalAPI\npublic expect fun generateNonce(): String\n\n/**\n * Generates a nonce bytes of [size]. Could block if the system's entropy source is empty\n */\n@InternalAPI\npublic fun generateNonce(size: Int): ByteArray = buildPacket {\n while (this.size < size) {\n writeText(generateNonce())\n }\n}.readBytes(size)\n\n/**\n * Compute SHA-1 hash for the specified [bytes]\n */\npublic expect fun sha1(bytes: ByteArray): ByteArray\n\n/**\n * Create [Digest] from specified hash [name].\n */\n@Suppress(\"FunctionName\")\n@InternalAPI\npublic expect fun Digest(name: String): Digest\n\n/**\n * Stateful digest class specified to calculate digest.\n */\n@InternalAPI\npublic interface Digest {\n /**\n * Add [bytes] to digest value.\n */\n public operator fun plusAssign(bytes: ByteArray)\n\n /**\n * Reset [Digest] state.\n */\n public fun reset()\n\n /**\n * Calculate digest bytes.\n */\n public suspend fun build(): ByteArray\n}\n\n/**\n * Calculate digest from current state and specified [bytes].\n */\n@InternalAPI\npublic suspend fun Digest.build(bytes: ByteArray): ByteArray {\n this += bytes\n return build()\n}\n\n/**\n * Calculate digest from current state and specified [string].\n */\n@InternalAPI\npublic suspend fun Digest.build(string: String, charset: Charset = Charsets.UTF_8): ByteArray {\n this += string.toByteArray(charset)\n return build()\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\nimport io.ktor.utils.io.*\nimport kotlinx.coroutines.*\n\n/**\n * Empty [Encoder] that doesn't do any changes.\n */\npublic object Identity : Encoder {\n override fun CoroutineScope.encode(source: ByteReadChannel): ByteReadChannel = source\n\n override fun CoroutineScope.decode(source: ByteReadChannel): ByteReadChannel = source\n}\n\n/**\n * Content encoder.\n */\npublic interface Encoder {\n /**\n * Launch coroutine to encode [source] bytes.\n */\n public fun CoroutineScope.encode(source: ByteReadChannel): ByteReadChannel\n\n /**\n * Launch coroutine to decode [source] bytes.\n */\n public fun CoroutineScope.decode(source: ByteReadChannel): ByteReadChannel\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\n/**\n * Represents a nonce manager. It's responsibility is to produce nonce values\n * and verify nonce values from untrusted sources that they are provided by this manager.\n * This is usually required in web environment to mitigate CSRF attacks.\n * Depending on it's underlying implementation it could be stateful or stateless.\n * Note that there is usually some timeout for nonce values to reduce memory usage and to avoid replay attacks.\n * Nonce length is unspecified.\n */\npublic interface NonceManager {\n /**\n * Generate new nonce instance\n */\n public suspend fun newNonce(): String\n\n /**\n * Verify [nonce] value\n * @return `true` if [nonce] is valid\n */\n public suspend fun verifyNonce(nonce: String): Boolean\n}\n\n/**\n * This implementation does only generate nonce values but doesn't validate them. This is recommended for testing only.\n */\npublic object GenerateOnlyNonceManager : NonceManager {\n override suspend fun newNonce(): String {\n return generateNonce()\n }\n\n override suspend fun verifyNonce(nonce: String): Boolean {\n return true\n }\n}\n\n/**\n * Stub implementation that always fails.\n * Will be removed so no public signatures should rely on it\n */\n@Deprecated(\"This should be removed with OAuth2StateProvider\", level = DeprecationLevel.ERROR)\n@InternalAPI\npublic object AlwaysFailNonceManager : NonceManager {\n override suspend fun newNonce(): String {\n throw UnsupportedOperationException(\"This manager should never be used\")\n }\n\n override suspend fun verifyNonce(nonce: String): Boolean {\n throw UnsupportedOperationException(\"This manager should never be used\")\n }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\n/**\n * Provides data structure for associating a [String] with a [List] of Strings\n */\npublic interface StringValues {\n public companion object {\n /**\n * Empty [StringValues] instance\n */\n public val Empty: StringValues = StringValuesImpl()\n\n /**\n * Builds a [StringValues] instance with the given [builder] function\n * @param caseInsensitiveName specifies if map should have case-sensitive or case-insensitive names\n * @param builder specifies a function to build a map\n */\n public inline fun build(\n caseInsensitiveName: Boolean = false,\n builder: StringValuesBuilder.() -> Unit\n ): StringValues = StringValuesBuilder(caseInsensitiveName).apply(builder).build()\n }\n\n /**\n * Specifies if map has case-sensitive or case-insensitive names\n */\n public val caseInsensitiveName: Boolean\n\n /**\n * Gets first value from the list of values associated with a [name], or null if the name is not present\n */\n public operator fun get(name: String): String? = getAll(name)?.firstOrNull()\n\n /**\n * Gets all values associated with the [name], or null if the name is not present\n */\n public fun getAll(name: String): List?\n\n /**\n * Gets all names from the map\n */\n public fun names(): Set\n\n /**\n * Gets all entries from the map\n */\n public fun entries(): Set>>\n\n /**\n * Checks if the given [name] exists in the map\n */\n public operator fun contains(name: String): Boolean = getAll(name) != null\n\n /**\n * Checks if the given [name] and [value] pair exists in the map\n */\n public fun contains(name: String, value: String): Boolean = getAll(name)?.contains(value) ?: false\n\n /**\n * Iterates over all entries in this map and calls [body] for each pair\n *\n * Can be optimized in implementations\n */\n public fun forEach(body: (String, List) -> Unit): Unit = entries().forEach { (k, v) -> body(k, v) }\n\n /**\n * Checks if this map is empty\n */\n public fun isEmpty(): Boolean\n}\n\n@InternalAPI\n@Suppress(\"KDocMissingDocumentation\")\npublic open class StringValuesSingleImpl(\n override val caseInsensitiveName: Boolean,\n public val name: String,\n public val values: List\n) : StringValues {\n\n override fun getAll(name: String): List? = if (this.name.equals(name, caseInsensitiveName)) values else null\n\n override fun entries(): Set>> = setOf(\n object : Map.Entry> {\n override val key: String = name\n override val value: List = values\n override fun toString() = \"$key=$value\"\n }\n )\n\n override fun isEmpty(): Boolean = false\n\n override fun names(): Set = setOf(name)\n\n override fun toString(): String = \"StringValues(case=${!caseInsensitiveName}) ${entries()}\"\n\n override fun hashCode(): Int = entriesHashCode(entries(), 31 * caseInsensitiveName.hashCode())\n\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (other !is StringValues) return false\n if (caseInsensitiveName != other.caseInsensitiveName) return false\n return entriesEquals(entries(), other.entries())\n }\n\n override fun forEach(body: (String, List) -> Unit): Unit = body(name, values)\n\n override fun get(name: String): String? =\n if (name.equals(this.name, caseInsensitiveName)) values.firstOrNull() else null\n\n override fun contains(name: String): Boolean = name.equals(this.name, caseInsensitiveName)\n\n override fun contains(name: String, value: String): Boolean =\n name.equals(this.name, caseInsensitiveName) && values.contains(value)\n}\n\n@InternalAPI\n@Suppress(\"KDocMissingDocumentation\")\npublic open class StringValuesImpl(\n override val caseInsensitiveName: Boolean = false,\n values: Map> = emptyMap()\n) : StringValues {\n\n protected val values: Map> by lazy {\n if (caseInsensitiveName) caseInsensitiveMap>().apply { putAll(values) } else values.toMap()\n }\n\n override operator fun get(name: String): String? = listForKey(name)?.firstOrNull()\n\n override fun getAll(name: String): List? = listForKey(name)\n\n override operator fun contains(name: String): Boolean = listForKey(name) != null\n\n override fun contains(name: String, value: String): Boolean = listForKey(name)?.contains(value) ?: false\n\n override fun names(): Set = values.keys.unmodifiable()\n\n override fun isEmpty(): Boolean = values.isEmpty()\n\n override fun entries(): Set>> = values.entries.unmodifiable()\n\n override fun forEach(body: (String, List) -> Unit) {\n for ((key, value) in values) body(key, value)\n }\n\n private fun listForKey(name: String): List? = values[name]\n\n override fun toString(): String = \"StringValues(case=${!caseInsensitiveName}) ${entries()}\"\n\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (other !is StringValues) return false\n if (caseInsensitiveName != other.caseInsensitiveName) return false\n return entriesEquals(entries(), other.entries())\n }\n\n override fun hashCode(): Int = entriesHashCode(entries(), 31 * caseInsensitiveName.hashCode())\n}\n\n@InternalAPI\n@Suppress(\"KDocMissingDocumentation\")\npublic open class StringValuesBuilder(public val caseInsensitiveName: Boolean = false, size: Int = 8) {\n protected val values: MutableMap> =\n if (caseInsensitiveName) caseInsensitiveMap() else LinkedHashMap(size)\n\n protected var built: Boolean = false\n\n public fun getAll(name: String): List? = values[name]\n\n public operator fun contains(name: String): Boolean = name in values\n\n public fun contains(name: String, value: String): Boolean = values[name]?.contains(value) ?: false\n\n public fun names(): Set = values.keys\n\n public fun isEmpty(): Boolean = values.isEmpty()\n\n public fun entries(): Set>> = values.entries.unmodifiable()\n\n public operator fun set(name: String, value: String) {\n validateValue(value)\n val list = ensureListForKey(name, 1)\n list.clear()\n list.add(value)\n }\n\n public operator fun get(name: String): String? = getAll(name)?.firstOrNull()\n\n public fun append(name: String, value: String) {\n validateValue(value)\n ensureListForKey(name, 1).add(value)\n }\n\n public fun appendAll(stringValues: StringValues) {\n stringValues.forEach { name, values ->\n appendAll(name, values)\n }\n }\n\n public fun appendMissing(stringValues: StringValues) {\n stringValues.forEach { name, values ->\n appendMissing(name, values)\n }\n }\n\n public fun appendAll(name: String, values: Iterable) {\n ensureListForKey(name, (values as? Collection)?.size ?: 2).let { list ->\n values.forEach { value ->\n validateValue(value)\n list.add(value)\n }\n }\n }\n\n public fun appendMissing(name: String, values: Iterable) {\n val existing = this.values[name]?.toSet() ?: emptySet()\n\n appendAll(name, values.filter { it !in existing })\n }\n\n public fun remove(name: String) {\n values.remove(name)\n }\n\n public fun removeKeysWithNoEntries() {\n for ((k, _) in values.filter { it.value.isEmpty() }) {\n remove(k)\n }\n }\n\n public fun remove(name: String, value: String): Boolean = values[name]?.remove(value) ?: false\n\n public fun clear() {\n values.clear()\n }\n\n public open fun build(): StringValues {\n require(!built) { \"ValueMapBuilder can only build a single ValueMap\" }\n built = true\n return StringValuesImpl(caseInsensitiveName, values)\n }\n\n protected open fun validateName(name: String) {\n }\n\n protected open fun validateValue(value: String) {\n }\n\n private fun ensureListForKey(name: String, size: Int): MutableList {\n if (built) {\n throw IllegalStateException(\"Cannot modify a builder when final structure has already been built\")\n }\n\n return values[name] ?: ArrayList(size).also { validateName(name); values[name] = it }\n }\n}\n\n/**\n * Build an instance of [StringValues] from a vararg list of pairs\n */\npublic fun valuesOf(vararg pairs: Pair>, caseInsensitiveKey: Boolean = false): StringValues {\n return StringValuesImpl(caseInsensitiveKey, pairs.asList().toMap())\n}\n\n/**\n * Build an instance of [StringValues] from a single pair\n */\npublic fun valuesOf(name: String, value: String, caseInsensitiveKey: Boolean = false): StringValues {\n return StringValuesSingleImpl(caseInsensitiveKey, name, listOf(value))\n}\n\n/**\n * Build an instance of [StringValues] with a single [name] and multiple [values]\n */\npublic fun valuesOf(name: String, values: List, caseInsensitiveKey: Boolean = false): StringValues {\n return StringValuesSingleImpl(caseInsensitiveKey, name, values)\n}\n\n/**\n * Build an empty [StringValues] instance.\n */\npublic fun valuesOf(): StringValues = StringValues.Empty\n\n/**\n * Build an instance of [StringValues] from the specified [map]\n */\npublic fun valuesOf(map: Map>, caseInsensitiveKey: Boolean = false): StringValues {\n val size = map.size\n if (size == 1) {\n val entry = map.entries.single()\n return StringValuesSingleImpl(caseInsensitiveKey, entry.key, entry.value.toList())\n }\n val values: MutableMap> =\n if (caseInsensitiveKey) caseInsensitiveMap() else LinkedHashMap(size)\n map.entries.forEach { values.put(it.key, it.value.toList()) }\n return StringValuesImpl(caseInsensitiveKey, values)\n}\n\n/**\n * Copy values to a new independent map\n */\npublic fun StringValues.toMap(): Map> =\n entries().associateByTo(LinkedHashMap(), { it.key }, { it.value.toList() })\n\n/**\n * Copy values to a list of pairs\n */\npublic fun StringValues.flattenEntries(): List> = entries().flatMap { e ->\n e.value.map { e.key to it }\n}\n\n/**\n * Invoke [block] function for every value pair\n */\npublic fun StringValues.flattenForEach(block: (String, String) -> Unit): Unit = forEach { name, items ->\n items.forEach { block(name, it) }\n}\n\n/**\n * Create a new instance of [StringValues] filtered by the specified [predicate]\n * @param keepEmpty when `true` will keep empty lists otherwise keys with no values will be discarded\n */\npublic fun StringValues.filter(keepEmpty: Boolean = false, predicate: (String, String) -> Boolean): StringValues {\n val entries = entries()\n val values: MutableMap> =\n if (caseInsensitiveName) caseInsensitiveMap() else LinkedHashMap(entries.size)\n\n entries.forEach { entry ->\n val list = entry.value.filterTo(ArrayList(entry.value.size)) { predicate(entry.key, it) }\n if (keepEmpty || list.isNotEmpty()) {\n values.put(entry.key, list)\n }\n }\n\n return StringValuesImpl(caseInsensitiveName, values)\n}\n\n/**\n * Append values from [source] filtering values by the specified [predicate]\n * @param keepEmpty when `true` will keep empty lists otherwise keys with no values will be discarded\n */\npublic fun StringValuesBuilder.appendFiltered(\n source: StringValues,\n keepEmpty: Boolean = false,\n predicate: (String, String) -> Boolean\n) {\n source.forEach { name, value ->\n val list = value.filterTo(ArrayList(value.size)) { predicate(name, it) }\n if (keepEmpty || list.isNotEmpty()) {\n appendAll(name, list)\n }\n }\n}\n\n/**\n * Append all values from the specified [builder]\n */\npublic fun StringValuesBuilder.appendAll(builder: StringValuesBuilder): StringValuesBuilder = apply {\n builder.entries().forEach { (name, values) ->\n appendAll(name, values)\n }\n}\n\nprivate fun entriesEquals(a: Set>>, b: Set>>): Boolean {\n return a == b\n}\n\nprivate fun entriesHashCode(entries: Set>>, seed: Int): Int {\n return seed * 31 + entries.hashCode()\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.cio\n\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.core.*\nimport kotlin.contracts.*\n\n/**\n * Convert [ByteReadChannel] to [ByteArray]\n */\npublic suspend fun ByteReadChannel.toByteArray(limit: Int = Int.MAX_VALUE): ByteArray =\n readRemaining(limit.toLong()).readBytes()\n\n/**\n * Executes [block] on [ByteWriteChannel] and close it down correctly whether an exception\n */\npublic inline fun ByteWriteChannel.use(block: ByteWriteChannel.() -> Unit) {\n contract {\n callsInPlace(block, InvocationKind.EXACTLY_ONCE)\n }\n\n try {\n block()\n } catch (cause: Throwable) {\n close(cause)\n throw cause\n } finally {\n close()\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\n@file:Suppress(\"KDocMissingDocumentation\")\n\npackage io.ktor.util\n\n@InternalAPI\npublic expect class Lock() {\n public fun lock()\n public fun unlock()\n\n public fun close()\n}\n\n@InternalAPI\npublic inline fun Lock.withLock(crossinline block: () -> R): R {\n try {\n lock()\n return block()\n } finally {\n unlock()\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.collections\n\nimport io.ktor.util.*\n\n@InternalAPI\npublic open class ConcurrentCollection(\n private val delegate: MutableCollection,\n private val lock: Lock\n) : MutableCollection {\n\n override val size: Int get() = lock.withLock {\n delegate.size\n }\n\n override fun contains(element: E): Boolean = lock.withLock {\n delegate.contains(element)\n }\n\n override fun containsAll(elements: Collection): Boolean = lock.withLock {\n delegate.containsAll(elements)\n }\n\n override fun isEmpty(): Boolean = lock.withLock {\n delegate.isEmpty()\n }\n\n override fun add(element: E): Boolean = lock.withLock {\n delegate.add(element)\n }\n\n override fun addAll(elements: Collection): Boolean = lock.withLock {\n delegate.addAll(elements)\n }\n\n override fun clear(): Unit = lock.withLock {\n delegate.clear()\n }\n\n override fun iterator(): MutableIterator = delegate.iterator()\n\n override fun remove(element: E): Boolean = lock.withLock {\n delegate.remove(element)\n }\n\n override fun removeAll(elements: Collection): Boolean = lock.withLock {\n delegate.removeAll(elements)\n }\n\n override fun retainAll(elements: Collection): Boolean = lock.withLock {\n delegate.retainAll(elements)\n }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.collections\n\nimport io.ktor.util.*\nimport io.ktor.util.collections.internal.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.concurrent.*\nimport kotlinx.atomicfu.locks.*\n\nprivate const val INITIAL_CAPACITY = 32\n\n@KtorExperimentalAPI\npublic class ConcurrentList : MutableList {\n private var data by shared(SharedList(INITIAL_CAPACITY))\n\n override var size: Int by shared(0)\n private set\n\n private val lock = SynchronizedObject()\n\n init {\n makeShared()\n }\n\n override fun hashCode(): Int = synchronized(lock) {\n return@synchronized fold(7) { state, current -> Hash.combine(state, current.hashCode()) }\n }\n\n override fun equals(other: Any?): Boolean = synchronized(lock) {\n if (other == null || other !is List<*> || other.size != size) {\n return@synchronized false\n }\n\n forEachIndexed { index, item ->\n if (other[index] != item) return@synchronized false\n }\n\n return@synchronized true\n }\n\n override fun toString(): String = synchronized(lock) {\n return@synchronized buildString {\n append('[')\n this@ConcurrentList.forEachIndexed { index, item ->\n append(\"$item\")\n\n if (index + 1 < size) {\n append(\", \")\n }\n }\n\n append(']')\n }\n }\n\n override fun contains(element: T): Boolean = indexOf(element) >= 0\n\n override fun containsAll(elements: Collection): Boolean = elements.all { contains(it) }\n\n override fun get(index: Int): T = synchronized(lock) {\n if (index >= size) {\n throw NoSuchElementException()\n }\n\n return data[index]!!\n }\n\n override fun indexOf(element: T): Int = synchronized(lock) {\n for (index in 0 until size) {\n if (data[index] == element) {\n return index\n }\n }\n\n return -1\n }\n\n override fun isEmpty(): Boolean = size == 0\n\n override fun lastIndexOf(element: T): Int = synchronized(lock) {\n for (index in size - 1 downTo 0) {\n if (data[index] == element) {\n return index\n }\n }\n\n return -1\n }\n\n override fun add(element: T): Boolean = synchronized(lock) {\n if (size >= data.size) {\n increaseCapacity()\n }\n\n data[size] = element\n size += 1\n return true\n }\n\n override fun add(index: Int, element: T) {\n reserve(index, 1)\n data[index] = element\n }\n\n override fun addAll(index: Int, elements: Collection): Boolean {\n reserve(index, elements.size)\n\n var current = index\n for (item in elements) {\n data[current] = item\n current += 1\n }\n\n return elements.isNotEmpty()\n }\n\n override fun addAll(elements: Collection): Boolean {\n elements.all { add(it) }\n return elements.isNotEmpty()\n }\n\n override fun clear(): Unit = synchronized(lock) {\n data = SharedList(INITIAL_CAPACITY)\n size = 0\n }\n\n override fun iterator(): MutableIterator = listIterator()\n\n override fun listIterator(): MutableListIterator = listIterator(0)\n\n override fun listIterator(index: Int): MutableListIterator = object : MutableListIterator {\n var current by shared(index)\n\n override fun hasNext(): Boolean = current < this@ConcurrentList.size\n\n override fun next(): T = this@ConcurrentList[current++]\n\n override fun remove() {\n removeAt(current - 1)\n current--\n }\n\n override fun hasPrevious(): Boolean = current > 0\n\n override fun nextIndex(): Int = current + 1\n\n override fun previous(): T = this@ConcurrentList[current--]\n\n override fun previousIndex(): Int = current - 1\n\n override fun add(element: T) {\n add(current, element)\n }\n\n override fun set(element: T) {\n this@ConcurrentList[current - 1] = element\n }\n }\n\n override fun subList(fromIndex: Int, toIndex: Int): MutableList =\n ConcurrentListSlice(this, fromIndex, toIndex)\n\n override fun remove(element: T): Boolean = synchronized(lock) {\n val index = indexOf(element)\n if (index < 0) {\n return false\n }\n\n removeAt(index)\n return true\n }\n\n override fun removeAll(elements: Collection): Boolean {\n var result = false\n elements.forEach { result = remove(it) || result }\n return result\n }\n\n override fun removeAt(index: Int): T = synchronized(lock) {\n checkIndex(index)\n\n val old = data[index]\n data[index] = null\n\n sweep(index)\n return old!!\n }\n\n override fun retainAll(elements: Collection): Boolean = synchronized(lock) {\n var changed = false\n var firstNull = -1\n for (index in 0 until size) {\n val item = data[index]!!\n\n if (item !in elements) {\n changed = true\n data[index] = null\n\n if (firstNull < 0) {\n firstNull = index\n }\n }\n }\n\n if (changed) {\n sweep(firstNull)\n }\n\n return changed\n }\n\n override fun set(index: Int, element: T): T = synchronized(lock) {\n checkIndex(index)\n val old = data[index]\n data[index] = element\n\n return old ?: element\n }\n\n private fun checkIndex(index: Int) {\n if (index >= size || index < 0) throw IndexOutOfBoundsException()\n }\n\n private fun increaseCapacity(targetCapacity: Int = data.size * 2) {\n val newData = SharedList(targetCapacity)\n for (index in 0 until data.size) {\n newData[index] = data[index]\n }\n\n data = newData\n }\n\n private fun sweep(firstNull: Int) {\n var writePosition = firstNull\n\n for (index in writePosition + 1 until size) {\n if (data[index] == null) {\n continue\n }\n\n data[writePosition] = data[index]\n writePosition += 1\n }\n\n for (index in writePosition until size) {\n data[index] = null\n }\n\n size = writePosition\n }\n\n private fun reserve(index: Int, gapSize: Int) {\n val targetSize = gapSize + size\n while (data.size < targetSize) {\n increaseCapacity()\n }\n\n var readPosition = size - 1\n while (readPosition >= index) {\n data[readPosition + gapSize] = data[readPosition]\n readPosition -= 1\n }\n\n for (current in index until index + gapSize) {\n data[current] = null\n }\n\n size += gapSize\n }\n}\n",null,"/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.collections\n\nimport io.ktor.util.*\nimport io.ktor.util.collections.internal.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.concurrent.*\nimport kotlinx.atomicfu.*\n\nprivate const val INITIAL_CAPACITY = 32\nprivate const val MAX_LOAD_FACTOR = 0.5\nprivate const val UPSIZE_RATIO = 2\n\n/**\n * Ktor concurrent map implementation. Please do not use it.\n */\n@InternalAPI\npublic class ConcurrentMap(\n private val lock: Lock = Lock(),\n initialCapacity: Int = INITIAL_CAPACITY\n) : MutableMap {\n private var table by shared(SharedList>>(initialCapacity))\n private var insertionOrder by shared(SharedForwardList>())\n\n private val _size = atomic(0)\n private val loadFactor: Float get() = _size.value.toFloat() / table.size\n\n public constructor(lock: Lock, map: Map) : this(lock, map.size) {\n putAll(map)\n }\n\n init {\n makeShared()\n }\n\n override val size: Int\n get() = _size.value\n\n override fun containsKey(key: Key): Boolean = get(key) != null\n\n override fun containsValue(value: Value): Boolean = locked {\n for (bucket in table) {\n bucket ?: continue\n\n for (item in bucket) {\n if (item.value == value) {\n return@locked true\n }\n }\n }\n\n return@locked false\n }\n\n override fun get(key: Key): Value? = locked {\n val bucket = findBucket(key) ?: return@locked null\n val item = bucket.find { it.key == key }\n\n return@locked item?.value\n }\n\n override fun isEmpty(): Boolean = size == 0\n\n override fun clear(): Unit = locked {\n table = SharedList(INITIAL_CAPACITY)\n insertionOrder = SharedForwardList()\n }\n\n override fun put(key: Key, value: Value): Value? = locked {\n if (loadFactor > MAX_LOAD_FACTOR) {\n upsize()\n }\n\n val bucket = findOrCreateBucket(key)\n val item = bucket.find { it.key == key }\n\n if (item != null) {\n val oldValue = item.value\n item.value = value\n return@locked oldValue\n }\n\n val mapNode = MapNode(key, value)\n val node = insertionOrder.appendLast(mapNode)\n\n mapNode.backReference = node\n bucket.appendFirst(mapNode)\n\n _size.incrementAndGet()\n return@locked null\n }\n\n override fun putAll(from: Map) {\n for ((key, value) in from) {\n put(key, value)\n }\n }\n\n override fun remove(key: Key): Value? = locked {\n val bucket = findBucket(key) ?: return@locked null\n\n with(bucket.iterator()) {\n while (hasNext()) {\n val item = next()\n\n if (item.key == key) {\n val result = item.value\n _size.decrementAndGet()\n\n item.remove()\n remove()\n\n return@locked result\n }\n }\n }\n\n return@locked null\n }\n\n override val entries: MutableSet>\n get() = MutableMapEntries(this)\n\n override val keys: MutableSet\n get() = ConcurrentMapKeys(this)\n\n override val values: MutableCollection\n get() = ConcurrentMapValues(this)\n\n override fun equals(other: Any?): Boolean = locked {\n if (other == null || other !is Map<*, *> || other.size != size) {\n return@locked false\n }\n\n for ((key, value) in other.entries) {\n if (get(key) != value) {\n return@locked false\n }\n }\n\n return@locked true\n }\n\n override fun hashCode(): Int = locked {\n var current = 7\n for ((key, value) in entries) {\n current = Hash.combine(key.hashCode(), value.hashCode(), current)\n }\n\n return@locked current\n }\n\n override fun toString(): String = locked {\n return@locked buildString {\n append(\"{\")\n this@ConcurrentMap.entries.forEachIndexed { index, (key, value) ->\n append(\"$key=$value\")\n\n if (index != size - 1) {\n append(\", \")\n }\n }\n\n append(\"}\")\n }\n }\n\n internal fun iterator(): MutableIterator> =\n object : MutableIterator> {\n private var current: ForwardListNode>? by shared(insertionOrder.first())\n private val previous: ForwardListNode>? get() = current?.previous\n\n init {\n makeShared()\n }\n\n override fun hasNext(): Boolean = current != null\n\n override fun next(): MutableMap.MutableEntry {\n val result = current!!.item!!\n current = current?.next\n return result\n }\n\n override fun remove() {\n val item = previous!!.item!!\n remove(item.key)\n }\n }\n\n /**\n * Perform concurrent insert.\n */\n @Deprecated(\n \"This is accidentally does insert instead of get. Use computeIfAbsent or getOrElse instead.\",\n level = DeprecationLevel.ERROR\n )\n public fun getOrDefault(key: Key, block: () -> Value): Value = lock.withLock {\n return@withLock computeIfAbsent(key, block)\n }\n\n /**\n * Computes [block] and inserts result in map. The [block] will be evaluated at most once.\n */\n public fun computeIfAbsent(key: Key, block: () -> Value): Value = locked {\n val value = get(key)\n if (value != null) {\n return@locked value\n }\n val newValue = block()\n put(key, newValue)\n\n return@locked newValue\n }\n\n private fun findBucket(key: Key): SharedForwardList>? {\n val bucketId = key.hashCode() and (table.size - 1)\n return table[bucketId]\n }\n\n private fun findOrCreateBucket(key: Key): SharedForwardList> {\n val bucketId = key.hashCode() and (table.size - 1)\n val result = table[bucketId]\n\n if (result == null) {\n val bucket = SharedForwardList>()\n table[bucketId] = bucket\n return bucket\n }\n\n return result\n }\n\n private fun upsize() {\n val newTable = ConcurrentMap(initialCapacity = table.size * UPSIZE_RATIO)\n newTable.putAll(this)\n\n table = newTable.table\n }\n\n private fun locked(block: () -> T): T = lock.withLock { block() }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.collections.internal\n\nimport kotlin.math.*\n\ninternal class ConcurrentListSlice(\n private val origin: MutableList,\n private val fromIndex: Int,\n private val toIndex: Int\n) : AbstractMutableList() {\n override val size: Int\n get() = min(origin.size, toIndex - fromIndex)\n\n override fun get(index: Int): T {\n return origin[fromIndex + index]\n }\n\n override fun add(index: Int, element: T) {\n error(\"Unsupported append in ConcurrentList slice\")\n }\n\n override fun removeAt(index: Int): T {\n error(\"Unsupported remove in ConcurrentList slice\")\n }\n\n override fun set(index: Int, element: T): T = origin.set(fromIndex + index, element)\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.collections.internal\n\nimport io.ktor.util.collections.*\nimport io.ktor.utils.io.*\n\ninternal class ConcurrentMapKeys(\n private val delegate: ConcurrentMap\n) : MutableSet {\n\n init {\n makeShared()\n }\n\n override fun add(element: Key): Boolean = throw UnsupportedOperationException()\n\n override fun addAll(elements: Collection): Boolean {\n throw UnsupportedOperationException()\n }\n\n override fun clear() {\n delegate.clear()\n }\n\n override fun iterator(): MutableIterator = object : MutableIterator {\n private val delegateIterator: MutableIterator> = delegate.iterator()\n\n init {\n makeShared()\n }\n\n override fun hasNext(): Boolean = delegateIterator.hasNext()\n\n override fun next(): Key = delegateIterator.next().key\n\n override fun remove() {\n delegateIterator.remove()\n }\n }\n\n override fun remove(element: Key): Boolean = delegate.remove(element) != null\n\n override fun removeAll(elements: Collection): Boolean {\n var modified = false\n elements.forEach {\n modified = remove(it) || modified\n }\n\n return modified\n }\n\n override fun retainAll(elements: Collection): Boolean {\n var modified = false\n\n with(iterator()) {\n while (hasNext()) {\n if (next() in elements) {\n continue\n }\n\n modified = true\n remove()\n }\n }\n\n return modified\n }\n\n override val size: Int\n get() = delegate.size\n\n override fun contains(element: Key): Boolean = delegate.contains(element)\n\n override fun containsAll(elements: Collection): Boolean = elements.all { contains(it) }\n\n override fun isEmpty(): Boolean = size == 0\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.collections.internal\n\nimport io.ktor.util.collections.*\nimport io.ktor.utils.io.*\n\ninternal class ConcurrentMapValues(\n private val delegate: ConcurrentMap\n) : MutableCollection {\n\n init {\n makeShared()\n }\n\n override val size: Int\n get() = delegate.size\n\n override fun contains(element: Value): Boolean = delegate.containsValue(element)\n\n override fun containsAll(elements: Collection): Boolean = elements.all { contains(it) }\n\n override fun isEmpty(): Boolean = delegate.size == 0\n\n override fun add(element: Value): Boolean {\n throw UnsupportedOperationException()\n }\n\n override fun addAll(elements: Collection): Boolean {\n throw UnsupportedOperationException()\n }\n\n override fun clear() {\n delegate.clear()\n }\n\n override fun iterator(): MutableIterator = object : MutableIterator {\n val delegateIterator = delegate.iterator()\n\n init {\n makeShared()\n }\n\n override fun hasNext(): Boolean = delegateIterator.hasNext()\n\n override fun next(): Value = delegateIterator.next().value\n\n override fun remove() {\n delegateIterator.remove()\n }\n }\n\n override fun remove(element: Value): Boolean {\n var modified = false\n\n with(iterator()) {\n while (hasNext()) {\n if (next() == element) {\n continue\n }\n\n modified = true\n remove()\n }\n }\n\n return modified\n }\n\n override fun removeAll(elements: Collection): Boolean {\n var modified = false\n\n with(iterator()) {\n while (hasNext()) {\n if (next() !in elements) {\n continue\n }\n\n modified = true\n remove()\n }\n }\n\n return modified\n }\n\n override fun retainAll(elements: Collection): Boolean {\n error(\"Common concurrent map doesn't support this operation yet.\")\n }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.collections.internal\n\nimport io.ktor.utils.io.concurrent.*\n\ninternal class ForwardListIterator(head: ForwardListNode) : MutableIterator {\n var previous by shared?>(head)\n val current: ForwardListNode? get() = previous?.next\n\n override fun hasNext(): Boolean = current?.item != null\n\n override fun next(): T {\n previous = current\n return previous?.item ?: throw NoSuchElementException()\n }\n\n override fun remove() {\n previous?.remove() ?: error(\"Fail to remove element before iteration\")\n }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.collections.internal\n\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.concurrent.*\n\ninternal class ForwardListNode(\n private val list: SharedForwardList,\n next: ForwardListNode?,\n val item: T?,\n previous: ForwardListNode?\n) {\n var next by shared(next)\n var previous: ForwardListNode? by shared(previous)\n\n init {\n makeShared()\n }\n\n fun insertAfter(value: T): ForwardListNode {\n val result = ForwardListNode(list, next, value, this)\n next = result\n return result\n }\n\n fun removeNext() {\n if (next == list.tail) {\n list.tail = this\n }\n\n next = next?.next\n next?.previous = this\n }\n\n fun remove() {\n previous!!.removeNext()\n }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.collections.internal\n\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.concurrent.*\n\ninternal class MapNode(override val key: Key, value: Value) : MutableMap.MutableEntry {\n internal var backReference: ForwardListNode>? by shared(null)\n override var value: Value by shared(value)\n\n val hash: Int = key.hashCode()\n\n init {\n makeShared()\n }\n\n override fun setValue(newValue: Value): Value {\n val result = value\n value = newValue\n return result\n }\n\n internal fun remove() {\n backReference!!.remove()\n backReference = null\n }\n\n override fun toString(): String = \"MapItem[$key, $value]\"\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.collections.internal\n\nimport io.ktor.util.collections.*\nimport io.ktor.utils.io.*\n\ninternal class MutableMapEntries(\n private val delegate: ConcurrentMap\n) : MutableSet> {\n\n init {\n makeShared()\n }\n\n override fun add(element: MutableMap.MutableEntry): Boolean =\n delegate.put(element.key, element.value) != element.value\n\n override fun addAll(elements: Collection>): Boolean {\n var result = false\n\n elements.forEach {\n result = add(it) || result\n }\n\n return result\n }\n\n override fun clear() {\n delegate.clear()\n }\n\n override fun iterator(): MutableIterator> =\n object : MutableIterator> {\n private val origin = delegate.iterator()\n override fun hasNext(): Boolean = origin.hasNext()\n\n override fun next(): MutableMap.MutableEntry = origin.next()\n\n override fun remove(): Unit = origin.remove()\n }\n\n override fun remove(element: MutableMap.MutableEntry): Boolean =\n delegate.remove(element.key) != null\n\n override fun removeAll(elements: Collection>): Boolean {\n var modified = false\n elements.forEach {\n modified = remove(it) || modified\n }\n\n return modified\n }\n\n override fun retainAll(elements: Collection>): Boolean {\n var modified = false\n with(iterator()) {\n while (hasNext()) {\n if (next() in elements) {\n continue\n }\n\n modified = true\n remove()\n }\n }\n\n return modified\n }\n\n override val size: Int\n get() = delegate.size\n\n override fun contains(element: MutableMap.MutableEntry): Boolean =\n delegate[element.key] == element.value\n\n override fun containsAll(elements: Collection>): Boolean =\n elements.all { contains(it) }\n\n override fun isEmpty(): Boolean = delegate.isEmpty()\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.collections.internal\n\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.concurrent.*\n\ninternal class SharedForwardList : MutableIterable {\n internal var head: ForwardListNode? by shared(null)\n internal var tail by shared(head)\n\n init {\n makeShared()\n\n head = ForwardListNode(this, null, null, null)\n tail = head\n }\n\n fun first(): ForwardListNode? {\n return head!!.next\n }\n\n fun last(): ForwardListNode? {\n if (head == tail) {\n return null\n }\n\n return tail\n }\n\n fun appendFirst(value: T): ForwardListNode {\n val newValue = head!!.insertAfter(value)\n if (head == tail) {\n tail = newValue\n }\n\n return newValue\n }\n\n fun appendLast(value: T): ForwardListNode {\n tail = tail!!.insertAfter(value)\n return tail!!\n }\n\n override fun iterator(): MutableIterator =\n ForwardListIterator(head!!)\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.date\n\nimport kotlin.time.*\n\n/**\n * According to:\n * http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html\n */\n\n/**\n * Day of week\n * [value] is 3 letter shortcut\n */\n@Suppress(\"KDocMissingDocumentation\")\npublic enum class WeekDay(public val value: String) {\n MONDAY(\"Mon\"),\n TUESDAY(\"Tue\"),\n WEDNESDAY(\"Wed\"),\n THURSDAY(\"Thu\"),\n FRIDAY(\"Fri\"),\n SATURDAY(\"Sat\"),\n SUNDAY(\"Sun\");\n\n public companion object {\n /**\n * Lookup an instance by [ordinal]\n */\n public fun from(ordinal: Int): WeekDay = values()[ordinal]\n\n /**\n * Lookup an instance by short week day name [WeekDay.value]\n */\n public fun from(value: String): WeekDay = values().find { it.value == value }\n ?: error(\"Invalid day of week: $value\")\n }\n}\n\n/**\n * Month\n * [value] is 3 letter shortcut\n */\n@Suppress(\"KDocMissingDocumentation\")\npublic enum class Month(public val value: String) {\n JANUARY(\"Jan\"),\n FEBRUARY(\"Feb\"),\n MARCH(\"Mar\"),\n APRIL(\"Apr\"),\n MAY(\"May\"),\n JUNE(\"Jun\"),\n JULY(\"Jul\"),\n AUGUST(\"Aug\"),\n SEPTEMBER(\"Sep\"),\n OCTOBER(\"Oct\"),\n NOVEMBER(\"Nov\"),\n DECEMBER(\"Dec\");\n\n public companion object {\n /**\n * Lookup an instance by [ordinal]\n */\n public fun from(ordinal: Int): Month = values()[ordinal]\n /**\n * Lookup an instance by short month name [Month.value]\n */\n public fun from(value: String): Month = values().find { it.value == value }\n ?: error(\"Invalid month: $value\")\n }\n}\n\n/**\n * Date in GMT timezone\n *\n * @property seconds: seconds from 0 to 60(last is for leap second)\n * @property minutes: minutes from 0 to 59\n * @property hours: hours from 0 to 23\n * @property dayOfWeek an instance of the corresponding day of week\n * @property dayOfMonth: day of month from 1 to 31\n * @property dayOfYear: day of year from 1 to 366\n * @property month an instance of the corresponding month\n * @property year: year in common era(CE: https://en.wikipedia.org/wiki/Common_Era)\n *\n * @property timestamp is a number of epoch milliseconds\n */\npublic data class GMTDate internal constructor(\n val seconds: Int,\n val minutes: Int,\n val hours: Int,\n\n val dayOfWeek: WeekDay,\n val dayOfMonth: Int,\n val dayOfYear: Int,\n\n val month: Month,\n val year: Int,\n\n val timestamp: Long\n) : Comparable {\n\n override fun compareTo(other: GMTDate): Int = timestamp.compareTo(other.timestamp)\n\n public companion object {\n /**\n * An instance of [GMTDate] corresponding to the epoch beginning\n */\n public val START: GMTDate = GMTDate(0)\n }\n}\n\n/**\n * Create new gmt date from the [timestamp].\n * @param timestamp is a number of epoch milliseconds (it is `now` by default).\n */\n@Suppress(\"FunctionName\")\npublic expect fun GMTDate(timestamp: Long? = null): GMTDate\n\n/**\n * Create an instance of [GMTDate] from the specified date/time components\n */\n@Suppress(\"FunctionName\")\npublic expect fun GMTDate(seconds: Int, minutes: Int, hours: Int, dayOfMonth: Int, month: Month, year: Int): GMTDate\n\n/**\n * Adds the specified number of [milliseconds]\n */\npublic operator fun GMTDate.plus(milliseconds: Long): GMTDate = GMTDate(timestamp + milliseconds)\n\n/**\n * Subtracts the specified number of [milliseconds]\n */\npublic operator fun GMTDate.minus(milliseconds: Long): GMTDate = GMTDate(timestamp - milliseconds)\n\n/**\n * Adds the specified [duration]\n */\n@ExperimentalTime\npublic operator fun GMTDate.plus(duration: Duration): GMTDate = GMTDate(timestamp + duration.toLongMilliseconds())\n\n/**\n * Subtracts the specified [duration]\n */\n@ExperimentalTime\npublic operator fun GMTDate.minus(duration: Duration): GMTDate = GMTDate(timestamp - duration.toLongMilliseconds())\n\n/**\n * Truncate to seconds by discarding sub-second part\n */\npublic fun GMTDate.truncateToSeconds(): GMTDate = GMTDate(seconds, minutes, hours, dayOfMonth, month, year)\n\n/**\n * Gets current system time in milliseconds since certain moment in the past, only delta between two subsequent calls makes sense.\n */\npublic expect fun getTimeMillis(): Long\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.collections.internal\n\nimport io.ktor.util.*\nimport io.ktor.utils.io.*\nimport kotlinx.atomicfu.*\n\n@InternalAPI\ninternal class SharedList(override val size: Int) : List {\n private val data: AtomicArray = atomicArrayOfNulls(size)\n\n init {\n makeShared()\n }\n\n operator fun set(index: Int, value: T?) {\n data[index].value = value\n }\n\n override fun contains(element: T?): Boolean {\n for (index in 0 until size) {\n if (data[index].value == element) {\n return true\n }\n }\n\n return false\n }\n\n override fun containsAll(elements: Collection): Boolean = elements.all { contains(it) }\n\n override fun get(index: Int): T? = data[index].value\n\n override fun indexOf(element: T?): Int {\n for (index in 0 until size) {\n if (data[index].value == element) {\n return index\n }\n }\n\n return -1\n }\n\n override fun isEmpty(): Boolean = size == 0\n\n override fun iterator(): Iterator = listIterator(0)\n\n override fun lastIndexOf(element: T?): Int = asReversed().indexOf(element)\n\n override fun listIterator(): ListIterator = listIterator(0)\n\n override fun listIterator(index: Int): ListIterator = object : ListIterator {\n private val currentIndex = atomic(index)\n\n init {\n makeShared()\n }\n\n override fun hasNext(): Boolean = currentIndex.value < size\n\n override fun hasPrevious(): Boolean = currentIndex.value > 0\n\n override fun next(): T? {\n check(hasNext())\n val current = currentIndex.getAndIncrement()\n return data[current].value\n }\n\n override fun nextIndex(): Int {\n check(hasNext())\n return currentIndex.value + 1\n }\n\n override fun previous(): T? {\n check(hasPrevious())\n val current = currentIndex.getAndDecrement()\n return data[current].value\n }\n\n override fun previousIndex(): Int {\n check(hasPrevious())\n return currentIndex.value - 1\n }\n }\n\n override fun subList(fromIndex: Int, toIndex: Int): List {\n val result = SharedList(toIndex - fromIndex)\n\n for (index in fromIndex until toIndex) {\n result[index - fromIndex] = data[index].value\n }\n\n return result\n }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.pipeline\n\nimport kotlin.coroutines.*\n\n/**\n * Represents running execution of a pipeline\n * @param context object representing context in which pipeline executes\n * @param interceptors list of interceptors to execute\n * @param subject object representing subject that goes along the pipeline\n */\n@ContextDsl\ninternal class DebugPipelineContext constructor(\n override val context: TContext,\n private val interceptors: List>,\n subject: TSubject,\n override val coroutineContext: CoroutineContext\n) : PipelineContext,\n @Suppress(\"DEPRECATION\")\n PipelineExecutor {\n\n /**\n * Subject of this pipeline execution\n */\n override var subject: TSubject = subject\n private set\n\n private var index = 0\n\n /**\n * Finishes current pipeline execution\n */\n override fun finish() {\n index = -1\n }\n\n /**\n * Continues execution of the pipeline with the given subject\n */\n override suspend fun proceedWith(subject: TSubject): TSubject {\n this.subject = subject\n return proceed()\n }\n\n /**\n * Continues execution of the pipeline with the same subject\n */\n override suspend fun proceed(): TSubject {\n val index = index\n if (index < 0) return subject\n\n if (index >= interceptors.size) {\n finish()\n return subject\n }\n\n return proceedLoop()\n }\n\n override suspend fun execute(initial: TSubject): TSubject {\n index = 0\n subject = initial\n return proceed()\n }\n\n private suspend fun proceedLoop(): TSubject {\n do {\n val index = index\n if (index == -1) {\n break\n }\n val interceptors = interceptors\n if (index >= interceptors.size) {\n finish()\n break\n }\n val executeInterceptor = interceptors[index]\n this.index = index + 1\n executeInterceptor.invoke(this, subject)\n } while (true)\n\n return subject\n }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.pipeline\n\nimport io.ktor.util.collections.*\nimport io.ktor.utils.io.concurrent.*\n\ninternal class PhaseContent(\n val phase: PipelinePhase,\n val relation: PipelinePhaseRelation,\n interceptors: MutableList>\n) {\n private var interceptors: MutableList> by shared(interceptors)\n\n @Suppress(\"UNCHECKED_CAST\")\n constructor(\n phase: PipelinePhase,\n relation: PipelinePhaseRelation\n ) : this(phase, relation, SharedArrayList as MutableList>) {\n check(SharedArrayList.isEmpty()) { \"The shared empty array list has been modified\" }\n }\n\n var shared: Boolean by shared(true)\n\n val isEmpty: Boolean get() = interceptors.isEmpty()\n val size: Int get() = interceptors.size\n\n fun addInterceptor(interceptor: PipelineInterceptor) {\n if (shared) {\n copyInterceptors()\n }\n\n interceptors.add(interceptor)\n }\n\n fun addTo(destination: MutableList>) {\n val interceptors = interceptors\n\n if (destination is ArrayList) {\n destination.ensureCapacity(destination.size + interceptors.size)\n }\n\n for (index in 0 until interceptors.size) {\n destination.add(interceptors[index])\n }\n }\n\n fun addTo(destination: PhaseContent) {\n if (isEmpty) return\n\n if (destination.isEmpty) {\n destination.interceptors = sharedInterceptors()\n destination.shared = true\n return\n }\n\n if (destination.shared) {\n destination.copyInterceptors()\n }\n\n addTo(destination.interceptors)\n }\n\n fun sharedInterceptors(): MutableList> {\n shared = true\n return interceptors\n }\n\n fun copiedInterceptors(): MutableList> =\n sharedListOf>().apply {\n addAll(interceptors)\n }\n\n override fun toString(): String = \"Phase `${phase.name}`, $size handlers\"\n\n private fun copyInterceptors() {\n interceptors = copiedInterceptors()\n shared = false\n }\n\n companion object {\n val SharedArrayList: MutableList = sharedListOf()\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.date\n\nimport io.ktor.util.*\n\n/**\n * Build [GMTDate] parser using [pattern] string.\n *\n * Pattern string format:\n * | Unit | pattern char | Description |\n * | -------- | ------------ | ---------------------------------------------------- |\n * | Seconds | s | parse seconds 0 to 60 |\n * | Minutes | m | parse minutes 0 to 60 |\n * | Hours | h | parse hours 0 to 23 |\n * | Month | M | parse month from Jan to Dec(see [Month] for details) |\n * | Year | Y | parse year |\n * | Any char | * | Match any character |\n */\n@InternalAPI\npublic class GMTDateParser(private val pattern: String) {\n init {\n check(pattern.isNotEmpty()) { \"Date parser pattern shouldn't be empty.\" }\n }\n\n /**\n * Parse [GMTDate] from [dateString] using [pattern].\n */\n public fun parse(dateString: String): GMTDate {\n val builder = GMTDateBuilder()\n\n var start = 0\n var current = pattern[start]\n var chunkStart = 0\n var index = 1\n\n try {\n while (index < pattern.length) {\n if (pattern[index] == current) {\n index++\n continue\n }\n\n val chunkEnd = chunkStart + index - start\n builder.handleToken(current, dateString.substring(chunkStart, chunkEnd))\n\n chunkStart = chunkEnd\n start = index\n current = pattern[index]\n\n index++\n }\n\n if (chunkStart < dateString.length) {\n builder.handleToken(current, dateString.substring(chunkStart))\n }\n } catch (_: Throwable) {\n throw InvalidDateStringException(dateString, chunkStart, pattern)\n }\n\n return builder.build()\n }\n\n private fun GMTDateBuilder.handleToken(\n type: Char,\n chunk: String\n ): Unit = when (type) {\n SECONDS -> {\n seconds = chunk.toInt()\n }\n MINUTES -> {\n minutes = chunk.toInt()\n }\n HOURS -> {\n hours = chunk.toInt()\n }\n DAY_OF_MONTH -> {\n dayOfMonth = chunk.toInt()\n }\n MONTH -> {\n month = Month.from(chunk)\n }\n YEAR -> {\n year = chunk.toInt()\n }\n ZONE ->\n check(chunk == \"GMT\")\n ANY -> Unit\n else -> {\n check(chunk.all { it == type })\n }\n }\n\n public companion object {\n public const val SECONDS: Char = 's'\n public const val MINUTES: Char = 'm'\n public const val HOURS: Char = 'h'\n\n public const val DAY_OF_MONTH: Char = 'd'\n public const val MONTH: Char = 'M'\n public const val YEAR: Char = 'Y'\n\n public const val ZONE: Char = 'z'\n\n public const val ANY: Char = '*'\n }\n}\n\ninternal class GMTDateBuilder {\n var seconds: Int? = null\n var minutes: Int? = null\n var hours: Int? = null\n\n var dayOfMonth: Int? = null\n lateinit var month: Month\n var year: Int? = null\n\n public fun build(): GMTDate = GMTDate(seconds!!, minutes!!, hours!!, dayOfMonth!!, month, year!!)\n}\n\n/**\n * Thrown when the date string doesn't the string pattern.\n */\npublic class InvalidDateStringException(\n data: String,\n at: Int,\n pattern: String\n) : IllegalStateException(\"Failed to parse date string: \\\"${data}\\\" at index $at. Pattern: \\\"$pattern\\\"\")\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.pipeline\n\nimport io.ktor.util.*\nimport io.ktor.util.collections.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.concurrent.*\nimport kotlinx.atomicfu.*\nimport kotlin.coroutines.*\n\n/**\n * Represents an execution pipeline for asynchronous extensible computations\n */\npublic open class Pipeline(\n vararg phases: PipelinePhase\n) {\n /**\n * Provides common place to store pipeline attributes\n */\n public val attributes: Attributes = Attributes(concurrent = true)\n\n /**\n * Indicated if debug mode is enabled. In debug mode users will get more details in the stacktrace.\n */\n public open val developmentMode: Boolean = false\n\n private val phasesRaw: MutableList = sharedListOf(*phases)\n\n private var interceptorsQuantity by shared(0)\n\n /**\n * Phases of this pipeline\n */\n public val items: List\n get() = phasesRaw.map {\n it as? PipelinePhase ?: (it as? PhaseContent<*, *>)?.phase!!\n }\n\n /**\n * @return `true` if there are no interceptors installed regardless number of phases\n */\n @InternalAPI\n public val isEmpty: Boolean\n get() = interceptorsQuantity == 0\n\n private val _interceptors: AtomicRef.(TSubject) -> Unit>?> =\n atomic(null)\n\n private var interceptors: List>?\n get() = _interceptors.value\n set(value) {\n _interceptors.value = value\n }\n\n /**\n * share between pipelines/contexts\n */\n private var interceptorsListShared: Boolean by shared(false)\n\n /**\n * interceptors list is shared with pipeline phase content\n */\n private var interceptorsListSharedPhase: PipelinePhase? by shared(null)\n\n public constructor(\n phase: PipelinePhase,\n interceptors: List>\n ) : this(phase) {\n interceptors.forEach { intercept(phase, it) }\n }\n\n /**\n * Executes this pipeline in the given [context] and with the given [subject]\n */\n public suspend fun execute(context: TContext, subject: TSubject): TSubject =\n createContext(context, subject, coroutineContext).execute(subject)\n\n /**\n * Adds [phase] to the end of this pipeline\n */\n public fun addPhase(phase: PipelinePhase) {\n if (hasPhase(phase)) {\n return\n }\n\n phasesRaw.add(phase)\n }\n\n /**\n * Inserts [phase] after the [reference] phase\n */\n public fun insertPhaseAfter(reference: PipelinePhase, phase: PipelinePhase) {\n if (hasPhase(phase)) return\n\n val index = findPhaseIndex(reference)\n if (index == -1) {\n throw InvalidPhaseException(\"Phase $reference was not registered for this pipeline\")\n }\n\n phasesRaw.add(index + 1, PhaseContent(phase, PipelinePhaseRelation.After(reference)))\n }\n\n /**\n * Inserts [phase] before the [reference] phase\n */\n public fun insertPhaseBefore(reference: PipelinePhase, phase: PipelinePhase) {\n if (hasPhase(phase)) return\n\n val index = findPhaseIndex(reference)\n if (index == -1) {\n throw InvalidPhaseException(\"Phase $reference was not registered for this pipeline\")\n }\n\n phasesRaw.add(index, PhaseContent(phase, PipelinePhaseRelation.Before(reference)))\n }\n\n /**\n * Adds [block] to the [phase] of this pipeline\n */\n public fun intercept(phase: PipelinePhase, block: PipelineInterceptor) {\n val phaseContent = findPhase(phase)\n ?: throw InvalidPhaseException(\"Phase $phase was not registered for this pipeline\")\n\n if (tryAddToPhaseFastPath(phase, block)) {\n interceptorsQuantity++\n return\n }\n\n phaseContent.addInterceptor(block)\n interceptorsQuantity++\n resetInterceptorsList()\n\n afterIntercepted()\n }\n\n /**\n * Invoked after an interceptor has been installed\n */\n public open fun afterIntercepted() {\n }\n\n /**\n * Merges another pipeline into this pipeline, maintaining relative phases order\n */\n public fun merge(from: Pipeline) {\n if (fastPathMerge(from)) {\n return\n }\n\n if (interceptorsQuantity == 0) {\n setInterceptorsListFromAnotherPipeline(from)\n } else {\n resetInterceptorsList()\n }\n\n val fromPhases = from.phasesRaw\n for (index in 0..fromPhases.lastIndex) {\n val fromPhaseOrContent = fromPhases[index]\n\n val fromPhase =\n (fromPhaseOrContent as? PipelinePhase) ?: (fromPhaseOrContent as PhaseContent<*, *>).phase\n\n if (!hasPhase(fromPhase)) {\n val fromPhaseRelation = when {\n fromPhaseOrContent === fromPhase -> PipelinePhaseRelation.Last\n else -> (fromPhaseOrContent as PhaseContent<*, *>).relation\n }\n\n when (fromPhaseRelation) {\n is PipelinePhaseRelation.Last -> addPhase(fromPhase)\n is PipelinePhaseRelation.Before -> insertPhaseBefore(\n fromPhaseRelation.relativeTo,\n fromPhase\n )\n is PipelinePhaseRelation.After -> insertPhaseAfter(\n fromPhaseRelation.relativeTo,\n fromPhase\n )\n }\n }\n\n if (fromPhaseOrContent is PhaseContent<*, *> && !fromPhaseOrContent.isEmpty) {\n @Suppress(\"UNCHECKED_CAST\")\n fromPhaseOrContent as PhaseContent\n\n fromPhaseOrContent.addTo(findPhase(fromPhase)!!)\n interceptorsQuantity += fromPhaseOrContent.size\n }\n }\n }\n\n internal fun phaseInterceptors(phase: PipelinePhase): List> =\n findPhase(phase)?.sharedInterceptors() ?: emptyList()\n\n /**\n * For tests only\n */\n internal fun interceptorsForTests(): List> {\n return interceptors ?: cacheInterceptors()\n }\n\n @Suppress(\"DEPRECATION\")\n private fun createContext(\n context: TContext,\n subject: TSubject,\n coroutineContext: CoroutineContext\n ): PipelineExecutor =\n pipelineExecutorFor(context, sharedInterceptorsList(), subject, coroutineContext, developmentMode)\n\n private fun findPhase(phase: PipelinePhase): PhaseContent? {\n val phasesList = phasesRaw\n\n for (index in 0 until phasesList.size) {\n val current = phasesList[index]\n if (current === phase) {\n val content = PhaseContent(phase, PipelinePhaseRelation.Last)\n phasesList[index] = content\n return content\n }\n\n if (current is PhaseContent<*, *> && current.phase === phase) {\n @Suppress(\"UNCHECKED_CAST\")\n return current as PhaseContent\n }\n }\n\n return null\n }\n\n private fun findPhaseIndex(phase: PipelinePhase): Int {\n val phasesList = phasesRaw\n for (index in 0 until phasesList.size) {\n val current = phasesList[index]\n if (current === phase || (current is PhaseContent<*, *> && current.phase === phase)) {\n return index\n }\n }\n\n return -1\n }\n\n private fun hasPhase(phase: PipelinePhase): Boolean {\n val phasesList = phasesRaw\n for (index in 0 until phasesList.size) {\n val current = phasesList[index]\n if (current === phase || (current is PhaseContent<*, *> && current.phase === phase)) {\n return true\n }\n }\n\n return false\n }\n\n private fun cacheInterceptors(): List> {\n val interceptorsQuantity = interceptorsQuantity\n if (interceptorsQuantity == 0) {\n notSharedInterceptorsList(emptyList())\n return emptyList()\n }\n\n val phases = phasesRaw\n if (interceptorsQuantity == 1) {\n for (phaseIndex in 0..phases.lastIndex) {\n @Suppress(\"UNCHECKED_CAST\")\n val phaseContent =\n phases[phaseIndex] as? PhaseContent ?: continue\n\n if (!phaseContent.isEmpty) {\n val interceptors = phaseContent.sharedInterceptors()\n setInterceptorsListFromPhase(phaseContent)\n return interceptors\n }\n }\n }\n\n val destination: MutableList.(TSubject) -> Unit> = sharedListOf()\n for (phaseIndex in 0..phases.lastIndex) {\n @Suppress(\"UNCHECKED_CAST\")\n val phase = phases[phaseIndex] as? PhaseContent\n ?: continue\n\n phase.addTo(destination)\n }\n\n notSharedInterceptorsList(destination)\n return destination\n }\n\n private fun fastPathMerge(from: Pipeline): Boolean {\n if (from.phasesRaw.isEmpty()) {\n return true\n }\n\n if (phasesRaw.isNotEmpty()) {\n return false\n }\n\n val fromPhases = from.phasesRaw\n\n for (index in 0..fromPhases.lastIndex) {\n val fromPhaseOrContent = fromPhases[index]\n if (fromPhaseOrContent is PipelinePhase) {\n phasesRaw.add(fromPhaseOrContent)\n continue\n }\n\n if (fromPhaseOrContent is PhaseContent<*, *>) {\n @Suppress(\"UNCHECKED_CAST\")\n fromPhaseOrContent as PhaseContent\n\n phasesRaw.add(\n PhaseContent(\n fromPhaseOrContent.phase,\n fromPhaseOrContent.relation,\n fromPhaseOrContent.sharedInterceptors()\n )\n )\n continue\n }\n }\n\n interceptorsQuantity += from.interceptorsQuantity\n setInterceptorsListFromAnotherPipeline(from)\n return true\n }\n\n private fun sharedInterceptorsList(): List> {\n if (interceptors == null) {\n cacheInterceptors()\n }\n\n interceptorsListShared = true\n return interceptors!!\n }\n\n private fun resetInterceptorsList() {\n interceptors = null\n interceptorsListShared = false\n interceptorsListSharedPhase = null\n }\n\n private fun notSharedInterceptorsList(list: List>) {\n interceptors = list\n interceptorsListShared = false\n interceptorsListSharedPhase = null\n }\n\n private fun setInterceptorsListFromPhase(phaseContent: PhaseContent) {\n interceptors = phaseContent.sharedInterceptors()\n interceptorsListShared = false\n interceptorsListSharedPhase = phaseContent.phase\n }\n\n private fun setInterceptorsListFromAnotherPipeline(pipeline: Pipeline) {\n interceptors = pipeline.sharedInterceptorsList()\n interceptorsListShared = true\n interceptorsListSharedPhase = null\n }\n\n private fun tryAddToPhaseFastPath(phase: PipelinePhase, block: PipelineInterceptor): Boolean {\n val currentInterceptors = interceptors\n if (phasesRaw.isEmpty() || currentInterceptors == null) {\n return false\n }\n\n if (interceptorsListShared || currentInterceptors !is MutableList) {\n return false\n }\n\n if (interceptorsListSharedPhase == phase) {\n currentInterceptors.add(block)\n return true\n }\n\n if (phase == phasesRaw.last() || findPhaseIndex(phase) == phasesRaw.lastIndex) {\n findPhase(phase)!!.addInterceptor(block)\n currentInterceptors.add(block)\n return true\n }\n\n return false\n }\n}\n\n/**\n * Executes this pipeline\n */\n@Suppress(\"NOTHING_TO_INLINE\")\npublic suspend inline fun Pipeline.execute(\n context: TContext\n): Unit = execute(context, Unit)\n\n/**\n * Intercepts an untyped pipeline when the subject is of the given type\n */\npublic inline fun Pipeline<*, TContext>.intercept(\n phase: PipelinePhase,\n noinline block: suspend PipelineContext.(TSubject) -> Unit\n) {\n intercept(phase) interceptor@{ subject ->\n if (subject !is TSubject) return@interceptor\n\n @Suppress(\"UNCHECKED_CAST\")\n val reinterpret = this as? PipelineContext\n reinterpret?.block(subject)\n }\n}\n\n/**\n * Represents an interceptor type which is a suspend extension function for context\n */\npublic typealias PipelineInterceptor =\n suspend PipelineContext.(TSubject) -> Unit\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.pipeline\n\nimport kotlinx.coroutines.internal.*\nimport kotlin.coroutines.*\n\n/**\n * Recreates the exception with the original cause to keep exception structure.\n *\n * Notice: This method breaks the [exception] identity.\n */\ninternal fun recoverStackTraceBridge(exception: Throwable, continuation: Continuation<*>): Throwable = try {\n @Suppress(\"INVISIBLE_MEMBER\")\n recoverStackTrace(exception, continuation).withCause(exception.cause)\n} catch (_: Throwable) {\n exception\n}\n\ninternal expect fun Throwable.withCause(cause: Throwable?): Throwable\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.pipeline\n\n/**\n * Represents relations between pipeline phases\n */\ninternal sealed class PipelinePhaseRelation {\n /**\n * Given phase should be executed after [relativeTo] phase\n * @property relativeTo represents phases for relative positioning\n */\n class After(val relativeTo: PipelinePhase) : PipelinePhaseRelation()\n\n /**\n * Given phase should be executed before [relativeTo] phase\n * @property relativeTo represents phases for relative positioning\n */\n class Before(val relativeTo: PipelinePhase) : PipelinePhaseRelation()\n\n /**\n * Given phase should be executed last\n */\n object Last : PipelinePhaseRelation()\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.pipeline\n\ninternal object StackWalkingFailed {\n public fun failedToCaptureStackFrame() {\n error(\n \"Failed to capture stack frame. This is usually happens when a coroutine is running so\" +\n \" the frame stack is changing quickly \" +\n \"and the coroutine debug agent is unable to capture it concurrently.\" +\n \" You may retry running your test to see this particular trace.\"\n )\n }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.pipeline\n\nimport io.ktor.util.*\nimport kotlin.coroutines.*\n\n/**\n * This is a fake coroutine stack frame. It is reported by [SuspendFunctionGun] when the debug agent\n * is trying to probe jobs state by peeking frames when the coroutine is running at the same time\n * and the frames sequence is concurrently changed.\n */\ninternal object StackWalkingFailedFrame : CoroutineStackFrame, Continuation {\n override val callerFrame: CoroutineStackFrame? get() = null\n\n override fun getStackTraceElement(): StackTraceElement? {\n return createStackTraceElement(\n StackWalkingFailed::class,\n StackWalkingFailed::failedToCaptureStackFrame.name,\n \"StackWalkingFailed.kt\",\n 8\n )\n }\n\n override val context: CoroutineContext\n get() = EmptyCoroutineContext\n\n override fun resumeWith(result: Result) {\n StackWalkingFailed.failedToCaptureStackFrame()\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\nimport kotlin.coroutines.*\nimport kotlin.coroutines.intrinsics.*\n\n@InternalAPI\n@Suppress(\"NOTHING_TO_INLINE\")\ninternal actual inline fun (suspend R.(A) -> Unit).startCoroutineUninterceptedOrReturn3(\n receiver: R,\n arg: A,\n continuation: Continuation\n): Any? {\n val block: suspend () -> Unit = { this(receiver, arg) }\n return block.startCoroutineUninterceptedOrReturn(continuation)\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.pipeline\n\nimport io.ktor.util.*\nimport io.ktor.util.CoroutineStackFrame\nimport io.ktor.util.StackTraceElement\nimport io.ktor.utils.io.*\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\nimport kotlin.coroutines.intrinsics.*\n\ninternal class SuspendFunctionGun(\n initial: TSubject,\n override val context: TContext,\n private val blocks: List>\n) : PipelineContext,\n @Suppress(\"DEPRECATION\")\n PipelineExecutor,\n CoroutineScope {\n\n override val coroutineContext: CoroutineContext get() = continuation.context\n\n // Stack-walking state\n private var lastPeekedIndex: Int = -1\n\n // this is impossible to inline because of property name clash\n // between PipelineContext.context and Continuation.context\n private val continuation: Continuation = object : Continuation, CoroutineStackFrame {\n override val callerFrame: CoroutineStackFrame? get() = peekContinuation() as? CoroutineStackFrame\n\n override fun getStackTraceElement(): StackTraceElement? = null\n\n private fun peekContinuation(): Continuation<*>? {\n if (lastPeekedIndex < 0) return null\n\n when (val rootContinuation = rootContinuation) {\n null -> return null\n is Continuation<*> -> {\n --lastPeekedIndex\n return rootContinuation\n }\n is ArrayList<*> -> {\n if (rootContinuation.isEmpty()) {\n // If the list is empty, then lastPeekedIndex should be -1\n // and null should be already returned at the beginning of the function.\n // So if we are here and see that the list is empty but lastPeekedIndex wasn't -1,\n // then it means that element(s) has disappeared concurrently.\n return StackWalkingFailedFrame\n }\n @Suppress(\"UNCHECKED_CAST\")\n return peekContinuationFromList(rootContinuation as List>)\n }\n else -> return null\n }\n }\n\n private fun peekContinuationFromList(list: List>): Continuation<*>? {\n // this is only invoked by debug agent during job state probes\n // lastPeekedIndex is non-volatile intentionally\n // and the list of continuations is not synchronized too\n // so this is not guaranteed to work properly (may produce incorrect trace),\n // but the only we care is to not crash here\n // and simply return StackWalkingFailedFrame on any unfortunate accident\n\n try {\n val index = lastPeekedIndex\n val result = list.getOrNull(index) ?: return StackWalkingFailedFrame\n lastPeekedIndex = index - 1\n return result\n } catch (_: Throwable) {\n return StackWalkingFailedFrame\n }\n }\n\n @Suppress(\"UNCHECKED_CAST\")\n override val context: CoroutineContext\n get() = when (val cont = rootContinuation) {\n null -> throw IllegalStateException(\"Not started\")\n is Continuation<*> -> cont.context\n is List<*> -> (cont as List>).last().context\n else -> throw IllegalStateException(\"Unexpected rootContinuation value\")\n }\n\n override fun resumeWith(result: Result) {\n if (result.isFailure) {\n resumeRootWith(Result.failure(result.exceptionOrNull()!!))\n return\n }\n\n loop(false)\n }\n }\n\n override var subject: TSubject = initial\n private set\n\n private var rootContinuation: Any? = null\n private var index = 0\n\n init {\n preventFreeze()\n }\n\n override fun finish() {\n index = blocks.size\n }\n\n override suspend fun proceed(): TSubject = suspendCoroutineUninterceptedOrReturn { continuation ->\n if (index == blocks.size) return@suspendCoroutineUninterceptedOrReturn subject\n\n addContinuation(continuation)\n\n if (loop(true)) {\n discardLastRootContinuation()\n return@suspendCoroutineUninterceptedOrReturn subject\n }\n\n COROUTINE_SUSPENDED\n }\n\n override suspend fun proceedWith(subject: TSubject): TSubject {\n this.subject = subject\n return proceed()\n }\n\n override suspend fun execute(initial: TSubject): TSubject {\n index = 0\n if (index == blocks.size) return initial\n subject = initial\n\n if (rootContinuation != null) throw IllegalStateException(\"Already started\")\n\n return proceed()\n }\n\n /**\n * @return `true` if it is possible to return result immediately\n */\n private fun loop(direct: Boolean): Boolean {\n do {\n val index = index // it is important to read index every time\n if (index == blocks.size) {\n if (!direct) {\n resumeRootWith(Result.success(subject))\n return false\n }\n\n return true\n }\n\n this@SuspendFunctionGun.index = index + 1 // it is important to increase it before function invocation\n val next = blocks[index]\n\n try {\n val me = this@SuspendFunctionGun\n\n val rc = next.startCoroutineUninterceptedOrReturn3(me, me.subject, me.continuation)\n if (rc === COROUTINE_SUSPENDED) {\n return false\n }\n } catch (cause: Throwable) {\n resumeRootWith(Result.failure(cause))\n return false\n }\n } while (true)\n }\n\n private fun resumeRootWith(result: Result) {\n val rootContinuation = rootContinuation\n\n @Suppress(\"UNCHECKED_CAST\")\n val next = when (rootContinuation) {\n null -> throw IllegalStateException(\"No more continuations to resume\")\n is Continuation<*> -> {\n this.rootContinuation = null\n lastPeekedIndex = -1\n rootContinuation\n }\n is ArrayList<*> -> {\n if (rootContinuation.isEmpty()) throw IllegalStateException(\"No more continuations to resume\")\n lastPeekedIndex = rootContinuation.lastIndex - 1\n rootContinuation.removeAt(rootContinuation.lastIndex)\n }\n else -> unexpectedRootContinuationValue(rootContinuation)\n } as Continuation\n\n if (!result.isFailure) {\n next.resumeWith(result)\n } else {\n val exception = recoverStackTraceBridge(result.exceptionOrNull()!!, next)\n next.resumeWithException(exception)\n }\n }\n\n private fun discardLastRootContinuation() {\n val rootContinuation = rootContinuation\n\n @Suppress(\"UNCHECKED_CAST\")\n when (rootContinuation) {\n null -> throw IllegalStateException(\"No more continuations to resume\")\n is Continuation<*> -> {\n lastPeekedIndex = -1\n this.rootContinuation = null\n }\n is ArrayList<*> -> {\n if (rootContinuation.isEmpty()) throw IllegalStateException(\"No more continuations to resume\")\n rootContinuation.removeAt(rootContinuation.lastIndex)\n lastPeekedIndex = rootContinuation.lastIndex\n }\n else -> unexpectedRootContinuationValue(rootContinuation)\n }\n }\n\n private fun addContinuation(continuation: Continuation) {\n when (val rootContinuation = rootContinuation) {\n null -> {\n lastPeekedIndex = 0\n this.rootContinuation = continuation\n }\n is Continuation<*> -> {\n this.rootContinuation = ArrayList>(blocks.size).apply {\n add(rootContinuation)\n add(continuation)\n lastPeekedIndex = 1\n }\n }\n is ArrayList<*> -> {\n @Suppress(\"UNCHECKED_CAST\")\n rootContinuation as ArrayList>\n rootContinuation.add(continuation)\n lastPeekedIndex = rootContinuation.lastIndex\n }\n else -> unexpectedRootContinuationValue(rootContinuation)\n }\n }\n\n private fun unexpectedRootContinuationValue(rootContinuation: Any?): Nothing {\n throw IllegalStateException(\"Unexpected rootContinuation content: $rootContinuation\")\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\n/**\n * Create ES specific [Attributes] instance.\n */\n@JsName(\"AttributesJsFn\")\npublic actual fun Attributes(concurrent: Boolean): Attributes = AttributesJs()\n\n@Suppress(\"KDocMissingDocumentation\")\npublic class AttributesJs : Attributes {\n private val map = mutableMapOf, Any?>()\n\n @Suppress(\"UNCHECKED_CAST\")\n override fun getOrNull(key: AttributeKey): T? = map[key] as T?\n\n override operator fun contains(key: AttributeKey<*>): Boolean = map.containsKey(key)\n\n override fun put(key: AttributeKey, value: T) {\n map[key] = value\n }\n\n override fun remove(key: AttributeKey) {\n map.remove(key)\n }\n\n @Suppress(\"UNCHECKED_CAST\")\n override fun computeIfAbsent(key: AttributeKey, block: () -> T): T {\n map[key]?.let { return it as T }\n return block().also { result ->\n map[key] = result\n }\n }\n\n override val allKeys: List>\n get() = map.keys.toList()\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\npublic actual fun Set.unmodifiable(): Set = this\n","// ktlint-disable filename\n/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\npublic actual object PlatformUtils {\n public actual val IS_BROWSER: Boolean = js(\n \"typeof window !== 'undefined' && typeof window.document !== 'undefined'\"\n ) as Boolean\n\n public actual val IS_NODE: Boolean = js(\n \"typeof process !== 'undefined' && process.versions != null && process.versions.node != null\"\n ) as Boolean\n\n public actual val IS_JVM: Boolean = false\n public actual val IS_NATIVE: Boolean = false\n public actual val IS_DEVELOPMENT_MODE: Boolean = false\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\nimport kotlin.reflect.*\n\n@Suppress(\"UNUSED\")\ninternal actual interface CoroutineStackFrame {\n public actual val callerFrame: CoroutineStackFrame?\n public actual fun getStackTraceElement(): StackTraceElement?\n}\n\n@Suppress(\"ACTUAL_WITHOUT_EXPECT\")\ninternal actual typealias StackTraceElement = Any\n\n@Suppress(\"FunctionName\")\ninternal actual fun createStackTraceElement(\n kClass: KClass<*>,\n methodName: String,\n fileName: String,\n lineNumber: Int\n): StackTraceElement = Any()\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.date\n\nimport kotlin.js.*\n\npublic actual fun GMTDate(timestamp: Long?): GMTDate {\n val date = timestamp?.toDouble()?.let { Date(it) } ?: Date()\n\n if (date.getTime().isNaN()) throw InvalidTimestampException(timestamp!!)\n\n with(date) {\n /* from SUNDAY 0 -> MONDAY 0 */\n val dayOfWeek = WeekDay.from((getUTCDay() + 6) % 7)\n\n val month = Month.from(getUTCMonth())\n\n return GMTDate(\n getUTCSeconds(),\n getUTCMinutes(),\n getUTCHours(),\n\n dayOfWeek,\n getUTCDate(),\n getUTCFullYear(),\n\n month,\n getUTCFullYear(),\n\n getTime().toLong()\n )\n }\n}\n\npublic actual fun GMTDate(seconds: Int, minutes: Int, hours: Int, dayOfMonth: Int, month: Month, year: Int): GMTDate {\n val timestamp = Date.UTC(year, month.ordinal, dayOfMonth, hours, minutes, seconds).toLong()\n return GMTDate(timestamp)\n}\n\n/**\n * Invalid exception: possible overflow or underflow\n */\npublic class InvalidTimestampException(timestamp: Long) : IllegalStateException(\n \"Invalid date timestamp exception: $timestamp\"\n)\n\n/**\n * Gets current system time in milliseconds since certain moment in the past, only delta between two subsequent calls makes sense.\n */\npublic actual fun getTimeMillis(): Long = Date().getTime().toLong()\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util.network\n\n/**\n * Represents remote endpoint with [hostname] and [port].\n *\n * The address will be resolved after construction.\n *\n * @throws UnresolvedAddressException if the [hostname] cannot be resolved.\n */\npublic actual class NetworkAddress internal constructor(\n internal val hostname: String,\n internal val port: Int,\n internal val address: String\n)\n\n/**\n * Network address hostname.\n */\npublic actual val NetworkAddress.hostname: String\n get() = hostname\n\n/**\n * Network address port.\n */\npublic actual val NetworkAddress.port: Int\n get() = port\n\n/**\n * Represents remote endpoint with [hostname] and [port].\n *\n * The address will be resolved after construction.\n *\n * @throws UnresolvedAddressException if the [hostname] cannot be resolved.\n */\npublic actual fun NetworkAddress(hostname: String, port: Int): NetworkAddress =\n NetworkAddress(hostname, port, hostname)\n\npublic actual class UnresolvedAddressException : IllegalArgumentException()\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.util\n\nimport kotlinx.coroutines.*\nimport org.khronos.webgl.*\nimport kotlin.js.*\n\nprivate const val NONCE_SIZE_IN_BYTES = 8\n\n/**\n * Generates a nonce string.\n */\n@InternalAPI\npublic actual fun generateNonce(): String {\n val buffer = ByteArray(NONCE_SIZE_IN_BYTES)\n if (PlatformUtils.IS_NODE) {\n _crypto.randomFillSync(buffer)\n } else {\n _crypto.getRandomValues(buffer)\n }\n return hex(buffer)\n}\n\n/**\n * Create [Digest] from specified hash [name].\n */\n@InternalAPI\npublic actual fun Digest(name: String): Digest = object : Digest {\n private val state = mutableListOf()\n override fun plusAssign(bytes: ByteArray) {\n state += bytes\n }\n\n override fun reset() {\n state.clear()\n }\n\n override suspend fun build(): ByteArray {\n val snapshot = state.reduce { a, b -> a + b }\n val digestBuffer = _crypto.subtle.digest(name, snapshot).asDeferred().await()\n val digestView = DataView(digestBuffer)\n return ByteArray(digestView.byteLength) { digestView.getUint8(it) }\n }\n}\n\n// Variable is renamed to `_crypto` so it wouldn't clash with existing `crypto` variable.\n// JS IR backend doesn't reserve names accessed inside js(\"\") calls\nprivate val _crypto: Crypto = if (PlatformUtils.IS_NODE) js(\"require('crypto')\") else js(\"(crypto ? crypto : msCrypto)\")\n\nprivate external class Crypto {\n val subtle: SubtleCrypto\n\n public fun getRandomValues(array: ByteArray)\n\n public fun randomFillSync(array: ByteArray)\n}\n\nprivate external class SubtleCrypto {\n public fun digest(algoName: String, buffer: ByteArray): Promise\n}\n\n/**\n * Compute SHA-1 hash for the specified [bytes]\n */\npublic actual fun sha1(bytes: ByteArray): ByteArray = error(\"sha1 currently is not supported in ktor-js\")\n","'use strict'\nvar inherits = require('inherits')\nvar MD5 = require('md5.js')\nvar RIPEMD160 = require('ripemd160')\nvar sha = require('sha.js')\nvar Base = require('cipher-base')\n\nfunction Hash (hash) {\n Base.call(this, 'digest')\n\n this._hash = hash\n}\n\ninherits(Hash, Base)\n\nHash.prototype._update = function (data) {\n this._hash.update(data)\n}\n\nHash.prototype._final = function () {\n return this._hash.digest()\n}\n\nmodule.exports = function createHash (alg) {\n alg = alg.toLowerCase()\n if (alg === 'md5') return new MD5()\n if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()\n\n return new Hash(sha(alg))\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// NOTE: These type checking functions intentionally don't use `instanceof`\n// because it is fragile and can be easily faked with `Object.create()`.\n\nfunction isArray(arg) {\n if (Array.isArray) {\n return Array.isArray(arg);\n }\n return objectToString(arg) === '[object Array]';\n}\nexports.isArray = isArray;\n\nfunction isBoolean(arg) {\n return typeof arg === 'boolean';\n}\nexports.isBoolean = isBoolean;\n\nfunction isNull(arg) {\n return arg === null;\n}\nexports.isNull = isNull;\n\nfunction isNullOrUndefined(arg) {\n return arg == null;\n}\nexports.isNullOrUndefined = isNullOrUndefined;\n\nfunction isNumber(arg) {\n return typeof arg === 'number';\n}\nexports.isNumber = isNumber;\n\nfunction isString(arg) {\n return typeof arg === 'string';\n}\nexports.isString = isString;\n\nfunction isSymbol(arg) {\n return typeof arg === 'symbol';\n}\nexports.isSymbol = isSymbol;\n\nfunction isUndefined(arg) {\n return arg === void 0;\n}\nexports.isUndefined = isUndefined;\n\nfunction isRegExp(re) {\n return objectToString(re) === '[object RegExp]';\n}\nexports.isRegExp = isRegExp;\n\nfunction isObject(arg) {\n return typeof arg === 'object' && arg !== null;\n}\nexports.isObject = isObject;\n\nfunction isDate(d) {\n return objectToString(d) === '[object Date]';\n}\nexports.isDate = isDate;\n\nfunction isError(e) {\n return (objectToString(e) === '[object Error]' || e instanceof Error);\n}\nexports.isError = isError;\n\nfunction isFunction(arg) {\n return typeof arg === 'function';\n}\nexports.isFunction = isFunction;\n\nfunction isPrimitive(arg) {\n return arg === null ||\n typeof arg === 'boolean' ||\n typeof arg === 'number' ||\n typeof arg === 'string' ||\n typeof arg === 'symbol' || // ES6 symbol\n typeof arg === 'undefined';\n}\nexports.isPrimitive = isPrimitive;\n\nexports.isBuffer = Buffer.isBuffer;\n\nfunction objectToString(o) {\n return Object.prototype.toString.call(o);\n}\n","module.exports = function xor (a, b) {\n var length = Math.min(a.length, b.length)\n var buffer = new Buffer(length)\n\n for (var i = 0; i < length; ++i) {\n buffer[i] = a[i] ^ b[i]\n }\n\n return buffer\n}\n","'use strict';\n\nvar utils = require('./utils');\nvar assert = require('minimalistic-assert');\n\nfunction BlockHash() {\n this.pending = null;\n this.pendingTotal = 0;\n this.blockSize = this.constructor.blockSize;\n this.outSize = this.constructor.outSize;\n this.hmacStrength = this.constructor.hmacStrength;\n this.padLength = this.constructor.padLength / 8;\n this.endian = 'big';\n\n this._delta8 = this.blockSize / 8;\n this._delta32 = this.blockSize / 32;\n}\nexports.BlockHash = BlockHash;\n\nBlockHash.prototype.update = function update(msg, enc) {\n // Convert message to array, pad it, and join into 32bit blocks\n msg = utils.toArray(msg, enc);\n if (!this.pending)\n this.pending = msg;\n else\n this.pending = this.pending.concat(msg);\n this.pendingTotal += msg.length;\n\n // Enough data, try updating\n if (this.pending.length >= this._delta8) {\n msg = this.pending;\n\n // Process pending data in blocks\n var r = msg.length % this._delta8;\n this.pending = msg.slice(msg.length - r, msg.length);\n if (this.pending.length === 0)\n this.pending = null;\n\n msg = utils.join32(msg, 0, msg.length - r, this.endian);\n for (var i = 0; i < msg.length; i += this._delta32)\n this._update(msg, i, i + this._delta32);\n }\n\n return this;\n};\n\nBlockHash.prototype.digest = function digest(enc) {\n this.update(this._pad());\n assert(this.pending === null);\n\n return this._digest(enc);\n};\n\nBlockHash.prototype._pad = function pad() {\n var len = this.pendingTotal;\n var bytes = this._delta8;\n var k = bytes - ((len + this.padLength) % bytes);\n var res = new Array(k + this.padLength);\n res[0] = 0x80;\n for (var i = 1; i < k; i++)\n res[i] = 0;\n\n // Append length\n len <<= 3;\n if (this.endian === 'big') {\n for (var t = 8; t < this.padLength; t++)\n res[i++] = 0;\n\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = len & 0xff;\n } else {\n res[i++] = len & 0xff;\n res[i++] = (len >>> 8) & 0xff;\n res[i++] = (len >>> 16) & 0xff;\n res[i++] = (len >>> 24) & 0xff;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n res[i++] = 0;\n\n for (t = 8; t < this.padLength; t++)\n res[i++] = 0;\n }\n\n return res;\n};\n","'use strict';\n\nconst inherits = require('inherits');\nconst Reporter = require('../base/reporter').Reporter;\nconst Buffer = require('safer-buffer').Buffer;\n\nfunction DecoderBuffer(base, options) {\n Reporter.call(this, options);\n if (!Buffer.isBuffer(base)) {\n this.error('Input not Buffer');\n return;\n }\n\n this.base = base;\n this.offset = 0;\n this.length = base.length;\n}\ninherits(DecoderBuffer, Reporter);\nexports.DecoderBuffer = DecoderBuffer;\n\nDecoderBuffer.isDecoderBuffer = function isDecoderBuffer(data) {\n if (data instanceof DecoderBuffer) {\n return true;\n }\n\n // Or accept compatible API\n const isCompatible = typeof data === 'object' &&\n Buffer.isBuffer(data.base) &&\n data.constructor.name === 'DecoderBuffer' &&\n typeof data.offset === 'number' &&\n typeof data.length === 'number' &&\n typeof data.save === 'function' &&\n typeof data.restore === 'function' &&\n typeof data.isEmpty === 'function' &&\n typeof data.readUInt8 === 'function' &&\n typeof data.skip === 'function' &&\n typeof data.raw === 'function';\n\n return isCompatible;\n};\n\nDecoderBuffer.prototype.save = function save() {\n return { offset: this.offset, reporter: Reporter.prototype.save.call(this) };\n};\n\nDecoderBuffer.prototype.restore = function restore(save) {\n // Return skipped data\n const res = new DecoderBuffer(this.base);\n res.offset = save.offset;\n res.length = this.offset;\n\n this.offset = save.offset;\n Reporter.prototype.restore.call(this, save.reporter);\n\n return res;\n};\n\nDecoderBuffer.prototype.isEmpty = function isEmpty() {\n return this.offset === this.length;\n};\n\nDecoderBuffer.prototype.readUInt8 = function readUInt8(fail) {\n if (this.offset + 1 <= this.length)\n return this.base.readUInt8(this.offset++, true);\n else\n return this.error(fail || 'DecoderBuffer overrun');\n};\n\nDecoderBuffer.prototype.skip = function skip(bytes, fail) {\n if (!(this.offset + bytes <= this.length))\n return this.error(fail || 'DecoderBuffer overrun');\n\n const res = new DecoderBuffer(this.base);\n\n // Share reporter state\n res._reporterState = this._reporterState;\n\n res.offset = this.offset;\n res.length = this.offset + bytes;\n this.offset += bytes;\n return res;\n};\n\nDecoderBuffer.prototype.raw = function raw(save) {\n return this.base.slice(save ? save.offset : this.offset, this.length);\n};\n\nfunction EncoderBuffer(value, reporter) {\n if (Array.isArray(value)) {\n this.length = 0;\n this.value = value.map(function(item) {\n if (!EncoderBuffer.isEncoderBuffer(item))\n item = new EncoderBuffer(item, reporter);\n this.length += item.length;\n return item;\n }, this);\n } else if (typeof value === 'number') {\n if (!(0 <= value && value <= 0xff))\n return reporter.error('non-byte EncoderBuffer value');\n this.value = value;\n this.length = 1;\n } else if (typeof value === 'string') {\n this.value = value;\n this.length = Buffer.byteLength(value);\n } else if (Buffer.isBuffer(value)) {\n this.value = value;\n this.length = value.length;\n } else {\n return reporter.error('Unsupported type: ' + typeof value);\n }\n}\nexports.EncoderBuffer = EncoderBuffer;\n\nEncoderBuffer.isEncoderBuffer = function isEncoderBuffer(data) {\n if (data instanceof EncoderBuffer) {\n return true;\n }\n\n // Or accept compatible API\n const isCompatible = typeof data === 'object' &&\n data.constructor.name === 'EncoderBuffer' &&\n typeof data.length === 'number' &&\n typeof data.join === 'function';\n\n return isCompatible;\n};\n\nEncoderBuffer.prototype.join = function join(out, offset) {\n if (!out)\n out = Buffer.alloc(this.length);\n if (!offset)\n offset = 0;\n\n if (this.length === 0)\n return out;\n\n if (Array.isArray(this.value)) {\n this.value.forEach(function(item) {\n item.join(out, offset);\n offset += item.length;\n });\n } else {\n if (typeof this.value === 'number')\n out[offset] = this.value;\n else if (typeof this.value === 'string')\n out.write(this.value, offset);\n else if (Buffer.isBuffer(this.value))\n this.value.copy(out, offset);\n offset += this.length;\n }\n\n return out;\n};\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models\n\ndata class DownloadRecord(\n var id: Long = 0,\n var type: String,\n var name: String,\n var link: String,\n var coverUrl: String,\n var totalFiles: Long = 1,\n)\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models\n\nsealed class AllPlatforms {\n object Js : AllPlatforms()\n object Jvm : AllPlatforms()\n object Native : AllPlatforms()\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models\n\nsealed class CorsProxy(open val url: String) {\n data class SelfHostedCorsProxy(override val url: String = \"https://spotiflyer.azurewebsites.net/\") : CorsProxy(url)\n data class PublicProxyWithExtension(override val url: String = \"https://cors.bridged.cc/\") : CorsProxy(url)\n\n fun toggle(mode: CorsProxy? = null): CorsProxy {\n mode?.let {\n corsProxy = mode\n return corsProxy\n }\n corsProxy = when (corsProxy) {\n is SelfHostedCorsProxy -> PublicProxyWithExtension()\n is PublicProxyWithExtension -> SelfHostedCorsProxy()\n }\n return corsProxy\n }\n\n fun extensionMode(): Boolean {\n return when (corsProxy) {\n is SelfHostedCorsProxy -> false\n is PublicProxyWithExtension -> true\n }\n }\n}\n\n/*\n* This Var Keeps Track for Cors Config in JS Platform\n* Default Self Hosted, However ask user to use extension if possible.\n* */\nvar corsProxy: CorsProxy = CorsProxy.SelfHostedCorsProxy()\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models\n\nimport com.shabinder.common.models.spotify.Source\nimport dev.icerock.moko.parcelize.Parcelable\nimport dev.icerock.moko.parcelize.Parcelize\nimport kotlinx.serialization.Serializable\n\n@Parcelize\n@Serializable\ndata class TrackDetails(\n var title: String,\n var artists: List,\n var durationSec: Int,\n var albumName: String? = null,\n var year: String? = null,\n var comment: String? = null,\n var lyrics: String? = null,\n var trackUrl: String? = null,\n var albumArtPath: String,\n var albumArtURL: String,\n var source: Source,\n val progress: Int = 2,\n val downloaded: DownloadStatus = DownloadStatus.NotDownloaded,\n var outputFilePath: String,\n var videoID: String? = null,\n) : Parcelable\n\n@Serializable\nsealed class DownloadStatus : Parcelable {\n @Parcelize object Downloaded : DownloadStatus()\n @Parcelize data class Downloading(val progress: Int = 2) : DownloadStatus()\n @Parcelize object Queued : DownloadStatus()\n @Parcelize object NotDownloaded : DownloadStatus()\n @Parcelize object Converting : DownloadStatus()\n @Parcelize object Failed : DownloadStatus()\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models\n\nsealed class DownloadResult {\n\n data class Error(val message: String, val cause: Exception? = null) : DownloadResult()\n\n data class Progress(val progress: Int) : DownloadResult()\n\n data class Success(val byteArray: ByteArray) : DownloadResult() {\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (other == null || this::class != other::class) return false\n\n other as Success\n\n if (!byteArray.contentEquals(other.byteArray)) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n return byteArray.contentHashCode()\n }\n }\n}\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models\n\nimport com.shabinder.common.models.spotify.Source\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class PlatformQueryResult(\n var folderType: String,\n var subFolder: String,\n var title: String,\n var coverUrl: String,\n var trackList: List,\n var source: Source\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class YoutubeTrack(\n var name: String? = null,\n var type: String? = null, // Song / Video\n var artist: String? = null,\n var duration: String? = null,\n var videoId: String? = null\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Artist(\n val popularity: Int,\n val seokey: String,\n val name: String,\n @SerialName(\"artwork_175x175\")var artworkLink: String? = null\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class CustomArtworks(\n @SerialName(\"40x40\") val size_40p: String,\n @SerialName(\"80x80\") val size_80p: String,\n @SerialName(\"110x110\")val size_110p: String,\n @SerialName(\"175x175\")val size_175p: String,\n @SerialName(\"480x480\")val size_480p: String,\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class GaanaAlbum(\n val tracks: List,\n val count: Int,\n val custom_artworks: CustomArtworks,\n val release_year: Int,\n val favorite_count: Int,\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class GaanaArtistDetails(\n val artist: List,\n val count: Int,\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class GaanaArtistTracks(\n val count: Int,\n val tracks: List? = null\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class GaanaPlaylist(\n val modified_on: String,\n val count: Int,\n val created_on: String,\n val favorite_count: Int,\n val tracks: List,\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class GaanaSong(\n val tracks: List\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.gaana\n\nimport com.shabinder.common.models.DownloadStatus\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class GaanaTrack(\n val tags: List? = null,\n val seokey: String,\n val albumseokey: String? = null,\n val track_title: String,\n val album_title: String? = null,\n val language: String? = null,\n val duration: Int,\n @SerialName(\"artwork_large\") val artworkLink: String,\n val artist: List = emptyList(),\n @SerialName(\"gener\") val genre: List? = null,\n val lyrics_url: String? = null,\n val youtube_id: String? = null,\n val total_favourite_count: Int? = null,\n val release_date: String? = null,\n val play_ct: String? = null,\n val secondary_language: String? = null,\n var downloaded: DownloadStatus? = DownloadStatus.NotDownloaded\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Genre(\n val genre_id: Int,\n val name: String\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.gaana\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Tags(\n val tag_id: Int,\n val tag_name: String\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Album(\n var album_type: String? = null,\n var artists: List? = null,\n var available_markets: List? = null,\n var copyrights: List? = null,\n var external_ids: Map? = null,\n var external_urls: Map? = null,\n var genres: List? = null,\n var href: String? = null,\n var id: String? = null,\n var images: List? = null,\n var label: String? = null,\n var name: String? = null,\n var popularity: Int? = null,\n var release_date: String? = null,\n var release_date_precision: String? = null,\n var tracks: PagingObjectTrack? = null,\n var type: String? = null,\n var uri: String? = null\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Artist(\n var external_urls: Map? = null,\n var href: String? = null,\n var id: String? = null,\n var name: String? = null,\n var type: String? = null,\n var uri: String? = null\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Copyright(\n var text: String? = null,\n var type: String? = null\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Followers(\n var href: String? = null,\n var total: Int? = null\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Image(\n var width: Int? = null,\n var height: Int? = null,\n var url: String? = null\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class LinkedTrack(\n var external_urls: Map? = null,\n var href: String? = null,\n var id: String? = null,\n var type: String? = null,\n var uri: String? = null\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class PagingObjectPlaylistTrack(\n var href: String? = null,\n var items: List? = null,\n var limit: Int = 0,\n var next: String? = null,\n var offset: Int = 0,\n var previous: String? = null,\n var total: Int = 0\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class PagingObjectTrack(\n var href: String? = null,\n var items: List? = null,\n var limit: Int = 0,\n var next: String? = null,\n var offset: Int = 0,\n var previous: String? = null,\n var total: Int = 0\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Playlist(\n @SerialName(\"collaborative\")var is_collaborative: Boolean? = null,\n var description: String? = null,\n var external_urls: Map? = null,\n var followers: Followers? = null,\n var href: String? = null,\n var id: String? = null,\n var images: List? = null,\n var name: String? = null,\n var owner: UserPublic? = null,\n @SerialName(\"public\")var is_public: Boolean? = null,\n var snapshot_id: String? = null,\n var tracks: PagingObjectPlaylistTrack? = null,\n var type: String? = null,\n var uri: String? = null\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class PlaylistTrack(\n var added_at: String? = null,\n var added_by: UserPublic? = null,\n var track: Track? = null,\n var is_local: Boolean? = null\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.spotify\n\nenum class Source {\n Spotify,\n YouTube,\n Gaana,\n}\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.SerialName\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class TokenData(\n var access_token: String?,\n var token_type: String?,\n @SerialName(\"expires_in\") var expiry: Long?\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.spotify\n\nimport com.shabinder.common.models.DownloadStatus\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class Track(\n var artists: List? = null,\n var available_markets: List? = null,\n var is_playable: Boolean? = null,\n var linked_from: LinkedTrack? = null,\n var disc_number: Int = 0,\n var duration_ms: Long = 0,\n var explicit: Boolean? = null,\n var external_urls: Map? = null,\n var href: String? = null,\n var name: String? = null,\n var preview_url: String? = null,\n var track_number: Int = 0,\n var type: String? = null,\n var uri: String? = null,\n var album: Album? = null,\n var external_ids: Map? = null,\n var popularity: Int? = null,\n var downloaded: DownloadStatus = DownloadStatus.NotDownloaded\n)\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.models.spotify\n\nimport kotlinx.serialization.Serializable\n\n@Serializable\ndata class UserPublic(\n var display_name: String? = null,\n var external_urls: Map? = null,\n var followers: Followers? = null,\n var href: String? = null,\n var id: String? = null,\n var images: List? = null,\n var type: String? = null,\n var uri: String? = null\n)\n","/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.properties\n\nimport kotlin.reflect.KProperty\n\n/**\n * Standard property delegates.\n */\npublic object Delegates {\n /**\n * Returns a property delegate for a read/write property with a non-`null` value that is initialized not during\n * object construction time but at a later time. Trying to read the property before the initial value has been\n * assigned results in an exception.\n *\n * @sample samples.properties.Delegates.notNullDelegate\n */\n public fun notNull(): ReadWriteProperty = NotNullVar()\n\n /**\n * Returns a property delegate for a read/write property that calls a specified callback function when changed.\n * @param initialValue the initial value of the property.\n * @param onChange the callback which is called after the change of the property is made. The value of the property\n * has already been changed when this callback is invoked.\n *\n * @sample samples.properties.Delegates.observableDelegate\n */\n public inline fun observable(initialValue: T, crossinline onChange: (property: KProperty<*>, oldValue: T, newValue: T) -> Unit):\n ReadWriteProperty =\n object : ObservableProperty(initialValue) {\n override fun afterChange(property: KProperty<*>, oldValue: T, newValue: T) = onChange(property, oldValue, newValue)\n }\n\n /**\n * Returns a property delegate for a read/write property that calls a specified callback function when changed,\n * allowing the callback to veto the modification.\n * @param initialValue the initial value of the property.\n * @param onChange the callback which is called before a change to the property value is attempted.\n * The value of the property hasn't been changed yet, when this callback is invoked.\n * If the callback returns `true` the value of the property is being set to the new value,\n * and if the callback returns `false` the new value is discarded and the property remains its old value.\n *\n * @sample samples.properties.Delegates.vetoableDelegate\n * @sample samples.properties.Delegates.throwVetoableDelegate\n */\n public inline fun vetoable(initialValue: T, crossinline onChange: (property: KProperty<*>, oldValue: T, newValue: T) -> Boolean):\n ReadWriteProperty =\n object : ObservableProperty(initialValue) {\n override fun beforeChange(property: KProperty<*>, oldValue: T, newValue: T): Boolean = onChange(property, oldValue, newValue)\n }\n\n}\n\n\nprivate class NotNullVar() : ReadWriteProperty {\n private var value: T? = null\n\n public override fun getValue(thisRef: Any?, property: KProperty<*>): T {\n return value ?: throw IllegalStateException(\"Property ${property.name} should be initialized before get.\")\n }\n\n public override fun setValue(thisRef: Any?, property: KProperty<*>, value: T) {\n this.value = value\n }\n}\n\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features.cache\n\nimport io.ktor.client.call.*\nimport io.ktor.client.statement.*\nimport io.ktor.http.*\nimport io.ktor.util.*\nimport io.ktor.util.date.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.core.*\n\ninternal suspend fun HttpCacheEntry(response: HttpResponse): HttpCacheEntry {\n val body = response.content.readRemaining().readBytes()\n response.complete()\n return HttpCacheEntry(response.cacheExpires(), response.varyKeys(), response, body)\n}\n\n/**\n * Client single response cache with [expires] and [varyKeys].\n */\n@KtorExperimentalAPI\n@Suppress(\"KDocMissingDocumentation\")\npublic class HttpCacheEntry internal constructor(\n public val expires: GMTDate,\n public val varyKeys: Map,\n public val response: HttpResponse,\n public val body: ByteArray\n) {\n internal val responseHeaders: Headers = Headers.build {\n appendAll(response.headers)\n }\n\n internal fun produceResponse(): HttpResponse {\n val currentClient = response.call.client ?: error(\"Failed to save response in cache in different thread.\")\n val call = SavedHttpCall(currentClient)\n call.response = SavedHttpResponse(call, body, response)\n call.request = SavedHttpRequest(call, response.call.request)\n\n return call.response\n }\n\n override fun equals(other: Any?): Boolean {\n if (other == null || other !is HttpCacheEntry) return false\n if (other === this) return true\n return varyKeys == other.varyKeys\n }\n\n override fun hashCode(): Int {\n return varyKeys.hashCode()\n }\n}\n\ninternal fun HttpResponse.varyKeys(): Map {\n val validationKeys = vary() ?: return emptyMap()\n\n val result = mutableMapOf()\n val requestHeaders = call.request.headers\n\n for (key in validationKeys) {\n result[key] = requestHeaders[key] ?: \"\"\n }\n\n return result\n}\n\ninternal fun HttpResponse.cacheExpires(fallback: () -> GMTDate = { GMTDate() }): GMTDate {\n val cacheControl = cacheControl()\n\n val isPrivate = CacheControl.PRIVATE in cacheControl\n\n val maxAgeKey = if (isPrivate) \"s-max-age\" else \"max-age\"\n\n val maxAge = cacheControl.firstOrNull { it.value.startsWith(maxAgeKey) }\n ?.value?.split(\"=\")\n ?.get(1)?.toInt()\n\n if (maxAge != null) {\n return call.response.requestTime + maxAge * 1000L\n }\n\n val expires = headers[HttpHeaders.Expires]\n return expires?.let {\n // Handle \"0\" case faster\n if (it == \"0\" || it.isBlank()) return fallback()\n\n return try {\n it.fromHttpToGmtDate()\n } catch (e: Throwable) {\n fallback()\n }\n } ?: fallback()\n}\n\ninternal fun HttpCacheEntry.shouldValidate(): Boolean {\n val cacheControl = responseHeaders[HttpHeaders.CacheControl]?.let { parseHeaderValue(it) } ?: emptyList()\n val isStale = GMTDate() > expires\n // must-revalidate; re-validate once STALE, and MUST NOT return a cached response once stale.\n // This is how majority of clients implement the RFC\n // OkHttp Implements this the same: https://github.com/square/okhttp/issues/4043#issuecomment-403679369\n // Disabled for now, as we don't currently return a cached object when there's a network failure; must-revalidate\n // works the same as being stale on the request side. On response side, must-revalidate would not return a cached\n // object if we are stale and couldn't refresh.\n // isStale = isStale && CacheControl.MUST_REVALIDATE in cacheControl\n return isStale || CacheControl.NO_CACHE in cacheControl\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features.websocket\n\nimport io.ktor.client.*\nimport io.ktor.client.call.*\nimport io.ktor.client.engine.*\nimport io.ktor.client.features.*\nimport io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport io.ktor.http.*\nimport io.ktor.http.cio.websocket.*\nimport io.ktor.util.*\nimport kotlin.native.concurrent.*\n\n@ExperimentalWebSocketExtensionApi\n@SharedImmutable\nprivate val REQUEST_EXTENSIONS_KEY = AttributeKey>>(\"Websocket extensions\")\n\n/**\n * Indicates if a client engine supports WebSockets.\n */\npublic object WebSocketCapability : HttpClientEngineCapability {\n override fun toString(): String = \"WebSocketCapability\"\n}\n\n/**\n * Indicates if a client engine supports extensions for WebSocket feature.\n */\npublic object WebSocketExtensionsCapability : HttpClientEngineCapability {\n override fun toString(): String = \"WebSocketExtensionsCapability\"\n}\n\n/**\n * Client WebSocket feature.\n *\n * @property pingInterval - interval between [FrameType.PING] messages.\n * @property maxFrameSize - max size of single websocket frame.\n * @property extensionsConfig - extensions configuration\n */\n@OptIn(WebSocketInternalAPI::class)\npublic class WebSockets @OptIn(ExperimentalWebSocketExtensionApi::class)\ninternal constructor(\n public val pingInterval: Long,\n public val maxFrameSize: Long,\n private val extensionsConfig: WebSocketExtensionsConfig\n) {\n /**\n * Client WebSocket feature.\n *\n * @property pingInterval - interval between [FrameType.PING] messages.\n * @property maxFrameSize - max size of single websocket frame.\n */\n @OptIn(ExperimentalWebSocketExtensionApi::class)\n public constructor(\n pingInterval: Long = -1L,\n maxFrameSize: Long = Int.MAX_VALUE.toLong(),\n ) : this(pingInterval, maxFrameSize, WebSocketExtensionsConfig())\n\n /**\n * Client WebSocket feature.\n */\n @OptIn(ExperimentalWebSocketExtensionApi::class)\n public constructor() : this(-1L, Int.MAX_VALUE.toLong(), WebSocketExtensionsConfig())\n\n @ExperimentalWebSocketExtensionApi\n private fun installExtensions(context: HttpRequestBuilder) {\n val installed = extensionsConfig.build()\n context.attributes.put(REQUEST_EXTENSIONS_KEY, installed)\n\n val protocols = installed.flatMap { it.protocols }\n addNegotiatedProtocols(context, protocols)\n }\n\n @Suppress(\"UNCHECKED_CAST\")\n @ExperimentalWebSocketExtensionApi\n private fun completeNegotiation(\n call: HttpClientCall\n ): List> {\n val serverExtensions: List = call.response\n .headers[HttpHeaders.SecWebSocketExtensions]\n ?.let { parseWebSocketExtensions(it) } ?: emptyList()\n\n val clientExtensions = call.attributes[REQUEST_EXTENSIONS_KEY]\n\n return clientExtensions.filter { it.clientNegotiation(serverExtensions) }\n }\n\n @OptIn(ExperimentalWebSocketExtensionApi::class)\n private fun addNegotiatedProtocols(context: HttpRequestBuilder, protocols: List) {\n val headerValue = protocols.joinToString(\";\")\n context.header(HttpHeaders.SecWebSocketExtensions, headerValue)\n }\n\n internal fun convertSessionToDefault(session: WebSocketSession): DefaultWebSocketSession {\n if (session is DefaultWebSocketSession) return session\n\n return DefaultWebSocketSession(session, pingInterval, timeoutMillis = pingInterval * 2).also {\n it.maxFrameSize = this@WebSockets.maxFrameSize\n }\n }\n\n init {\n }\n\n /**\n * [WebSockets] configuration.\n */\n public class Config {\n @ExperimentalWebSocketExtensionApi\n internal val extensionsConfig: WebSocketExtensionsConfig = WebSocketExtensionsConfig()\n\n /**\n * Sets interval of sending ping frames.\n *\n * Value -1L is for disabled ping.\n */\n public var pingInterval: Long = -1L\n\n /**\n * Sets maximum frame size in bytes.\n */\n public var maxFrameSize: Long = Int.MAX_VALUE.toLong()\n\n /**\n * Configure WebSocket extensions.\n */\n @ExperimentalWebSocketExtensionApi\n public fun extensions(block: WebSocketExtensionsConfig.() -> Unit) {\n extensionsConfig.apply(block)\n }\n }\n\n /**\n * Add WebSockets support for ktor http client.\n */\n public companion object Feature : HttpClientFeature {\n override val key: AttributeKey = AttributeKey(\"Websocket\")\n\n @OptIn(ExperimentalWebSocketExtensionApi::class)\n override fun prepare(block: Config.() -> Unit): WebSockets {\n val config = Config().apply(block)\n return WebSockets(config.pingInterval, config.maxFrameSize, config.extensionsConfig)\n }\n\n @OptIn(ExperimentalWebSocketExtensionApi::class)\n override fun install(feature: WebSockets, scope: HttpClient) {\n val extensionsSupported = scope.engine.supportedCapabilities.contains(WebSocketExtensionsCapability)\n\n scope.requestPipeline.intercept(HttpRequestPipeline.Render) {\n if (!context.url.protocol.isWebsocket()) return@intercept\n context.setCapability(WebSocketCapability, Unit)\n\n if (extensionsSupported) {\n feature.installExtensions(context)\n }\n\n proceedWith(WebSocketContent())\n }\n\n scope.responsePipeline.intercept(HttpResponsePipeline.Transform) { (info, session) ->\n if (session !is WebSocketSession) return@intercept\n\n val clientSession: ClientWebSocketSession = when (info.type) {\n DefaultClientWebSocketSession::class -> {\n val defaultSession = feature.convertSessionToDefault(session)\n val clientSession = DefaultClientWebSocketSession(context, defaultSession)\n\n val negotiated = if (extensionsSupported) {\n feature.completeNegotiation(context)\n } else emptyList()\n\n clientSession.apply {\n start(negotiated)\n }\n }\n else -> DelegatingClientWebSocketSession(context, session)\n }\n\n val response = HttpResponseContainer(info, clientSession)\n proceedWith(response)\n }\n }\n }\n}\n\n@Suppress(\"KDocMissingDocumentation\")\npublic class WebSocketException(message: String) : IllegalStateException(message)\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client\n\nimport io.ktor.client.call.*\nimport io.ktor.client.engine.*\nimport io.ktor.client.features.*\nimport io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport io.ktor.client.utils.checkCoroutinesVersion\nimport io.ktor.util.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.concurrent.*\nimport io.ktor.utils.io.core.*\nimport kotlinx.atomicfu.*\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\n\n/**\n * Constructs an asynchronous [HttpClient] using optional [block] for configuring this client.\n *\n * The [HttpClientEngine] is selected from the dependencies.\n * https://ktor.io/clients/http-client/engines.html\n */\n@HttpClientDsl\npublic expect fun HttpClient(\n block: HttpClientConfig<*>.() -> Unit = {}\n): HttpClient\n\n/**\n * Constructs an asynchronous [HttpClient] using the specified [engineFactory]\n * and an optional [block] for configuring this client.\n */\n@HttpClientDsl\npublic fun HttpClient(\n engineFactory: HttpClientEngineFactory,\n block: HttpClientConfig.() -> Unit = {}\n): HttpClient {\n val config: HttpClientConfig = HttpClientConfig().apply(block)\n val engine = engineFactory.create(config.engineConfig)\n val client = HttpClient(engine, config, manageEngine = true)\n\n // If the engine was created using factory Ktor is responsible for its lifecycle management. Otherwise user has to\n // close engine by themself.\n client.coroutineContext[Job]!!.invokeOnCompletion {\n engine.close()\n }\n\n return client\n}\n\n/**\n * Constructs an asynchronous [HttpClient] using the specified [engine]\n * and a [block] for configuring this client.\n */\n@HttpClientDsl\npublic fun HttpClient(\n engine: HttpClientEngine,\n block: HttpClientConfig<*>.() -> Unit\n): HttpClient = HttpClient(engine, HttpClientConfig().apply(block), manageEngine = false)\n\n/**\n * Asynchronous client to perform HTTP requests.\n *\n * This is a generic implementation that uses a specific engine [HttpClientEngine].\n * @property engine: [HttpClientEngine] for executing requests.\n */\n@OptIn(InternalCoroutinesApi::class)\npublic class HttpClient(\n public val engine: HttpClientEngine,\n private val userConfig: HttpClientConfig = HttpClientConfig()\n) : CoroutineScope, Closeable {\n private var manageEngine: Boolean by shared(false)\n\n internal constructor(\n engine: HttpClientEngine,\n userConfig: HttpClientConfig,\n manageEngine: Boolean\n ) : this(engine, userConfig) {\n this.manageEngine = manageEngine\n }\n\n private val closed = atomic(false)\n\n private val clientJob: CompletableJob = Job(engine.coroutineContext[Job])\n\n public override val coroutineContext: CoroutineContext = engine.coroutineContext + clientJob\n\n /**\n * Pipeline used for processing all the requests sent by this client.\n */\n public val requestPipeline: HttpRequestPipeline = HttpRequestPipeline(userConfig.developmentMode)\n\n /**\n * Pipeline used for processing all the responses sent by the server.\n */\n public val responsePipeline: HttpResponsePipeline = HttpResponsePipeline(userConfig.developmentMode)\n\n /**\n * Pipeline used for sending the request.\n */\n public val sendPipeline: HttpSendPipeline = HttpSendPipeline(userConfig.developmentMode)\n\n /**\n * Pipeline used for receiving request.\n */\n public val receivePipeline: HttpReceivePipeline = HttpReceivePipeline(userConfig.developmentMode)\n\n /**\n * Typed attributes used as a lightweight container for this client.\n */\n public val attributes: Attributes = Attributes(concurrent = true)\n\n /**\n * Dispatcher handles io operations.\n */\n @Deprecated(\n \"[dispatcher] is deprecated. Use coroutineContext instead.\",\n replaceWith = ReplaceWith(\"coroutineContext\"),\n level = DeprecationLevel.ERROR\n )\n public val dispatcher: CoroutineDispatcher\n get() = engine.dispatcher\n\n /**\n * Client engine config.\n */\n public val engineConfig: HttpClientEngineConfig = engine.config\n\n internal val config = HttpClientConfig()\n\n init {\n checkCoroutinesVersion()\n\n if (manageEngine) {\n clientJob.invokeOnCompletion {\n if (it != null) {\n engine.cancel()\n }\n }\n }\n\n engine.install(this)\n\n sendPipeline.intercept(HttpSendPipeline.Receive) { call ->\n check(call is HttpClientCall) { \"Error: HttpClientCall expected, but found $call(${call::class}).\" }\n val receivedCall = receivePipeline.execute(call, call.response).call\n proceedWith(receivedCall)\n }\n\n with(userConfig) {\n config.install(HttpRequestLifecycle)\n\n if (useDefaultTransformers) {\n config.install(HttpPlainText)\n config.install(\"DefaultTransformers\") { defaultTransformers() }\n }\n\n config.install(HttpSend)\n\n if (followRedirects) {\n config.install(HttpRedirect)\n }\n\n config += this\n\n config.addDefaultResponseValidation()\n\n config.install(this@HttpClient)\n }\n\n makeShared()\n }\n\n /**\n * Creates a new [HttpRequest] from a request [data] and a specific client [call].\n */\n\n @Deprecated(\n \"Unbound [HttpClientCall] is deprecated. Consider using [request(builder)] instead.\",\n level = DeprecationLevel.ERROR,\n replaceWith = ReplaceWith(\n \"this.request(builder)\",\n \"io.ktor.client.statement.*\"\n )\n )\n @InternalAPI\n public suspend fun execute(builder: HttpRequestBuilder): HttpClientCall =\n requestPipeline.execute(builder, builder.body) as HttpClientCall\n\n /**\n * Check if the specified [capability] is supported by this client.\n */\n public fun isSupported(capability: HttpClientEngineCapability<*>): Boolean {\n return engine.supportedCapabilities.contains(capability)\n }\n\n /**\n * Returns a new [HttpClient] copying this client configuration,\n * and additionally configured by the [block] parameter.\n */\n public fun config(block: HttpClientConfig<*>.() -> Unit): HttpClient = HttpClient(\n engine,\n HttpClientConfig().apply {\n plusAssign(userConfig)\n block()\n },\n manageEngine\n )\n\n /**\n * Closes the underlying [engine].\n */\n override fun close() {\n val success = closed.compareAndSet(false, true)\n if (!success) return\n\n attributes.allKeys.forEach { key ->\n @Suppress(\"UNCHECKED_CAST\")\n val feature = attributes[key as AttributeKey]\n\n if (feature is Closeable) {\n feature.close()\n }\n }\n\n clientJob.complete()\n if (manageEngine) {\n engine.close()\n }\n }\n\n override fun toString(): String = \"HttpClient[$engine]\"\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client\n\nimport io.ktor.client.engine.*\nimport io.ktor.client.features.*\nimport io.ktor.client.utils.sharedMap\nimport io.ktor.util.*\nimport io.ktor.utils.io.concurrent.*\nimport kotlin.collections.set\n\n/**\n * Mutable configuration used by [HttpClient].\n */\n@HttpClientDsl\npublic class HttpClientConfig {\n private val features: MutableMap, (HttpClient) -> Unit> = sharedMap()\n private val featureConfigurations: MutableMap, Any.() -> Unit> = sharedMap()\n\n private val customInterceptors: MutableMap Unit> = sharedMap()\n\n internal var engineConfig: T.() -> Unit by shared {}\n\n /**\n * Configure engine parameters.\n */\n public fun engine(block: T.() -> Unit) {\n val oldConfig = engineConfig\n engineConfig = {\n oldConfig()\n block()\n }\n }\n\n /**\n * Use [HttpRedirect] feature to automatically follow redirects.\n */\n public var followRedirects: Boolean by shared(true)\n\n /**\n * Use [defaultTransformers] to automatically handle simple [ContentType].\n */\n public var useDefaultTransformers: Boolean by shared(true)\n\n /**\n * Terminate [HttpClient.receivePipeline] if status code is not successful (>=300).\n */\n public var expectSuccess: Boolean by shared(true)\n\n /**\n * Indicate if client should use development mode. In development mode client pipelines have advanced stack traces.\n */\n public var developmentMode: Boolean by shared(PlatformUtils.IS_DEVELOPMENT_MODE)\n\n /**\n * Installs a specific [feature] and optionally [configure] it.\n */\n public fun install(\n feature: HttpClientFeature,\n configure: TBuilder.() -> Unit = {}\n ) {\n val previousConfigBlock = featureConfigurations[feature.key]\n featureConfigurations[feature.key] = {\n previousConfigBlock?.invoke(this)\n\n @Suppress(\"UNCHECKED_CAST\")\n (this as TBuilder).configure()\n }\n\n if (features.containsKey(feature.key)) return\n\n features[feature.key] = { scope ->\n val attributes = scope.attributes.computeIfAbsent(FEATURE_INSTALLED_LIST) { Attributes(concurrent = true) }\n val config = scope.config.featureConfigurations[feature.key]!!\n val featureData = feature.prepare(config)\n\n feature.install(featureData, scope)\n attributes.put(feature.key, featureData)\n }\n }\n\n /**\n * Installs an interceptor defined by [block].\n * The [key] parameter is used as a unique name, that also prevents installing duplicated interceptors.\n */\n public fun install(key: String, block: HttpClient.() -> Unit) {\n customInterceptors[key] = block\n }\n\n /**\n * Applies all the installed [features] and [customInterceptors] from this configuration\n * into the specified [client].\n */\n public fun install(client: HttpClient) {\n features.values.forEach { client.apply(it) }\n customInterceptors.values.forEach { client.apply(it) }\n }\n\n /**\n * Clones this [HttpClientConfig] duplicating all the [features] and [customInterceptors].\n */\n public fun clone(): HttpClientConfig {\n val result = HttpClientConfig()\n result += this\n return result\n }\n\n /**\n * Install features from [other] client config.\n */\n public operator fun plusAssign(other: HttpClientConfig) {\n followRedirects = other.followRedirects\n useDefaultTransformers = other.useDefaultTransformers\n expectSuccess = other.expectSuccess\n\n features += other.features\n featureConfigurations += other.featureConfigurations\n customInterceptors += other.customInterceptors\n }\n}\n\n/**\n * Dsl marker for [HttpClient] dsl.\n */\n@DslMarker\npublic annotation class HttpClientDsl\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.call\n\nimport io.ktor.client.*\nimport io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.concurrent.*\nimport kotlinx.atomicfu.*\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\nimport kotlin.reflect.*\n\n@InternalAPI\ninternal fun HttpClientCall(\n client: HttpClient,\n requestData: HttpRequestData,\n responseData: HttpResponseData\n): HttpClientCall = HttpClientCall(client).apply {\n request = DefaultHttpRequest(this, requestData)\n response = DefaultHttpResponse(this, responseData)\n\n if (responseData.body !is ByteReadChannel) {\n @Suppress(\"DEPRECATION\")\n attributes.put(HttpClientCall.CustomResponse, responseData.body)\n }\n}\n\n/**\n * A class that represents a single pair of [request] and [response] for a specific [HttpClient].\n *\n * @property client: client that executed the call.\n */\npublic open class HttpClientCall internal constructor(\n client: HttpClient\n) : CoroutineScope {\n private val received: AtomicBoolean = atomic(false)\n\n public val client: HttpClient? by threadLocal(client)\n\n override val coroutineContext: CoroutineContext get() = response.coroutineContext\n\n /**\n * Typed [Attributes] associated to this call serving as a lightweight container.\n */\n public val attributes: Attributes get() = request.attributes\n\n /**\n * Represents the [request] sent by the client\n */\n public lateinit var request: HttpRequest\n internal set\n\n /**\n * Represents the [response] sent by the server.\n */\n public lateinit var response: HttpResponse\n internal set\n\n protected open val allowDoubleReceive: Boolean = false\n\n protected open suspend fun getResponseContent(): ByteReadChannel = response.content\n\n /**\n * Tries to receive the payload of the [response] as a specific expected type provided in [info].\n * Returns [response] if [info] corresponds to [HttpResponse].\n *\n * @throws NoTransformationFoundException If no transformation is found for the type [info].\n * @throws DoubleReceiveException If already called [receive].\n */\n public suspend fun receive(info: TypeInfo): Any {\n try {\n if (response.instanceOf(info.type)) return response\n if (!allowDoubleReceive && !received.compareAndSet(false, true)) {\n throw DoubleReceiveException(this)\n }\n\n @Suppress(\"DEPRECATION\")\n val responseData = attributes.getOrNull(CustomResponse) ?: getResponseContent()\n\n val subject = HttpResponseContainer(info, responseData)\n val currentClient = client ?: error(\"Failed to receive call($this) in different native thread.\")\n\n val result = currentClient.responsePipeline.execute(this, subject).response\n if (!result.instanceOf(info.type)) {\n val from = result::class\n val to = info.type\n throw NoTransformationFoundException(response, from, to)\n }\n\n return result\n } catch (cause: Throwable) {\n response.cancel(\"Receive failed\", cause)\n throw cause\n } finally {\n response.complete()\n }\n }\n\n override fun toString(): String = \"HttpClientCall[${request.url}, ${response.status}]\"\n\n public companion object {\n /**\n * [CustomResponse] key used to process the response of custom type in case of [HttpClientEngine] can't return body bytes directly.\n * If present, attribute value will be an initial value for [HttpResponseContainer] in [HttpClient.responsePipeline].\n *\n * Example: [WebSocketSession]\n */\n @Deprecated(\n \"This is going to be removed. \" +\n \"Please file a ticket with clarification why and what for do you need it.\"\n )\n public val CustomResponse: AttributeKey = AttributeKey(\"CustomResponse\")\n }\n}\n\n/**\n * Raw http call produced by engine.\n *\n * @property request - executed http request.\n * @property response - raw http response\n */\n@Deprecated(\n \"HttpEngineCall deprecated.\",\n level = DeprecationLevel.ERROR,\n replaceWith = ReplaceWith(\"HttpResponseData\")\n)\n@InternalAPI\npublic data class HttpEngineCall(val request: HttpRequest, val response: HttpResponse)\n\n/**\n * Constructs a [HttpClientCall] from this [HttpClient] and with the specified [HttpRequestBuilder]\n * configured inside the [block].\n */\n@Deprecated(\n \"Unbound [HttpClientCall] is deprecated. Consider using [request(block)] in instead.\",\n level = DeprecationLevel.ERROR,\n replaceWith = ReplaceWith(\n \"this.request(block)\",\n \"io.ktor.client.request.request\",\n \"io.ktor.client.statement.*\"\n )\n)\n@Suppress(\"RedundantSuspendModifier\", \"unused\", \"UNUSED_PARAMETER\")\npublic suspend fun HttpClient.call(block: suspend HttpRequestBuilder.() -> Unit = {}): HttpClientCall =\n error(\"Unbound [HttpClientCall] is deprecated. Consider using [request(block)] in instead.\")\n\n/**\n * Tries to receive the payload of the [response] as an specific type [T].\n *\n * @throws NoTransformationFoundException If no transformation is found for the type [T].\n * @throws DoubleReceiveException If already called [receive].\n */\npublic suspend inline fun HttpClientCall.receive(): T = receive(typeInfo()) as T\n\n/**\n * Tries to receive the payload of the [response] as an specific type [T].\n *\n * @throws NoTransformationFoundException If no transformation is found for the type [T].\n * @throws DoubleReceiveException If already called [receive].\n */\npublic suspend inline fun HttpResponse.receive(): T = call.receive(typeInfo()) as T\n\n/**\n * Exception representing that the response payload has already been received.\n */\n@Suppress(\"KDocMissingDocumentation\")\npublic class DoubleReceiveException(call: HttpClientCall) : IllegalStateException() {\n override val message: String = \"Response already received: $call\"\n}\n\n/**\n * Exception representing fail of the response pipeline\n * [cause] contains origin pipeline exception\n */\n@Suppress(\"KDocMissingDocumentation\", \"unused\")\npublic class ReceivePipelineException(\n public val request: HttpClientCall,\n public val info: TypeInfo,\n override val cause: Throwable\n) : IllegalStateException(\"Fail to run receive pipeline: $cause\")\n\n/**\n * Exception representing the no transformation was found.\n * It includes the received type and the expected type as part of the message.\n */\n@Suppress(\"KDocMissingDocumentation\")\npublic class NoTransformationFoundException(\n response: HttpResponse,\n from: KClass<*>,\n to: KClass<*>\n) : UnsupportedOperationException() {\n override val message: String? = \"\"\"No transformation found: $from -> $to\n |with response from ${response.request.url}:\n |status: ${response.status}\n |response headers: \n |${response.headers.flattenEntries().joinToString { (key, value) -> \"$key: $value\\n\" }}\n \"\"\".trimMargin()\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.engine\n\nimport io.ktor.util.*\nimport io.ktor.utils.io.core.*\nimport kotlinx.atomicfu.*\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\n\n/**\n * Abstract implementation of [HttpClientEngine] responsible for lifecycle control of [dispatcher] and\n * [coroutineContext] as well as proper call context management. Should be considered as the best parent class for\n * custom [HttpClientEngine] implementations.\n */\npublic abstract class HttpClientEngineBase(private val engineName: String) : HttpClientEngine {\n private val closed = atomic(false)\n\n override val coroutineContext: CoroutineContext by lazy {\n SilentSupervisor() + dispatcher + CoroutineName(\"$engineName-context\")\n }\n\n override fun close() {\n if (!closed.compareAndSet(false, true)) return\n\n val requestJob = coroutineContext[Job] as? CompletableJob ?: return\n\n requestJob.complete()\n requestJob.invokeOnCompletion {\n dispatcher.close()\n }\n }\n}\n\n/**\n * Exception that indicates that client engine is already closed.\n */\npublic class ClientEngineClosedException(override val cause: Throwable? = null) :\n IllegalStateException(\"Client already closed\")\n\n/**\n * Close [CoroutineDispatcher] if it's [Closeable].\n */\nprivate fun CoroutineDispatcher.close() = try {\n (this as? Closeable)?.close()\n} catch (ignore: Throwable) {\n // Some closeable dispatchers like Dispatchers.IO can't be closed.\n}\n","package io.ktor.client.engine\n\nimport io.ktor.http.*\nimport io.ktor.util.network.*\n\n/**\n * Proxy configuration.\n *\n * See [ProxyBuilder] to create proxy.\n */\npublic expect class ProxyConfig\n\n/**\n * Type of configured proxy.\n */\npublic expect val ProxyConfig.type: ProxyType\n\n/**\n * Types of proxy\n */\n@Suppress(\"NO_EXPLICIT_VISIBILITY_IN_API_MODE_WARNING\", \"KDocMissingDocumentation\")\npublic enum class ProxyType {\n SOCKS,\n HTTP,\n UNKNOWN\n}\n\n/**\n * Resolve remote address of [ProxyConfig].\n *\n * This operations can block.\n */\npublic expect fun ProxyConfig.resolveAddress(): NetworkAddress\n\n/**\n * [ProxyConfig] factory.\n */\npublic expect object ProxyBuilder {\n /**\n * Create http proxy from [url].\n */\n public fun http(url: Url): ProxyConfig\n\n /**\n * Create socks proxy from [host] and [port].\n */\n public fun socks(host: String, port: Int): ProxyConfig\n}\n\n/**\n * Create http proxy from [urlString].\n */\npublic fun ProxyBuilder.http(urlString: String): ProxyConfig = http(Url(urlString))\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.call\n\nimport io.ktor.client.*\nimport io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport io.ktor.http.*\nimport io.ktor.util.*\nimport io.ktor.util.date.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.core.*\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\n\ninternal class SavedHttpCall(client: HttpClient) : HttpClientCall(client) {\n /**\n * Equals [HttpResponse.content] in case [receive] was never called before or equals it's copy if [receive] was\n * already called at least once.\n * */\n private var responseContent: ByteReadChannel? = null\n\n /**\n * Saves [responseContent] and returns it's copy that is safe to use without loosing [responseContent] data.\n * */\n override suspend fun getResponseContent(): ByteReadChannel {\n if (responseContent == null) {\n responseContent = response.content\n }\n val contentBytes = responseContent!!.toByteArray()\n responseContent = ByteReadChannel(contentBytes)\n return ByteReadChannel(contentBytes)\n }\n\n override val allowDoubleReceive: Boolean = true\n}\n\ninternal class SavedHttpRequest(\n override val call: SavedHttpCall,\n origin: HttpRequest\n) : HttpRequest by origin\n\ninternal class SavedHttpResponse(\n override val call: SavedHttpCall,\n body: ByteArray,\n origin: HttpResponse\n) : HttpResponse() {\n private val context = Job()\n\n override val status: HttpStatusCode = origin.status\n\n override val version: HttpProtocolVersion = origin.version\n\n override val requestTime: GMTDate = origin.requestTime\n\n override val responseTime: GMTDate = origin.responseTime\n\n override val headers: Headers = origin.headers\n\n override val coroutineContext: CoroutineContext = origin.coroutineContext + context\n\n override val content: ByteReadChannel = ByteReadChannel(body)\n}\n\n/**\n * Fetch data for [HttpClientCall] and close the origin.\n */\n@KtorExperimentalAPI\npublic suspend fun HttpClientCall.save(): HttpClientCall {\n val currentClient = client ?: error(\"Failed to save call in different native thread.\")\n\n return SavedHttpCall(currentClient).also { result ->\n val content = response.content.readRemaining()\n\n result.request = SavedHttpRequest(result, request)\n result.response = SavedHttpResponse(result, content.readBytes(), response)\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.call\n\nimport kotlin.reflect.*\n\n/**\n * Information about type.\n */\npublic expect interface Type\n\n/**\n * Ktor type information.\n * @param type: source KClass<*>\n * @param reifiedType: type with substituted generics\n * @param kotlinType: kotlin reified type with all generic type parameters.\n */\npublic data class TypeInfo(\n val type: KClass<*>,\n val reifiedType: Type,\n val kotlinType: KType? = null\n)\n\n/**\n * Returns [TypeInfo] for the specified type [T]\n */\npublic expect inline fun typeInfo(): TypeInfo\n\n/**\n * Check [this] is instance of [type].\n */\ninternal expect fun Any.instanceOf(type: KClass<*>): Boolean\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.call\n\nimport io.ktor.client.*\nimport io.ktor.client.request.*\nimport io.ktor.http.*\nimport io.ktor.http.content.*\n\n@Suppress(\"KDocMissingDocumentation\")\npublic class UnsupportedContentTypeException(content: OutgoingContent) :\n IllegalStateException(\"Failed to write body: ${content::class}\")\n\n@Suppress(\"KDocMissingDocumentation\", \"UNUSED\")\npublic class UnsupportedUpgradeProtocolException(\n url: Url\n) : IllegalArgumentException(\"Unsupported upgrade protocol exception: $url\")\n\n/**\n * Constructs a [HttpClientCall] from this [HttpClient] and\n * with the specified HTTP request [builder].\n */\n@Deprecated(\n \"Unbound [HttpClientCall] is deprecated. Consider using [request(builder)] instead.\",\n level = DeprecationLevel.ERROR,\n replaceWith = ReplaceWith(\"this.request(builder)\", \"io.ktor.client.statement.*\")\n)\n@Suppress(\"UNUSED\", \"UNUSED_PARAMETER\", \"RedundantSuspendModifier\")\npublic suspend fun HttpClient.call(builder: HttpRequestBuilder): HttpClientCall =\n error(\"Unbound [HttpClientCall] is deprecated. Consider using [request(builder)] instead.\")\n\n/**\n * Constructs a [HttpClientCall] from this [HttpClient],\n * an [url] and an optional [block] configuring a [HttpRequestBuilder].\n */\n@Deprecated(\n \"Unbound [HttpClientCall] is deprecated. Consider using [request(urlString, block)] instead.\",\n level = DeprecationLevel.ERROR,\n replaceWith = ReplaceWith(\n \"this.request(urlString, block)\",\n \"io.ktor.client.statement.*\"\n )\n)\n@Suppress(\"UNUSED\", \"UNUSED_PARAMETER\", \"RedundantSuspendModifier\")\npublic suspend fun HttpClient.call(\n urlString: String,\n block: suspend HttpRequestBuilder.() -> Unit = {}\n): HttpClientCall = error(\n \"Unbound [HttpClientCall] is deprecated. Consider using [request(urlString, block)] instead.\"\n)\n\n/**\n * Constructs a [HttpClientCall] from this [HttpClient],\n * an [url] and an optional [block] configuring a [HttpRequestBuilder].\n */\n@Deprecated(\n \"Unbound [HttpClientCall] is deprecated. Consider using [request(url, block)] instead.\",\n level = DeprecationLevel.ERROR,\n replaceWith = ReplaceWith(\"this.request(url, block)\", \"io.ktor.client.statement.*\")\n)\n@Suppress(\"UNUSED\", \"UNUSED_PARAMETER\", \"RedundantSuspendModifier\")\npublic suspend fun HttpClient.call(\n url: Url,\n block: suspend HttpRequestBuilder.() -> Unit = {}\n): HttpClientCall = error(\n \"Unbound [HttpClientCall] is deprecated. Consider using [request(url, block)] instead.\"\n)\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.engine\n\nimport io.ktor.client.*\nimport io.ktor.client.call.*\nimport io.ktor.client.request.*\nimport io.ktor.http.*\nimport io.ktor.util.*\nimport io.ktor.util.pipeline.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.core.*\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\nimport kotlin.native.concurrent.*\n\n@SharedImmutable\ninternal val CALL_COROUTINE = CoroutineName(\"call-context\")\n\n/**\n * Base interface use to define engines for [HttpClient].\n */\npublic interface HttpClientEngine : CoroutineScope, Closeable {\n /**\n * [CoroutineDispatcher] specified for io operations.\n */\n public val dispatcher: CoroutineDispatcher\n\n /**\n * Engine configuration\n */\n public val config: HttpClientEngineConfig\n\n /**\n * Set of supported engine extensions.\n */\n @KtorExperimentalAPI\n public val supportedCapabilities: Set>\n get() = emptySet()\n\n private val closed: Boolean\n get() = !(coroutineContext[Job]?.isActive ?: false)\n\n /**\n * Creates a new [HttpClientCall] specific for this engine, using a request [data].\n */\n @InternalAPI\n public suspend fun execute(data: HttpRequestData): HttpResponseData\n\n /**\n * Install engine into [HttpClient].\n */\n @InternalAPI\n public fun install(client: HttpClient) {\n client.sendPipeline.intercept(HttpSendPipeline.Engine) { content ->\n val requestData = HttpRequestBuilder().apply {\n takeFromWithExecutionContext(context)\n body = content\n }.build()\n\n validateHeaders(requestData)\n checkExtensions(requestData)\n\n val responseData = executeWithinCallContext(requestData)\n val call = HttpClientCall(client, requestData, responseData)\n\n proceedWith(call)\n }\n }\n\n /**\n * Create call context and use it as a coroutine context to [execute] request.\n */\n private suspend fun executeWithinCallContext(requestData: HttpRequestData): HttpResponseData {\n val callContext = createCallContext(requestData.executionContext)\n callContext.makeShared()\n\n val context = callContext + KtorCallContextElement(callContext)\n return async(context) {\n if (closed) {\n throw ClientEngineClosedException()\n }\n\n execute(requestData)\n }.await()\n }\n\n private fun checkExtensions(requestData: HttpRequestData) {\n for (requestedExtension in requestData.requiredCapabilities) {\n require(supportedCapabilities.contains(requestedExtension)) { \"Engine doesn't support $requestedExtension\" }\n }\n }\n}\n\n/**\n * Factory of [HttpClientEngine] with a specific [T] of [HttpClientEngineConfig].\n */\npublic interface HttpClientEngineFactory {\n /**\n * Creates a new [HttpClientEngine] optionally specifying a [block] configuring [T].\n */\n public fun create(block: T.() -> Unit = {}): HttpClientEngine\n}\n\n/**\n * Creates a new [HttpClientEngineFactory] based on this one\n * with further configurations from the [nested] block.\n */\npublic fun HttpClientEngineFactory.config(\n nested: T.() -> Unit\n): HttpClientEngineFactory {\n val parent = this\n\n return object : HttpClientEngineFactory {\n override fun create(block: T.() -> Unit): HttpClientEngine = parent.create {\n nested()\n block()\n }\n }\n}\n\n/**\n * Create call context with the specified [parentJob] to be used during call execution in the engine. Call context\n * inherits [coroutineContext], but overrides job and coroutine name so that call job's parent is [parentJob] and\n * call coroutine's name is \"call-context\".\n */\ninternal expect suspend fun HttpClientEngine.createCallContext(parentJob: Job): CoroutineContext\n\n/**\n * Validates request headers and fails if there are unsafe headers supplied\n */\nprivate fun validateHeaders(request: HttpRequestData) {\n val requestHeaders = request.headers\n val unsafeRequestHeaders = requestHeaders.names().filter {\n it in HttpHeaders.UnsafeHeadersList\n }\n if (unsafeRequestHeaders.isNotEmpty()) {\n throw UnsafeHeaderException(unsafeRequestHeaders.toString())\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.engine\n\nimport io.ktor.client.utils.*\nimport io.ktor.http.*\nimport io.ktor.http.content.*\nimport io.ktor.util.*\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\n\n/**\n * Default user agent to use in ktor client.\n */\n@InternalAPI\npublic val KTOR_DEFAULT_USER_AGENT: String = \"Ktor client\"\n\n/**\n * Merge headers from [content] and [requestHeaders] according to [OutgoingContent] properties\n */\n@InternalAPI\npublic fun mergeHeaders(\n requestHeaders: Headers,\n content: OutgoingContent,\n block: (key: String, value: String) -> Unit\n) {\n buildHeaders {\n appendAll(requestHeaders)\n appendAll(content.headers)\n }.forEach { key, values ->\n if (HttpHeaders.ContentLength == key) return@forEach // set later\n if (HttpHeaders.ContentType == key) return@forEach // set later\n\n // https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2\n block(key, values.joinToString(\",\"))\n }\n\n val missingAgent = requestHeaders[HttpHeaders.UserAgent] == null && content.headers[HttpHeaders.UserAgent] == null\n if (missingAgent && needUserAgent()) {\n block(HttpHeaders.UserAgent, KTOR_DEFAULT_USER_AGENT)\n }\n\n val type = content.contentType?.toString() ?: content.headers[HttpHeaders.ContentType]\n val length = content.contentLength?.toString() ?: content.headers[HttpHeaders.ContentLength]\n\n type?.let { block(HttpHeaders.ContentType, it) }\n length?.let { block(HttpHeaders.ContentLength, it) }\n}\n\n/**\n * Returns current call context if exists, otherwise null.\n */\n@InternalAPI\npublic suspend fun callContext(): CoroutineContext = coroutineContext[KtorCallContextElement]!!.callContext\n\n/**\n * Coroutine context element containing call job.\n */\ninternal class KtorCallContextElement(val callContext: CoroutineContext) : CoroutineContext.Element {\n override val key: CoroutineContext.Key<*>\n get() = KtorCallContextElement\n\n public companion object : CoroutineContext.Key\n}\n\n/**\n * Attach [callJob] to user job using the following logic: when user job completes with exception, [callJob] completes\n * with exception too.\n */\n@OptIn(InternalCoroutinesApi::class)\ninternal suspend inline fun attachToUserJob(callJob: Job) {\n val userJob = coroutineContext[Job] ?: return\n\n val cleanupHandler = userJob.invokeOnCompletion(onCancelling = true) { cause ->\n cause ?: return@invokeOnCompletion\n callJob.cancel(CancellationException(cause.message))\n }\n\n callJob.invokeOnCompletion {\n cleanupHandler.dispose()\n }\n}\n\nprivate fun needUserAgent(): Boolean = !PlatformUtils.IS_BROWSER\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.call\n\nimport kotlin.reflect.*\n\npublic actual interface Type\n\npublic object JsType : Type\n\n@OptIn(ExperimentalStdlibApi::class)\npublic actual inline fun typeInfo(): TypeInfo = try {\n TypeInfo(T::class, JsType, typeOf())\n} catch (_: dynamic) {\n TypeInfo(T::class, JsType)\n}\n\n/**\n * Check [this] is instance of [type].\n */\ninternal actual fun Any.instanceOf(type: KClass<*>): Boolean = type.isInstance(this)\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features\n\nimport io.ktor.client.*\nimport io.ktor.client.request.*\nimport io.ktor.util.*\n\n/**\n * [Feature] is used to set request default parameters.\n */\npublic class DefaultRequest(private val builder: HttpRequestBuilder.() -> Unit) {\n\n public companion object Feature : HttpClientFeature {\n override val key: AttributeKey = AttributeKey(\"DefaultRequest\")\n\n override fun prepare(block: HttpRequestBuilder.() -> Unit): DefaultRequest =\n DefaultRequest(block)\n\n override fun install(feature: DefaultRequest, scope: HttpClient) {\n scope.requestPipeline.intercept(HttpRequestPipeline.Before) {\n context.apply(feature.builder)\n }\n }\n }\n}\n\n/**\n * Set request default parameters.\n */\npublic fun HttpClientConfig<*>.defaultRequest(block: HttpRequestBuilder.() -> Unit) {\n install(DefaultRequest) {\n block()\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features\n\nimport io.ktor.client.*\nimport io.ktor.client.call.*\nimport io.ktor.client.statement.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.concurrent.*\nimport kotlin.jvm.*\nimport kotlin.native.concurrent.*\n\n@SharedImmutable\nprivate val ValidateMark = AttributeKey(\"ValidateMark\")\n\n/**\n * Default response validation.\n * Check the response status code in range (0..299).\n */\npublic fun HttpClientConfig<*>.addDefaultResponseValidation() {\n HttpResponseValidator {\n @Suppress(\"DEPRECATION\")\n expectSuccess = this@addDefaultResponseValidation.expectSuccess\n\n validateResponse { response ->\n val expectSuccess = response.call.attributes[ExpectSuccessAttributeKey]\n if (!expectSuccess) {\n return@validateResponse\n }\n\n val statusCode = response.status.value\n val originCall = response.call\n if (statusCode < 300 || originCall.attributes.contains(ValidateMark)) {\n return@validateResponse\n }\n\n val exceptionCall = originCall.save().apply {\n attributes.put(ValidateMark, Unit)\n }\n\n val exceptionResponse = exceptionCall.response\n val exceptionResponseText = exceptionResponse.readText()\n when (statusCode) {\n in 300..399 -> throw RedirectResponseException(exceptionResponse, exceptionResponseText)\n in 400..499 -> throw ClientRequestException(exceptionResponse, exceptionResponseText)\n in 500..599 -> throw ServerResponseException(exceptionResponse, exceptionResponseText)\n else -> throw ResponseException(exceptionResponse, exceptionResponseText)\n }\n }\n }\n}\n\ninternal const val NO_RESPONSE_TEXT: String = \"\"\ninternal const val DEPRECATED_EXCEPTION_CTOR: String = \"Please, provide response text in constructor\"\n\n/**\n * Base for default response exceptions.\n * @param [response]: origin response\n */\npublic open class ResponseException(\n response: HttpResponse,\n cachedResponseText: String\n) : IllegalStateException(\"Bad response: $response. Text: \\\"$cachedResponseText\\\"\") {\n @Deprecated(level = DeprecationLevel.WARNING, message = DEPRECATED_EXCEPTION_CTOR)\n public constructor(response: HttpResponse) : this(response, NO_RESPONSE_TEXT)\n\n @delegate:Transient\n private val _response: HttpResponse? by threadLocal(response)\n public val response: HttpResponse\n get() = _response ?: error(\"Failed to access response from a different native thread\")\n}\n\n/**\n * Unhandled redirect exception.\n */\n@Suppress(\"KDocMissingDocumentation\")\npublic class RedirectResponseException(response: HttpResponse, cachedResponseText: String) :\n ResponseException(response, cachedResponseText) {\n @Deprecated(level = DeprecationLevel.WARNING, message = DEPRECATED_EXCEPTION_CTOR)\n public constructor(response: HttpResponse) : this(response, NO_RESPONSE_TEXT)\n\n override val message: String? = \"Unhandled redirect: ${response.call.request.url}. \" +\n \"Status: ${response.status}. Text: \\\"$cachedResponseText\\\"\"\n}\n\n/**\n * Server error exception.\n */\n@Suppress(\"KDocMissingDocumentation\")\npublic class ServerResponseException(\n response: HttpResponse,\n cachedResponseText: String\n) : ResponseException(response, cachedResponseText) {\n @Deprecated(level = DeprecationLevel.WARNING, message = DEPRECATED_EXCEPTION_CTOR)\n public constructor(response: HttpResponse) : this(response, NO_RESPONSE_TEXT)\n\n override val message: String? = \"Server error(${response.call.request.url}: \" +\n \"${response.status}. Text: \\\"$cachedResponseText\\\"\"\n}\n\n/**\n * Bad client request exception.\n */\n@Suppress(\"KDocMissingDocumentation\")\npublic class ClientRequestException(\n response: HttpResponse,\n cachedResponseText: String\n) : ResponseException(response, cachedResponseText) {\n @Deprecated(level = DeprecationLevel.WARNING, message = DEPRECATED_EXCEPTION_CTOR)\n public constructor(response: HttpResponse) : this(response, NO_RESPONSE_TEXT)\n\n override val message: String? = \"Client request(${response.call.request.url}) \" +\n \"invalid: ${response.status}. Text: \\\"$cachedResponseText\\\"\"\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features\n\nimport io.ktor.client.*\nimport io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport io.ktor.http.*\nimport io.ktor.http.content.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.core.*\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.CancellationException\n\n/**\n * Install default transformers.\n * Usually installed by default so there is no need to use it\n * unless you have disabled it via [HttpClientConfig.useDefaultTransformers].\n */\npublic fun HttpClient.defaultTransformers() {\n val client = this\n\n requestPipeline.intercept(HttpRequestPipeline.Render) { body ->\n if (context.headers[HttpHeaders.Accept] == null) {\n context.headers.append(HttpHeaders.Accept, \"*/*\")\n }\n\n val contentType = context.headers[HttpHeaders.ContentType]?.let {\n ContentType.parse(it)\n }\n\n val content = when (body) {\n is String -> {\n TextContent(body, contentType ?: ContentType.Text.Plain)\n }\n is ByteArray -> object : OutgoingContent.ByteArrayContent() {\n override val contentType: ContentType = contentType ?: ContentType.Application.OctetStream\n override val contentLength: Long = body.size.toLong()\n override fun bytes(): ByteArray = body\n }\n is ByteReadChannel -> object : OutgoingContent.ReadChannelContent() {\n override val contentType: ContentType = contentType ?: ContentType.Application.OctetStream\n override fun readFrom(): ByteReadChannel = body\n }\n else -> null\n }\n\n if (content != null) {\n context.headers.remove(HttpHeaders.ContentType)\n proceedWith(content)\n }\n }\n\n responsePipeline.intercept(HttpResponsePipeline.Parse) { (info, body) ->\n if (body !is ByteReadChannel) return@intercept\n val response = context.response\n val contentLength = response.headers[HttpHeaders.ContentLength]?.toLong() ?: Long.MAX_VALUE\n\n when (info.type) {\n Unit::class -> {\n body.cancel()\n proceedWith(HttpResponseContainer(info, Unit))\n }\n Int::class -> {\n proceedWith(HttpResponseContainer(info, body.readRemaining().readText().toInt()))\n }\n ByteReadPacket::class,\n Input::class -> {\n proceedWith(HttpResponseContainer(info, body.readRemaining()))\n }\n ByteArray::class -> {\n val readRemaining = body.readRemaining(contentLength)\n if (contentLength < Long.MAX_VALUE) {\n check(readRemaining.remaining == contentLength) {\n \"Expected $contentLength, actual ${readRemaining.remaining}\"\n }\n }\n\n proceedWith(HttpResponseContainer(info, readRemaining.readBytes()))\n }\n ByteReadChannel::class -> {\n // the response job could be already completed so the job holder\n // could be cancelled immediately, but it doesn't matter\n // since the copying job is running under the client job\n val responseJobHolder = Job(response.coroutineContext[Job])\n val channel: ByteReadChannel = writer(client.coroutineContext) {\n try {\n body.copyTo(channel, limit = Long.MAX_VALUE)\n } catch (cause: CancellationException) {\n response.cancel(cause)\n throw cause\n } catch (cause: Throwable) {\n response.cancel(\"Receive failed\", cause)\n throw cause\n } finally {\n response.complete()\n }\n }.also { writerJob ->\n writerJob.invokeOnCompletion {\n responseJobHolder.complete()\n }\n }.channel\n\n proceedWith(HttpResponseContainer(info, channel))\n }\n HttpStatusCode::class -> {\n body.cancel()\n proceedWith(HttpResponseContainer(info, response.status))\n }\n }\n }\n\n platformDefaultTransformers()\n}\n\ninternal expect fun HttpClient.platformDefaultTransformers()\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features\n\nimport io.ktor.client.*\nimport io.ktor.util.*\n\n@Deprecated(\n \"[BadResponseStatusException] is deprecated. Use [ResponseException] instead.\",\n ReplaceWith(\"ResponseException\"),\n DeprecationLevel.ERROR\n)\n@Suppress(\"KDocMissingDocumentation\")\npublic typealias BadResponseStatusException = ResponseException\n\n@Deprecated(\n \"Use [HttpCallValidator] instead.\",\n ReplaceWith(\"HttpCallValidator\"),\n DeprecationLevel.ERROR\n)\n@Suppress(\"KDocMissingDocumentation\")\npublic class ExpectSuccess {\n @Suppress(\"DEPRECATION_ERROR\")\n public companion object : HttpClientFeature {\n\n override val key: AttributeKey\n get() = error(\"Deprecated\")\n\n override fun prepare(block: Unit.() -> Unit): ExpectSuccess {\n error(\"Deprecated\")\n }\n\n override fun install(feature: ExpectSuccess, scope: HttpClient) {\n error(\"Deprecated\")\n }\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features\n\nimport io.ktor.client.*\nimport io.ktor.client.call.*\nimport io.ktor.client.features.HttpCallValidator.*\nimport io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport io.ktor.client.utils.*\nimport io.ktor.util.*\nimport io.ktor.util.pipeline.*\nimport kotlin.native.concurrent.*\n\n/**\n * Response validator method.\n *\n * You could throw an exception to fail the response.\n */\npublic typealias ResponseValidator = suspend (response: HttpResponse) -> Unit\n\n/**\n * Response exception handler method.\n */\npublic typealias CallExceptionHandler = suspend (cause: Throwable) -> Unit\n\n/**\n * Response validator feature is used for validate response and handle response exceptions.\n *\n * See also [Config] for additional details.\n */\npublic class HttpCallValidator internal constructor(\n private val responseValidators: List,\n private val callExceptionHandlers: List,\n private val expectSuccess: Boolean\n) {\n\n /**\n * Response validator feature is used for validate response and handle response exceptions.\n *\n * See also [Config] for additional details.\n */\n @Deprecated(\n \"This is going to become internal. \" +\n \"Please file a ticket and clarify, why do you need it.\"\n )\n public constructor(\n responseValidators: List,\n callExceptionHandlers: List\n ) : this(responseValidators, callExceptionHandlers, true)\n\n private suspend fun validateResponse(response: HttpResponse) {\n responseValidators.forEach { it(response) }\n }\n\n private suspend fun processException(cause: Throwable) {\n callExceptionHandlers.forEach { it(cause) }\n }\n\n /**\n * [HttpCallValidator] configuration.\n */\n public class Config {\n internal val responseValidators: MutableList = mutableListOf()\n internal val responseExceptionHandlers: MutableList = mutableListOf()\n\n /**\n * Terminate [HttpClient.receivePipeline] if status code is not successful (>=300).\n */\n\n @Deprecated(\n \"This property is ignored. Please use `expectSuccess` property in HttpClientConfig. \" +\n \"This is going to become internal.\"\n )\n public var expectSuccess: Boolean = true\n\n /**\n * Add [CallExceptionHandler].\n * Last added handler executes first.\n */\n public fun handleResponseException(block: CallExceptionHandler) {\n responseExceptionHandlers += block\n }\n\n /**\n * Add [ResponseValidator].\n * Last added validator executes first.\n */\n public fun validateResponse(block: ResponseValidator) {\n responseValidators += block\n }\n }\n\n public companion object : HttpClientFeature {\n override val key: AttributeKey = AttributeKey(\"HttpResponseValidator\")\n\n override fun prepare(block: Config.() -> Unit): HttpCallValidator {\n val config = Config().apply(block)\n\n return HttpCallValidator(\n config.responseValidators.reversed(),\n config.responseExceptionHandlers.reversed(),\n config.expectSuccess\n )\n }\n\n override fun install(feature: HttpCallValidator, scope: HttpClient) {\n scope.requestPipeline.intercept(HttpRequestPipeline.Before) {\n try {\n context.attributes.computeIfAbsent(ExpectSuccessAttributeKey) { feature.expectSuccess }\n proceedWith(it)\n } catch (cause: Throwable) {\n val unwrappedCause = cause.unwrapCancellationException()\n feature.processException(unwrappedCause)\n throw unwrappedCause\n }\n }\n\n val BeforeReceive = PipelinePhase(\"BeforeReceive\")\n scope.responsePipeline.insertPhaseBefore(HttpResponsePipeline.Receive, BeforeReceive)\n scope.responsePipeline.intercept(BeforeReceive) { container ->\n try {\n proceedWith(container)\n } catch (cause: Throwable) {\n val unwrappedCause = cause.unwrapCancellationException()\n feature.processException(unwrappedCause)\n throw unwrappedCause\n }\n }\n\n scope[HttpSend].intercept { call, _ ->\n feature.validateResponse(call.response)\n call\n }\n }\n }\n}\n\n/**\n * Install [HttpCallValidator] with [block] configuration.\n */\npublic fun HttpClientConfig<*>.HttpResponseValidator(block: HttpCallValidator.Config.() -> Unit) {\n install(HttpCallValidator, block)\n}\n\n/**\n * Terminate [HttpClient.receivePipeline] if status code is not successful (>=300).\n */\npublic var HttpRequestBuilder.expectSuccess: Boolean\n get() = attributes.getOrNull(ExpectSuccessAttributeKey) ?: true\n set(value) = attributes.put(ExpectSuccessAttributeKey, value)\n\n@SharedImmutable\ninternal val ExpectSuccessAttributeKey = AttributeKey(\"ExpectSuccessAttribyteKey\")\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features\n\nimport io.ktor.client.*\nimport io.ktor.util.*\nimport kotlin.native.concurrent.*\n\n@SharedImmutable\ninternal val FEATURE_INSTALLED_LIST = AttributeKey(\"ApplicationFeatureRegistry\")\n\n/**\n * Base interface representing a [HttpClient] feature.\n */\npublic interface HttpClientFeature {\n /**\n * The [AttributeKey] for this feature.\n */\n public val key: AttributeKey\n\n /**\n * Builds a [TFeature] by calling the [block] with a [TConfig] config instance as receiver.\n */\n public fun prepare(block: TConfig.() -> Unit = {}): TFeature\n\n /**\n * Installs the [feature] class for a [HttpClient] defined at [scope].\n */\n public fun install(feature: TFeature, scope: HttpClient)\n}\n\n/**\n * Try to get the [feature] installed in this client. Returns `null` if the feature was not previously installed.\n */\npublic fun HttpClient.feature(feature: HttpClientFeature): F? =\n attributes.getOrNull(FEATURE_INSTALLED_LIST)?.getOrNull(feature.key)\n\n/**\n * Find the [feature] installed in [HttpClient].\n *\n * @throws [IllegalStateException] if [feature] is not installed.\n */\npublic operator fun HttpClient.get(feature: HttpClientFeature): F {\n val requestedFeature = feature(feature)\n if (requestedFeature != null) {\n return requestedFeature\n }\n\n val message = \"Feature $feature is not installed. Consider using `install(${feature.key})` in client config first.\"\n error(message)\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features\n\nimport io.ktor.client.*\nimport io.ktor.client.call.*\nimport io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport io.ktor.http.*\nimport io.ktor.http.content.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.*\nimport kotlin.math.*\n\n/**\n * [HttpClient] feature that encodes [String] request bodies to [TextContent]\n * and processes the response body as [String].\n *\n * To configure charsets set following properties in [HttpPlainText.Config].\n */\npublic class HttpPlainText internal constructor(\n charsets: Set,\n charsetQuality: Map,\n sendCharset: Charset?,\n private val responseCharsetFallback: Charset\n) {\n private val requestCharset: Charset\n private val acceptCharsetHeader: String\n\n init {\n val withQuality = charsetQuality.toList().sortedByDescending { it.second }\n val withoutQuality = charsets.filter { !charsetQuality.containsKey(it) }.sortedBy { it.name }\n\n acceptCharsetHeader = buildString {\n withoutQuality.forEach {\n if (length > 0) append(\",\")\n append(it.name)\n }\n\n withQuality.forEach { (charset, quality) ->\n if (length > 0) append(\",\")\n\n check(quality in 0.0..1.0)\n\n val truncatedQuality = (100 * quality).roundToInt() / 100.0\n append(\"${charset.name};q=$truncatedQuality\")\n }\n\n if (isEmpty()) {\n append(responseCharsetFallback.name)\n }\n }\n\n requestCharset = sendCharset\n ?: withoutQuality.firstOrNull() ?: withQuality.firstOrNull()?.first ?: Charsets.UTF_8\n }\n\n /**\n * Charset configuration for [HttpPlainText] feature.\n */\n public class Config {\n internal val charsets: MutableSet = mutableSetOf()\n internal val charsetQuality: MutableMap = mutableMapOf()\n\n /**\n * Add [charset] to allowed list with selected [quality].\n */\n public fun register(charset: Charset, quality: Float? = null) {\n quality?.let { check(it in 0.0..1.0) }\n\n charsets.add(charset)\n\n if (quality == null) {\n charsetQuality.remove(charset)\n } else {\n charsetQuality[charset] = quality\n }\n }\n\n /**\n * Explicit [Charset] for sending content.\n *\n * Use first with highest quality from [register] charset if null.\n */\n public var sendCharset: Charset? = null\n\n /**\n * Fallback charset for the response.\n * Use it if no charset specified.\n */\n public var responseCharsetFallback: Charset = Charsets.UTF_8\n\n /**\n * Default [Charset] to use.\n */\n @Suppress(\"unused\")\n @Deprecated(\n \"Use [register] method instead.\",\n replaceWith = ReplaceWith(\"register()\"),\n level = DeprecationLevel.ERROR\n )\n public var defaultCharset: Charset = Charsets.UTF_8\n }\n\n @Suppress(\"KDocMissingDocumentation\")\n public companion object Feature : HttpClientFeature {\n override val key: AttributeKey = AttributeKey(\"HttpPlainText\")\n\n override fun prepare(block: Config.() -> Unit): HttpPlainText {\n val config = Config().apply(block)\n\n with(config) {\n return HttpPlainText(\n charsets,\n charsetQuality,\n sendCharset,\n responseCharsetFallback\n )\n }\n }\n\n override fun install(feature: HttpPlainText, scope: HttpClient) {\n scope.requestPipeline.intercept(HttpRequestPipeline.Render) { content ->\n feature.addCharsetHeaders(context)\n\n if (content !is String) {\n return@intercept\n }\n\n val contentType = context.contentType()\n if (contentType != null && contentType.contentType != ContentType.Text.Plain.contentType) {\n return@intercept\n }\n\n val contentCharset = contentType?.charset()\n proceedWith(feature.wrapContent(content, contentCharset))\n }\n\n scope.responsePipeline.intercept(HttpResponsePipeline.Parse) { (info, body) ->\n if (info.type != String::class || body !is ByteReadChannel) return@intercept\n\n val bodyBytes = body.readRemaining()\n val content = feature.read(context, bodyBytes)\n proceedWith(HttpResponseContainer(info, content))\n }\n }\n }\n\n private fun wrapContent(content: String, contentCharset: Charset?): Any {\n val charset = contentCharset ?: requestCharset\n return TextContent(content, ContentType.Text.Plain.withCharset(charset))\n }\n\n internal fun read(call: HttpClientCall, body: Input): String {\n val actualCharset = call.response.charset() ?: responseCharsetFallback\n return body.readText(charset = actualCharset)\n }\n\n internal fun addCharsetHeaders(context: HttpRequestBuilder) {\n if (context.headers[HttpHeaders.AcceptCharset] != null) return\n context.headers[HttpHeaders.AcceptCharset] = acceptCharsetHeader\n }\n\n /**\n * Deprecated\n */\n @Suppress(\"unused\", \"UNUSED_PARAMETER\")\n @Deprecated(\n \"Use [Config.register] method instead.\",\n replaceWith = ReplaceWith(\"register()\"),\n level = DeprecationLevel.ERROR\n )\n public var defaultCharset: Charset\n get() = error(\"defaultCharset is deprecated\")\n set(value) = error(\"defaultCharset is deprecated\")\n}\n\n/**\n * Configure client charsets.\n *\n * ```kotlin\n * val client = HttpClient {\n * Charsets {\n * register(Charsets.UTF_8)\n * register(Charsets.ISO_8859_1, quality = 0.1)\n * }\n * }\n * ```\n */\n@Suppress(\"FunctionName\")\npublic fun HttpClientConfig<*>.Charsets(block: HttpPlainText.Config.() -> Unit) {\n install(HttpPlainText, block)\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features\n\nimport io.ktor.client.*\nimport io.ktor.client.call.*\nimport io.ktor.client.request.*\nimport io.ktor.http.*\nimport io.ktor.util.*\nimport kotlinx.atomicfu.*\nimport kotlin.jvm.*\nimport kotlin.native.concurrent.*\n\n@ThreadLocal\nprivate val ALLOWED_FOR_REDIRECT: Set = setOf(HttpMethod.Get, HttpMethod.Head)\n\n/**\n * [HttpClient] feature that handles http redirect\n */\npublic class HttpRedirect {\n private val _checkHttpMethod = atomic(true)\n private val _allowHttpsDowngrade = atomic(false)\n\n /**\n * Check if the HTTP method is allowed for redirect.\n * Only [HttpMethod.Get] and [HttpMethod.Head] is allowed for implicit redirect.\n *\n * Please note: changing this flag could lead to security issues, consider changing the request URL instead.\n */\n public var checkHttpMethod: Boolean\n get() = _checkHttpMethod.value\n set(value) {\n _checkHttpMethod.value = value\n }\n\n /**\n * `true` value allows client redirect with downgrade from https to plain http.\n */\n public var allowHttpsDowngrade: Boolean\n get() = _allowHttpsDowngrade.value\n set(value) {\n _allowHttpsDowngrade.value = value\n }\n\n public companion object Feature : HttpClientFeature {\n override val key: AttributeKey = AttributeKey(\"HttpRedirect\")\n\n override fun prepare(block: HttpRedirect.() -> Unit): HttpRedirect = HttpRedirect().apply(block)\n\n override fun install(feature: HttpRedirect, scope: HttpClient) {\n scope[HttpSend].intercept { origin, context ->\n if (feature.checkHttpMethod && origin.request.method !in ALLOWED_FOR_REDIRECT) {\n return@intercept origin\n }\n\n handleCall(context, origin, feature.allowHttpsDowngrade)\n }\n }\n\n private suspend fun Sender.handleCall(\n context: HttpRequestBuilder,\n origin: HttpClientCall,\n allowHttpsDowngrade: Boolean\n ): HttpClientCall {\n if (!origin.response.status.isRedirect()) return origin\n\n var call = origin\n var requestBuilder = context\n val originProtocol = origin.request.url.protocol\n val originAuthority = origin.request.url.authority\n while (true) {\n val location = call.response.headers[HttpHeaders.Location]\n\n requestBuilder = HttpRequestBuilder().apply {\n takeFromWithExecutionContext(requestBuilder)\n url.parameters.clear()\n\n location?.let { url.takeFrom(it) }\n\n /**\n * Disallow redirect with a security downgrade.\n */\n if (!allowHttpsDowngrade && originProtocol.isSecure() && !url.protocol.isSecure()) {\n return call\n }\n\n if (originAuthority != url.authority) {\n headers.remove(HttpHeaders.Authorization)\n }\n }\n\n call = execute(requestBuilder)\n if (!call.response.status.isRedirect()) return call\n }\n }\n }\n}\n\nprivate fun HttpStatusCode.isRedirect(): Boolean = when (value) {\n HttpStatusCode.MovedPermanently.value,\n HttpStatusCode.Found.value,\n HttpStatusCode.TemporaryRedirect.value,\n HttpStatusCode.PermanentRedirect.value,\n HttpStatusCode.SeeOther.value -> true\n else -> false\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features\n\nimport io.ktor.client.*\nimport io.ktor.client.request.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.*\nimport kotlinx.coroutines.*\n\n/**\n * Client HTTP feature that sets up [HttpRequestBuilder.executionContext] and completes it when the pipeline is fully\n * processed.\n */\ninternal class HttpRequestLifecycle {\n /**\n * Companion object for feature installation.\n */\n companion object Feature : HttpClientFeature {\n\n override val key: AttributeKey = AttributeKey(\"RequestLifecycle\")\n\n override fun prepare(block: Unit.() -> Unit): HttpRequestLifecycle = HttpRequestLifecycle()\n\n override fun install(feature: HttpRequestLifecycle, scope: HttpClient) {\n scope.requestPipeline.intercept(HttpRequestPipeline.Before) {\n val executionContext = Job(context.executionContext).also {\n it.makeShared()\n }\n\n attachToClientEngineJob(executionContext, scope.coroutineContext[Job]!!)\n\n try {\n context.executionContext = executionContext\n proceed()\n } catch (cause: Throwable) {\n executionContext.completeExceptionally(cause)\n throw cause\n } finally {\n executionContext.complete()\n }\n }\n }\n }\n}\n\n/**\n * Attach client engine job.\n */\nprivate fun attachToClientEngineJob(\n requestJob: CompletableJob,\n clientEngineJob: Job\n) {\n clientEngineJob.makeShared()\n\n val handler = clientEngineJob.invokeOnCompletion { cause ->\n if (cause != null) {\n requestJob.cancel(\"Engine failed\", cause)\n } else {\n requestJob.complete()\n }\n }\n\n requestJob.invokeOnCompletion {\n handler.dispose()\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features\n\nimport io.ktor.client.*\nimport io.ktor.client.call.*\nimport io.ktor.client.request.*\nimport io.ktor.client.utils.*\nimport io.ktor.http.content.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.concurrent.*\nimport kotlinx.coroutines.*\n\n/**\n * HttpSend pipeline interceptor function\n */\npublic typealias HttpSendInterceptor = suspend Sender.(HttpClientCall, HttpRequestBuilder) -> HttpClientCall\n\n/**\n * HttpSend pipeline interceptor function backward compatible with previous implementation.\n */\npublic typealias HttpSendInterceptorBackwardCompatible = suspend Sender.(HttpClientCall) -> HttpClientCall\n\n/**\n * This interface represents a request send pipeline interceptor chain\n */\n@KtorExperimentalAPI\npublic interface Sender {\n /**\n * Execute send pipeline. It could start pipeline execution or replace the call\n */\n public suspend fun execute(requestBuilder: HttpRequestBuilder): HttpClientCall\n}\n\n/**\n * This is internal feature that is always installed.\n * @property maxSendCount is a maximum number of requests that can be sent during a call\n */\n@KtorExperimentalAPI\npublic class HttpSend(\n maxSendCount: Int = 20\n) {\n public var maxSendCount: Int by shared(maxSendCount)\n\n private val interceptors: MutableList = sharedList()\n\n init {\n makeShared()\n }\n\n /**\n * Install send pipeline starter interceptor\n */\n public fun intercept(block: HttpSendInterceptor) {\n interceptors += block\n }\n\n /**\n * Install send pipeline starter interceptor (backward compatible function).\n */\n @Deprecated(\"Intercept with one parameter is deprecated, use both call and request builder as parameters.\")\n public fun intercept(block: HttpSendInterceptorBackwardCompatible) {\n interceptors += { call, _ ->\n block(call)\n }\n }\n\n /**\n * Feature installation object\n */\n public companion object Feature : HttpClientFeature {\n override val key: AttributeKey = AttributeKey(\"HttpSend\")\n\n override fun prepare(block: HttpSend.() -> Unit): HttpSend = HttpSend().apply(block)\n\n override fun install(feature: HttpSend, scope: HttpClient) {\n // default send scenario\n scope.requestPipeline.intercept(HttpRequestPipeline.Send) { content ->\n check(content is OutgoingContent) {\n \"\"\"\n|Fail to serialize body. Content has type: ${content::class}, but OutgoingContent expected.\n|If you expect serialized body, please check that you have installed the corresponding feature(like `Json`) and set `Content-Type` header.\"\"\"\n .trimMargin()\n }\n context.body = content\n\n val sender = DefaultSender(feature.maxSendCount, scope)\n var currentCall = sender.execute(context)\n var callChanged: Boolean\n\n do {\n callChanged = false\n\n passInterceptors@ for (interceptor in feature.interceptors) {\n val transformed = interceptor(sender, currentCall, context)\n if (transformed === currentCall) continue@passInterceptors\n\n currentCall = transformed\n callChanged = true\n break@passInterceptors\n }\n } while (callChanged)\n\n proceedWith(currentCall)\n }\n }\n }\n\n private class DefaultSender(\n private val maxSendCount: Int,\n private val client: HttpClient\n ) : Sender {\n private var sentCount: Int = 0\n private var currentCall: HttpClientCall? = null\n\n override suspend fun execute(requestBuilder: HttpRequestBuilder): HttpClientCall {\n currentCall?.cancel()\n\n if (sentCount >= maxSendCount) {\n throw SendCountExceedException(\"Max send count $maxSendCount exceeded\")\n }\n\n sentCount++\n val sendResult = client.sendPipeline.execute(\n requestBuilder,\n requestBuilder.body\n )\n\n val call = sendResult as? HttpClientCall\n ?: error(\"Failed to execute send pipeline. Expected to got [HttpClientCall], but received $sendResult\")\n\n currentCall = call\n return call\n }\n }\n}\n\n/**\n * Thrown when too many actual requests were sent during a client call.\n * It could be caused by infinite or too long redirect sequence.\n * Maximum number of requests is limited by [HttpSend.maxSendCount]\n */\npublic class SendCountExceedException(message: String) : IllegalStateException(message)\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features\n\nimport io.ktor.client.*\nimport io.ktor.client.engine.*\nimport io.ktor.client.request.*\nimport io.ktor.network.sockets.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.concurrent.*\nimport kotlinx.coroutines.*\n\n/**\n * Client HTTP timeout feature. There are no default values, so default timeouts will be taken from engine configuration\n * or considered as infinite time if engine doesn't provide them.\n */\npublic class HttpTimeout(\n private val requestTimeoutMillis: Long?,\n private val connectTimeoutMillis: Long?,\n private val socketTimeoutMillis: Long?\n) {\n /**\n * [HttpTimeout] extension configuration that is used during installation.\n */\n public class HttpTimeoutCapabilityConfiguration {\n private var _requestTimeoutMillis: Long? by shared(0)\n private var _connectTimeoutMillis: Long? by shared(0)\n private var _socketTimeoutMillis: Long? by shared(0)\n\n /**\n * Creates a new instance of [HttpTimeoutCapabilityConfiguration].\n */\n @InternalAPI\n public constructor(\n requestTimeoutMillis: Long? = null,\n connectTimeoutMillis: Long? = null,\n socketTimeoutMillis: Long? = null\n ) {\n this.requestTimeoutMillis = requestTimeoutMillis\n this.connectTimeoutMillis = connectTimeoutMillis\n this.socketTimeoutMillis = socketTimeoutMillis\n }\n\n /**\n * Request timeout in milliseconds.\n */\n public var requestTimeoutMillis: Long?\n get() = _requestTimeoutMillis\n set(value) {\n _requestTimeoutMillis = checkTimeoutValue(value)\n }\n\n /**\n * Connect timeout in milliseconds.\n */\n public var connectTimeoutMillis: Long?\n get() = _connectTimeoutMillis\n set(value) {\n _connectTimeoutMillis = checkTimeoutValue(value)\n }\n\n /**\n * Socket timeout (read and write) in milliseconds.\n */\n public var socketTimeoutMillis: Long?\n get() = _socketTimeoutMillis\n set(value) {\n _socketTimeoutMillis = checkTimeoutValue(value)\n }\n\n internal fun build(): HttpTimeout = HttpTimeout(requestTimeoutMillis, connectTimeoutMillis, socketTimeoutMillis)\n\n private fun checkTimeoutValue(value: Long?): Long? {\n require(value == null || value > 0) {\n \"Only positive timeout values are allowed, for infinite timeout use HttpTimeout.INFINITE_TIMEOUT_MS\"\n }\n return value\n }\n\n override fun equals(other: Any?): Boolean {\n if (this === other) return true\n if (other == null || this::class != other::class) return false\n\n other as HttpTimeoutCapabilityConfiguration\n\n if (_requestTimeoutMillis != other._requestTimeoutMillis) return false\n if (_connectTimeoutMillis != other._connectTimeoutMillis) return false\n if (_socketTimeoutMillis != other._socketTimeoutMillis) return false\n\n return true\n }\n\n override fun hashCode(): Int {\n var result = _requestTimeoutMillis?.hashCode() ?: 0\n result = 31 * result + (_connectTimeoutMillis?.hashCode() ?: 0)\n result = 31 * result + (_socketTimeoutMillis?.hashCode() ?: 0)\n return result\n }\n\n public companion object {\n public val key: AttributeKey = AttributeKey(\"TimeoutConfiguration\")\n }\n }\n\n /**\n * Utils method that return true if at least one timeout is configured (has not null value).\n */\n private fun hasNotNullTimeouts() =\n requestTimeoutMillis != null || connectTimeoutMillis != null || socketTimeoutMillis != null\n\n /**\n * Companion object for feature installation.\n */\n public companion object Feature :\n HttpClientFeature,\n HttpClientEngineCapability {\n\n override val key: AttributeKey = AttributeKey(\"TimeoutFeature\")\n\n /**\n * Infinite timeout in milliseconds.\n */\n public const val INFINITE_TIMEOUT_MS: Long = Long.MAX_VALUE\n\n override fun prepare(block: HttpTimeoutCapabilityConfiguration.() -> Unit): HttpTimeout =\n HttpTimeoutCapabilityConfiguration().apply(block).build()\n\n override fun install(feature: HttpTimeout, scope: HttpClient) {\n scope.requestPipeline.intercept(HttpRequestPipeline.Before) {\n var configuration = context.getCapabilityOrNull(HttpTimeout)\n if (configuration == null && feature.hasNotNullTimeouts()) {\n configuration = HttpTimeoutCapabilityConfiguration()\n context.setCapability(HttpTimeout, configuration)\n }\n\n configuration?.apply {\n connectTimeoutMillis = connectTimeoutMillis ?: feature.connectTimeoutMillis\n socketTimeoutMillis = socketTimeoutMillis ?: feature.socketTimeoutMillis\n requestTimeoutMillis = requestTimeoutMillis ?: feature.requestTimeoutMillis\n\n val requestTimeout = requestTimeoutMillis ?: feature.requestTimeoutMillis\n if (requestTimeout == null || requestTimeout == INFINITE_TIMEOUT_MS) return@apply\n\n val executionContext = context.executionContext\n val killer = scope.launch {\n delay(requestTimeout)\n executionContext.cancel(HttpRequestTimeoutException(context))\n }\n\n context.executionContext.invokeOnCompletion {\n killer.cancel()\n }\n }\n }\n }\n }\n}\n\n/**\n * Adds timeout boundaries to the request. Requires [HttpTimeout] feature to be installed.\n */\npublic fun HttpRequestBuilder.timeout(block: HttpTimeout.HttpTimeoutCapabilityConfiguration.() -> Unit): Unit =\n setCapability(HttpTimeout, HttpTimeout.HttpTimeoutCapabilityConfiguration().apply(block))\n\n/**\n * This exception is thrown in case request timeout exceeded.\n */\npublic class HttpRequestTimeoutException(\n request: HttpRequestBuilder\n) : CancellationException(\n \"Request timeout has been expired [url=${request.url.buildString()}, \" +\n \"request_timeout=${request.getCapabilityOrNull(HttpTimeout)?.requestTimeoutMillis ?: \"unknown\"} ms]\"\n)\n\n/**\n * This exception is thrown in case connect timeout exceeded.\n */\npublic fun ConnectTimeoutException(\n request: HttpRequestData,\n cause: Throwable? = null\n): ConnectTimeoutException = ConnectTimeoutException(\n \"Connect timeout has been expired [url=${request.url}, \" +\n \"connect_timeout=${request.getCapabilityOrNull(HttpTimeout)?.connectTimeoutMillis ?: \"unknown\"} ms]\",\n cause\n)\n\n/**\n * This exception is thrown in case connect timeout exceeded.\n */\npublic fun ConnectTimeoutException(\n url: String,\n timeout: Long?,\n cause: Throwable? = null\n): ConnectTimeoutException = ConnectTimeoutException(\n \"Connect timeout has been expired [url=$url, connect_timeout=${timeout ?: \"unknown\"} ms]\",\n cause\n)\n\n/**\n * This exception is thrown in case socket timeout (read or write) exceeded.\n */\npublic fun SocketTimeoutException(\n request: HttpRequestData,\n cause: Throwable? = null\n): SocketTimeoutException = SocketTimeoutException(\n \"Socket timeout has been expired [url=${request.url}, \" +\n \"socket_timeout=${request.getCapabilityOrNull(HttpTimeout)?.socketTimeoutMillis ?: \"unknown\"}] ms\",\n cause\n)\n\n/**\n * Convert long timeout in milliseconds to int value. To do that we need to consider [HttpTimeout.INFINITE_TIMEOUT_MS]\n * as zero and convert timeout value to [Int].\n */\n@InternalAPI\npublic fun convertLongTimeoutToIntWithInfiniteAsZero(timeout: Long): Int = when {\n timeout == HttpTimeout.INFINITE_TIMEOUT_MS -> 0\n timeout < Int.MIN_VALUE -> Int.MIN_VALUE\n timeout > Int.MAX_VALUE -> Int.MAX_VALUE\n else -> timeout.toInt()\n}\n\n/**\n * Convert long timeout in milliseconds to long value. To do that we need to consider [HttpTimeout.INFINITE_TIMEOUT_MS]\n * as zero and convert timeout value to [Int].\n */\n@InternalAPI\npublic fun convertLongTimeoutToLongWithInfiniteAsZero(timeout: Long): Long = when (timeout) {\n HttpTimeout.INFINITE_TIMEOUT_MS -> 0L\n else -> timeout\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features.cookies\n\nimport io.ktor.client.*\nimport io.ktor.client.features.*\nimport io.ktor.client.features.cookies.HttpCookies.*\nimport io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport io.ktor.http.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.core.*\nimport kotlinx.coroutines.*\n\n/**\n * [HttpClient] feature that handles sent `Cookie`, and received `Set-Cookie` headers,\n * using a specific [storage] for storing and retrieving cookies.\n *\n * You can configure the [Config.storage] and to provide [Config.default] blocks to set\n * cookies when installing.\n */\npublic class HttpCookies(\n private val storage: CookiesStorage,\n private val defaults: List Unit>\n) : Closeable {\n private val initializer: Job = GlobalScope.launch(Dispatchers.Unconfined) {\n defaults.forEach { it(storage) }\n }\n\n /**\n * Find all cookies by [requestUrl].\n */\n public suspend fun get(requestUrl: Url): List {\n initializer.join()\n return storage.get(requestUrl)\n }\n\n internal suspend fun sendCookiesWith(builder: HttpRequestBuilder) {\n val cookies = get(builder.url.clone().build())\n\n with(builder) {\n if (cookies.isNotEmpty()) {\n headers[HttpHeaders.Cookie] = renderClientCookies(cookies)\n } else {\n headers.remove(HttpHeaders.Cookie)\n }\n }\n }\n\n internal suspend fun saveCookiesFrom(response: HttpResponse) {\n val url = response.request.url\n response.setCookie().forEach {\n storage.addCookie(url, it)\n }\n }\n\n override fun close() {\n storage.close()\n }\n\n /**\n * [HttpCookies] configuration.\n */\n public class Config {\n private val defaults = mutableListOf Unit>()\n\n /**\n * [CookiesStorage] that will be used at this feature.\n * By default it just uses an initially empty in-memory [AcceptAllCookiesStorage].\n */\n public var storage: CookiesStorage = AcceptAllCookiesStorage()\n\n /**\n * Registers a [block] that will be called when the configuration is complete the specified [storage].\n * The [block] can potentially add new cookies by calling [CookiesStorage.addCookie].\n */\n public fun default(block: suspend CookiesStorage.() -> Unit) {\n defaults.add(block)\n }\n\n internal fun build(): HttpCookies = HttpCookies(storage, defaults)\n }\n\n public companion object : HttpClientFeature {\n override fun prepare(block: Config.() -> Unit): HttpCookies = Config().apply(block).build()\n\n override val key: AttributeKey = AttributeKey(\"HttpCookies\")\n\n override fun install(feature: HttpCookies, scope: HttpClient) {\n scope.sendPipeline.intercept(HttpSendPipeline.State) {\n feature.sendCookiesWith(context)\n }\n\n scope.receivePipeline.intercept(HttpReceivePipeline.State) { response ->\n feature.saveCookiesFrom(response)\n }\n }\n }\n}\n\nprivate fun renderClientCookies(cookies: List): String = buildString {\n cookies.forEach {\n append(it.name)\n append('=')\n append(encodeCookieValue(it.value, it.encoding))\n append(';')\n }\n}\n\n/**\n * Gets all the cookies for the specified [url] for this [HttpClient].\n */\npublic suspend fun HttpClient.cookies(url: Url): List = feature(HttpCookies)?.get(url) ?: emptyList()\n\n/**\n * Gets all the cookies for the specified [urlString] for this [HttpClient].\n */\npublic suspend fun HttpClient.cookies(urlString: String): List =\n feature(HttpCookies)?.get(Url(urlString)) ?: emptyList()\n\n/**\n * Find the [Cookie] by [name]\n */\npublic operator fun List.get(name: String): Cookie? = find { it.name == name }\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features.observer\n\nimport io.ktor.client.*\nimport io.ktor.client.call.*\nimport io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport io.ktor.http.*\nimport io.ktor.util.*\nimport io.ktor.util.date.*\nimport io.ktor.utils.io.*\nimport kotlin.coroutines.*\n\n/**\n * Wrap existing [HttpClientCall] with new [content].\n */\n@Deprecated(\n \"Parameter [shouldCloseOrigin] is deprecated\",\n ReplaceWith(\"wrapWithContent(content)\"),\n level = DeprecationLevel.ERROR\n)\npublic fun HttpClientCall.wrapWithContent(\n content: ByteReadChannel,\n shouldCloseOrigin: Boolean\n): HttpClientCall = wrapWithContent(content)\n\n/**\n * Wrap existing [HttpClientCall] with new [content].\n */\n@KtorExperimentalAPI\npublic fun HttpClientCall.wrapWithContent(content: ByteReadChannel): HttpClientCall {\n val currentClient = client ?: error(\"Fail to create response observer in different native thread.\")\n\n return DelegatedCall(currentClient, content, this)\n}\n\ninternal class DelegatedCall(\n client: HttpClient,\n content: ByteReadChannel,\n originCall: HttpClientCall\n) : HttpClientCall(client) {\n\n init {\n request = DelegatedRequest(this, originCall.request)\n response = DelegatedResponse(this, content, originCall.response)\n }\n}\n\ninternal class DelegatedRequest(\n override val call: HttpClientCall,\n origin: HttpRequest\n) : HttpRequest by origin\n\ninternal class DelegatedResponse(\n override val call: HttpClientCall,\n override val content: ByteReadChannel,\n private val origin: HttpResponse\n) : HttpResponse() {\n override val coroutineContext: CoroutineContext = origin.coroutineContext\n\n override val status: HttpStatusCode get() = origin.status\n\n override val version: HttpProtocolVersion get() = origin.version\n\n override val requestTime: GMTDate get() = origin.requestTime\n\n override val responseTime: GMTDate get() = origin.responseTime\n\n override val headers: Headers get() = origin.headers\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features.observer\n\nimport io.ktor.client.*\nimport io.ktor.client.features.*\nimport io.ktor.client.statement.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.*\nimport kotlinx.coroutines.*\n\n/**\n * [ResponseObserver] callback.\n */\npublic typealias ResponseHandler = suspend (HttpResponse) -> Unit\n\n/**\n * Observe response feature.\n */\npublic class ResponseObserver(\n private val responseHandler: ResponseHandler\n) {\n public class Config {\n internal var responseHandler: ResponseHandler = {}\n\n /**\n * Set response handler for logging.\n */\n public fun onResponse(block: ResponseHandler) {\n responseHandler = block\n }\n }\n\n public companion object Feature : HttpClientFeature {\n\n override val key: AttributeKey = AttributeKey(\"BodyInterceptor\")\n\n override fun prepare(block: Config.() -> Unit): ResponseObserver =\n ResponseObserver(Config().apply(block).responseHandler)\n\n override fun install(feature: ResponseObserver, scope: HttpClient) {\n scope.receivePipeline.intercept(HttpReceivePipeline.After) { response ->\n val (loggingContent, responseContent) = response.content.split(response)\n\n val newClientCall = context.wrapWithContent(responseContent)\n val sideCall = newClientCall.wrapWithContent(loggingContent)\n\n scope.launch {\n try {\n feature.responseHandler(sideCall.response)\n } catch (_: Throwable) {\n }\n\n val content = sideCall.response.content\n if (!content.isClosedForRead) {\n content.discard()\n }\n }\n\n context.response = newClientCall.response\n context.request = newClientCall.request\n\n @Suppress(\"UNCHECKED_CAST\")\n (response.coroutineContext[Job] as CompletableJob).complete()\n proceedWith(context.response)\n }\n }\n }\n}\n\n/**\n * Install [ResponseObserver] feature in client.\n */\npublic fun HttpClientConfig<*>.ResponseObserver(block: ResponseHandler) {\n install(ResponseObserver) {\n responseHandler = block\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features.websocket\n\nimport io.ktor.client.*\nimport io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport io.ktor.http.*\nimport io.ktor.http.cio.websocket.*\n\n/**\n * Install [WebSockets] feature using the [config] as configuration.\n */\npublic fun HttpClientConfig<*>.WebSockets(config: WebSockets.Config.() -> Unit) {\n install(WebSockets) {\n config()\n }\n}\n\n/**\n * Open [DefaultClientWebSocketSession].\n */\n@OptIn(WebSocketInternalAPI::class)\npublic suspend fun HttpClient.webSocketSession(\n block: HttpRequestBuilder.() -> Unit\n): DefaultClientWebSocketSession = request {\n url {\n protocol = URLProtocol.WS\n port = protocol.defaultPort\n }\n block()\n}\n\n/**\n * Open [DefaultClientWebSocketSession].\n */\n@OptIn(WebSocketInternalAPI::class)\npublic suspend fun HttpClient.webSocketSession(\n method: HttpMethod = HttpMethod.Get,\n host: String = \"localhost\",\n port: Int = DEFAULT_PORT,\n path: String = \"/\",\n block: HttpRequestBuilder.() -> Unit = {}\n): DefaultClientWebSocketSession = webSocketSession {\n this.method = method\n url(\"ws\", host, port, path)\n block()\n}\n\n/**\n * Open [block] with [DefaultClientWebSocketSession].\n */\npublic suspend fun HttpClient.webSocket(\n request: HttpRequestBuilder.() -> Unit,\n block: suspend DefaultClientWebSocketSession.() -> Unit\n) {\n val session = request {\n url {\n protocol = URLProtocol.WS\n port = protocol.defaultPort\n }\n request()\n }\n\n session.receive {\n try {\n block(it)\n } finally {\n it.close()\n }\n }\n}\n\n/**\n * Open [block] with [DefaultClientWebSocketSession].\n */\npublic suspend fun HttpClient.webSocket(\n method: HttpMethod = HttpMethod.Get,\n host: String = \"localhost\",\n port: Int = DEFAULT_PORT,\n path: String = \"/\",\n request: HttpRequestBuilder.() -> Unit = {},\n block: suspend DefaultClientWebSocketSession.() -> Unit\n) {\n webSocket(\n {\n this.method = method\n url(\"ws\", host, port, path)\n request()\n },\n block\n )\n}\n\n/**\n * Open [block] with [DefaultClientWebSocketSession].\n */\npublic suspend fun HttpClient.webSocket(\n urlString: String,\n request: HttpRequestBuilder.() -> Unit = {},\n block: suspend DefaultClientWebSocketSession.() -> Unit\n) {\n webSocket(\n HttpMethod.Get,\n \"localhost\",\n DEFAULT_PORT,\n \"/\",\n {\n url.protocol = URLProtocol.WS\n url.port = port\n\n url.takeFrom(urlString)\n request()\n },\n block\n )\n}\n\n/**\n * Open [block] with [DefaultClientWebSocketSession].\n */\npublic suspend fun HttpClient.ws(\n method: HttpMethod = HttpMethod.Get,\n host: String = \"localhost\",\n port: Int = DEFAULT_PORT,\n path: String = \"/\",\n request: HttpRequestBuilder.() -> Unit = {},\n block: suspend DefaultClientWebSocketSession.() -> Unit\n): Unit = webSocket(method, host, port, path, request, block)\n\n/**\n * Open [block] with [DefaultClientWebSocketSession].\n */\npublic suspend fun HttpClient.ws(\n request: HttpRequestBuilder.() -> Unit,\n block: suspend DefaultClientWebSocketSession.() -> Unit\n): Unit = webSocket(request, block)\n\n/**\n * Open [block] with [DefaultClientWebSocketSession].\n */\npublic suspend fun HttpClient.ws(\n urlString: String,\n request: HttpRequestBuilder.() -> Unit = {},\n block: suspend DefaultClientWebSocketSession.() -> Unit\n): Unit = webSocket(urlString, request, block)\n\n/**\n * Open [block] with secure [DefaultClientWebSocketSession].\n */\npublic suspend fun HttpClient.wss(\n request: HttpRequestBuilder.() -> Unit,\n block: suspend DefaultClientWebSocketSession.() -> Unit\n): Unit = webSocket(\n {\n url.protocol = URLProtocol.WSS\n url.port = url.protocol.defaultPort\n request()\n },\n block = block\n)\n\n/**\n * Open [block] with secure [DefaultClientWebSocketSession].\n */\npublic suspend fun HttpClient.wss(\n urlString: String,\n request: HttpRequestBuilder.() -> Unit = {},\n block: suspend DefaultClientWebSocketSession.() -> Unit\n): Unit = wss(\n {\n url.takeFrom(urlString)\n request()\n },\n block = block\n)\n\n/**\n * Open [block] with secure [DefaultClientWebSocketSession].\n */\npublic suspend fun HttpClient.wss(\n method: HttpMethod = HttpMethod.Get,\n host: String = \"localhost\",\n port: Int = DEFAULT_PORT,\n path: String = \"/\",\n request: HttpRequestBuilder.() -> Unit = {},\n block: suspend DefaultClientWebSocketSession.() -> Unit\n): Unit = webSocket(\n method,\n host,\n port,\n path,\n request = {\n url.protocol = URLProtocol.WSS\n url.port = port\n\n request()\n },\n block = block\n)\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.statement\n\nimport io.ktor.client.*\nimport io.ktor.client.call.*\nimport io.ktor.client.engine.*\nimport io.ktor.client.features.*\nimport io.ktor.client.request.*\nimport io.ktor.http.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.*\nimport kotlinx.coroutines.*\n\n/**\n * Prepared statement for http client request.\n * This statement doesn't perform any network requests until [execute] method call.\n *\n * [HttpStatement] is safe to execute multiple times.\n */\npublic class HttpStatement(\n private val builder: HttpRequestBuilder,\n private val client: HttpClient\n) {\n init {\n checkCapabilities()\n }\n\n /**\n * Executes this statement and call the [block] with the streaming [response].\n *\n * The [response] argument holds a network connection until the [block] isn't completed. You can read the body\n * on-demand or at once with [receive()] method.\n *\n * After [block] finishes, [response] will be completed body will be discarded or released depends on the engine configuration.\n *\n * Please note: the [response] instance will be canceled and shouldn't be passed outside of [block].\n */\n public suspend fun execute(block: suspend (response: HttpResponse) -> T): T {\n val response: HttpResponse = executeUnsafe()\n\n try {\n return block(response)\n } finally {\n response.cleanup()\n }\n }\n\n /**\n * Executes this statement and download the response.\n * After the method finishes, the client downloads the response body in memory and release the connection.\n *\n * To receive exact type you consider using [receive()] method.\n */\n public suspend fun execute(): HttpResponse = execute {\n val savedCall = it.call.save()\n savedCall.response\n }\n\n /**\n * Executes this statement and run [HttpClient.responsePipeline] with the response and expected type [T].\n *\n * Note if T is a streaming type, you should manage how to close it manually.\n */\n @OptIn(ExperimentalStdlibApi::class)\n public suspend inline fun receive(): T = when (T::class) {\n HttpStatement::class -> this as T\n HttpResponse::class -> execute() as T\n else -> {\n val response = executeUnsafe()\n try {\n response.receive()\n } finally {\n response.complete()\n }\n }\n }\n\n /**\n * Executes this statement and run the [block] with a [HttpClient.responsePipeline] execution result.\n *\n * Note that T can be a streamed type such as [ByteReadChannel].\n */\n public suspend inline fun receive(crossinline block: suspend (response: T) -> R): R {\n val response: HttpResponse = executeUnsafe()\n try {\n val result = response.receive()\n return block(result)\n } finally {\n response.cleanup()\n }\n }\n\n /**\n * Return [HttpResponse] with open streaming body.\n */\n @PublishedApi\n internal suspend fun executeUnsafe(): HttpResponse {\n val builder = HttpRequestBuilder().takeFromWithExecutionContext(builder)\n @Suppress(\"DEPRECATION_ERROR\")\n val call = client.execute(builder)\n return call.response\n }\n\n /**\n * Complete [HttpResponse] and release resources.\n */\n @PublishedApi\n internal suspend fun HttpResponse.cleanup() {\n val job = coroutineContext[Job]!! as CompletableJob\n\n job.apply {\n complete()\n try {\n content.cancel()\n } catch (_: Throwable) {\n }\n join()\n }\n }\n\n /**\n * Check that all request configuration related to client capabilities have correspondent features installed.\n */\n private fun checkCapabilities() {\n builder.attributes.getOrNull(ENGINE_CAPABILITIES_KEY)?.keys\n ?.filterIsInstance>()\n ?.forEach {\n requireNotNull(client.feature(it)) {\n \"Consider installing $it feature because the request requires it to be installed\"\n }\n }\n }\n\n override fun toString(): String = \"HttpStatement[${builder.url.buildString()}]\"\n}\n\n@Deprecated(\n \"[HttpStatement] isn't closeable.\",\n level = DeprecationLevel.ERROR,\n replaceWith = ReplaceWith(\"this.execute(block)\")\n)\n@Suppress(\"unused\", \"KDocMissingDocumentation\", \"UNUSED_PARAMETER\")\npublic fun HttpStatement.use(block: suspend (response: HttpResponse) -> T) {\n}\n\n@Deprecated(\n \"Unbound [HttpResponse] is deprecated. Consider using [execute()] instead.\",\n level = DeprecationLevel.ERROR,\n replaceWith = ReplaceWith(\"this.execute()\")\n)\n@Suppress(\"KDocMissingDocumentation\", \"unused\")\npublic val HttpStatement.response: HttpResponse\n get() = error(\"Unbound [HttpClientCall] is deprecated. Consider using [HttpResponse] instead.\")\n\n/**\n * Read the [HttpResponse.content] as a String. You can pass an optional [charset]\n * to specify a charset in the case no one is specified as part of the Content-Type response.\n * If no charset specified either as parameter or as part of the response,\n * [io.ktor.client.features.HttpPlainText] settings will be used.\n *\n * Note that [fallbackCharset] parameter will be ignored if the response already has a charset.\n * So it just acts as a fallback, honoring the server preference.\n */\npublic suspend fun HttpResponse.readText(fallbackCharset: Charset? = null): String {\n val originCharset = charset() ?: fallbackCharset ?: Charsets.UTF_8\n val decoder = originCharset.newDecoder()\n val input = receive()\n\n return decoder.decode(input)\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.request\n\nimport io.ktor.http.*\nimport io.ktor.http.content.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.*\n\n@Suppress(\"KDocMissingDocumentation\")\n@InternalAPI\npublic abstract class ClientUpgradeContent : OutgoingContent.NoContent() {\n private val content: ByteChannel by lazy { ByteChannel() }\n\n public val output: ByteWriteChannel get() = content\n\n public suspend fun pipeTo(output: ByteWriteChannel) {\n content.copyAndClose(output)\n }\n\n public abstract fun verify(headers: Headers)\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.request\n\nimport io.ktor.client.call.*\nimport io.ktor.http.*\nimport io.ktor.http.content.*\nimport io.ktor.util.*\nimport kotlin.coroutines.*\n\n/**\n * Default [HttpRequest] implementation.\n */\n@InternalAPI\npublic open class DefaultHttpRequest(override val call: HttpClientCall, data: HttpRequestData) : HttpRequest {\n override val coroutineContext: CoroutineContext get() = call.coroutineContext\n\n override val method: HttpMethod = data.method\n\n override val url: Url = data.url\n\n override val content: OutgoingContent = data.body\n\n override val headers: Headers = data.headers\n\n override val attributes: Attributes = data.attributes\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.request\n\nimport io.ktor.client.*\nimport io.ktor.client.call.*\nimport io.ktor.client.engine.*\nimport io.ktor.client.utils.*\nimport io.ktor.http.*\nimport io.ktor.http.content.*\nimport io.ktor.util.*\nimport io.ktor.util.date.*\nimport io.ktor.utils.io.*\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\n\n/**\n * A request for [HttpClient], first part of [HttpClientCall].\n */\npublic interface HttpRequest : HttpMessage, CoroutineScope {\n /**\n * The associated [HttpClientCall] containing both\n * the underlying [HttpClientCall.request] and [HttpClientCall.response].\n */\n public val call: HttpClientCall\n\n override val coroutineContext: CoroutineContext get() = call.coroutineContext\n\n /**\n * The [HttpMethod] or HTTP VERB used for this request.\n */\n public val method: HttpMethod\n\n /**\n * The [Url] representing the endpoint and the uri for this request.\n */\n public val url: Url\n\n /**\n * Typed [Attributes] associated to this call serving as a lightweight container.\n */\n public val attributes: Attributes\n\n @Deprecated(\n \"Binary compatibility.\",\n level = DeprecationLevel.HIDDEN\n )\n @Suppress(\"unused\", \"KDocMissingDocumentation\")\n public val executionContext: Job\n get() = coroutineContext[Job]!!\n\n /**\n * An [OutgoingContent] representing the request body\n */\n public val content: OutgoingContent\n}\n\n/**\n * Class for building [HttpRequestData].\n */\npublic class HttpRequestBuilder : HttpMessageBuilder {\n /**\n * [URLBuilder] to configure the URL for this request.\n */\n public val url: URLBuilder = URLBuilder()\n\n /**\n * [HttpMethod] used by this request. [HttpMethod.Get] by default.\n */\n public var method: HttpMethod = HttpMethod.Get\n\n /**\n * [HeadersBuilder] to configure the headers for this request.\n */\n override val headers: HeadersBuilder = HeadersBuilder()\n\n /**\n * The [body] for this request. Initially [EmptyContent].\n */\n public var body: Any = EmptyContent\n\n /**\n * A deferred used to control the execution of this request.\n */\n @KtorExperimentalAPI\n public var executionContext: Job = SupervisorJob()\n .also { it.makeShared() }\n internal set(value) {\n value.makeShared()\n field = value\n }\n\n /**\n * Call specific attributes.\n */\n public val attributes: Attributes = Attributes(concurrent = true)\n\n /**\n * Executes a [block] that configures the [URLBuilder] associated to this request.\n */\n public fun url(block: URLBuilder.(URLBuilder) -> Unit): Unit = url.block(url)\n\n /**\n * Create immutable [HttpRequestData]\n */\n public fun build(): HttpRequestData = HttpRequestData(\n url.build(),\n method,\n headers.build(),\n body as? OutgoingContent ?: error(\"No request transformation found: $body\"),\n executionContext,\n attributes\n )\n\n /**\n * Set request specific attributes specified by [block].\n */\n public fun setAttributes(block: Attributes.() -> Unit) {\n attributes.apply(block)\n }\n\n /**\n * Mutates [this] copying all the data from another [builder] using it as base.\n */\n @InternalAPI\n public fun takeFromWithExecutionContext(builder: HttpRequestBuilder): HttpRequestBuilder {\n executionContext = builder.executionContext\n return takeFrom(builder)\n }\n\n /**\n * Mutates [this] copying all the data but execution context from another [builder] using it as base.\n */\n public fun takeFrom(builder: HttpRequestBuilder): HttpRequestBuilder {\n method = builder.method\n body = builder.body\n url.takeFrom(builder.url)\n url.encodedPath = if (url.encodedPath.isBlank()) \"/\" else url.encodedPath\n headers.appendAll(builder.headers)\n builder.attributes.allKeys.forEach {\n @Suppress(\"UNCHECKED_CAST\")\n attributes.put(it as AttributeKey, builder.attributes[it])\n }\n\n return this\n }\n\n /**\n * Set capability configuration.\n */\n @KtorExperimentalAPI\n public fun setCapability(key: HttpClientEngineCapability, capability: T) {\n val capabilities = attributes.computeIfAbsent(ENGINE_CAPABILITIES_KEY) { sharedMap() }\n capabilities[key] = capability\n }\n\n /**\n * Retrieve capability by key.\n */\n @KtorExperimentalAPI\n public fun getCapabilityOrNull(key: HttpClientEngineCapability): T? {\n @Suppress(\"UNCHECKED_CAST\")\n return attributes.getOrNull(ENGINE_CAPABILITIES_KEY)?.get(key) as T?\n }\n\n public companion object\n}\n\n/**\n * Actual data of the [HttpRequest], including [url], [method], [headers], [body] and [executionContext].\n * Built by [HttpRequestBuilder].\n */\npublic class HttpRequestData @InternalAPI constructor(\n public val url: Url,\n public val method: HttpMethod,\n public val headers: Headers,\n public val body: OutgoingContent,\n public val executionContext: Job,\n public val attributes: Attributes\n) {\n /**\n * Retrieve extension by it's key.\n */\n @KtorExperimentalAPI\n public fun getCapabilityOrNull(key: HttpClientEngineCapability): T? {\n @Suppress(\"UNCHECKED_CAST\")\n return attributes.getOrNull(ENGINE_CAPABILITIES_KEY)?.get(key) as T?\n }\n\n /**\n * All extension keys associated with this request.\n */\n internal val requiredCapabilities: Set> =\n attributes.getOrNull(ENGINE_CAPABILITIES_KEY)?.keys ?: emptySet()\n\n override fun toString(): String = \"HttpRequestData(url=$url, method=$method)\"\n}\n\n/**\n * Data prepared for [HttpResponse].\n */\npublic class HttpResponseData constructor(\n public val statusCode: HttpStatusCode,\n public val requestTime: GMTDate,\n public val headers: Headers,\n public val version: HttpProtocolVersion,\n public val body: Any,\n public val callContext: CoroutineContext\n) {\n public val responseTime: GMTDate = GMTDate()\n\n override fun toString(): String = \"HttpResponseData=(statusCode=$statusCode)\"\n}\n\n/**\n * Executes a [block] that configures the [HeadersBuilder] associated to this request.\n */\npublic fun HttpRequestBuilder.headers(block: HeadersBuilder.() -> Unit): HeadersBuilder = headers.apply(block)\n\n/**\n * Mutates [this] copying all the data from another [request] using it as base.\n */\npublic fun HttpRequestBuilder.takeFrom(request: HttpRequest): HttpRequestBuilder {\n method = request.method\n body = request.content\n url.takeFrom(request.url)\n headers.appendAll(request.headers)\n\n return this\n}\n\n/**\n * Executes a [block] that configures the [URLBuilder] associated to this request.\n */\npublic fun HttpRequestBuilder.url(block: URLBuilder.() -> Unit): Unit = block(url)\n\n/**\n * Sets the [HttpRequestBuilder] from [request].\n */\npublic fun HttpRequestBuilder.takeFrom(request: HttpRequestData): HttpRequestBuilder {\n method = request.method\n body = request.body\n url.takeFrom(request.url)\n headers.appendAll(request.headers)\n\n return this\n}\n\n/**\n * Executes a [block] that configures the [URLBuilder] associated to thisrequest.\n */\npublic operator fun HttpRequestBuilder.Companion.invoke(block: URLBuilder.() -> Unit): HttpRequestBuilder =\n HttpRequestBuilder().apply { url(block) }\n\n/**\n * Sets the [url] using the specified [scheme], [host], [port] and [path].\n */\npublic fun HttpRequestBuilder.url(\n scheme: String = \"http\",\n host: String = \"localhost\",\n port: Int = DEFAULT_PORT,\n path: String = \"/\",\n block: URLBuilder.() -> Unit = {}\n): Unit { // ktlint-disable filename no-unit-return\n url.apply {\n protocol = URLProtocol.createOrDefault(scheme)\n this.host = host\n this.port = port\n encodedPath = path\n block(url)\n }\n}\n\n/**\n * Constructs a [HttpRequestBuilder] from URL information: [scheme], [host], [port] and [path]\n * and optionally further configures it using [block].\n */\npublic operator fun HttpRequestBuilder.Companion.invoke(\n scheme: String = \"http\",\n host: String = \"localhost\",\n port: Int = DEFAULT_PORT,\n path: String = \"/\",\n block: URLBuilder.() -> Unit = {}\n): HttpRequestBuilder = HttpRequestBuilder().apply { url(scheme, host, port, path, block) }\n\n/**\n * Sets the [HttpRequestBuilder.url] from [urlString].\n */\npublic fun HttpRequestBuilder.url(urlString: String): Unit { // ktlint-disable filename no-unit-return\n url.takeFrom(urlString)\n}\n\n@InternalAPI\n@Suppress(\"KDocMissingDocumentation\")\npublic fun HttpRequestData.isUpgradeRequest(): Boolean {\n return body is ClientUpgradeContent\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.request\n\nimport io.ktor.client.*\nimport io.ktor.http.*\n\n/**\n * Executes a [HttpClient] GET request, with the specified [url] as Url and\n * an optional [block] receiving an [HttpRequestBuilder] for further configuring the request.\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.get(\n url: Url,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = get {\n this.url.takeFrom(url)\n block()\n}\n\n/**\n * Executes a [HttpClient] POST request, with the specified [url] as Url and\n * an optional [block] receiving an [HttpRequestBuilder] for further configuring the request.\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.post(\n url: Url,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = post {\n this.url.takeFrom(url)\n block()\n}\n\n/**\n * Executes a [HttpClient] PUT request, with the specified [url] as Url and\n * an optional [block] receiving an [HttpRequestBuilder] for further configuring the request.\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.put(\n url: Url,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = put {\n this.url.takeFrom(url)\n block()\n}\n\n/**\n * Executes a [HttpClient] PATCH request, with the specified [url] as Url and\n * an optional [block] receiving an [HttpRequestBuilder] for further configuring the request.\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.patch(\n url: Url,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = patch {\n this.url.takeFrom(url)\n block()\n}\n\n/**\n * Executes a [HttpClient] OPTIONS request, with the specified [url] as Url and\n * an optional [block] receiving an [HttpRequestBuilder] for further configuring the request.\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.options(\n url: Url,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = options {\n this.url.takeFrom(url)\n block()\n}\n\n/**\n * Executes a [HttpClient] HEAD request, with the specified [url] as Url and\n * an optional [block] receiving an [HttpRequestBuilder] for further configuring the request.\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.head(\n url: Url,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = head {\n this.url.takeFrom(url)\n block()\n}\n\n/**\n * Executes a [HttpClient] HEAD request, with the specified [url] as Url and\n * an optional [block] receiving an [HttpRequestBuilder] for further configuring the request.\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.delete(\n url: Url,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = delete {\n this.url.takeFrom(url)\n block()\n}\n\n/**\n * Sets the [HttpRequestBuilder.url] from [url].\n */\npublic fun HttpRequestBuilder.url(url: Url): Unit { // ktlint-disable no-unit-return\n this.url.takeFrom(url)\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.request.forms\n\nimport io.ktor.client.*\nimport io.ktor.client.request.*\nimport io.ktor.http.*\nimport io.ktor.http.content.*\n\n/**\n * Submit [formParameters] request.\n *\n * If [encodeInQuery] specified encode [formParameters] in url parameters and use [HttpMethod.Get] for the request.\n * Otherwise send [HttpMethod.Post] request with [formParameters] encoded in body.\n *\n * [formParameters] encoded using application/x-www-form-urlencoded format.\n */\npublic suspend inline fun HttpClient.submitForm(\n formParameters: Parameters = Parameters.Empty,\n encodeInQuery: Boolean = false,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = request {\n if (encodeInQuery) {\n method = HttpMethod.Get\n url.parameters.appendAll(formParameters)\n } else {\n method = HttpMethod.Post\n body = FormDataContent(formParameters)\n }\n\n block()\n}\n\n/**\n * Submit [formParameters] request.\n *\n * If [encodeInQuery] specified encode [formParameters] in url parameters and use [HttpMethod.Get] for the request.\n * Otherwise send [HttpMethod.Post] request with [formParameters] encoded in body.\n *\n * [url] destination\n * [formParameters] encoded using application/x-www-form-urlencoded format.\n */\npublic suspend inline fun HttpClient.submitForm(\n url: String,\n formParameters: Parameters = Parameters.Empty,\n encodeInQuery: Boolean = false,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = submitForm(formParameters, encodeInQuery) {\n url(url)\n block()\n}\n\n/**\n * Send [HttpMethod.Post] request with [formData] encoded in body.\n * [formData] encoded using multipart/form-data format.\n * https://tools.ietf.org/html/rfc2045\n */\npublic suspend inline fun HttpClient.submitFormWithBinaryData(\n formData: List,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = request {\n method = HttpMethod.Post\n body = MultiPartFormDataContent(formData)\n block()\n}\n\n/**\n * Send [HttpMethod.Post] request with [formData] encoded in body.\n * [url] destination\n * [formData] encoded using multipart/form-data format.\n *\n * https://tools.ietf.org/html/rfc2045\n */\npublic suspend inline fun HttpClient.submitFormWithBinaryData(\n url: String,\n formData: List,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = submitFormWithBinaryData(formData) {\n url(url)\n block()\n}\n\n/**\n * Submit [formParameters] request.\n *\n * If [encodeInQuery] specified encode [formParameters] in url parameters and use [HttpMethod.Get] for the request.\n * Otherwise send [HttpMethod.Post] request with [formParameters] encoded in body.\n *\n * [formParameters] encoded using application/x-www-form-urlencoded format.\n */\npublic suspend inline fun HttpClient.submitForm(\n scheme: String = \"http\",\n host: String = \"localhost\",\n port: Int = 80,\n path: String = \"/\",\n formParameters: Parameters = Parameters.Empty,\n encodeInQuery: Boolean = false,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = submitForm(formParameters, encodeInQuery) {\n url(scheme, host, port, path)\n apply(block)\n}\n\n/**\n * Send [HttpMethod.Post] request with [formData] encoded in body.\n * [formData] encoded using multipart/form-data format.\n * https://tools.ietf.org/html/rfc2045\n */\npublic suspend inline fun HttpClient.submitFormWithBinaryData(\n scheme: String = \"http\",\n host: String = \"localhost\",\n port: Int = 80,\n path: String = \"/\",\n formData: List = emptyList(),\n block: HttpRequestBuilder.() -> Unit = {}\n): T = submitFormWithBinaryData(formData) {\n url(scheme, host, port, path)\n apply(block)\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.request.forms\n\nimport io.ktor.http.*\nimport io.ktor.http.content.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.core.*\nimport kotlin.contracts.*\n\n/**\n * Multipart form item. Use it to build form in client.\n *\n * @param key multipart name\n * @param value content, could be [String], [Number] or [Input]\n * @param headers part headers, note that some servers may fail if an unknown header provided\n */\npublic data class FormPart(val key: String, val value: T, val headers: Headers = Headers.Empty)\n\n/**\n * Build multipart form from [values].\n */\npublic fun formData(vararg values: FormPart<*>): List {\n val result = mutableListOf()\n\n values.forEach { (key, value, headers) ->\n val partHeaders = HeadersBuilder().apply {\n append(HttpHeaders.ContentDisposition, \"form-data; name=${key.escapeIfNeeded()}\")\n appendAll(headers)\n }\n val part = when (value) {\n is String -> PartData.FormItem(value, {}, partHeaders.build())\n is Number -> PartData.FormItem(value.toString(), {}, partHeaders.build())\n is ByteArray -> {\n partHeaders.append(HttpHeaders.ContentLength, value.size.toString())\n PartData.BinaryItem({ ByteReadPacket(value) }, {}, partHeaders.build())\n }\n is ByteReadPacket -> {\n partHeaders.append(HttpHeaders.ContentLength, value.remaining.toString())\n PartData.BinaryItem({ value.copy() }, { value.close() }, partHeaders.build())\n }\n is InputProvider -> {\n val size = value.size\n if (size != null) {\n partHeaders.append(HttpHeaders.ContentLength, size.toString())\n }\n PartData.BinaryItem(value.block, {}, partHeaders.build())\n }\n is Input -> error(\"Can't use [Input] as part of form: $value. Consider using [InputProvider] instead.\")\n else -> error(\"Unknown form content type: $value\")\n }\n\n result += part\n }\n\n return result\n}\n\n/**\n * Build multipart form using [block] function.\n */\npublic fun formData(block: FormBuilder.() -> Unit): List =\n formData(*FormBuilder().apply(block).build().toTypedArray())\n\n/**\n * Form builder type used in [formData] builder function.\n */\npublic class FormBuilder internal constructor() {\n private val parts = mutableListOf>()\n\n /**\n * Append a pair [key]:[value] with optional [headers].\n */\n @InternalAPI\n public fun append(key: String, value: T, headers: Headers = Headers.Empty) {\n parts += FormPart(key, value, headers)\n }\n\n /**\n * Append a pair [key]:[value] with optional [headers].\n */\n public fun append(key: String, value: String, headers: Headers = Headers.Empty) {\n parts += FormPart(key, value, headers)\n }\n\n /**\n * Append a pair [key]:[value] with optional [headers].\n */\n public fun append(key: String, value: Number, headers: Headers = Headers.Empty) {\n parts += FormPart(key, value, headers)\n }\n\n /**\n * Append a pair [key]:[value] with optional [headers].\n */\n public fun append(key: String, value: ByteArray, headers: Headers = Headers.Empty) {\n parts += FormPart(key, value, headers)\n }\n\n /**\n * Append a pair [key]:[value] with optional [headers].\n */\n public fun append(key: String, value: InputProvider, headers: Headers = Headers.Empty) {\n parts += FormPart(key, value, headers)\n }\n\n /**\n * Append a pair [key]:[InputProvider(block)] with optional [headers].\n */\n public fun appendInput(key: String, headers: Headers = Headers.Empty, size: Long? = null, block: () -> Input) {\n parts += FormPart(key, InputProvider(size, block), headers)\n }\n\n /**\n * Append a pair [key]:[value] with optional [headers].\n */\n public fun append(key: String, value: ByteReadPacket, headers: Headers = Headers.Empty) {\n parts += FormPart(key, value, headers)\n }\n\n /**\n * Append a pair [key]:[value] with optional [headers].\n */\n @Suppress(\"UNUSED_PARAMETER\")\n @Deprecated(\n \"Input is not reusable. Please use [InputProvider] instead.\",\n level = DeprecationLevel.ERROR,\n replaceWith = ReplaceWith(\"appendInput(key, headers) { /* create fresh input here */ }\")\n )\n public fun append(key: String, value: Input, headers: Headers = Headers.Empty) {\n error(\"Input is not reusable. Please use [InputProvider] instead.\")\n }\n\n /**\n * Append a form [part].\n */\n public fun append(part: FormPart) {\n parts += part\n }\n\n internal fun build(): List> = parts\n}\n\n/**\n * Append a form part with the specified [key] using [bodyBuilder] for it's body.\n */\n@OptIn(ExperimentalContracts::class)\npublic inline fun FormBuilder.append(\n key: String,\n headers: Headers = Headers.Empty,\n size: Long? = null,\n crossinline bodyBuilder: BytePacketBuilder.() -> Unit\n) {\n contract {\n callsInPlace(bodyBuilder, InvocationKind.EXACTLY_ONCE)\n }\n append(FormPart(key, InputProvider(size) { buildPacket { bodyBuilder() } }, headers))\n}\n\n/**\n * Reusable [Input] form entry.\n *\n * @property size estimate for data produced by the block or `null` if no size estimation known\n * @param block: content generator\n */\n@KtorExperimentalAPI\npublic class InputProvider(public val size: Long? = null, public val block: () -> Input)\n\n/**\n * Append a form part with the specified [key], [filename] and optional [contentType] using [bodyBuilder] for it's body.\n */\n@OptIn(ExperimentalContracts::class)\npublic fun FormBuilder.append(\n key: String,\n filename: String,\n contentType: ContentType? = null,\n size: Long? = null,\n bodyBuilder: BytePacketBuilder.() -> Unit\n) {\n contract {\n callsInPlace(bodyBuilder, InvocationKind.EXACTLY_ONCE)\n }\n\n val headersBuilder = HeadersBuilder()\n headersBuilder[HttpHeaders.ContentDisposition] = \"filename=${filename.escapeIfNeeded()}\"\n contentType?.run { headersBuilder[HttpHeaders.ContentType] = this.toString() }\n val headers = headersBuilder.build()\n\n append(key, headers, size, bodyBuilder)\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.request\n\nimport io.ktor.client.*\nimport io.ktor.client.call.*\nimport io.ktor.util.pipeline.*\n\n/**\n * [HttpClient] Pipeline used for executing [HttpRequest].\n */\npublic class HttpRequestPipeline(\n override val developmentMode: Boolean = false\n) : Pipeline(Before, State, Transform, Render, Send) {\n /**\n * All interceptors accept payload as [subject] and try to convert it to [OutgoingContent]\n * Last phase should proceed with [HttpClientCall]\n */\n public companion object Phases {\n /**\n * The earliest phase that happens before any other\n */\n public val Before: PipelinePhase = PipelinePhase(\"Before\")\n\n /**\n * Use this phase to modify request with shared state\n */\n public val State: PipelinePhase = PipelinePhase(\"State\")\n\n /**\n * Transform request body to supported render format\n */\n public val Transform: PipelinePhase = PipelinePhase(\"Transform\")\n\n /**\n * Encode request body to [OutgoingContent]\n */\n public val Render: PipelinePhase = PipelinePhase(\"Render\")\n\n /**\n * Phase for [HttpSend] feature\n */\n public val Send: PipelinePhase = PipelinePhase(\"Send\")\n }\n}\n\n/**\n * [HttpClient] Pipeline used for sending [HttpRequest] to remote server.\n */\npublic class HttpSendPipeline(\n override val developmentMode: Boolean = false\n) : Pipeline(Before, State, Monitoring, Engine, Receive) {\n\n public companion object Phases {\n /**\n * The earliest phase that happens before any other.\n */\n public val Before: PipelinePhase = PipelinePhase(\"Before\")\n\n /**\n * Use this phase to modify request with shared state.\n */\n public val State: PipelinePhase = PipelinePhase(\"State\")\n\n /**\n * Use this phase for logging and other actions that don't modify request or shared data.\n */\n public val Monitoring: PipelinePhase = PipelinePhase(\"Monitoring\")\n\n /**\n * Send request to remote server.\n */\n public val Engine: PipelinePhase = PipelinePhase(\"Engine\")\n\n /**\n * Receive pipeline execution phase.\n */\n public val Receive: PipelinePhase = PipelinePhase(\"Receive\")\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.request\n\nimport io.ktor.client.*\nimport io.ktor.client.call.*\nimport io.ktor.client.statement.*\nimport io.ktor.client.utils.*\nimport io.ktor.http.*\n\n/**\n * Executes a [HttpClient] request, with the information from the [builder]\n * and tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.request(\n builder: HttpRequestBuilder = HttpRequestBuilder()\n): T = HttpStatement(builder, this).receive()\n\n/**\n * Executes a [HttpClient] request, with the information configured in [builder] block\n * and tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.request(block: HttpRequestBuilder.() -> Unit): T =\n request(HttpRequestBuilder().apply(block))\n\n/**\n * Executes a [HttpClient] request, with the [urlString] and the information configured in builder [block]\n * and tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.request(\n urlString: String,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = request(\n HttpRequestBuilder().apply {\n url(urlString)\n block()\n }\n)\n\n/**\n * Executes a [HttpClient] request, with the [url] and the information configured in builder [block]\n * and tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.request(\n url: Url,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = request(\n HttpRequestBuilder().apply {\n url(url)\n block()\n }\n)\n\n/**\n * Executes a [HttpClient] GET request, with the information from the [builder]\n * and tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.get(builder: HttpRequestBuilder): T {\n builder.method = HttpMethod.Get\n return request(builder)\n}\n\n/**\n * Executes a [HttpClient] POST request, with the information from the [builder]\n * and tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.post(builder: HttpRequestBuilder): T {\n builder.method = HttpMethod.Post\n return request(builder)\n}\n\n/**\n * Executes a [HttpClient] PUT request, with the information from the [builder]\n * and tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.put(builder: HttpRequestBuilder): T {\n builder.method = HttpMethod.Put\n return request(builder)\n}\n\n/**\n * Executes a [HttpClient] DELETE request, with the information from the [builder]\n * and tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.delete(builder: HttpRequestBuilder): T {\n builder.method = HttpMethod.Delete\n return request(builder)\n}\n\n/**\n * Executes a [HttpClient] OPTIONS request, with the information from the [builder]\n * and tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.options(builder: HttpRequestBuilder): T {\n builder.method = HttpMethod.Options\n return request(builder)\n}\n\n/**\n * Executes a [HttpClient] PATCH request, with the information from the [builder]\n * and tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.patch(builder: HttpRequestBuilder): T {\n builder.method = HttpMethod.Patch\n return request(builder)\n}\n\n/**\n * Executes a [HttpClient] HEAD request, with the information from the [builder]\n * and tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.head(builder: HttpRequestBuilder): T {\n builder.method = HttpMethod.Head\n return request(builder)\n}\n\n/**\n * Executes a [HttpClient] GET request, with the specified [scheme], [host], [port], [path] and [body].\n * And allows to further configure the request, using a [block] receiving an [HttpRequestBuilder].\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.get(\n scheme: String = \"http\",\n host: String = \"localhost\",\n port: Int = DEFAULT_PORT,\n path: String = \"/\",\n body: Any = EmptyContent,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = request {\n url(scheme, host, port, path)\n method = HttpMethod.Get\n this.body = body\n apply(block)\n}\n\n/**\n * Executes a [HttpClient] POST request, with the specified [scheme], [host], [port], [path] and [body].\n * And allows to further configure the request, using a [block] receiving an [HttpRequestBuilder].\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.post(\n scheme: String = \"http\",\n host: String = \"localhost\",\n port: Int = DEFAULT_PORT,\n path: String = \"/\",\n body: Any = EmptyContent,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = request {\n url(scheme, host, port, path)\n method = HttpMethod.Post\n this.body = body\n apply(block)\n}\n\n/**\n * Executes a [HttpClient] PUT request, with the specified [scheme], [host], [port], [path] and [body].\n * And allows to further configure the request, using a [block] receiving an [HttpRequestBuilder].\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.put(\n scheme: String = \"http\",\n host: String = \"localhost\",\n port: Int = DEFAULT_PORT,\n path: String = \"/\",\n body: Any = EmptyContent,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = request {\n url(scheme, host, port, path)\n method = HttpMethod.Put\n this.body = body\n apply(block)\n}\n\n/**\n * Executes a [HttpClient] DELETE request, with the specified [scheme], [host], [port], [path] and [body].\n * And allows to further configure the request, using a [block] receiving an [HttpRequestBuilder].\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.delete(\n scheme: String = \"http\",\n host: String = \"localhost\",\n port: Int = DEFAULT_PORT,\n path: String = \"/\",\n body: Any = EmptyContent,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = request {\n url(scheme, host, port, path)\n method = HttpMethod.Delete\n this.body = body\n apply(block)\n}\n\n/**\n * Executes a [HttpClient] PATCH request, with the specified [scheme], [host], [port], [path] and [body].\n * And allows to further configure the request, using a [block] receiving an [HttpRequestBuilder].\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.patch(\n scheme: String = \"http\",\n host: String = \"localhost\",\n port: Int = DEFAULT_PORT,\n path: String = \"/\",\n body: Any = EmptyContent,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = request {\n url(scheme, host, port, path)\n method = HttpMethod.Patch\n this.body = body\n apply(block)\n}\n\n/**\n * Executes a [HttpClient] HEAD request, with the specified [scheme], [host], [port], [path] and [body].\n * And allows to further configure the request, using a [block] receiving an [HttpRequestBuilder].\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.head(\n scheme: String = \"http\",\n host: String = \"localhost\",\n port: Int = DEFAULT_PORT,\n path: String = \"/\",\n body: Any = EmptyContent,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = request {\n url(scheme, host, port, path)\n method = HttpMethod.Head\n this.body = body\n apply(block)\n}\n\n/**\n * Executes a [HttpClient] OPTIONS request, with the specified [scheme], [host], [port], [path] and [body].\n * And allows to further configure the request, using a [block] receiving an [HttpRequestBuilder].\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.options(\n scheme: String = \"http\",\n host: String = \"localhost\",\n port: Int = DEFAULT_PORT,\n path: String = \"/\",\n body: Any = EmptyContent,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = request {\n url(scheme, host, port, path)\n method = HttpMethod.Options\n this.body = body\n apply(block)\n}\n\n/**\n * Creates a [HttpRequestBuilder] and configures it with a [block] of code.\n */\npublic fun request(block: HttpRequestBuilder.() -> Unit): HttpRequestBuilder = HttpRequestBuilder().apply(block)\n\n/**\n * Executes a [HttpClient] GET request, with the specified [url] as URL and\n * an optional [block] receiving an [HttpRequestBuilder] for further configuring the request.\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.get(\n urlString: String,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = get {\n url.takeFrom(urlString)\n block()\n}\n\n/**\n * Executes a [HttpClient] POST request, with the specified [url] as URL and\n * an optional [block] receiving an [HttpRequestBuilder] for further configuring the request.\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.post(\n urlString: String,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = post {\n url.takeFrom(urlString)\n block()\n}\n\n/**\n * Executes a [HttpClient] PUT request, with the specified [url] as URL and\n * an optional [block] receiving an [HttpRequestBuilder] for further configuring the request.\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.put(\n urlString: String,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = put {\n url.takeFrom(urlString)\n block()\n}\n\n/**\n * Executes a [HttpClient] DELETE request, with the specified [url] as URL and\n * an optional [block] receiving an [HttpRequestBuilder] for further configuring the request.\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.delete(\n urlString: String,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = delete {\n url.takeFrom(urlString)\n block()\n}\n\n/**\n * Executes a [HttpClient] OPTIONS request, with the specified [url] as URL and\n * an optional [block] receiving an [HttpRequestBuilder] for further configuring the request.\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.options(\n urlString: String,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = options {\n url.takeFrom(urlString)\n block()\n}\n\n/**\n * Executes a [HttpClient] PATCH request, with the specified [url] as URL and\n * an optional [block] receiving an [HttpRequestBuilder] for further configuring the request.\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.patch(\n urlString: String,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = patch {\n url.takeFrom(urlString)\n block()\n}\n\n/**\n * Executes a [HttpClient] HEAD request, with the specified [url] as URL and\n * an optional [block] receiving an [HttpRequestBuilder] for further configuring the request.\n *\n * Tries to receive a specific type [T], if fails, an exception is thrown.\n */\npublic suspend inline fun HttpClient.head(\n urlString: String,\n block: HttpRequestBuilder.() -> Unit = {}\n): T = head {\n url.takeFrom(urlString)\n block()\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.request.forms\n\nimport io.ktor.http.*\nimport io.ktor.http.content.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.charsets.*\nimport io.ktor.utils.io.core.*\nimport kotlin.native.concurrent.*\nimport kotlin.random.*\n\n@ThreadLocal\nprivate val RN_BYTES = \"\\r\\n\".toByteArray()\n\n/**\n * [OutgoingContent] with for application/x-www-form-urlencoded formatted request.\n *\n * @param formData: data to send.\n */\npublic class FormDataContent(\n public val formData: Parameters\n) : OutgoingContent.ByteArrayContent() {\n private val content = formData.formUrlEncode().toByteArray()\n\n override val contentLength: Long = content.size.toLong()\n override val contentType: ContentType = ContentType.Application.FormUrlEncoded.withCharset(Charsets.UTF_8)\n\n override fun bytes(): ByteArray = content\n}\n\n/**\n * [OutgoingContent] for multipart/form-data formatted request.\n *\n * @param parts: form part data\n */\npublic class MultiPartFormDataContent(\n parts: List\n) : OutgoingContent.WriteChannelContent() {\n private val boundary: String = generateBoundary()\n private val BOUNDARY_BYTES = \"--$boundary\\r\\n\".toByteArray()\n private val LAST_BOUNDARY_BYTES = \"--$boundary--\\r\\n\".toByteArray()\n\n private val BODY_OVERHEAD_SIZE = LAST_BOUNDARY_BYTES.size\n private val PART_OVERHEAD_SIZE = RN_BYTES.size * 2 + BOUNDARY_BYTES.size\n\n private val rawParts: List = parts.map { part ->\n val headersBuilder = BytePacketBuilder()\n for ((key, values) in part.headers.entries()) {\n headersBuilder.writeText(\"$key: ${values.joinToString(\"; \")}\")\n headersBuilder.writeFully(RN_BYTES)\n }\n\n val bodySize = part.headers[HttpHeaders.ContentLength]?.toLong()\n when (part) {\n is PartData.FileItem -> {\n val headers = headersBuilder.build().readBytes()\n val size = bodySize?.plus(PART_OVERHEAD_SIZE)?.plus(headers.size)\n PreparedPart(headers, part.provider, size)\n }\n is PartData.BinaryItem -> {\n val headers = headersBuilder.build().readBytes()\n val size = bodySize?.plus(PART_OVERHEAD_SIZE)?.plus(headers.size)\n PreparedPart(headers, part.provider, size)\n }\n is PartData.FormItem -> {\n val bytes = buildPacket { writeText(part.value) }.readBytes()\n val provider = { buildPacket { writeFully(bytes) } }\n if (bodySize == null) {\n headersBuilder.writeText(\"${HttpHeaders.ContentLength}: ${bytes.size}\")\n headersBuilder.writeFully(RN_BYTES)\n }\n\n val headers = headersBuilder.build().readBytes()\n val size = bytes.size + PART_OVERHEAD_SIZE + headers.size\n PreparedPart(headers, provider, size.toLong())\n }\n }\n }\n\n override val contentLength: Long?\n\n override val contentType: ContentType = ContentType.MultiPart.FormData.withParameter(\"boundary\", boundary)\n\n init {\n var rawLength: Long? = 0\n for (part in rawParts) {\n val size = part.size\n if (size == null) {\n rawLength = null\n break\n }\n\n rawLength = rawLength?.plus(size)\n }\n\n if (rawLength != null) {\n rawLength += BODY_OVERHEAD_SIZE\n }\n\n contentLength = rawLength\n }\n\n override suspend fun writeTo(channel: ByteWriteChannel) {\n try {\n for (part in rawParts) {\n channel.writeFully(BOUNDARY_BYTES)\n channel.writeFully(part.headers)\n channel.writeFully(RN_BYTES)\n\n part.provider().use { input ->\n input.copyTo(channel)\n }\n\n channel.writeFully(RN_BYTES)\n }\n\n channel.writeFully(LAST_BOUNDARY_BYTES)\n } catch (cause: Throwable) {\n channel.close(cause)\n } finally {\n channel.close()\n }\n }\n}\n\nprivate fun generateBoundary(): String = buildString {\n repeat(32) {\n append(Random.nextInt().toString(16))\n }\n}.take(70)\n\nprivate class PreparedPart(\n val headers: ByteArray,\n val provider: () -> Input,\n val size: Long?\n)\n\nprivate suspend fun Input.copyTo(channel: ByteWriteChannel) {\n if (this is ByteReadPacket) {\n channel.writePacket(this)\n return\n }\n\n while (!this@copyTo.endOfInput) {\n channel.write { freeSpace, startOffset, endExclusive ->\n this@copyTo.readAvailable(freeSpace, startOffset, endExclusive - startOffset).toInt()\n }\n }\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.statement\n\nimport io.ktor.client.call.*\nimport io.ktor.client.request.*\nimport io.ktor.http.*\nimport io.ktor.util.*\nimport io.ktor.util.date.*\nimport io.ktor.utils.io.*\nimport kotlin.coroutines.*\n\n@InternalAPI\npublic class DefaultHttpResponse(\n override val call: HttpClientCall,\n responseData: HttpResponseData\n) : HttpResponse() {\n override val coroutineContext: CoroutineContext = responseData.callContext\n\n override val status: HttpStatusCode = responseData.statusCode\n\n override val version: HttpProtocolVersion = responseData.version\n\n override val requestTime: GMTDate = responseData.requestTime\n\n override val responseTime: GMTDate = responseData.responseTime\n\n override val content: ByteReadChannel = responseData.body as? ByteReadChannel\n ?: ByteReadChannel.Empty\n\n override val headers: Headers = responseData.headers\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.statement\n\nimport io.ktor.client.*\nimport io.ktor.client.call.*\nimport io.ktor.util.pipeline.*\n\n/**\n * [HttpClient] Pipeline used for executing [HttpResponse].\n */\npublic class HttpResponsePipeline(\n override val developmentMode: Boolean = false\n) : Pipeline(\n Receive,\n Parse,\n Transform,\n State,\n After\n) {\n public companion object Phases {\n /**\n * The earliest phase that happens before any other\n */\n public val Receive: PipelinePhase = PipelinePhase(\"Receive\")\n\n /**\n * Decode response body\n */\n public val Parse: PipelinePhase = PipelinePhase(\"Parse\")\n\n /**\n * Transform response body to expected format\n */\n public val Transform: PipelinePhase = PipelinePhase(\"Transform\")\n\n /**\n * Use this phase to store request shared state\n */\n public val State: PipelinePhase = PipelinePhase(\"State\")\n\n /**\n * Latest response pipeline phase\n */\n public val After: PipelinePhase = PipelinePhase(\"After\")\n }\n}\n\n/**\n * [HttpClient] Pipeline used for receiving [HttpResponse] without any processing.\n */\npublic class HttpReceivePipeline(\n override val developmentMode: Boolean = false\n) : Pipeline(Before, State, After) {\n public companion object Phases {\n /**\n * The earliest phase that happens before any other\n */\n public val Before: PipelinePhase = PipelinePhase(\"Before\")\n\n /**\n * Use this phase to store request shared state\n */\n public val State: PipelinePhase = PipelinePhase(\"State\")\n\n /**\n * Latest response pipeline phase\n */\n public val After: PipelinePhase = PipelinePhase(\"After\")\n }\n}\n\n/**\n * Class representing a typed [response] with an attached [expectedType].\n * @param expectedType: information about expected type.\n * @param response: current response state.\n */\npublic data class HttpResponseContainer(val expectedType: TypeInfo, val response: Any)\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.request\n\nimport io.ktor.http.*\nimport io.ktor.util.date.*\n\n/**\n * Gets the associated URL's host.\n */\npublic var HttpRequestBuilder.host: String\n get() = url.host\n set(value) {\n url.host = value\n }\n\n/**\n * Gets the associated URL's port.\n */\npublic var HttpRequestBuilder.port: Int\n get() = url.port\n set(value) {\n url.port = value\n }\n\n/**\n * Sets a single header of [key] with a specific [value] if the value is not null.\n */\npublic fun HttpRequestBuilder.header(key: String, value: Any?): Unit =\n value?.let { headers.append(key, it.toString()) } ?: Unit\n\n/**\n * Sets a single header of [key] with a specific [value] if the value is not null.\n */\npublic fun HttpRequestBuilder.cookie(\n name: String,\n value: String,\n maxAge: Int = 0,\n expires: GMTDate? = null,\n domain: String? = null,\n path: String? = null,\n secure: Boolean = false,\n httpOnly: Boolean = false,\n extensions: Map = emptyMap()\n): Unit { // ktlint-disable no-unit-return\n val renderedCookie = Cookie(\n name = name,\n value = value,\n maxAge = maxAge,\n expires = expires,\n domain = domain,\n path = path,\n secure = secure,\n httpOnly = httpOnly,\n extensions = extensions\n ).let(::renderCookieHeader)\n\n if (HttpHeaders.Cookie !in headers) {\n headers.append(HttpHeaders.Cookie, renderedCookie)\n return\n }\n // Client cookies are stored in a single header \"Cookies\" and multiple values are separated with \";\"\n headers[HttpHeaders.Cookie] = headers[HttpHeaders.Cookie] + \"; \" + renderedCookie\n}\n\n/**\n * Sets a single URL query parameter of [key] with a specific [value] if the value is not null. Can not be used to set\n * form parameters in the body.\n */\npublic fun HttpRequestBuilder.parameter(key: String, value: Any?): Unit =\n value?.let { url.parameters.append(key, it.toString()) } ?: Unit\n\n/**\n * Sets the `Accept` header with a specific [contentType].\n */\npublic fun HttpRequestBuilder.accept(contentType: ContentType): Unit =\n headers.append(HttpHeaders.Accept, contentType.toString())\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\n@file:Suppress(\"KDocMissingDocumentation\")\n\npackage io.ktor.client.response\n\nimport io.ktor.http.*\nimport io.ktor.utils.io.charsets.*\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\n\n@Deprecated(\n \"Unbound streaming [HttpResponse] is deprecated. Consider using [HttpStatement] instead.\",\n level = DeprecationLevel.ERROR,\n replaceWith = ReplaceWith(\"HttpStatement\", \"io.ktor.client.statement.*\")\n)\npublic class HttpResponse : CoroutineScope, HttpMessage {\n override val coroutineContext: CoroutineContext\n get() = error(\"Unbound streaming [HttpResponse] is deprecated. Consider using [HttpStatement] instead.\")\n override val headers: Headers\n get() = error(\"Unbound streaming [HttpResponse] is deprecated. Consider using [HttpStatement] instead.\")\n}\n\n@Suppress(\"DEPRECATION_ERROR\", \"unused\", \"UNUSED_PARAMETER\", \"RedundantSuspendModifier\")\n@Deprecated(\n \"Unbound streaming [HttpResponse] is deprecated. Consider using [HttpStatement] instead.\",\n level = DeprecationLevel.ERROR\n)\npublic suspend fun HttpResponse.readText(charset: Charset? = null): String {\n error(\"Unbound streaming [HttpResponse] is deprecated. Consider using [HttpStatement] instead.\")\n}\n\n/**\n * Exactly reads [count] bytes of the [HttpResponse.content].\n */\n@Deprecated(\n \"Unbound streaming [HttpResponse] is deprecated. Consider using [HttpStatement] instead.\",\n level = DeprecationLevel.ERROR\n)\n@Suppress(\"DEPRECATION_ERROR\", \"unused\", \"UNUSED_PARAMETER\", \"RedundantSuspendModifier\")\npublic suspend fun HttpResponse.readBytes(count: Int): ByteArray {\n error(\"Unbound streaming [HttpResponse] is deprecated. Consider using [HttpStatement] instead.\")\n}\n\n/**\n * Reads the whole [HttpResponse.content] if Content-Length was specified.\n * Otherwise it just reads one byte.\n */\n@Deprecated(\n \"Unbound streaming [HttpResponse] is deprecated. Consider using [HttpStatement] instead.\",\n level = DeprecationLevel.ERROR\n)\n@Suppress(\"DEPRECATION_ERROR\", \"unused\", \"UNUSED_PARAMETER\", \"RedundantSuspendModifier\")\npublic suspend fun HttpResponse.readBytes(): ByteArray {\n error(\"Unbound streaming [HttpResponse] is deprecated. Consider using [HttpStatement] instead.\")\n}\n\n/**\n * Efficiently discards the remaining bytes of [HttpResponse.content].\n */\n@Deprecated(\n \"Unbound streaming [HttpResponse] is deprecated. Consider using [HttpStatement] instead.\",\n level = DeprecationLevel.ERROR\n)\n@Suppress(\"DEPRECATION_ERROR\", \"unused\", \"UNUSED_PARAMETER\", \"RedundantSuspendModifier\")\npublic suspend fun HttpResponse.discardRemaining() {\n error(\"Unbound streaming [HttpResponse] is deprecated. Consider using [HttpStatement] instead.\")\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.statement\n\nimport io.ktor.client.*\nimport io.ktor.client.call.*\nimport io.ktor.client.request.*\nimport io.ktor.http.*\nimport io.ktor.util.*\nimport io.ktor.util.date.*\nimport io.ktor.utils.io.*\nimport kotlinx.coroutines.*\n\n/**\n * A response for [HttpClient], second part of [HttpClientCall].\n */\npublic abstract class HttpResponse : HttpMessage, CoroutineScope {\n /**\n * The associated [HttpClientCall] containing both\n * the underlying [HttpClientCall.request] and [HttpClientCall.response].\n */\n public abstract val call: HttpClientCall\n\n /**\n * The [HttpStatusCode] returned by the server. It includes both,\n * the [HttpStatusCode.description] and the [HttpStatusCode.value] (code).\n */\n public abstract val status: HttpStatusCode\n\n /**\n * HTTP version. Usually [HttpProtocolVersion.HTTP_1_1] or [HttpProtocolVersion.HTTP_2_0].\n */\n public abstract val version: HttpProtocolVersion\n\n /**\n * [GMTDate] of the request start.\n */\n public abstract val requestTime: GMTDate\n\n /**\n * [GMTDate] of the response start.\n */\n public abstract val responseTime: GMTDate\n\n /**\n * Unmodified [ByteReadChannel] with the raw payload of the response.\n *\n * **Note:** this content doesn't go through any interceptors from [HttpResponsePipeline].\n * If you need modified content, use [HttpResponse::receive] function.\n */\n public abstract val content: ByteReadChannel\n\n override fun toString(): String = \"HttpResponse[${request.url}, $status]\"\n}\n\n/**\n * [HttpRequest] associated with this response.\n */\npublic val HttpResponse.request: HttpRequest get() = call.request\n\n@Suppress(\"unused\", \"KDocMissingDocumentation\")\n@Deprecated(\"Close is obsolete for [HttpResponse]\", replaceWith = ReplaceWith(\"this\"))\npublic fun HttpResponse.close() {\n}\n\n@Suppress(\"UNUSED_PARAMETER\", \"KDocMissingDocumentation\", \"unused\")\n@Deprecated(\"Use is obsolete for [HttpResponse]\", replaceWith = ReplaceWith(\"this.also(block)\"))\npublic fun HttpResponse.use(block: () -> Unit) {\n}\n\n@Suppress(\"unused\", \"KDocMissingDocumentation\")\n@Deprecated(\"[response] is obsolete for [HttpResponse]\", replaceWith = ReplaceWith(\"this\"))\npublic val HttpResponse.response: HttpResponse\n get() = this\n\n@InternalAPI\n@PublishedApi\ninternal fun HttpResponse.complete() {\n val job = coroutineContext[Job]!! as CompletableJob\n job.complete()\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.statement\n\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.core.*\n\n/**\n * Exactly reads [count] bytes of the [HttpResponse.content].\n */\npublic suspend fun HttpResponse.readBytes(count: Int): ByteArray = ByteArray(count).also {\n content.readFully(it)\n}\n\n/**\n * Reads the whole [HttpResponse.content] if Content-Length was specified.\n * Otherwise it just reads one byte.\n */\npublic suspend fun HttpResponse.readBytes(): ByteArray = content.readRemaining().readBytes()\n\n/**\n * Efficiently discards the remaining bytes of [HttpResponse.content].\n */\npublic suspend fun HttpResponse.discardRemaining() {\n content.discard()\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.utils\n\nimport io.ktor.util.*\n\n/**\n * List of [CacheControl] known values.\n */\n@Suppress(\"KDocMissingDocumentation\", \"MemberVisibilityCanBePrivate\")\n@KtorExperimentalAPI\npublic object CacheControl {\n public const val MAX_AGE: String = \"max-age\"\n public const val MIN_FRESH: String = \"min-fresh\"\n public const val ONLY_IF_CACHED: String = \"only-if-cached\"\n\n public const val MAX_STALE: String = \"max-stale\"\n public const val NO_CACHE: String = \"no-cache\"\n public const val NO_STORE: String = \"no-store\"\n public const val NO_TRANSFORM: String = \"no-transform\"\n\n public const val MUST_REVALIDATE: String = \"must-revalidate\"\n public const val PUBLIC: String = \"public\"\n public const val PRIVATE: String = \"private\"\n public const val PROXY_REVALIDATE: String = \"proxy-revalidate\"\n public const val S_MAX_AGE: String = \"s-maxage\"\n\n // ------- binary compatibility\n\n @Suppress(\"unused\", \"KDocMissingDocumentation\", \"FunctionName\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getMAX_AGE(): String = MAX_AGE\n\n @Suppress(\"unused\", \"KDocMissingDocumentation\", \"FunctionName\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getMIN_FRESH(): String = MIN_FRESH\n\n @Suppress(\"unused\", \"KDocMissingDocumentation\", \"FunctionName\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getONLY_IF_CACHED(): String = ONLY_IF_CACHED\n\n @Suppress(\"unused\", \"KDocMissingDocumentation\", \"FunctionName\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getMAX_STALE(): String = MAX_STALE\n\n @Suppress(\"unused\", \"KDocMissingDocumentation\", \"FunctionName\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getNO_CACHE(): String = NO_CACHE\n\n @Suppress(\"unused\", \"KDocMissingDocumentation\", \"FunctionName\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getNO_STORE(): String = NO_STORE\n\n @Suppress(\"unused\", \"KDocMissingDocumentation\", \"FunctionName\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getNO_TRANSFORM(): String = NO_TRANSFORM\n\n @Suppress(\"unused\", \"KDocMissingDocumentation\", \"FunctionName\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getMUST_REVALIDATE(): String = MUST_REVALIDATE\n\n @Suppress(\"unused\", \"KDocMissingDocumentation\", \"FunctionName\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getPUBLIC(): String = PUBLIC\n\n @Suppress(\"unused\", \"KDocMissingDocumentation\", \"FunctionName\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getPRIVATE(): String = PRIVATE\n\n @Suppress(\"unused\", \"KDocMissingDocumentation\", \"FunctionName\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getPROXY_REVALIDATE(): String = PROXY_REVALIDATE\n\n @Suppress(\"unused\", \"KDocMissingDocumentation\", \"FunctionName\")\n @Deprecated(\"Compatibility\", level = DeprecationLevel.HIDDEN)\n public fun getS_MAX_AGE(): String = S_MAX_AGE\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.utils\n\nimport io.ktor.http.*\nimport io.ktor.http.content.*\nimport io.ktor.utils.io.*\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\n\n/**\n * Concrete [OutgoingContent] without a payload.\n */\npublic object EmptyContent : OutgoingContent.NoContent() {\n override val contentLength: Long = 0\n\n override fun toString(): String = \"EmptyContent\"\n}\n\n/**\n * Generates a new [OutgoingContent] of the same abstract type\n * but with [OutgoingContent.headers] transformed by the specified [block].\n */\npublic fun OutgoingContent.wrapHeaders(block: (Headers) -> Headers): OutgoingContent = when (this) {\n is OutgoingContent.NoContent -> object : OutgoingContent.NoContent() {\n override val contentLength: Long? get() = this@wrapHeaders.contentLength\n override val contentType: ContentType? get() = this@wrapHeaders.contentType\n override val status: HttpStatusCode? get() = this@wrapHeaders.status\n\n override val headers: Headers = block(this@wrapHeaders.headers)\n }\n is OutgoingContent.ReadChannelContent -> object : OutgoingContent.ReadChannelContent() {\n override val contentLength: Long? get() = this@wrapHeaders.contentLength\n override val contentType: ContentType? get() = this@wrapHeaders.contentType\n override val status: HttpStatusCode? get() = this@wrapHeaders.status\n\n override val headers: Headers = block(this@wrapHeaders.headers)\n\n override fun readFrom(): ByteReadChannel = this@wrapHeaders.readFrom()\n\n override fun readFrom(range: LongRange): ByteReadChannel = this@wrapHeaders.readFrom(range)\n }\n is OutgoingContent.WriteChannelContent -> object : OutgoingContent.WriteChannelContent() {\n override val contentLength: Long? get() = this@wrapHeaders.contentLength\n override val contentType: ContentType? get() = this@wrapHeaders.contentType\n override val status: HttpStatusCode? get() = this@wrapHeaders.status\n\n override val headers: Headers = block(this@wrapHeaders.headers)\n\n override suspend fun writeTo(channel: ByteWriteChannel) = this@wrapHeaders.writeTo(channel)\n }\n is OutgoingContent.ByteArrayContent -> object : OutgoingContent.ByteArrayContent() {\n override val contentLength: Long? get() = this@wrapHeaders.contentLength\n override val contentType: ContentType? get() = this@wrapHeaders.contentType\n override val status: HttpStatusCode? get() = this@wrapHeaders.status\n\n override val headers: Headers = block(this@wrapHeaders.headers)\n\n override fun bytes(): ByteArray = this@wrapHeaders.bytes()\n }\n is OutgoingContent.ProtocolUpgrade -> object : OutgoingContent.ProtocolUpgrade() {\n override val contentLength: Long? get() = this@wrapHeaders.contentLength\n override val contentType: ContentType? get() = this@wrapHeaders.contentType\n\n override val headers: Headers = block(this@wrapHeaders.headers)\n\n override suspend fun upgrade(\n input: ByteReadChannel,\n output: ByteWriteChannel,\n engineContext: CoroutineContext,\n userContext: CoroutineContext\n ): Job = this@wrapHeaders.upgrade(input, output, engineContext, userContext)\n }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.network.sockets\n\nimport io.ktor.client.features.*\nimport io.ktor.client.request.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.errors.*\nimport kotlinx.coroutines.*\n\n/**\n * This exception is thrown in case connect timeout exceeded.\n */\npublic expect class ConnectTimeoutException(message: String, cause: Throwable? = null) : IOException\n\n/**\n * This exception is thrown in case socket timeout (read or write) exceeded.\n */\npublic expect class SocketTimeoutException(message: String, cause: Throwable? = null) : IOException\n\n/**\n * Returns [ByteReadChannel] with [ByteChannel.close] handler that returns [SocketTimeoutException] instead of\n * [SocketTimeoutException].\n */\n@InternalAPI\npublic fun CoroutineScope.mapEngineExceptions(input: ByteReadChannel, request: HttpRequestData): ByteReadChannel {\n if (PlatformUtils.IS_NATIVE) {\n return input\n }\n\n val replacementChannel = ByteChannelWithMappedExceptions(request)\n\n writer(channel = replacementChannel) {\n try {\n input.copyAndClose(replacementChannel)\n } catch (cause: Throwable) {\n input.cancel(cause)\n }\n }\n\n return replacementChannel\n}\n\n/**\n * Returns [ByteWriteChannel] with [ByteChannel.close] handler that returns [SocketTimeoutException] instead of\n * [SocketTimeoutException].\n */\n@InternalAPI\npublic fun CoroutineScope.mapEngineExceptions(output: ByteWriteChannel, request: HttpRequestData): ByteWriteChannel {\n if (PlatformUtils.IS_NATIVE) {\n return output\n }\n\n val replacementChannel = ByteChannelWithMappedExceptions(request)\n\n writer(channel = replacementChannel) {\n try {\n replacementChannel.copyAndClose(output)\n } catch (cause: Throwable) {\n replacementChannel.close(cause)\n }\n }\n\n return replacementChannel\n}\n\n/**\n * Creates [ByteChannel] that maps close exceptions (close the channel with [SocketTimeoutException] if asked to\n * close it with [SocketTimeoutException]).\n */\ninternal expect fun ByteChannelWithMappedExceptions(request: HttpRequestData): ByteChannel\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.utils\n\nimport io.ktor.http.*\nimport io.ktor.util.*\n\n/**\n * Builds an instance of [Headers] using the [block] function.\n */\npublic fun buildHeaders(block: HeadersBuilder.() -> Unit = {}): Headers =\n HeadersBuilder().apply(block).build()\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.engine.js\n\nimport io.ktor.client.engine.*\nimport io.ktor.client.engine.js.compatibility.*\nimport io.ktor.client.engine.js.node.*\nimport io.ktor.client.features.*\nimport io.ktor.client.features.websocket.*\nimport io.ktor.client.request.*\nimport io.ktor.client.utils.*\nimport io.ktor.http.*\nimport io.ktor.util.*\nimport io.ktor.util.date.*\nimport kotlinx.coroutines.*\nimport org.w3c.dom.*\nimport org.w3c.dom.events.*\nimport kotlin.coroutines.*\n\ninternal class JsClientEngine(override val config: HttpClientEngineConfig) : HttpClientEngineBase(\"ktor-js\") {\n\n override val dispatcher = Dispatchers.Default\n\n override val supportedCapabilities = setOf(HttpTimeout, WebSocketCapability)\n\n init {\n check(config.proxy == null) { \"Proxy unsupported in Js engine.\" }\n }\n\n override suspend fun execute(data: HttpRequestData): HttpResponseData {\n val callContext = callContext()\n\n if (data.isUpgradeRequest()) {\n return executeWebSocketRequest(data, callContext)\n }\n\n val requestTime = GMTDate()\n val rawRequest = data.toRaw(callContext)\n val rawResponse = commonFetch(data.url.toString(), rawRequest)\n\n val status = HttpStatusCode(rawResponse.status.toInt(), rawResponse.statusText)\n val headers = rawResponse.headers.mapToKtor()\n val version = HttpProtocolVersion.HTTP_1_1\n\n val body = CoroutineScope(callContext).readBody(rawResponse)\n\n return HttpResponseData(\n status,\n requestTime,\n headers,\n version,\n body,\n callContext\n )\n }\n\n private suspend fun executeWebSocketRequest(\n request: HttpRequestData,\n callContext: CoroutineContext\n ): HttpResponseData {\n val requestTime = GMTDate()\n\n val urlString = request.url.toString()\n val socket = if (PlatformUtils.IS_NODE) {\n NodeWebsocket(urlString)\n } else {\n WebSocket(urlString)\n }\n\n try {\n socket.awaitConnection()\n } catch (cause: Throwable) {\n callContext.cancel(CancellationException(\"Failed to connect to $urlString\", cause))\n throw cause\n }\n\n val session = JsWebSocketSession(callContext, socket)\n\n return HttpResponseData(\n HttpStatusCode.OK,\n requestTime,\n Headers.Empty,\n HttpProtocolVersion.HTTP_1_1,\n session,\n callContext\n )\n }\n}\n\nprivate suspend fun WebSocket.awaitConnection(): WebSocket = suspendCancellableCoroutine { continuation ->\n if (continuation.isCancelled) return@suspendCancellableCoroutine\n\n val eventListener = { event: Event ->\n when (event.type) {\n \"open\" -> continuation.resume(this)\n \"error\" -> continuation.resumeWithException(WebSocketException(JSON.stringify(event)))\n }\n }\n\n addEventListener(\"open\", callback = eventListener)\n addEventListener(\"error\", callback = eventListener)\n\n continuation.invokeOnCancellation {\n removeEventListener(\"open\", callback = eventListener)\n removeEventListener(\"error\", callback = eventListener)\n\n if (it != null) {\n this@awaitConnection.close()\n }\n }\n}\n\nprivate fun org.w3c.fetch.Headers.mapToKtor(): Headers = buildHeaders {\n this@mapToKtor.asDynamic().forEach { value: String, key: String ->\n append(key, value)\n }\n\n Unit\n}\n\n/**\n * Wrapper for javascript `error` objects.\n * @property origin: fail reason\n */\npublic class JsError(public val origin: dynamic) : Throwable(\"Error from javascript[$origin].\")\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.engine.js\n\nimport io.ktor.client.engine.*\nimport io.ktor.client.engine.js.node.*\nimport io.ktor.client.request.*\nimport io.ktor.http.content.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.*\nimport io.ktor.utils.io.core.*\nimport kotlinx.coroutines.*\nimport org.khronos.webgl.*\nimport org.w3c.fetch.*\nimport kotlin.coroutines.*\n\ninternal suspend fun HttpRequestData.toRaw(callContext: CoroutineContext): RequestInit {\n val jsHeaders = if (PlatformUtils.IS_BROWSER) {\n Headers()\n } else {\n NodeFetch.Headers()\n }\n mergeHeaders(headers, body) { key, value ->\n jsHeaders.set(key, value)\n }\n\n val bodyBytes = when (val content = body) {\n is OutgoingContent.ByteArrayContent -> content.bytes()\n is OutgoingContent.ReadChannelContent -> content.readFrom().readRemaining().readBytes()\n is OutgoingContent.WriteChannelContent -> {\n GlobalScope.writer(callContext) {\n content.writeTo(channel)\n }.channel.readRemaining().readBytes()\n }\n else -> null\n }?.let { Uint8Array(it.toTypedArray()) }\n\n return RequestInit(\n method = method.value,\n headers = jsHeaders,\n body = bodyBytes,\n redirect = RequestRedirect.FOLLOW\n )\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.engine.js.compatibility\n\nimport io.ktor.client.engine.js.browser.*\nimport io.ktor.client.engine.js.node.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.*\nimport kotlinx.browser.*\nimport kotlinx.coroutines.*\nimport org.w3c.fetch.*\nimport kotlin.coroutines.*\nimport kotlin.js.*\n\ninternal suspend fun commonFetch(\n input: String,\n init: RequestInit\n): Response = suspendCancellableCoroutine { continuation ->\n val controller = if (PlatformUtils.IS_BROWSER) {\n AbortController()\n } else {\n NodeAbortController()\n }\n init.signal = controller.signal\n\n continuation.invokeOnCancellation {\n controller.abort()\n }\n\n val promise: Promise = if (PlatformUtils.IS_BROWSER) {\n window.fetch(input, init)\n } else {\n nodeFetch(input, init)\n }\n\n promise.then(\n onFulfilled = {\n continuation.resume(it)\n },\n onRejected = {\n continuation.resumeWithException(Error(\"Fail to fetch\", it))\n }\n )\n}\n\ninternal fun CoroutineScope.readBody(\n response: Response\n): ByteReadChannel = if (PlatformUtils.IS_BROWSER) {\n readBodyBrowser(response)\n} else {\n readBodyNode(response)\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.engine.js\n\nimport kotlinx.coroutines.*\nimport org.khronos.webgl.*\nimport kotlin.coroutines.*\nimport kotlin.js.*\n\ninternal external interface ReadableStream {\n public fun getReader(): ReadableStreamReader\n}\n\ninternal external interface ReadResult {\n val done: Boolean\n val value: Uint8Array?\n}\n\ninternal external interface ReadableStreamReader {\n public fun cancel(reason: dynamic): Promise\n public fun read(): Promise\n}\n\ninternal suspend fun ReadableStreamReader.readChunk(): Uint8Array? = suspendCancellableCoroutine { continuation ->\n read().then {\n val chunk = it.value\n val result = if (it.done || chunk == null) null else chunk\n continuation.resumeWith(Result.success(result))\n }.catch { cause ->\n continuation.resumeWithException(cause)\n }\n}\n\n@Suppress(\"UnsafeCastFromDynamic\")\ninternal fun Uint8Array.asByteArray(): ByteArray {\n return Int8Array(buffer, byteOffset, length).asDynamic()\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.engine.js.browser\n\nimport io.ktor.client.engine.js.*\nimport io.ktor.client.engine.js.ReadableStream\nimport io.ktor.utils.io.*\nimport kotlinx.coroutines.*\nimport org.w3c.fetch.*\n\ninternal fun CoroutineScope.readBodyBrowser(response: Response): ByteReadChannel {\n @Suppress(\"UNCHECKED_CAST_TO_EXTERNAL_INTERFACE\")\n val stream = response.body as? ReadableStream ?: error(\"Fail to obtain native stream: ${response.asDynamic()}\")\n return channelFromStream(stream)\n}\n\ninternal fun CoroutineScope.channelFromStream(\n stream: ReadableStream\n): ByteReadChannel = writer {\n val reader = stream.getReader()\n while (true) {\n try {\n val chunk = reader.readChunk() ?: break\n channel.writeFully(chunk.asByteArray())\n } catch (cause: Throwable) {\n reader.cancel(cause)\n throw cause\n }\n }\n}.channel\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.utils\n\nimport io.ktor.util.*\nimport io.ktor.util.collections.*\n\ninternal fun sharedMap(): MutableMap {\n if (PlatformUtils.IS_NATIVE) {\n return ConcurrentMap()\n }\n\n return mutableMapOf()\n}\n\ninternal fun sharedList(): MutableList {\n if (PlatformUtils.IS_NATIVE) {\n return ConcurrentList()\n }\n\n return mutableListOf()\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client\n\nimport io.ktor.client.engine.js.*\n\n/**\n * Constructs an asynchronous [HttpClient] using optional [block] for configuring this client.\n *\n * The [HttpClientEngine] is selected from the dependencies.\n * https://ktor.io/clients/http-client/engines.html\n */\npublic actual fun HttpClient(\n block: HttpClientConfig<*>.() -> Unit\n): HttpClient = HttpClient(JsClient(), block)\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.engine\n\nimport kotlinx.coroutines.*\nimport kotlin.coroutines.*\n\n/**\n * Create call context with the specified [parentJob] to be used during call execution in the engine. Call context\n * inherits [coroutineContext], but overrides job and coroutine name so that call job's parent is [parentJob] and\n * call coroutine's name is \"call-context\".\n */\ninternal actual suspend fun HttpClientEngine.createCallContext(parentJob: Job): CoroutineContext {\n val callJob = Job(parentJob)\n val callContext = coroutineContext + callJob + CALL_COROUTINE\n\n attachToUserJob(callJob)\n\n return callContext\n}\n","package io.ktor.client.engine\n\nimport io.ktor.http.*\nimport io.ktor.util.network.*\n\n/**\n * Proxy configuration.\n *\n * See [ProxyBuilder] to create proxy.\n */\npublic actual class ProxyConfig\n\n/**\n * [ProxyConfig] factory.\n */\npublic actual object ProxyBuilder {\n /**\n * Create http proxy from [url].\n */\n public actual fun http(url: Url): ProxyConfig {\n error(\"Proxy unsupported in js client engine.\")\n }\n\n /**\n * Create socks proxy from [host] and [port].\n */\n public actual fun socks(host: String, port: Int): ProxyConfig {\n error(\"Proxy unsupported in js client engine.\")\n }\n}\n\n/**\n * Resolve remote address of [ProxyConfig].\n *\n * This operations can block.\n */\npublic actual fun ProxyConfig.resolveAddress(): NetworkAddress {\n error(\"Proxy unsupported in js client engine.\")\n}\n\n/**\n * Type of configured proxy.\n */\npublic actual val ProxyConfig.type: ProxyType\n get() = error(\"Proxy unsupported in js client engine.\")\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.engine.js\n\nimport io.ktor.client.engine.*\n\n/**\n * [HttpClientEngineFactory] using a fetch API to execute requests.\n */\npublic object Js : HttpClientEngineFactory {\n override fun create(block: HttpClientEngineConfig.() -> Unit): HttpClientEngine =\n JsClientEngine(HttpClientEngineConfig().apply(block))\n}\n\n@JsName(\"JsClient\")\npublic fun JsClient(): HttpClientEngineFactory = Js\n","/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n// NOTE: THIS FILE IS AUTO-GENERATED, DO NOT EDIT!\n// See github.com/kotlin/dukat for details\n\npackage org.w3c.fetch\n\nimport kotlin.js.*\nimport org.khronos.webgl.*\nimport org.w3c.css.masking.*\nimport org.w3c.dom.*\nimport org.w3c.dom.clipboard.*\nimport org.w3c.dom.css.*\nimport org.w3c.dom.encryptedmedia.*\nimport org.w3c.dom.events.*\nimport org.w3c.dom.mediacapture.*\nimport org.w3c.dom.mediasource.*\nimport org.w3c.dom.parsing.*\nimport org.w3c.dom.pointerevents.*\nimport org.w3c.dom.svg.*\nimport org.w3c.dom.url.*\nimport org.w3c.files.*\nimport org.w3c.notifications.*\nimport org.w3c.performance.*\nimport org.w3c.workers.*\nimport org.w3c.xhr.*\n\n/**\n * Exposes the JavaScript [Headers](https://developer.mozilla.org/en/docs/Web/API/Headers) to Kotlin\n */\npublic external open class Headers(init: dynamic = definedExternally) {\n fun append(name: String, value: String)\n fun delete(name: String)\n fun get(name: String): String?\n fun has(name: String): Boolean\n fun set(name: String, value: String)\n}\n\n/**\n * Exposes the JavaScript [Body](https://developer.mozilla.org/en/docs/Web/API/Body) to Kotlin\n */\npublic external interface Body {\n val bodyUsed: Boolean\n fun arrayBuffer(): Promise\n fun blob(): Promise\n fun formData(): Promise\n fun json(): Promise\n fun text(): Promise\n}\n\n/**\n * Exposes the JavaScript [Request](https://developer.mozilla.org/en/docs/Web/API/Request) to Kotlin\n */\npublic external open class Request(input: dynamic, init: RequestInit = definedExternally) : Body {\n open val method: String\n open val url: String\n open val headers: Headers\n open val type: RequestType\n open val destination: RequestDestination\n open val referrer: String\n open val referrerPolicy: dynamic\n open val mode: RequestMode\n open val credentials: RequestCredentials\n open val cache: RequestCache\n open val redirect: RequestRedirect\n open val integrity: String\n open val keepalive: Boolean\n override val bodyUsed: Boolean\n fun clone(): Request\n override fun arrayBuffer(): Promise\n override fun blob(): Promise\n override fun formData(): Promise\n override fun json(): Promise\n override fun text(): Promise\n}\n\npublic external interface RequestInit {\n var method: String?\n get() = definedExternally\n set(value) = definedExternally\n var headers: dynamic\n get() = definedExternally\n set(value) = definedExternally\n var body: dynamic\n get() = definedExternally\n set(value) = definedExternally\n var referrer: String?\n get() = definedExternally\n set(value) = definedExternally\n var referrerPolicy: dynamic\n get() = definedExternally\n set(value) = definedExternally\n var mode: RequestMode?\n get() = definedExternally\n set(value) = definedExternally\n var credentials: RequestCredentials?\n get() = definedExternally\n set(value) = definedExternally\n var cache: RequestCache?\n get() = definedExternally\n set(value) = definedExternally\n var redirect: RequestRedirect?\n get() = definedExternally\n set(value) = definedExternally\n var integrity: String?\n get() = definedExternally\n set(value) = definedExternally\n var keepalive: Boolean?\n get() = definedExternally\n set(value) = definedExternally\n var window: Any?\n get() = definedExternally\n set(value) = definedExternally\n}\n\n@kotlin.internal.InlineOnly\npublic inline fun RequestInit(method: String? = undefined, headers: dynamic = undefined, body: dynamic = undefined, referrer: String? = undefined, referrerPolicy: dynamic = undefined, mode: RequestMode? = undefined, credentials: RequestCredentials? = undefined, cache: RequestCache? = undefined, redirect: RequestRedirect? = undefined, integrity: String? = undefined, keepalive: Boolean? = undefined, window: Any? = undefined): RequestInit {\n val o = js(\"({})\")\n o[\"method\"] = method\n o[\"headers\"] = headers\n o[\"body\"] = body\n o[\"referrer\"] = referrer\n o[\"referrerPolicy\"] = referrerPolicy\n o[\"mode\"] = mode\n o[\"credentials\"] = credentials\n o[\"cache\"] = cache\n o[\"redirect\"] = redirect\n o[\"integrity\"] = integrity\n o[\"keepalive\"] = keepalive\n o[\"window\"] = window\n return o\n}\n\n/**\n * Exposes the JavaScript [Response](https://developer.mozilla.org/en/docs/Web/API/Response) to Kotlin\n */\npublic external open class Response(body: dynamic = definedExternally, init: ResponseInit = definedExternally) : Body {\n open val type: ResponseType\n open val url: String\n open val redirected: Boolean\n open val status: Short\n open val ok: Boolean\n open val statusText: String\n open val headers: Headers\n open val body: dynamic\n open val trailer: Promise\n override val bodyUsed: Boolean\n fun clone(): Response\n override fun arrayBuffer(): Promise\n override fun blob(): Promise\n override fun formData(): Promise\n override fun json(): Promise\n override fun text(): Promise\n\n companion object {\n fun error(): Response\n fun redirect(url: String, status: Short = definedExternally): Response\n }\n}\n\npublic external interface ResponseInit {\n var status: Short? /* = 200 */\n get() = definedExternally\n set(value) = definedExternally\n var statusText: String? /* = \"OK\" */\n get() = definedExternally\n set(value) = definedExternally\n var headers: dynamic\n get() = definedExternally\n set(value) = definedExternally\n}\n\n@kotlin.internal.InlineOnly\npublic inline fun ResponseInit(status: Short? = 200, statusText: String? = \"OK\", headers: dynamic = undefined): ResponseInit {\n val o = js(\"({})\")\n o[\"status\"] = status\n o[\"statusText\"] = statusText\n o[\"headers\"] = headers\n return o\n}\n\n/* please, don't implement this interface! */\n@Suppress(\"NESTED_CLASS_IN_EXTERNAL_INTERFACE\")\npublic external interface RequestType {\n companion object\n}\n\npublic inline val RequestType.Companion.EMPTY: RequestType get() = \"\".asDynamic().unsafeCast()\n\npublic inline val RequestType.Companion.AUDIO: RequestType get() = \"audio\".asDynamic().unsafeCast()\n\npublic inline val RequestType.Companion.FONT: RequestType get() = \"font\".asDynamic().unsafeCast()\n\npublic inline val RequestType.Companion.IMAGE: RequestType get() = \"image\".asDynamic().unsafeCast()\n\npublic inline val RequestType.Companion.SCRIPT: RequestType get() = \"script\".asDynamic().unsafeCast()\n\npublic inline val RequestType.Companion.STYLE: RequestType get() = \"style\".asDynamic().unsafeCast()\n\npublic inline val RequestType.Companion.TRACK: RequestType get() = \"track\".asDynamic().unsafeCast()\n\npublic inline val RequestType.Companion.VIDEO: RequestType get() = \"video\".asDynamic().unsafeCast()\n\n/* please, don't implement this interface! */\n@Suppress(\"NESTED_CLASS_IN_EXTERNAL_INTERFACE\")\npublic external interface RequestDestination {\n companion object\n}\n\npublic inline val RequestDestination.Companion.EMPTY: RequestDestination get() = \"\".asDynamic().unsafeCast()\n\npublic inline val RequestDestination.Companion.DOCUMENT: RequestDestination get() = \"document\".asDynamic().unsafeCast()\n\npublic inline val RequestDestination.Companion.EMBED: RequestDestination get() = \"embed\".asDynamic().unsafeCast()\n\npublic inline val RequestDestination.Companion.FONT: RequestDestination get() = \"font\".asDynamic().unsafeCast()\n\npublic inline val RequestDestination.Companion.IMAGE: RequestDestination get() = \"image\".asDynamic().unsafeCast()\n\npublic inline val RequestDestination.Companion.MANIFEST: RequestDestination get() = \"manifest\".asDynamic().unsafeCast()\n\npublic inline val RequestDestination.Companion.MEDIA: RequestDestination get() = \"media\".asDynamic().unsafeCast()\n\npublic inline val RequestDestination.Companion.OBJECT: RequestDestination get() = \"object\".asDynamic().unsafeCast()\n\npublic inline val RequestDestination.Companion.REPORT: RequestDestination get() = \"report\".asDynamic().unsafeCast()\n\npublic inline val RequestDestination.Companion.SCRIPT: RequestDestination get() = \"script\".asDynamic().unsafeCast()\n\npublic inline val RequestDestination.Companion.SERVICEWORKER: RequestDestination get() = \"serviceworker\".asDynamic().unsafeCast()\n\npublic inline val RequestDestination.Companion.SHAREDWORKER: RequestDestination get() = \"sharedworker\".asDynamic().unsafeCast()\n\npublic inline val RequestDestination.Companion.STYLE: RequestDestination get() = \"style\".asDynamic().unsafeCast()\n\npublic inline val RequestDestination.Companion.WORKER: RequestDestination get() = \"worker\".asDynamic().unsafeCast()\n\npublic inline val RequestDestination.Companion.XSLT: RequestDestination get() = \"xslt\".asDynamic().unsafeCast()\n\n/* please, don't implement this interface! */\n@Suppress(\"NESTED_CLASS_IN_EXTERNAL_INTERFACE\")\npublic external interface RequestMode {\n companion object\n}\n\npublic inline val RequestMode.Companion.NAVIGATE: RequestMode get() = \"navigate\".asDynamic().unsafeCast()\n\npublic inline val RequestMode.Companion.SAME_ORIGIN: RequestMode get() = \"same-origin\".asDynamic().unsafeCast()\n\npublic inline val RequestMode.Companion.NO_CORS: RequestMode get() = \"no-cors\".asDynamic().unsafeCast()\n\npublic inline val RequestMode.Companion.CORS: RequestMode get() = \"cors\".asDynamic().unsafeCast()\n\n/* please, don't implement this interface! */\n@Suppress(\"NESTED_CLASS_IN_EXTERNAL_INTERFACE\")\npublic external interface RequestCredentials {\n companion object\n}\n\npublic inline val RequestCredentials.Companion.OMIT: RequestCredentials get() = \"omit\".asDynamic().unsafeCast()\n\npublic inline val RequestCredentials.Companion.SAME_ORIGIN: RequestCredentials get() = \"same-origin\".asDynamic().unsafeCast()\n\npublic inline val RequestCredentials.Companion.INCLUDE: RequestCredentials get() = \"include\".asDynamic().unsafeCast()\n\n/* please, don't implement this interface! */\n@Suppress(\"NESTED_CLASS_IN_EXTERNAL_INTERFACE\")\npublic external interface RequestCache {\n companion object\n}\n\npublic inline val RequestCache.Companion.DEFAULT: RequestCache get() = \"default\".asDynamic().unsafeCast()\n\npublic inline val RequestCache.Companion.NO_STORE: RequestCache get() = \"no-store\".asDynamic().unsafeCast()\n\npublic inline val RequestCache.Companion.RELOAD: RequestCache get() = \"reload\".asDynamic().unsafeCast()\n\npublic inline val RequestCache.Companion.NO_CACHE: RequestCache get() = \"no-cache\".asDynamic().unsafeCast()\n\npublic inline val RequestCache.Companion.FORCE_CACHE: RequestCache get() = \"force-cache\".asDynamic().unsafeCast()\n\npublic inline val RequestCache.Companion.ONLY_IF_CACHED: RequestCache get() = \"only-if-cached\".asDynamic().unsafeCast()\n\n/* please, don't implement this interface! */\n@Suppress(\"NESTED_CLASS_IN_EXTERNAL_INTERFACE\")\npublic external interface RequestRedirect {\n companion object\n}\n\npublic inline val RequestRedirect.Companion.FOLLOW: RequestRedirect get() = \"follow\".asDynamic().unsafeCast()\n\npublic inline val RequestRedirect.Companion.ERROR: RequestRedirect get() = \"error\".asDynamic().unsafeCast()\n\npublic inline val RequestRedirect.Companion.MANUAL: RequestRedirect get() = \"manual\".asDynamic().unsafeCast()\n\n/* please, don't implement this interface! */\n@Suppress(\"NESTED_CLASS_IN_EXTERNAL_INTERFACE\")\npublic external interface ResponseType {\n companion object\n}\n\npublic inline val ResponseType.Companion.BASIC: ResponseType get() = \"basic\".asDynamic().unsafeCast()\n\npublic inline val ResponseType.Companion.CORS: ResponseType get() = \"cors\".asDynamic().unsafeCast()\n\npublic inline val ResponseType.Companion.DEFAULT: ResponseType get() = \"default\".asDynamic().unsafeCast()\n\npublic inline val ResponseType.Companion.ERROR: ResponseType get() = \"error\".asDynamic().unsafeCast()\n\npublic inline val ResponseType.Companion.OPAQUE: ResponseType get() = \"opaque\".asDynamic().unsafeCast()\n\npublic inline val ResponseType.Companion.OPAQUEREDIRECT: ResponseType get() = \"opaqueredirect\".asDynamic().unsafeCast()","/*\n * Copyright 2014-2021 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.engine.js.compatibility\n\nimport org.w3c.dom.events.*\nimport org.w3c.fetch.*\n\n// https://youtrack.jetbrains.com/issue/KT-29243\n/**\n * https://fetch.spec.whatwg.org/#dom-request-signal\n */\ninternal var RequestInit.signal: AbortSignal\n get() = asDynamic().signal as AbortSignal\n set(newValue) {\n asDynamic().signal = newValue\n }\n\n/**\n * Exposes the JavaScript [AbortController](https://dom.spec.whatwg.org/#interface-abortcontroller) to Kotlin\n */\ninternal open external class AbortController {\n var signal: AbortSignal\n fun abort()\n}\n\n/**\n * Exposes the JavaScript [AbortSignal](https://dom.spec.whatwg.org/#interface-AbortSignal) to Kotlin\n */\ninternal abstract external class AbortSignal : EventTarget {\n var aborted: Boolean\n var onabort: ((AbortSignal, ev: Event) -> Any)?\n get() = definedExternally\n set(value) = definedExternally\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.engine.js.node\n\nimport io.ktor.client.engine.js.*\nimport io.ktor.utils.io.*\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.channels.*\nimport org.khronos.webgl.ArrayBuffer\nimport org.khronos.webgl.Uint8Array\nimport org.w3c.fetch.*\n\ninternal fun CoroutineScope.readBodyNode(response: Response): ByteReadChannel = writer {\n val body: dynamic = response.body ?: error(\"Fail to get body\")\n\n val responseData = Channel(1)\n\n body.on(\"data\") { chunk: ArrayBuffer ->\n responseData.offer(Uint8Array(chunk).asByteArray())\n body.pause()\n }\n\n body.on(\"error\") { error ->\n val cause = JsError(error)\n responseData.close(cause)\n channel.close(cause)\n }\n\n body.on(\"end\") {\n responseData.close()\n }\n\n try {\n for (chunk in responseData) {\n channel.writeFully(chunk)\n body.resume()\n }\n } catch (cause: Throwable) {\n body.destroy(cause)\n throw cause\n }\n}.channel\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features\n\nimport io.ktor.client.*\n\ninternal actual fun HttpClient.platformDefaultTransformers() {}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features.websocket\n\nimport io.ktor.http.cio.websocket.*\nimport io.ktor.utils.io.core.*\nimport kotlinx.coroutines.*\nimport kotlinx.coroutines.channels.*\nimport org.khronos.webgl.*\nimport org.w3c.dom.*\nimport kotlin.coroutines.*\n\ninternal class JsWebSocketSession(\n override val coroutineContext: CoroutineContext,\n private val websocket: WebSocket\n) : DefaultWebSocketSession {\n private val _closeReason: CompletableDeferred = CompletableDeferred()\n private val _incoming: Channel = Channel(Channel.UNLIMITED)\n private val _outgoing: Channel = Channel(Channel.UNLIMITED)\n\n override val incoming: ReceiveChannel = _incoming\n override val outgoing: SendChannel = _outgoing\n\n @ExperimentalWebSocketExtensionApi\n override val extensions: List> get() = emptyList()\n\n override val closeReason: Deferred = _closeReason\n\n override var maxFrameSize: Long\n get() = Long.MAX_VALUE\n set(value) {}\n\n init {\n websocket.binaryType = BinaryType.ARRAYBUFFER\n\n websocket.addEventListener(\n \"message\",\n callback = {\n val event = it.unsafeCast()\n\n launch {\n val data = event.data\n\n val frame: Frame = when (data) {\n is ArrayBuffer -> Frame.Binary(false, Int8Array(data).unsafeCast())\n is String -> Frame.Text(data)\n else -> {\n val error = IllegalStateException(\"Unknown frame type: ${event.type}\")\n _closeReason.completeExceptionally(error)\n throw error\n }\n }\n\n _incoming.offer(frame)\n }\n }\n )\n\n websocket.addEventListener(\n \"error\",\n callback = {\n val cause = WebSocketException(\"$it\")\n _closeReason.completeExceptionally(cause)\n _incoming.close(cause)\n _outgoing.cancel()\n }\n )\n\n websocket.addEventListener(\n \"close\",\n callback = { event: dynamic ->\n launch {\n val reason = CloseReason(event.code as Short, event.reason as String)\n _closeReason.complete(reason)\n _incoming.send(Frame.Close(reason))\n _incoming.close()\n\n _outgoing.cancel()\n }\n }\n )\n\n launch {\n @OptIn(ExperimentalCoroutinesApi::class)\n _outgoing.consumeEach {\n when (it.frameType) {\n FrameType.TEXT -> {\n val text = it.data\n websocket.send(String(text))\n }\n FrameType.BINARY -> {\n val source = it.data as Int8Array\n val frameData = source.buffer.slice(\n source.byteOffset,\n source.byteOffset + source.byteLength\n )\n\n websocket.send(frameData)\n }\n FrameType.CLOSE -> {\n val data = buildPacket { writeFully(it.data) }\n val code = data.readShort()\n val reason = data.readText()\n _closeReason.complete(CloseReason(code, reason))\n if (code.isReservedStatusCode()) {\n websocket.close()\n } else {\n websocket.close(code, reason)\n }\n }\n FrameType.PING, FrameType.PONG -> {\n // ignore\n }\n }\n }\n }\n\n coroutineContext[Job]?.invokeOnCompletion { cause ->\n if (cause == null) {\n websocket.close()\n } else {\n websocket.close(CloseReason.Codes.INTERNAL_ERROR.code, \"Client failed\")\n }\n }\n }\n\n @OptIn(ExperimentalWebSocketExtensionApi::class)\n override fun start(negotiatedExtensions: List>) {\n require(negotiatedExtensions.isEmpty()) { \"Extensions are not supported.\" }\n }\n\n override suspend fun flush() {\n }\n\n @Deprecated(\n \"Use cancel() instead.\",\n ReplaceWith(\"cancel()\", \"kotlinx.coroutines.cancel\")\n )\n override fun terminate() {\n _incoming.cancel()\n _outgoing.cancel()\n _closeReason.cancel(\"WebSocket terminated\")\n websocket.close()\n }\n\n private fun Short.isReservedStatusCode(): Boolean {\n return CloseReason.Codes.byCode(this).let { resolved ->\n @Suppress(\"DEPRECATION\")\n resolved == null || resolved == CloseReason.Codes.CLOSED_ABNORMALLY\n }\n }\n}\n","'use strict';\n\nif (typeof process === 'undefined' ||\n !process.version ||\n process.version.indexOf('v0.') === 0 ||\n process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {\n module.exports = { nextTick: nextTick };\n} else {\n module.exports = process\n}\n\nfunction nextTick(fn, arg1, arg2, arg3) {\n if (typeof fn !== 'function') {\n throw new TypeError('\"callback\" argument must be a function');\n }\n var len = arguments.length;\n var args, i;\n switch (len) {\n case 0:\n case 1:\n return process.nextTick(fn);\n case 2:\n return process.nextTick(function afterTickOne() {\n fn.call(null, arg1);\n });\n case 3:\n return process.nextTick(function afterTickTwo() {\n fn.call(null, arg1, arg2);\n });\n case 4:\n return process.nextTick(function afterTickThree() {\n fn.call(null, arg1, arg2, arg3);\n });\n default:\n args = new Array(len - 1);\n i = 0;\n while (i < args.length) {\n args[i++] = arguments[i];\n }\n return process.nextTick(function afterTick() {\n fn.apply(null, args);\n });\n }\n}\n\n","// based on the aes implimentation in triple sec\n// https://github.com/keybase/triplesec\n// which is in turn based on the one from crypto-js\n// https://code.google.com/p/crypto-js/\n\nvar Buffer = require('safe-buffer').Buffer\n\nfunction asUInt32Array (buf) {\n if (!Buffer.isBuffer(buf)) buf = Buffer.from(buf)\n\n var len = (buf.length / 4) | 0\n var out = new Array(len)\n\n for (var i = 0; i < len; i++) {\n out[i] = buf.readUInt32BE(i * 4)\n }\n\n return out\n}\n\nfunction scrubVec (v) {\n for (var i = 0; i < v.length; v++) {\n v[i] = 0\n }\n}\n\nfunction cryptBlock (M, keySchedule, SUB_MIX, SBOX, nRounds) {\n var SUB_MIX0 = SUB_MIX[0]\n var SUB_MIX1 = SUB_MIX[1]\n var SUB_MIX2 = SUB_MIX[2]\n var SUB_MIX3 = SUB_MIX[3]\n\n var s0 = M[0] ^ keySchedule[0]\n var s1 = M[1] ^ keySchedule[1]\n var s2 = M[2] ^ keySchedule[2]\n var s3 = M[3] ^ keySchedule[3]\n var t0, t1, t2, t3\n var ksRow = 4\n\n for (var round = 1; round < nRounds; round++) {\n t0 = SUB_MIX0[s0 >>> 24] ^ SUB_MIX1[(s1 >>> 16) & 0xff] ^ SUB_MIX2[(s2 >>> 8) & 0xff] ^ SUB_MIX3[s3 & 0xff] ^ keySchedule[ksRow++]\n t1 = SUB_MIX0[s1 >>> 24] ^ SUB_MIX1[(s2 >>> 16) & 0xff] ^ SUB_MIX2[(s3 >>> 8) & 0xff] ^ SUB_MIX3[s0 & 0xff] ^ keySchedule[ksRow++]\n t2 = SUB_MIX0[s2 >>> 24] ^ SUB_MIX1[(s3 >>> 16) & 0xff] ^ SUB_MIX2[(s0 >>> 8) & 0xff] ^ SUB_MIX3[s1 & 0xff] ^ keySchedule[ksRow++]\n t3 = SUB_MIX0[s3 >>> 24] ^ SUB_MIX1[(s0 >>> 16) & 0xff] ^ SUB_MIX2[(s1 >>> 8) & 0xff] ^ SUB_MIX3[s2 & 0xff] ^ keySchedule[ksRow++]\n s0 = t0\n s1 = t1\n s2 = t2\n s3 = t3\n }\n\n t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]\n t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]\n t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]\n t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]\n t0 = t0 >>> 0\n t1 = t1 >>> 0\n t2 = t2 >>> 0\n t3 = t3 >>> 0\n\n return [t0, t1, t2, t3]\n}\n\n// AES constants\nvar RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]\nvar G = (function () {\n // Compute double table\n var d = new Array(256)\n for (var j = 0; j < 256; j++) {\n if (j < 128) {\n d[j] = j << 1\n } else {\n d[j] = (j << 1) ^ 0x11b\n }\n }\n\n var SBOX = []\n var INV_SBOX = []\n var SUB_MIX = [[], [], [], []]\n var INV_SUB_MIX = [[], [], [], []]\n\n // Walk GF(2^8)\n var x = 0\n var xi = 0\n for (var i = 0; i < 256; ++i) {\n // Compute sbox\n var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4)\n sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63\n SBOX[x] = sx\n INV_SBOX[sx] = x\n\n // Compute multiplication\n var x2 = d[x]\n var x4 = d[x2]\n var x8 = d[x4]\n\n // Compute sub bytes, mix columns tables\n var t = (d[sx] * 0x101) ^ (sx * 0x1010100)\n SUB_MIX[0][x] = (t << 24) | (t >>> 8)\n SUB_MIX[1][x] = (t << 16) | (t >>> 16)\n SUB_MIX[2][x] = (t << 8) | (t >>> 24)\n SUB_MIX[3][x] = t\n\n // Compute inv sub bytes, inv mix columns tables\n t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100)\n INV_SUB_MIX[0][sx] = (t << 24) | (t >>> 8)\n INV_SUB_MIX[1][sx] = (t << 16) | (t >>> 16)\n INV_SUB_MIX[2][sx] = (t << 8) | (t >>> 24)\n INV_SUB_MIX[3][sx] = t\n\n if (x === 0) {\n x = xi = 1\n } else {\n x = x2 ^ d[d[d[x8 ^ x2]]]\n xi ^= d[d[xi]]\n }\n }\n\n return {\n SBOX: SBOX,\n INV_SBOX: INV_SBOX,\n SUB_MIX: SUB_MIX,\n INV_SUB_MIX: INV_SUB_MIX\n }\n})()\n\nfunction AES (key) {\n this._key = asUInt32Array(key)\n this._reset()\n}\n\nAES.blockSize = 4 * 4\nAES.keySize = 256 / 8\nAES.prototype.blockSize = AES.blockSize\nAES.prototype.keySize = AES.keySize\nAES.prototype._reset = function () {\n var keyWords = this._key\n var keySize = keyWords.length\n var nRounds = keySize + 6\n var ksRows = (nRounds + 1) * 4\n\n var keySchedule = []\n for (var k = 0; k < keySize; k++) {\n keySchedule[k] = keyWords[k]\n }\n\n for (k = keySize; k < ksRows; k++) {\n var t = keySchedule[k - 1]\n\n if (k % keySize === 0) {\n t = (t << 8) | (t >>> 24)\n t =\n (G.SBOX[t >>> 24] << 24) |\n (G.SBOX[(t >>> 16) & 0xff] << 16) |\n (G.SBOX[(t >>> 8) & 0xff] << 8) |\n (G.SBOX[t & 0xff])\n\n t ^= RCON[(k / keySize) | 0] << 24\n } else if (keySize > 6 && k % keySize === 4) {\n t =\n (G.SBOX[t >>> 24] << 24) |\n (G.SBOX[(t >>> 16) & 0xff] << 16) |\n (G.SBOX[(t >>> 8) & 0xff] << 8) |\n (G.SBOX[t & 0xff])\n }\n\n keySchedule[k] = keySchedule[k - keySize] ^ t\n }\n\n var invKeySchedule = []\n for (var ik = 0; ik < ksRows; ik++) {\n var ksR = ksRows - ik\n var tt = keySchedule[ksR - (ik % 4 ? 0 : 4)]\n\n if (ik < 4 || ksR <= 4) {\n invKeySchedule[ik] = tt\n } else {\n invKeySchedule[ik] =\n G.INV_SUB_MIX[0][G.SBOX[tt >>> 24]] ^\n G.INV_SUB_MIX[1][G.SBOX[(tt >>> 16) & 0xff]] ^\n G.INV_SUB_MIX[2][G.SBOX[(tt >>> 8) & 0xff]] ^\n G.INV_SUB_MIX[3][G.SBOX[tt & 0xff]]\n }\n }\n\n this._nRounds = nRounds\n this._keySchedule = keySchedule\n this._invKeySchedule = invKeySchedule\n}\n\nAES.prototype.encryptBlockRaw = function (M) {\n M = asUInt32Array(M)\n return cryptBlock(M, this._keySchedule, G.SUB_MIX, G.SBOX, this._nRounds)\n}\n\nAES.prototype.encryptBlock = function (M) {\n var out = this.encryptBlockRaw(M)\n var buf = Buffer.allocUnsafe(16)\n buf.writeUInt32BE(out[0], 0)\n buf.writeUInt32BE(out[1], 4)\n buf.writeUInt32BE(out[2], 8)\n buf.writeUInt32BE(out[3], 12)\n return buf\n}\n\nAES.prototype.decryptBlock = function (M) {\n M = asUInt32Array(M)\n\n // swap\n var m1 = M[1]\n M[1] = M[3]\n M[3] = m1\n\n var out = cryptBlock(M, this._invKeySchedule, G.INV_SUB_MIX, G.INV_SBOX, this._nRounds)\n var buf = Buffer.allocUnsafe(16)\n buf.writeUInt32BE(out[0], 0)\n buf.writeUInt32BE(out[3], 4)\n buf.writeUInt32BE(out[2], 8)\n buf.writeUInt32BE(out[1], 12)\n return buf\n}\n\nAES.prototype.scrub = function () {\n scrubVec(this._keySchedule)\n scrubVec(this._invKeySchedule)\n scrubVec(this._key)\n}\n\nmodule.exports.AES = AES\n","var Buffer = require('safe-buffer').Buffer\nvar MD5 = require('md5.js')\n\n/* eslint-disable camelcase */\nfunction EVP_BytesToKey (password, salt, keyBits, ivLen) {\n if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary')\n if (salt) {\n if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary')\n if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length')\n }\n\n var keyLen = keyBits / 8\n var key = Buffer.alloc(keyLen)\n var iv = Buffer.alloc(ivLen || 0)\n var tmp = Buffer.alloc(0)\n\n while (keyLen > 0 || ivLen > 0) {\n var hash = new MD5()\n hash.update(tmp)\n hash.update(password)\n if (salt) hash.update(salt)\n tmp = hash.digest()\n\n var used = 0\n\n if (keyLen > 0) {\n var keyStart = key.length - keyLen\n used = Math.min(keyLen, tmp.length)\n tmp.copy(key, keyStart, 0, used)\n keyLen -= used\n }\n\n if (used < tmp.length && ivLen > 0) {\n var ivStart = iv.length - ivLen\n var length = Math.min(ivLen, tmp.length - used)\n tmp.copy(iv, ivStart, used, used + length)\n ivLen -= length\n }\n }\n\n tmp.fill(0)\n return { key: key, iv: iv }\n}\n\nmodule.exports = EVP_BytesToKey\n","'use strict';\n\nvar BN = require('bn.js');\nvar utils = require('../utils');\nvar getNAF = utils.getNAF;\nvar getJSF = utils.getJSF;\nvar assert = utils.assert;\n\nfunction BaseCurve(type, conf) {\n this.type = type;\n this.p = new BN(conf.p, 16);\n\n // Use Montgomery, when there is no fast reduction for the prime\n this.red = conf.prime ? BN.red(conf.prime) : BN.mont(this.p);\n\n // Useful for many curves\n this.zero = new BN(0).toRed(this.red);\n this.one = new BN(1).toRed(this.red);\n this.two = new BN(2).toRed(this.red);\n\n // Curve configuration, optional\n this.n = conf.n && new BN(conf.n, 16);\n this.g = conf.g && this.pointFromJSON(conf.g, conf.gRed);\n\n // Temporary arrays\n this._wnafT1 = new Array(4);\n this._wnafT2 = new Array(4);\n this._wnafT3 = new Array(4);\n this._wnafT4 = new Array(4);\n\n this._bitLength = this.n ? this.n.bitLength() : 0;\n\n // Generalized Greg Maxwell's trick\n var adjustCount = this.n && this.p.div(this.n);\n if (!adjustCount || adjustCount.cmpn(100) > 0) {\n this.redN = null;\n } else {\n this._maxwellTrick = true;\n this.redN = this.n.toRed(this.red);\n }\n}\nmodule.exports = BaseCurve;\n\nBaseCurve.prototype.point = function point() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype.validate = function validate() {\n throw new Error('Not implemented');\n};\n\nBaseCurve.prototype._fixedNafMul = function _fixedNafMul(p, k) {\n assert(p.precomputed);\n var doubles = p._getDoubles();\n\n var naf = getNAF(k, 1, this._bitLength);\n var I = (1 << (doubles.step + 1)) - (doubles.step % 2 === 0 ? 2 : 1);\n I /= 3;\n\n // Translate into more windowed form\n var repr = [];\n var j;\n var nafW;\n for (j = 0; j < naf.length; j += doubles.step) {\n nafW = 0;\n for (var l = j + doubles.step - 1; l >= j; l--)\n nafW = (nafW << 1) + naf[l];\n repr.push(nafW);\n }\n\n var a = this.jpoint(null, null, null);\n var b = this.jpoint(null, null, null);\n for (var i = I; i > 0; i--) {\n for (j = 0; j < repr.length; j++) {\n nafW = repr[j];\n if (nafW === i)\n b = b.mixedAdd(doubles.points[j]);\n else if (nafW === -i)\n b = b.mixedAdd(doubles.points[j].neg());\n }\n a = a.add(b);\n }\n return a.toP();\n};\n\nBaseCurve.prototype._wnafMul = function _wnafMul(p, k) {\n var w = 4;\n\n // Precompute window\n var nafPoints = p._getNAFPoints(w);\n w = nafPoints.wnd;\n var wnd = nafPoints.points;\n\n // Get NAF form\n var naf = getNAF(k, w, this._bitLength);\n\n // Add `this`*(N+1) for every w-NAF index\n var acc = this.jpoint(null, null, null);\n for (var i = naf.length - 1; i >= 0; i--) {\n // Count zeroes\n for (var l = 0; i >= 0 && naf[i] === 0; i--)\n l++;\n if (i >= 0)\n l++;\n acc = acc.dblp(l);\n\n if (i < 0)\n break;\n var z = naf[i];\n assert(z !== 0);\n if (p.type === 'affine') {\n // J +- P\n if (z > 0)\n acc = acc.mixedAdd(wnd[(z - 1) >> 1]);\n else\n acc = acc.mixedAdd(wnd[(-z - 1) >> 1].neg());\n } else {\n // J +- J\n if (z > 0)\n acc = acc.add(wnd[(z - 1) >> 1]);\n else\n acc = acc.add(wnd[(-z - 1) >> 1].neg());\n }\n }\n return p.type === 'affine' ? acc.toP() : acc;\n};\n\nBaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW,\n points,\n coeffs,\n len,\n jacobianResult) {\n var wndWidth = this._wnafT1;\n var wnd = this._wnafT2;\n var naf = this._wnafT3;\n\n // Fill all arrays\n var max = 0;\n var i;\n var j;\n var p;\n for (i = 0; i < len; i++) {\n p = points[i];\n var nafPoints = p._getNAFPoints(defW);\n wndWidth[i] = nafPoints.wnd;\n wnd[i] = nafPoints.points;\n }\n\n // Comb small window NAFs\n for (i = len - 1; i >= 1; i -= 2) {\n var a = i - 1;\n var b = i;\n if (wndWidth[a] !== 1 || wndWidth[b] !== 1) {\n naf[a] = getNAF(coeffs[a], wndWidth[a], this._bitLength);\n naf[b] = getNAF(coeffs[b], wndWidth[b], this._bitLength);\n max = Math.max(naf[a].length, max);\n max = Math.max(naf[b].length, max);\n continue;\n }\n\n var comb = [\n points[a], /* 1 */\n null, /* 3 */\n null, /* 5 */\n points[b], /* 7 */\n ];\n\n // Try to avoid Projective points, if possible\n if (points[a].y.cmp(points[b].y) === 0) {\n comb[1] = points[a].add(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n } else if (points[a].y.cmp(points[b].y.redNeg()) === 0) {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].add(points[b].neg());\n } else {\n comb[1] = points[a].toJ().mixedAdd(points[b]);\n comb[2] = points[a].toJ().mixedAdd(points[b].neg());\n }\n\n var index = [\n -3, /* -1 -1 */\n -1, /* -1 0 */\n -5, /* -1 1 */\n -7, /* 0 -1 */\n 0, /* 0 0 */\n 7, /* 0 1 */\n 5, /* 1 -1 */\n 1, /* 1 0 */\n 3, /* 1 1 */\n ];\n\n var jsf = getJSF(coeffs[a], coeffs[b]);\n max = Math.max(jsf[0].length, max);\n naf[a] = new Array(max);\n naf[b] = new Array(max);\n for (j = 0; j < max; j++) {\n var ja = jsf[0][j] | 0;\n var jb = jsf[1][j] | 0;\n\n naf[a][j] = index[(ja + 1) * 3 + (jb + 1)];\n naf[b][j] = 0;\n wnd[a] = comb;\n }\n }\n\n var acc = this.jpoint(null, null, null);\n var tmp = this._wnafT4;\n for (i = max; i >= 0; i--) {\n var k = 0;\n\n while (i >= 0) {\n var zero = true;\n for (j = 0; j < len; j++) {\n tmp[j] = naf[j][i] | 0;\n if (tmp[j] !== 0)\n zero = false;\n }\n if (!zero)\n break;\n k++;\n i--;\n }\n if (i >= 0)\n k++;\n acc = acc.dblp(k);\n if (i < 0)\n break;\n\n for (j = 0; j < len; j++) {\n var z = tmp[j];\n p;\n if (z === 0)\n continue;\n else if (z > 0)\n p = wnd[j][(z - 1) >> 1];\n else if (z < 0)\n p = wnd[j][(-z - 1) >> 1].neg();\n\n if (p.type === 'affine')\n acc = acc.mixedAdd(p);\n else\n acc = acc.add(p);\n }\n }\n // Zeroify references\n for (i = 0; i < len; i++)\n wnd[i] = null;\n\n if (jacobianResult)\n return acc;\n else\n return acc.toP();\n};\n\nfunction BasePoint(curve, type) {\n this.curve = curve;\n this.type = type;\n this.precomputed = null;\n}\nBaseCurve.BasePoint = BasePoint;\n\nBasePoint.prototype.eq = function eq(/*other*/) {\n throw new Error('Not implemented');\n};\n\nBasePoint.prototype.validate = function validate() {\n return this.curve.validate(this);\n};\n\nBaseCurve.prototype.decodePoint = function decodePoint(bytes, enc) {\n bytes = utils.toArray(bytes, enc);\n\n var len = this.p.byteLength();\n\n // uncompressed, hybrid-odd, hybrid-even\n if ((bytes[0] === 0x04 || bytes[0] === 0x06 || bytes[0] === 0x07) &&\n bytes.length - 1 === 2 * len) {\n if (bytes[0] === 0x06)\n assert(bytes[bytes.length - 1] % 2 === 0);\n else if (bytes[0] === 0x07)\n assert(bytes[bytes.length - 1] % 2 === 1);\n\n var res = this.point(bytes.slice(1, 1 + len),\n bytes.slice(1 + len, 1 + 2 * len));\n\n return res;\n } else if ((bytes[0] === 0x02 || bytes[0] === 0x03) &&\n bytes.length - 1 === len) {\n return this.pointFromX(bytes.slice(1, 1 + len), bytes[0] === 0x03);\n }\n throw new Error('Unknown point format');\n};\n\nBasePoint.prototype.encodeCompressed = function encodeCompressed(enc) {\n return this.encode(enc, true);\n};\n\nBasePoint.prototype._encode = function _encode(compact) {\n var len = this.curve.p.byteLength();\n var x = this.getX().toArray('be', len);\n\n if (compact)\n return [ this.getY().isEven() ? 0x02 : 0x03 ].concat(x);\n\n return [ 0x04 ].concat(x, this.getY().toArray('be', len));\n};\n\nBasePoint.prototype.encode = function encode(enc, compact) {\n return utils.encode(this._encode(compact), enc);\n};\n\nBasePoint.prototype.precompute = function precompute(power) {\n if (this.precomputed)\n return this;\n\n var precomputed = {\n doubles: null,\n naf: null,\n beta: null,\n };\n precomputed.naf = this._getNAFPoints(8);\n precomputed.doubles = this._getDoubles(4, power);\n precomputed.beta = this._getBeta();\n this.precomputed = precomputed;\n\n return this;\n};\n\nBasePoint.prototype._hasDoubles = function _hasDoubles(k) {\n if (!this.precomputed)\n return false;\n\n var doubles = this.precomputed.doubles;\n if (!doubles)\n return false;\n\n return doubles.points.length >= Math.ceil((k.bitLength() + 1) / doubles.step);\n};\n\nBasePoint.prototype._getDoubles = function _getDoubles(step, power) {\n if (this.precomputed && this.precomputed.doubles)\n return this.precomputed.doubles;\n\n var doubles = [ this ];\n var acc = this;\n for (var i = 0; i < power; i += step) {\n for (var j = 0; j < step; j++)\n acc = acc.dbl();\n doubles.push(acc);\n }\n return {\n step: step,\n points: doubles,\n };\n};\n\nBasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) {\n if (this.precomputed && this.precomputed.naf)\n return this.precomputed.naf;\n\n var res = [ this ];\n var max = (1 << wnd) - 1;\n var dbl = max === 1 ? null : this.dbl();\n for (var i = 1; i < max; i++)\n res[i] = res[i - 1].add(dbl);\n return {\n wnd: wnd,\n points: res,\n };\n};\n\nBasePoint.prototype._getBeta = function _getBeta() {\n return null;\n};\n\nBasePoint.prototype.dblp = function dblp(k) {\n var r = this;\n for (var i = 0; i < k; i++)\n r = r.dbl();\n return r;\n};\n","var asn1 = require('./asn1')\nvar aesid = require('./aesid.json')\nvar fixProc = require('./fixProc')\nvar ciphers = require('browserify-aes')\nvar compat = require('pbkdf2')\nvar Buffer = require('safe-buffer').Buffer\nmodule.exports = parseKeys\n\nfunction parseKeys (buffer) {\n var password\n if (typeof buffer === 'object' && !Buffer.isBuffer(buffer)) {\n password = buffer.passphrase\n buffer = buffer.key\n }\n if (typeof buffer === 'string') {\n buffer = Buffer.from(buffer)\n }\n\n var stripped = fixProc(buffer, password)\n\n var type = stripped.tag\n var data = stripped.data\n var subtype, ndata\n switch (type) {\n case 'CERTIFICATE':\n ndata = asn1.certificate.decode(data, 'der').tbsCertificate.subjectPublicKeyInfo\n // falls through\n case 'PUBLIC KEY':\n if (!ndata) {\n ndata = asn1.PublicKey.decode(data, 'der')\n }\n subtype = ndata.algorithm.algorithm.join('.')\n switch (subtype) {\n case '1.2.840.113549.1.1.1':\n return asn1.RSAPublicKey.decode(ndata.subjectPublicKey.data, 'der')\n case '1.2.840.10045.2.1':\n ndata.subjectPrivateKey = ndata.subjectPublicKey\n return {\n type: 'ec',\n data: ndata\n }\n case '1.2.840.10040.4.1':\n ndata.algorithm.params.pub_key = asn1.DSAparam.decode(ndata.subjectPublicKey.data, 'der')\n return {\n type: 'dsa',\n data: ndata.algorithm.params\n }\n default: throw new Error('unknown key id ' + subtype)\n }\n // throw new Error('unknown key type ' + type)\n case 'ENCRYPTED PRIVATE KEY':\n data = asn1.EncryptedPrivateKey.decode(data, 'der')\n data = decrypt(data, password)\n // falls through\n case 'PRIVATE KEY':\n ndata = asn1.PrivateKey.decode(data, 'der')\n subtype = ndata.algorithm.algorithm.join('.')\n switch (subtype) {\n case '1.2.840.113549.1.1.1':\n return asn1.RSAPrivateKey.decode(ndata.subjectPrivateKey, 'der')\n case '1.2.840.10045.2.1':\n return {\n curve: ndata.algorithm.curve,\n privateKey: asn1.ECPrivateKey.decode(ndata.subjectPrivateKey, 'der').privateKey\n }\n case '1.2.840.10040.4.1':\n ndata.algorithm.params.priv_key = asn1.DSAparam.decode(ndata.subjectPrivateKey, 'der')\n return {\n type: 'dsa',\n params: ndata.algorithm.params\n }\n default: throw new Error('unknown key id ' + subtype)\n }\n // throw new Error('unknown key type ' + type)\n case 'RSA PUBLIC KEY':\n return asn1.RSAPublicKey.decode(data, 'der')\n case 'RSA PRIVATE KEY':\n return asn1.RSAPrivateKey.decode(data, 'der')\n case 'DSA PRIVATE KEY':\n return {\n type: 'dsa',\n params: asn1.DSAPrivateKey.decode(data, 'der')\n }\n case 'EC PRIVATE KEY':\n data = asn1.ECPrivateKey.decode(data, 'der')\n return {\n curve: data.parameters.value,\n privateKey: data.privateKey\n }\n default: throw new Error('unknown key type ' + type)\n }\n}\nparseKeys.signature = asn1.signature\nfunction decrypt (data, password) {\n var salt = data.algorithm.decrypt.kde.kdeparams.salt\n var iters = parseInt(data.algorithm.decrypt.kde.kdeparams.iters.toString(), 10)\n var algo = aesid[data.algorithm.decrypt.cipher.algo.join('.')]\n var iv = data.algorithm.decrypt.cipher.iv\n var cipherText = data.subjectPrivateKey\n var keylen = parseInt(algo.split('-')[1], 10) / 8\n var key = compat.pbkdf2Sync(password, salt, iters, keylen, 'sha1')\n var cipher = ciphers.createDecipheriv(algo, key, iv)\n var out = []\n out.push(cipher.update(cipherText))\n out.push(cipher.final())\n return Buffer.concat(out)\n}\n","(function (root, factory) {\n if (typeof define === 'function' && define.amd)\n define(['exports', 'kotlin', 'react', 'kotlin-wrappers-kotlin-extensions-jsLegacy', 'kotlinx-coroutines-core'], factory);\n else if (typeof exports === 'object')\n factory(module.exports, require('kotlin'), require('react'), require('kotlin-wrappers-kotlin-extensions-jsLegacy'), require('kotlinx-coroutines-core'));\n else {\n if (typeof kotlin === 'undefined') {\n throw new Error(\"Error loading module 'kotlin-wrappers-kotlin-react-jsLegacy'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'kotlin-wrappers-kotlin-react-jsLegacy'.\");\n }if (typeof react === 'undefined') {\n throw new Error(\"Error loading module 'kotlin-wrappers-kotlin-react-jsLegacy'. Its dependency 'react' was not found. Please, check whether 'react' is loaded prior to 'kotlin-wrappers-kotlin-react-jsLegacy'.\");\n }if (typeof this['kotlin-wrappers-kotlin-extensions-jsLegacy'] === 'undefined') {\n throw new Error(\"Error loading module 'kotlin-wrappers-kotlin-react-jsLegacy'. Its dependency 'kotlin-wrappers-kotlin-extensions-jsLegacy' was not found. Please, check whether 'kotlin-wrappers-kotlin-extensions-jsLegacy' is loaded prior to 'kotlin-wrappers-kotlin-react-jsLegacy'.\");\n }if (typeof this['kotlinx-coroutines-core'] === 'undefined') {\n throw new Error(\"Error loading module 'kotlin-wrappers-kotlin-react-jsLegacy'. Its dependency 'kotlinx-coroutines-core' was not found. Please, check whether 'kotlinx-coroutines-core' is loaded prior to 'kotlin-wrappers-kotlin-react-jsLegacy'.\");\n }root['kotlin-wrappers-kotlin-react-jsLegacy'] = factory(typeof this['kotlin-wrappers-kotlin-react-jsLegacy'] === 'undefined' ? {} : this['kotlin-wrappers-kotlin-react-jsLegacy'], kotlin, react, this['kotlin-wrappers-kotlin-extensions-jsLegacy'], this['kotlinx-coroutines-core']);\n }\n}(this, function (_, Kotlin, $module$react, $module$kotlin_wrappers_kotlin_extensions_jsLegacy, $module$kotlinx_coroutines_core) {\n 'use strict';\n var $$importsForInline$$ = _.$$importsForInline$$ || (_.$$importsForInline$$ = {});\n var Unit = Kotlin.kotlin.Unit;\n var Kind_CLASS = Kotlin.Kind.CLASS;\n var Annotation = Kotlin.kotlin.Annotation;\n var createElement = $module$react.createElement;\n var emptyList = Kotlin.kotlin.collections.emptyList_287e2$;\n var clone = $module$kotlin_wrappers_kotlin_extensions_jsLegacy.kotlinext.js.clone_issdgt$;\n var defineInlineFunction = Kotlin.defineInlineFunction;\n var wrapFunction = Kotlin.wrapFunction;\n var listOf = Kotlin.kotlin.collections.listOf_mh5how$;\n var Children = $module$react.Children;\n var addAll = Kotlin.kotlin.collections.addAll_ye1y7v$;\n var throwCCE = Kotlin.throwCCE;\n var cloneElement = $module$react.cloneElement;\n var first = Kotlin.kotlin.collections.first_2p1efm$;\n var ArrayList_init = Kotlin.kotlin.collections.ArrayList_init_287e2$;\n var copyToArray = Kotlin.kotlin.collections.copyToArray;\n var collectionSizeOrDefault = Kotlin.kotlin.collections.collectionSizeOrDefault_ba2ldo$;\n var ArrayList_init_0 = Kotlin.kotlin.collections.ArrayList_init_ww73n8$;\n var checkIndexOverflow = Kotlin.kotlin.collections.checkIndexOverflow_za3lpa$;\n var IllegalStateException_init = Kotlin.kotlin.IllegalStateException_init_pdl1vj$;\n var get_js = Kotlin.kotlin.js.get_js_1yb8b7$;\n var coroutines = $module$kotlinx_coroutines_core.kotlinx.coroutines;\n var Throwable = Error;\n var COROUTINE_SUSPENDED = Kotlin.kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED;\n var CoroutineImpl = Kotlin.kotlin.coroutines.CoroutineImpl;\n var launch = $module$kotlinx_coroutines_core.kotlinx.coroutines.launch_s496o7$;\n var Component = $module$react.Component;\n var Any = Object;\n var ReadWriteProperty = Kotlin.kotlin.properties.ReadWriteProperty;\n var to = Kotlin.kotlin.to_ujzrz7$;\n var rawUseEffect = $module$react.useEffect;\n RElementBuilder.prototype = Object.create(RBuilder.prototype);\n RElementBuilder.prototype.constructor = RElementBuilder;\n RComponent.prototype = Object.create(Component.prototype);\n RComponent.prototype.constructor = RComponent;\n function RBuilder() {\n this.childList = ArrayList_init();\n }\n RBuilder.prototype.child_52psg1$ = function (element) {\n this.childList.add_11rb$(element);\n return element;\n };\n RBuilder.prototype.unaryPlus_84gpoi$ = function ($receiver) {\n this.childList.add_11rb$($receiver);\n };\n RBuilder.prototype.unaryPlus_pdl1vz$ = function ($receiver) {\n this.childList.add_11rb$($receiver);\n };\n RBuilder.prototype.child_k3oess$ = function (type, props, children) {\n return this.child_52psg1$(createElement.apply(null, [type, props].concat(copyToArray(children))));\n };\n RBuilder.prototype.child_4dvv5y$ = function (type, props, handler) {\n var $receiver = new RElementBuilder(props);\n handler($receiver);\n var children = $receiver.childList;\n return this.child_k3oess$(type, props, children);\n };\n RBuilder.prototype.invoke_eb8iu4$ = function ($receiver, handler) {\n return this.child_4dvv5y$($receiver, {}, handler);\n };\n RBuilder.prototype.invoke_csqs6z$ = function ($receiver, value, handler) {\n var $receiver_0 = {};\n $receiver_0.value = value;\n return this.child_4dvv5y$($receiver, $receiver_0, handler);\n };\n function RBuilder$invoke$lambda$lambda$lambda(closure$handler, closure$value) {\n return function ($receiver) {\n closure$handler($receiver, closure$value);\n return Unit;\n };\n }\n function RBuilder$invoke$lambda$lambda(closure$handler) {\n return function (value) {\n return buildElements(RBuilder$invoke$lambda$lambda$lambda(closure$handler, value));\n };\n }\n function RBuilder$invoke$lambda($receiver) {\n return Unit;\n }\n RBuilder.prototype.invoke_ory6b3$ = function ($receiver, handler) {\n var $receiver_0 = {};\n $receiver_0.children = RBuilder$invoke$lambda$lambda(handler);\n return this.child_4dvv5y$($receiver, $receiver_0, RBuilder$invoke$lambda);\n };\n RBuilder.prototype.node_rwypko$ = function ($receiver, props, children) {\n if (children === void 0)\n children = emptyList();\n return this.child_k3oess$($receiver, clone(props), children);\n };\n RBuilder.prototype.child_ssazr1$ = function (klazz, handler) {\n return this.invoke_eb8iu4$(get_rClass(klazz), handler);\n };\n RBuilder.prototype.child_t7en6a$ = defineInlineFunction('kotlin-wrappers-kotlin-react-jsLegacy.react.RBuilder.child_t7en6a$', wrapFunction(function () {\n var getKClass = Kotlin.getKClass;\n return function (C_0, isC, handler) {\n return this.child_ssazr1$(getKClass(C_0), handler);\n };\n }));\n function RBuilder$childFunction$lambda(closure$children) {\n return function (value) {\n var $receiver = new RBuilder();\n closure$children($receiver, value);\n return first($receiver.childList);\n };\n }\n RBuilder.prototype.childFunction_2656uf$ = function (klazz, handler, children) {\n var tmp$ = get_rClass(klazz);\n var $receiver = new RElementBuilder({});\n handler($receiver);\n return this.child_k3oess$(tmp$, $receiver.attrs, listOf(RBuilder$childFunction$lambda(children)));\n };\n RBuilder.prototype.childFunction_khdow9$ = defineInlineFunction('kotlin-wrappers-kotlin-react-jsLegacy.react.RBuilder.childFunction_khdow9$', wrapFunction(function () {\n var getKClass = Kotlin.getKClass;\n return function (C_0, isC, handler, children) {\n return this.childFunction_2656uf$(getKClass(C_0), handler, children);\n };\n }));\n RBuilder.prototype.node_3ecl1l$ = function (klazz, props, children) {\n if (children === void 0)\n children = emptyList();\n return this.node_rwypko$(get_rClass(klazz), props, children);\n };\n RBuilder.prototype.node_e2hqbc$ = defineInlineFunction('kotlin-wrappers-kotlin-react-jsLegacy.react.RBuilder.node_e2hqbc$', wrapFunction(function () {\n var emptyList = Kotlin.kotlin.collections.emptyList_287e2$;\n var getKClass = Kotlin.getKClass;\n return function (C_0, isC, props, children) {\n if (children === void 0)\n children = emptyList();\n return this.node_3ecl1l$(getKClass(C_0), props, children);\n };\n }));\n RBuilder.prototype.children_yllgzm$ = function ($receiver) {\n addAll(this.childList, Children.toArray(get_children($receiver)));\n };\n RBuilder.prototype.children_48djri$ = function ($receiver, value) {\n var tmp$;\n this.childList.add_11rb$((typeof (tmp$ = get_children($receiver)) === 'function' ? tmp$ : throwCCE())(value));\n };\n RBuilder.prototype.renderEach_3b8uhr$ = function ($receiver, fn) {\n var tmp$ = this.childList;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$_0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n var tmp$_1 = destination.add_11rb$;\n var $receiver_0 = new RBuilder();\n fn($receiver_0, item);\n tmp$_1.call(destination, first($receiver_0.childList));\n }\n tmp$.add_11rb$(copyToArray(destination));\n };\n RBuilder.prototype.renderEachIndexed_a4qrr7$ = function ($receiver, fn) {\n var tmp$ = this.childList;\n var destination = ArrayList_init_0(collectionSizeOrDefault($receiver, 10));\n var tmp$_0, tmp$_0_0;\n var index = 0;\n tmp$_0 = $receiver.iterator();\n while (tmp$_0.hasNext()) {\n var item = tmp$_0.next();\n var tmp$_1 = destination.add_11rb$;\n var index_0 = checkIndexOverflow((tmp$_0_0 = index, index = tmp$_0_0 + 1 | 0, tmp$_0_0));\n var $receiver_0 = new RBuilder();\n fn($receiver_0, index_0, item);\n tmp$_1.call(destination, first($receiver_0.childList));\n }\n tmp$.add_11rb$(copyToArray(destination));\n };\n RBuilder.prototype.withKey_s5hl0b$ = function ($receiver, newKey) {\n var index = this.childList.indexOf_11rb$($receiver);\n if (index >= 0) {\n this.childList.removeAt_za3lpa$(index);\n var $receiver_0 = {};\n set_key($receiver_0, newKey);\n var elementWithKey = cloneElement($receiver, $receiver_0);\n this.childList.add_wxm5ur$(index, elementWithKey);\n }};\n RBuilder.prototype.withKey_pspxar$ = function ($receiver, newKey) {\n this.withKey_s5hl0b$($receiver, newKey.toString());\n };\n RBuilder.$metadata$ = {kind: Kind_CLASS, simpleName: 'RBuilder', interfaces: []};\n function buildElements(handler) {\n var tmp$;\n var $receiver = new RBuilder();\n handler($receiver);\n var nodes = $receiver.childList;\n switch (nodes.size) {\n case 0:\n tmp$ = null;\n break;\n case 1:\n tmp$ = first(nodes);\n break;\n default:var tmp$_0 = $module$react.Fragment;\n var $receiver_0 = {};\n tmp$ = createElement.apply(null, [tmp$_0, $receiver_0].concat(copyToArray(nodes)));\n break;\n }\n return tmp$;\n }\n function RElementBuilder(attrs) {\n RBuilder.call(this);\n this.attrs_iyt8sk$_0 = attrs;\n }\n Object.defineProperty(RElementBuilder.prototype, 'attrs', {get: function () {\n return this.attrs_iyt8sk$_0;\n }});\n RElementBuilder.prototype.attrs_slhiwc$ = function (handler) {\n handler(this.attrs);\n };\n Object.defineProperty(RElementBuilder.prototype, 'key', {configurable: true, get: function () {\n throw IllegalStateException_init(''.toString());\n }, set: function (value) {\n set_key(this.attrs, value);\n }});\n Object.defineProperty(RElementBuilder.prototype, 'ref', {configurable: true, get: function () {\n throw IllegalStateException_init(''.toString());\n }, set: function (value) {\n set_ref(this.attrs, value);\n }});\n RElementBuilder.prototype.ref_5ij4lk$ = function (handler) {\n ref(this.attrs, handler);\n };\n RElementBuilder.$metadata$ = {kind: Kind_CLASS, simpleName: 'RElementBuilder', interfaces: [RBuilder]};\n function functionalComponent$lambda$lambda(closure$func, closure$props) {\n return function ($receiver) {\n closure$func($receiver, closure$props);\n return Unit;\n };\n }\n function functionalComponent$lambda(closure$func) {\n return function (props) {\n return buildElements(functionalComponent$lambda$lambda(closure$func, props));\n };\n }\n function functionalComponent(displayName, func) {\n if (displayName === void 0)\n displayName = null;\n var fc = functionalComponent$lambda(func);\n if (displayName != null) {\n fc.displayName = displayName;\n }return fc;\n }\n function child$lambda($receiver) {\n return Unit;\n }\n function child($receiver, component, props, handler) {\n if (props === void 0) {\n props = {};\n }if (handler === void 0)\n handler = child$lambda;\n return $receiver.child_4dvv5y$(component, props, handler);\n }\n function get_rClass($receiver) {\n return get_js($receiver);\n }\n function get_children($receiver) {\n return $receiver.children;\n }\n function set_key($receiver, value) {\n $receiver.key = value;\n }\n function set_ref($receiver, value) {\n $receiver.ref = value;\n }\n function ref($receiver, ref) {\n $receiver.ref = ref;\n }\n function setState$lambda(closure$buildState) {\n return function (it) {\n var builder = closure$buildState;\n var $receiver = clone(it);\n builder($receiver);\n return $receiver;\n };\n }\n function setState($receiver, buildState) {\n $receiver.setState(setState$lambda(buildState));\n }\n function RComponent() {\n }\n RComponent.prototype.init_bc6fkx$ = function ($receiver) {\n };\n RComponent.prototype.init_65a95q$ = function ($receiver, props) {\n };\n RComponent.prototype.children_ss14n$ = function ($receiver) {\n $receiver.children_yllgzm$(this.props);\n };\n RComponent.prototype.children_tgvp6h$ = function ($receiver, value) {\n $receiver.children_48djri$(this.props, value);\n };\n function RComponent$render$lambda(this$RComponent) {\n return function ($receiver) {\n this$RComponent.render_ss14n$($receiver);\n return Unit;\n };\n }\n RComponent.prototype.render = function () {\n return buildElements(RComponent$render$lambda(this));\n };\n RComponent.$metadata$ = {kind: Kind_CLASS, simpleName: 'RComponent', interfaces: []};\n function RComponent_init_0(props, $this) {\n $this = $this || Object.create(RComponent.prototype);\n Component.call($this, props);\n RComponent.call($this);\n var $receiver = {};\n $this.init_65a95q$($receiver, props);\n $this.state = $receiver;\n return $this;\n }\n function RStateDelegate(state, setState) {\n this.state_0 = state;\n this.setState_0 = setState;\n }\n RStateDelegate.prototype.component1 = function () {\n return this.state_0;\n };\n RStateDelegate.prototype.component2 = function () {\n return this.setState_0;\n };\n RStateDelegate.prototype.getValue_lrcp0p$ = function (thisRef, property) {\n return this.state_0;\n };\n RStateDelegate.prototype.setValue_9rddgb$ = function (thisRef, property, value) {\n this.setState_0(value);\n };\n RStateDelegate.$metadata$ = {kind: Kind_CLASS, simpleName: 'RStateDelegate', interfaces: [ReadWriteProperty]};\n function useEffect$lambda(closure$effect) {\n return function () {\n closure$effect();\n return undefined;\n };\n }\n function useEffect(dependencies, effect) {\n if (dependencies === void 0)\n dependencies = null;\n var rawEffect = useEffect$lambda(effect);\n if (dependencies != null) {\n rawUseEffect(rawEffect, copyToArray(dependencies));\n } else {\n rawUseEffect(rawEffect);\n }\n }\n var package$react = _.react || (_.react = {});\n $$importsForInline$$['kotlin-wrappers-kotlin-extensions-jsLegacy'] = $module$kotlin_wrappers_kotlin_extensions_jsLegacy;\n package$react.RBuilder = RBuilder;\n package$react.buildElements_zepujl$ = buildElements;\n package$react.RElementBuilder = RElementBuilder;\n package$react.functionalComponent_7g4vsr$ = functionalComponent;\n package$react.child_9r8yuv$ = child;\n $$importsForInline$$.react = $module$react;\n package$react.get_rClass_inwa2g$ = get_rClass;\n package$react.get_children_yllgzm$ = get_children;\n package$react.set_key_38rnt0$ = set_key;\n package$react.set_ref_jjyqia$ = set_ref;\n package$react.ref_dpkau5$ = ref;\n package$react.setState_kpl3tw$ = setState;\n package$react.RComponent_init_8bz2yq$ = RComponent_init_0;\n package$react.RComponent = RComponent;\n package$react.RStateDelegate = RStateDelegate;\n package$react.useEffect_wrbdb4$ = useEffect;\n return _;\n}));\n\n//# sourceMappingURL=kotlin-wrappers-kotlin-react-jsLegacy.js.map\n","package com.arkivanov.mvikotlin.rx\n\n// Expect/actual workaround for https://github.com/arkivanov/MVIKotlin/issues/145\nexpect fun observer(onComplete: () -> Unit = {}, onNext: (T) -> Unit = {}): Observer\n","package com.arkivanov.mvikotlin.rx\n\nactual fun observer(onComplete: () -> Unit, onNext: (T) -> Unit): Observer =\n ObserverImpl(onComplete, onNext)\n\nprivate class ObserverImpl(\n private val onComplete: () -> Unit,\n private val onNext: (T) -> Unit\n) : Observer {\n override fun onNext(value: T) {\n onNext.invoke(value)\n }\n\n override fun onComplete() {\n onComplete.invoke()\n }\n}\n",null,null,"/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.database.TokenDBQueries\nimport com.shabinder.common.di.spotify.authenticateSpotify\nimport com.shabinder.common.models.spotify.TokenData\nimport kotlinx.coroutines.GlobalScope\nimport kotlinx.coroutines.launch\nimport kotlinx.datetime.Clock\n\nclass TokenStore(\n private val dir: Dir,\n private val logger: Kermit,\n) {\n private val db: TokenDBQueries?\n get() = dir.db?.tokenDBQueries\n\n private fun save(token: TokenData) {\n if (!token.access_token.isNullOrBlank() && token.expiry != null)\n db?.add(token.access_token!!, token.expiry!! + Clock.System.now().epochSeconds)\n }\n\n suspend fun getToken(): TokenData? {\n var token: TokenData? = db?.select()?.executeAsOneOrNull()?.let {\n TokenData(it.accessToken, null, it.expiry)\n }\n logger.d { \"System Time:${Clock.System.now().epochSeconds} , Token Expiry:${token?.expiry}\" }\n if (Clock.System.now().epochSeconds > token?.expiry ?: 0 || token == null) {\n logger.d { \"Requesting New Token\" }\n token = authenticateSpotify()\n GlobalScope.launch { token?.access_token?.let { save(token) } }\n }\n return token\n }\n}\n",null,"/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.database.createDatabase\nimport com.shabinder.common.database.getLogger\nimport com.shabinder.common.di.providers.GaanaProvider\nimport com.shabinder.common.di.providers.SpotifyProvider\nimport com.shabinder.common.di.providers.YoutubeMp3\nimport com.shabinder.common.di.providers.YoutubeMusic\nimport io.ktor.client.HttpClient\nimport io.ktor.client.features.json.JsonFeature\nimport io.ktor.client.features.json.serializer.KotlinxSerializer\nimport io.ktor.client.features.logging.DEFAULT\nimport io.ktor.client.features.logging.LogLevel\nimport io.ktor.client.features.logging.Logger\nimport io.ktor.client.features.logging.Logging\nimport kotlinx.serialization.json.Json\nimport org.koin.core.context.startKoin\nimport org.koin.dsl.KoinAppDeclaration\nimport org.koin.dsl.module\n\nfun initKoin(enableNetworkLogs: Boolean = false, appDeclaration: KoinAppDeclaration = {}) =\n startKoin {\n appDeclaration()\n modules(commonModule(enableNetworkLogs = enableNetworkLogs))\n }\n\nfun commonModule(enableNetworkLogs: Boolean) = module {\n single { createHttpClient(enableNetworkLogs = enableNetworkLogs) }\n single { Dir(get(), createDatabase()) }\n single { Kermit(getLogger()) }\n single { TokenStore(get(), get()) }\n single { YoutubeMusic(get(), get()) }\n single { SpotifyProvider(get(), get(), get()) }\n single { GaanaProvider(get(), get(), get()) }\n single { YoutubeProvider(get(), get(), get()) }\n single { YoutubeMp3(get(), get(), get()) }\n single { FetchPlatformQueryResult(get(), get(), get(), get(), get(), get()) }\n}\n\nval kotlinxSerializer = KotlinxSerializer(\n Json {\n isLenient = true\n ignoreUnknownKeys = true\n }\n)\n\nfun createHttpClient(enableNetworkLogs: Boolean = false, serializer: KotlinxSerializer = kotlinxSerializer) = HttpClient {\n install(JsonFeature) {\n this.serializer = serializer\n }\n if (enableNetworkLogs) {\n install(Logging) {\n logger = Logger.DEFAULT\n level = LogLevel.INFO\n }\n }\n}\nval ktorHttpClient = HttpClient {}\n",null,"/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.database.createDatabase\nimport com.shabinder.common.di.utils.removeIllegalChars\nimport com.shabinder.common.models.DownloadResult\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.database.Database\nimport io.ktor.client.request.get\nimport io.ktor.client.statement.HttpStatement\nimport io.ktor.http.contentLength\nimport io.ktor.http.isSuccess\nimport kotlinx.coroutines.flow.Flow\nimport kotlinx.coroutines.flow.flow\nimport kotlin.math.roundToInt\n\nexpect class Dir(\n logger: Kermit,\n database: Database? = createDatabase()\n) {\n val db: Database?\n fun isPresent(path: String): Boolean\n fun fileSeparator(): String\n fun defaultDir(): String\n fun imageCacheDir(): String\n fun createDirectory(dirPath: String)\n suspend fun cacheImage(image: Any, path: String) // in Android = ImageBitmap, Desktop = BufferedImage\n suspend fun loadImage(url: String): Picture\n suspend fun clearCache()\n suspend fun saveFileWithMetadata(mp3ByteArray: ByteArray, trackDetails: TrackDetails)\n fun addToLibrary(path: String)\n}\n\nsuspend fun downloadFile(url: String): Flow {\n return flow {\n val client = createHttpClient()\n val response = client.get(url).execute()\n val data = ByteArray(response.contentLength()!!.toInt())\n var offset = 0\n do {\n val currentRead = response.content.readAvailable(data, offset, data.size)\n offset += currentRead\n val progress = (offset * 100f / data.size).roundToInt()\n emit(DownloadResult.Progress(progress))\n } while (currentRead > 0)\n if (response.status.isSuccess()) {\n emit(DownloadResult.Success(data))\n } else {\n emit(DownloadResult.Error(\"File not downloaded\"))\n }\n client.close()\n }\n}\nfun getNameURL(url: String): String {\n return url.substring(url.lastIndexOf('/', url.lastIndexOf('/') - 1) + 1, url.length).replace('/', '_')\n}\n/*\n* Call this function at startup!\n* */\nfun Dir.createDirectories() {\n createDirectory(defaultDir())\n createDirectory(imageCacheDir())\n createDirectory(defaultDir() + \"Tracks/\")\n createDirectory(defaultDir() + \"Albums/\")\n createDirectory(defaultDir() + \"Playlists/\")\n createDirectory(defaultDir() + \"YT_Downloads/\")\n}\nfun Dir.finalOutputDir(itemName: String, type: String, subFolder: String, defaultDir: String, extension: String = \".mp3\"): String =\n defaultDir + removeIllegalChars(type) + this.fileSeparator() +\n if (subFolder.isEmpty())\"\" else { removeIllegalChars(subFolder) + this.fileSeparator() } +\n removeIllegalChars(itemName) + extension\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di\n\nimport com.shabinder.common.database.DownloadRecordDatabaseQueries\nimport com.shabinder.common.di.providers.GaanaProvider\nimport com.shabinder.common.di.providers.SpotifyProvider\nimport com.shabinder.common.di.providers.YoutubeMp3\nimport com.shabinder.common.di.providers.YoutubeMusic\nimport com.shabinder.common.models.PlatformQueryResult\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.withContext\n\nclass FetchPlatformQueryResult(\n private val gaanaProvider: GaanaProvider,\n private val spotifyProvider: SpotifyProvider,\n val youtubeProvider: YoutubeProvider,\n val youtubeMusic: YoutubeMusic,\n val youtubeMp3: YoutubeMp3,\n private val dir: Dir\n) {\n private val db: DownloadRecordDatabaseQueries?\n get() = dir.db?.downloadRecordDatabaseQueries\n\n suspend fun query(link: String): PlatformQueryResult? {\n val result = when {\n // SPOTIFY\n link.contains(\"spotify\", true) ->\n spotifyProvider.query(link)\n\n // YOUTUBE\n link.contains(\"youtube.com\", true) || link.contains(\"youtu.be\", true) ->\n youtubeProvider.query(link)\n\n // GAANA\n link.contains(\"gaana\", true) ->\n gaanaProvider.query(link)\n\n else -> {\n null\n }\n }\n result?.run {\n withContext(Dispatchers.Default) {\n db?.add(\n folderType, title, link, coverUrl, trackList.size.toLong()\n )\n }\n }\n return result\n }\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di.gaana\n\nimport com.shabinder.common.di.currentPlatform\nimport com.shabinder.common.models.AllPlatforms\nimport com.shabinder.common.models.corsProxy\nimport com.shabinder.common.models.gaana.GaanaAlbum\nimport com.shabinder.common.models.gaana.GaanaArtistDetails\nimport com.shabinder.common.models.gaana.GaanaArtistTracks\nimport com.shabinder.common.models.gaana.GaanaPlaylist\nimport com.shabinder.common.models.gaana.GaanaSong\nimport io.ktor.client.HttpClient\nimport io.ktor.client.request.get\n\nval corsApi get() = if (currentPlatform is AllPlatforms.Js) {\n corsProxy.url\n} // \"https://spotiflyer-cors.azurewebsites.net/\" //\"https://spotiflyer-cors.herokuapp.com/\"//\"https://cors.bridged.cc/\"\nelse \"\"\n\nprivate const val TOKEN = \"b2e6d7fbc136547a940516e9b77e5990\"\nprivate val BASE_URL get() = \"${corsApi}https://api.gaana.com\"\n\ninterface GaanaRequests {\n\n val httpClient: HttpClient\n\n /*\n * Api Request: http://api.gaana.com/?type=playlist&subtype=playlist_detail&seokey=gaana-dj-hindi-top-50-1&token=b2e6d7fbc136547a940516e9b77e5990&format=JSON\n *\n * subtype : [\"most_popular_playlist\" , \"playlist_home_featured\" ,\"playlist_detail\" ,\"user_playlist\" ,\"topCharts\"]\n **/\n suspend fun getGaanaPlaylist(\n type: String = \"playlist\",\n subtype: String = \"playlist_detail\",\n seokey: String,\n format: String = \"JSON\",\n limit: Int = 2000\n ): GaanaPlaylist {\n return httpClient.get(\n \"$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format&limit=$limit\"\n )\n }\n\n /*\n * Api Request: http://api.gaana.com/?type=album&subtype=album_detail&seokey=kabir-singh&token=b2e6d7fbc136547a940516e9b77e5990&format=JSON\n *\n * subtype : [\"most_popular\" , \"new_release\" ,\"featured_album\" ,\"similar_album\" ,\"all_albums\", \"album\" ,\"album_detail\" ,\"album_detail_info\"]\n **/\n suspend fun getGaanaAlbum(\n type: String = \"album\",\n subtype: String = \"album_detail\",\n seokey: String,\n format: String = \"JSON\",\n limit: Int = 2000\n ): GaanaAlbum {\n return httpClient.get(\n \"$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format&limit=$limit\"\n )\n }\n\n /*\n * Api Request: http://api.gaana.com/?type=song&subtype=song_detail&seokey=pachtaoge&token=b2e6d7fbc136547a940516e9b77e5990&format=JSON\n *\n * subtype : [\"most_popular\" , \"hot_songs\" ,\"recommendation\" ,\"song_detail\"]\n **/\n suspend fun getGaanaSong(\n type: String = \"song\",\n subtype: String = \"song_detail\",\n seokey: String,\n format: String = \"JSON\",\n ): GaanaSong {\n return httpClient.get(\n \"$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format\"\n )\n }\n\n /*\n * Api Request: https://api.gaana.com/?type=artist&subtype=artist_details_info&seokey=neha-kakkar&token=b2e6d7fbc136547a940516e9b77e5990&format=JSON\n *\n * subtype : [\"most_popular\" , \"artist_list\" ,\"artist_track_listing\" ,\"artist_album\" ,\"similar_artist\",\"artist_details\" ,\"artist_details_info\"]\n **/\n suspend fun getGaanaArtistDetails(\n type: String = \"artist\",\n subtype: String = \"artist_details_info\",\n seokey: String,\n format: String = \"JSON\",\n ): GaanaArtistDetails {\n return httpClient.get(\n \"$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format\"\n )\n }\n\n /*\n * Api Request: http://api.gaana.com/?type=artist&subtype=artist_track_listing&seokey=neha-kakkar&limit=50&token=b2e6d7fbc136547a940516e9b77e5990&format=JSON\n *\n * subtype : [\"most_popular\" , \"artist_list\" ,\"artist_track_listing\" ,\"artist_album\" ,\"similar_artist\",\"artist_details\" ,\"artist_details_info\"]\n **/\n suspend fun getGaanaArtistTracks(\n type: String = \"artist\",\n subtype: String = \"artist_track_listing\",\n seokey: String,\n format: String = \"JSON\",\n limit: Int = 50\n ): GaanaArtistTracks {\n return httpClient.get(\n \"$BASE_URL/?type=$type&subtype=$subtype&seokey=$seokey&token=$TOKEN&format=$format&limit=$limit\"\n )\n }\n}\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di.providers\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.di.Dir\nimport com.shabinder.common.di.finalOutputDir\nimport com.shabinder.common.di.gaana.GaanaRequests\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.PlatformQueryResult\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.gaana.GaanaTrack\nimport com.shabinder.common.models.spotify.Source\nimport io.ktor.client.HttpClient\n\nclass GaanaProvider(\n override val httpClient: HttpClient,\n private val logger: Kermit,\n private val dir: Dir,\n) : GaanaRequests {\n\n private val gaanaPlaceholderImageUrl = \"https://a10.gaanacdn.com/images/social/gaana_social.jpg\"\n\n suspend fun query(fullLink: String): PlatformQueryResult? {\n // Link Schema: https://gaana.com/type/link\n val gaanaLink = fullLink.substringAfter(\"gaana.com/\")\n\n val link = gaanaLink.substringAfterLast('/', \"error\")\n val type = gaanaLink.substringBeforeLast('/', \"error\").substringAfterLast('/')\n\n // Error\n if (type == \"Error\" || link == \"Error\") {\n return null\n }\n return gaanaSearch(\n type,\n link\n )\n }\n\n private suspend fun gaanaSearch(\n type: String,\n link: String,\n ): PlatformQueryResult {\n val result = PlatformQueryResult(\n folderType = \"\",\n subFolder = link,\n title = link,\n coverUrl = gaanaPlaceholderImageUrl,\n trackList = listOf(),\n Source.Gaana\n )\n logger.i { \"GAANA SEARCH: $type - $link\" }\n with(result) {\n when (type) {\n \"song\" -> {\n getGaanaSong(seokey = link).tracks.firstOrNull()?.also {\n folderType = \"Tracks\"\n subFolder = \"\"\n it.updateStatusIfPresent(folderType, subFolder)\n trackList = listOf(it).toTrackDetailsList(folderType, subFolder)\n title = it.track_title\n coverUrl = it.artworkLink\n }\n }\n \"album\" -> {\n getGaanaAlbum(seokey = link).also {\n folderType = \"Albums\"\n subFolder = link\n it.tracks.forEach { track ->\n track.updateStatusIfPresent(folderType, subFolder)\n }\n trackList = it.tracks.toTrackDetailsList(folderType, subFolder)\n title = link\n coverUrl = it.custom_artworks.size_480p\n }\n }\n \"playlist\" -> {\n getGaanaPlaylist(seokey = link).also {\n folderType = \"Playlists\"\n subFolder = link\n it.tracks.forEach { track ->\n track.updateStatusIfPresent(folderType, subFolder)\n }\n trackList = it.tracks.toTrackDetailsList(folderType, subFolder)\n title = link\n // coverUrl.value = \"TODO\"\n coverUrl = gaanaPlaceholderImageUrl\n }\n }\n \"artist\" -> {\n folderType = \"Artist\"\n subFolder = link\n coverUrl = gaanaPlaceholderImageUrl\n getGaanaArtistDetails(seokey = link).artist.firstOrNull()\n ?.also {\n title = it.name\n coverUrl = it.artworkLink ?: gaanaPlaceholderImageUrl\n }\n getGaanaArtistTracks(seokey = link).also {\n it.tracks?.forEach { track ->\n track.updateStatusIfPresent(folderType, subFolder)\n }\n trackList = it.tracks?.toTrackDetailsList(folderType, subFolder) ?: emptyList()\n }\n }\n else -> {\n // TODO Handle Error\n }\n }\n return result\n }\n }\n\n private fun List.toTrackDetailsList(type: String, subFolder: String) = this.map {\n TrackDetails(\n title = it.track_title,\n artists = it.artist.map { artist -> artist?.name.toString() },\n durationSec = it.duration,\n albumArtPath = dir.imageCacheDir() + (it.artworkLink.substringBeforeLast('/').substringAfterLast('/')) + \".jpeg\",\n albumName = it.album_title,\n year = it.release_date,\n comment = \"Genres:${it.genre?.map { genre -> genre?.name }?.reduceOrNull { acc, s -> acc + s }}\",\n trackUrl = it.lyrics_url,\n downloaded = it.downloaded ?: DownloadStatus.NotDownloaded,\n source = Source.Gaana,\n albumArtURL = it.artworkLink,\n outputFilePath = dir.finalOutputDir(it.track_title, type, subFolder, dir.defaultDir()/*,\".m4a\"*/)\n )\n }\n private fun GaanaTrack.updateStatusIfPresent(folderType: String, subFolder: String) {\n if (dir.isPresent(\n dir.finalOutputDir(\n track_title,\n folderType,\n subFolder,\n dir.defaultDir()\n )\n )\n ) { // Download Already Present!!\n downloaded = DownloadStatus.Downloaded\n }\n }\n}\n","/*\n * Copyright (c) 2021 Shabinder Singh\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di.providers\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.di.Dir\nimport com.shabinder.common.di.TokenStore\nimport com.shabinder.common.di.currentPlatform\nimport com.shabinder.common.di.finalOutputDir\nimport com.shabinder.common.di.kotlinxSerializer\nimport com.shabinder.common.di.spotify.SpotifyRequests\nimport com.shabinder.common.di.spotify.authenticateSpotify\nimport com.shabinder.common.models.AllPlatforms\nimport com.shabinder.common.models.PlatformQueryResult\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.spotify.Album\nimport com.shabinder.common.models.spotify.Image\nimport com.shabinder.common.models.spotify.Source\nimport com.shabinder.common.models.spotify.Track\nimport io.ktor.client.HttpClient\nimport io.ktor.client.features.defaultRequest\nimport io.ktor.client.features.json.JsonFeature\nimport io.ktor.client.request.header\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.GlobalScope\nimport kotlinx.coroutines.launch\n\nclass SpotifyProvider(\n private val tokenStore: TokenStore,\n private val logger: Kermit,\n private val dir: Dir,\n) : SpotifyRequests {\n\n init {\n logger.d { \"Creating Spotify Provider\" }\n GlobalScope.launch(Dispatchers.Default) {\n if (currentPlatform is AllPlatforms.Js) {\n authenticateSpotifyClient(override = true)\n } else authenticateSpotifyClient()\n }\n }\n\n override suspend fun authenticateSpotifyClient(override: Boolean): HttpClient? {\n val token = if (override) authenticateSpotify() else tokenStore.getToken()\n return if (token == null) {\n logger.d { \"Please Check your Network Connection\" }\n null\n } else {\n logger.d { \"Spotify Provider Created with $token\" }\n httpClient = HttpClient {\n defaultRequest {\n header(\"Authorization\", \"Bearer ${token.access_token}\")\n }\n install(JsonFeature) {\n serializer = kotlinxSerializer\n }\n }\n httpClient\n }\n }\n\n override lateinit var httpClient: HttpClient\n\n suspend fun query(fullLink: String): PlatformQueryResult? {\n\n if (!this::httpClient.isInitialized) {\n authenticateSpotifyClient()\n }\n\n var spotifyLink =\n \"https://\" + fullLink.substringAfterLast(\"https://\").substringBefore(\" \").trim()\n\n if (!spotifyLink.contains(\"open.spotify\")) {\n // Very Rare instance\n spotifyLink = resolveLink(spotifyLink)\n }\n\n val link = spotifyLink.substringAfterLast('/', \"Error\").substringBefore('?')\n val type = spotifyLink.substringBeforeLast('/', \"Error\").substringAfterLast('/')\n\n if (type == \"Error\" || link == \"Error\") {\n return null\n }\n\n if (type == \"episode\" || type == \"show\") {\n // TODO Implementation\n return null\n }\n\n return spotifySearch(\n type,\n link\n )\n }\n\n private suspend fun spotifySearch(\n type: String,\n link: String\n ): PlatformQueryResult {\n val result = PlatformQueryResult(\n folderType = \"\",\n subFolder = \"\",\n title = \"\",\n coverUrl = \"\",\n trackList = listOf(),\n Source.Spotify\n )\n with(result) {\n when (type) {\n \"track\" -> {\n getTrack(link).also {\n folderType = \"Tracks\"\n subFolder = \"\"\n it.updateStatusIfPresent(folderType, subFolder)\n trackList = listOf(it).toTrackDetailsList(folderType, subFolder)\n title = it.name.toString()\n coverUrl = (\n it.album?.images?.elementAtOrNull(1)?.url\n ?: it.album?.images?.elementAtOrNull(0)?.url\n ).toString()\n }\n }\n\n \"album\" -> {\n val albumObject = getAlbum(link)\n folderType = \"Albums\"\n subFolder = albumObject.name.toString()\n albumObject.tracks?.items?.forEach {\n it.updateStatusIfPresent(folderType, subFolder)\n it.album = Album(\n images = listOf(\n Image(\n url = albumObject.images?.elementAtOrNull(1)?.url\n ?: albumObject.images?.elementAtOrNull(0)?.url\n )\n )\n )\n }\n albumObject.tracks?.items?.toTrackDetailsList(folderType, subFolder).let {\n if (it.isNullOrEmpty()) {\n // TODO Handle Error\n } else {\n trackList = it\n title = albumObject.name.toString()\n coverUrl = (\n albumObject.images?.elementAtOrNull(1)?.url\n ?: albumObject.images?.elementAtOrNull(0)?.url\n ).toString()\n }\n }\n }\n\n \"playlist\" -> {\n val playlistObject = getPlaylist(link)\n folderType = \"Playlists\"\n subFolder = playlistObject.name.toString()\n val tempTrackList = mutableListOf()\n // log(\"Tracks Fetched\", playlistObject.tracks?.items?.size.toString())\n playlistObject.tracks?.items?.forEach {\n it.track?.let { it1 ->\n it1.updateStatusIfPresent(folderType, subFolder)\n tempTrackList.add(it1)\n }\n }\n var moreTracksAvailable = !playlistObject.tracks?.next.isNullOrBlank()\n\n while (moreTracksAvailable) {\n // Check For More Tracks If available\n val moreTracks =\n getPlaylistTracks(link, offset = tempTrackList.size)\n moreTracks.items?.forEach {\n it.track?.let { it1 -> tempTrackList.add(it1) }\n }\n moreTracksAvailable = !moreTracks.next.isNullOrBlank()\n }\n // log(\"Total Tracks Fetched\", tempTrackList.size.toString())\n trackList = tempTrackList.toTrackDetailsList(folderType, subFolder)\n title = playlistObject.name.toString()\n coverUrl = playlistObject.images?.elementAtOrNull(1)?.url\n ?: playlistObject.images?.firstOrNull()?.url.toString()\n }\n \"episode\" -> { // TODO\n }\n \"show\" -> { // TODO\n }\n else -> {\n // TODO Handle Error\n }\n }\n }\n return result\n }\n\n /*\n * New Link Schema: https://link.tospotify.com/kqTBblrjQbb,\n * Fetching Standard Link: https://open.spotify.com/playlist/37i9dQZF1DX9RwfGbeGQwP?si=iWz7B1tETiunDntnDo3lSQ&_branch_match_id=862039436205270630\n * */\n private suspend fun resolveLink(\n url: String\n ): String {\n val response = getResponse(url)\n val regex = \"\"\"https://open\\.spotify\\.com.+\\w\"\"\".toRegex()\n return regex.find(response)?.value.toString()\n }\n\n private fun List.toTrackDetailsList(type: String, subFolder: String) = this.map {\n TrackDetails(\n title = it.name.toString(),\n artists = it.artists?.map { artist -> artist?.name.toString() } ?: listOf(),\n durationSec = (it.duration_ms / 1000).toInt(),\n albumArtPath = dir.imageCacheDir() + (it.album?.images?.elementAtOrNull(1)?.url ?: it.album?.images?.firstOrNull()?.url.toString()).substringAfterLast('/') + \".jpeg\",\n albumName = it.album?.name,\n year = it.album?.release_date,\n comment = \"Genres:${it.album?.genres?.joinToString()}\",\n trackUrl = it.href,\n downloaded = it.downloaded,\n source = Source.Spotify,\n albumArtURL = it.album?.images?.elementAtOrNull(1)?.url ?: it.album?.images?.firstOrNull()?.url.toString(),\n outputFilePath = dir.finalOutputDir(it.name.toString(), type, subFolder, dir.defaultDir()/*,\".m4a\"*/)\n )\n }\n private fun Track.updateStatusIfPresent(folderType: String, subFolder: String) {\n if (dir.isPresent(\n dir.finalOutputDir(\n name.toString(),\n folderType,\n subFolder,\n dir.defaultDir()\n )\n )\n ) { // Download Already Present!!\n downloaded = com.shabinder.common.models.DownloadStatus.Downloaded\n }\n }\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di.providers\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.di.Dir\nimport com.shabinder.common.di.currentPlatform\nimport com.shabinder.common.di.youtubeMp3.Yt1sMp3\nimport com.shabinder.common.models.AllPlatforms\nimport io.ktor.client.HttpClient\n\nclass YoutubeMp3(\n override val httpClient: HttpClient,\n private val logger: Kermit,\n private val dir: Dir,\n) : Yt1sMp3 {\n suspend fun getMp3DownloadLink(videoID: String): String? = getLinkFromYt1sMp3(videoID)?.let {\n if (currentPlatform is AllPlatforms.Js/* && corsProxy !is CorsProxy.PublicProxyWithExtension*/)\n \"https://spotiflyer.azurewebsites.net/$it\"\n else it\n }\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di.providers\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.di.gaana.corsApi\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.common.models.YoutubeTrack\nimport com.willowtreeapps.fuzzywuzzy.diffutils.FuzzySearch\nimport io.ktor.client.HttpClient\nimport io.ktor.client.request.headers\nimport io.ktor.client.request.post\nimport io.ktor.http.ContentType\nimport io.ktor.http.contentType\nimport kotlinx.serialization.json.Json\nimport kotlinx.serialization.json.JsonArray\nimport kotlinx.serialization.json.buildJsonArray\nimport kotlinx.serialization.json.buildJsonObject\nimport kotlinx.serialization.json.contentOrNull\nimport kotlinx.serialization.json.jsonArray\nimport kotlinx.serialization.json.jsonObject\nimport kotlinx.serialization.json.jsonPrimitive\nimport kotlinx.serialization.json.put\nimport kotlinx.serialization.json.putJsonObject\nimport kotlin.math.absoluteValue\n\nprivate const val apiKey = \"AIzaSyC9XL3ZjWddXya6X74dJoCTL-WEYFDNX30\"\n\nclass YoutubeMusic constructor(\n private val logger: Kermit,\n private val httpClient: HttpClient,\n) {\n private val tag = \"YT Music\"\n\n suspend fun getYTIDBestMatch(query: String, trackDetails: TrackDetails): String? {\n return sortByBestMatch(\n getYTTracks(query),\n trackName = trackDetails.title,\n trackArtists = trackDetails.artists,\n trackDurationSec = trackDetails.durationSec\n ).keys.firstOrNull()\n }\n private suspend fun getYTTracks(query: String): List {\n val youtubeTracks = mutableListOf()\n\n val responseObj = Json.parseToJsonElement(getYoutubeMusicResponse(query))\n\n val contentBlocks = responseObj.jsonObject[\"contents\"]\n ?.jsonObject?.get(\"sectionListRenderer\")\n ?.jsonObject?.get(\"contents\")?.jsonArray\n\n val resultBlocks = mutableListOf()\n if (contentBlocks != null) {\n for (cBlock in contentBlocks) {\n /**\n *Ignore user-suggestion\n *The 'itemSectionRenderer' field is for user notices (stuff like - 'showing\n *results for xyz, search for abc instead') we have no use for them, the for\n *loop below if throw a keyError if we don't ignore them\n */\n if (cBlock.jsonObject.containsKey(\"itemSectionRenderer\")) {\n continue\n }\n\n for (\n contents in cBlock.jsonObject[\"musicShelfRenderer\"]?.jsonObject?.get(\"contents\")?.jsonArray\n ?: listOf()\n ) {\n /**\n * apparently content Blocks without an 'overlay' field don't have linkBlocks\n * I have no clue what they are and why there even exist\n *\n if(!contents.containsKey(\"overlay\")){\n println(contents)\n continue\n TODO check and correct\n }*/\n\n val result = contents.jsonObject[\"musicResponsiveListItemRenderer\"]\n ?.jsonObject?.get(\"flexColumns\")?.jsonArray\n\n // Add the linkBlock\n val linkBlock = contents.jsonObject[\"musicResponsiveListItemRenderer\"]\n ?.jsonObject?.get(\"overlay\")\n ?.jsonObject?.get(\"musicItemThumbnailOverlayRenderer\")\n ?.jsonObject?.get(\"content\")\n ?.jsonObject?.get(\"musicPlayButtonRenderer\")\n ?.jsonObject?.get(\"playNavigationEndpoint\")\n\n // detailsBlock is always a list, so we just append the linkBlock to it\n // instead of carrying along all the other junk from \"musicResponsiveListItemRenderer\"\n val finalResult = buildJsonArray {\n result?.let { add(it) }\n linkBlock?.let { add(it) }\n }\n resultBlocks.add(finalResult)\n }\n }\n\n /* We only need results that are Songs or Videos, so we filter out the rest, since\n ! Songs and Videos are supplied with different details, extracting all details from\n ! both is just carrying on redundant data, so we also have to selectively extract\n ! relevant details. What you need to know to understand how we do that here:\n !\n ! Songs details are ALWAYS in the following order:\n ! 0 - Name\n ! 1 - Type (Song)\n ! 2 - com.shabinder.spotiflyer.models.gaana.Artist\n ! 3 - Album\n ! 4 - Duration (mm:ss)\n !\n ! Video details are ALWAYS in the following order:\n ! 0 - Name\n ! 1 - Type (Video)\n ! 2 - Channel\n ! 3 - Viewers\n ! 4 - Duration (hh:mm:ss)\n !\n ! We blindly gather all the details we get our hands on, then\n ! cherry pick the details we need based on their index numbers,\n ! we do so only if their Type is 'Song' or 'Video\n */\n\n for (result in resultBlocks) {\n\n // Blindly gather available details\n val availableDetails = mutableListOf()\n\n /*\n Filter Out dummies here itself\n ! 'musicResponsiveListItemFlexColumnRenderer' should have more that one\n ! sub-block, if not its a dummy, why does the YTM response contain dummies?\n ! I have no clue. We skip these.\n\n ! Remember that we appended the linkBlock to result, treating that like the\n ! other constituents of a result block will lead to errors, hence the 'in\n ! result[:-1] ,i.e., skip last element in array '\n */\n for (detailArray in result.subList(0, result.size - 1)) {\n for (detail in detailArray.jsonArray) {\n if (detail.jsonObject[\"musicResponsiveListItemFlexColumnRenderer\"]?.jsonObject?.size ?: 0 < 2) continue\n\n // if not a dummy, collect All Variables\n val details = detail.jsonObject[\"musicResponsiveListItemFlexColumnRenderer\"]\n ?.jsonObject?.get(\"text\")\n ?.jsonObject?.get(\"runs\")?.jsonArray ?: listOf()\n\n for (d in details) {\n d.jsonObject[\"text\"]?.jsonPrimitive?.contentOrNull?.let {\n if (it != \" • \") {\n availableDetails.add(it)\n }\n }\n }\n }\n }\n // logger.d(\"YT Music details\"){availableDetails.toString()}\n /*\n ! Filter Out non-Song/Video results and incomplete results here itself\n ! From what we know about detail order, note that [1] - indicate result type\n */\n if (availableDetails.size == 5 && availableDetails[1] in listOf(\"Song\", \"Video\")) {\n\n // skip if result is in hours instead of minutes (no song is that long)\n if (availableDetails[4].split(':').size != 2) continue\n\n /*\n ! grab Video ID\n ! this is nested as [playlistEndpoint/watchEndpoint][videoId/playlistId/...]\n ! so hardcoding the dict keys for data look up is an ardours process, since\n ! the sub-block pattern is fixed even though the key isn't, we just\n ! reference the dict keys by index\n */\n\n val videoId: String? = result.last().jsonObject[\"watchEndpoint\"]?.jsonObject?.get(\"videoId\")?.jsonPrimitive?.content\n val ytTrack = YoutubeTrack(\n name = availableDetails[0],\n type = availableDetails[1],\n artist = availableDetails[2],\n duration = availableDetails[4],\n videoId = videoId\n )\n youtubeTracks.add(ytTrack)\n }\n }\n }\n // logger.d {youtubeTracks.joinToString(\"\\n\")}\n return youtubeTracks\n }\n\n private fun sortByBestMatch(\n ytTracks: List,\n trackName: String,\n trackArtists: List,\n trackDurationSec: Int,\n ): Map {\n /*\n * \"linksWithMatchValue\" is map with Youtube VideoID and its rating/match with 100 as Max Value\n **/\n val linksWithMatchValue = mutableMapOf()\n\n for (result in ytTracks) {\n\n // LoweCasing Name to match Properly\n // most song results on youtube go by $artist - $songName or artist1/artist2\n var hasCommonWord = false\n\n val resultName = result.name?.toLowerCase()?.replace(\"-\", \" \")?.replace(\"/\", \" \") ?: \"\"\n val trackNameWords = trackName.toLowerCase().split(\" \")\n\n for (nameWord in trackNameWords) {\n if (nameWord.isNotBlank() && FuzzySearch.partialRatio(nameWord, resultName) > 85) hasCommonWord = true\n }\n\n // Skip this Result if No Word is Common in Name\n if (!hasCommonWord) {\n // log(\"YT Api Removing\", result.toString())\n continue\n }\n\n // Find artist match\n // Will Be Using Fuzzy Search Because YT Spelling might be mucked up\n // match = (no of artist names in result) / (no. of artist names on spotify) * 100\n var artistMatchNumber = 0\n\n if (result.type == \"Song\") {\n for (artist in trackArtists) {\n if (FuzzySearch.ratio(artist.toLowerCase(), result.artist?.toLowerCase() ?: \"\") > 85)\n artistMatchNumber++\n }\n } else { // i.e. is a Video\n for (artist in trackArtists) {\n if (FuzzySearch.partialRatio(artist.toLowerCase(), result.name?.toLowerCase() ?: \"\") > 85)\n artistMatchNumber++\n }\n }\n\n if (artistMatchNumber == 0) {\n // logger.d{ \"YT Api Removing: $result\" }\n continue\n }\n\n val artistMatch = (artistMatchNumber / trackArtists.size) * 100\n\n // Duration Match\n /*! time match = 100 - (delta(duration)**2 / original duration * 100)\n ! difference in song duration (delta) is usually of the magnitude of a few\n ! seconds, we need to amplify the delta if it is to have any meaningful impact\n ! wen we calculate the avg match value*/\n val difference = result.duration?.split(\":\")?.get(0)?.toInt()?.times(60)\n ?.plus(result.duration?.split(\":\")?.get(1)?.toInt() ?: 0)\n ?.minus(trackDurationSec)?.absoluteValue ?: 0\n val nonMatchValue: Float = ((difference * difference).toFloat() / trackDurationSec.toFloat())\n val durationMatch = 100 - (nonMatchValue * 100)\n\n val avgMatch = (artistMatch + durationMatch) / 2\n linksWithMatchValue[result.videoId.toString()] = avgMatch.toInt()\n }\n // logger.d(\"YT Api Result\"){\"$trackName - $linksWithMatchValue\"}\n return linksWithMatchValue.toList().sortedByDescending { it.second }.toMap().also {\n logger.d(tag) { \"Match Found for $trackName - ${!it.isNullOrEmpty()}\" }\n }\n }\n\n private suspend fun getYoutubeMusicResponse(query: String): String {\n return httpClient.post(\"${corsApi}https://music.youtube.com/youtubei/v1/search?alt=json&key=$apiKey\") {\n contentType(ContentType.Application.Json)\n headers {\n append(\"referer\", \"https://music.youtube.com/search\")\n }\n body = buildJsonObject {\n putJsonObject(\"context\") {\n putJsonObject(\"client\") {\n put(\"clientName\", \"WEB_REMIX\")\n put(\"clientVersion\", \"0.1\")\n }\n }\n put(\"query\", query)\n }\n }\n }\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di.spotify\n\nimport com.shabinder.common.di.isInternetAvailable\nimport com.shabinder.common.di.kotlinxSerializer\nimport com.shabinder.common.models.spotify.TokenData\nimport io.ktor.client.HttpClient\nimport io.ktor.client.features.auth.Auth\nimport io.ktor.client.features.auth.providers.basic\nimport io.ktor.client.features.json.JsonFeature\nimport io.ktor.client.request.forms.FormDataContent\nimport io.ktor.client.request.post\nimport io.ktor.http.Parameters\n\nsuspend fun authenticateSpotify(): TokenData? {\n return if (isInternetAvailable) spotifyAuthClient.post(\"https://accounts.spotify.com/api/token\") {\n body = FormDataContent(Parameters.build { append(\"grant_type\", \"client_credentials\") })\n } else null\n}\n\nprivate val spotifyAuthClient by lazy {\n HttpClient {\n val clientId = \"694d8bf4f6ec420fa66ea7fb4c68f89d\"\n val clientSecret = \"02ca2d4021a7452dae2328b47a6e8fe8\"\n\n install(Auth) {\n basic {\n sendWithoutRequest = true\n username = clientId\n password = clientSecret\n }\n }\n install(JsonFeature) {\n serializer = kotlinxSerializer\n }\n }\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di.spotify\n\nimport com.shabinder.common.di.gaana.corsApi\nimport com.shabinder.common.models.spotify.Album\nimport com.shabinder.common.models.spotify.PagingObjectPlaylistTrack\nimport com.shabinder.common.models.spotify.Playlist\nimport com.shabinder.common.models.spotify.Track\nimport io.ktor.client.HttpClient\nimport io.ktor.client.request.get\n\nprivate val BASE_URL get() = \"${corsApi}https://api.spotify.com/v1\"\n\ninterface SpotifyRequests {\n\n val httpClient: HttpClient\n\n suspend fun authenticateSpotifyClient(override: Boolean = false): HttpClient?\n\n suspend fun getPlaylist(playlistID: String): Playlist {\n return httpClient.get(\"$BASE_URL/playlists/$playlistID\")\n }\n\n suspend fun getPlaylistTracks(\n playlistID: String?,\n offset: Int = 0,\n limit: Int = 100\n ): PagingObjectPlaylistTrack {\n return httpClient.get(\"$BASE_URL/playlists/$playlistID/tracks?offset=$offset&limit=$limit\")\n }\n\n suspend fun getTrack(id: String?): Track {\n return httpClient.get(\"$BASE_URL/tracks/$id\")\n }\n\n suspend fun getEpisode(id: String?): Track {\n return httpClient.get(\"$BASE_URL/episodes/$id\")\n }\n\n suspend fun getShow(id: String?): Track {\n return httpClient.get(\"$BASE_URL/shows/$id\")\n }\n\n suspend fun getAlbum(id: String): Album {\n return httpClient.get(\"$BASE_URL/albums/$id\")\n }\n\n suspend fun getResponse(url: String): String {\n return httpClient.get(url)\n }\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di.utils\n\n/**\n * Removing Illegal Chars from File Name\n * **/\nfun removeIllegalChars(fileName: String): String {\n val illegalCharArray = charArrayOf(\n '/',\n '\\n',\n '\\r',\n '\\t',\n '\\u0000',\n '\\u000C',\n '`',\n '?',\n '*',\n '\\\\',\n '<',\n '>',\n '|',\n '\\\"',\n '.',\n '-',\n '\\''\n )\n\n var name = fileName\n for (c in illegalCharArray) {\n name = fileName.replace(c, '_')\n }\n name = name.replace(\"\\\\s\".toRegex(), \"_\")\n name = name.replace(\"\\\\)\".toRegex(), \"\")\n name = name.replace(\"\\\\(\".toRegex(), \"\")\n name = name.replace(\"\\\\[\".toRegex(), \"\")\n name = name.replace(\"]\".toRegex(), \"\")\n name = name.replace(\"\\\\.\".toRegex(), \"\")\n name = name.replace(\"\\\"\".toRegex(), \"\")\n name = name.replace(\"\\'\".toRegex(), \"\")\n name = name.replace(\":\".toRegex(), \"\")\n name = name.replace(\"\\\\|\".toRegex(), \"\")\n return name\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di.youtubeMp3\n\nimport com.shabinder.common.di.gaana.corsApi\nimport io.ktor.client.HttpClient\nimport io.ktor.client.request.forms.FormDataContent\nimport io.ktor.client.request.post\nimport io.ktor.http.Parameters\nimport kotlinx.serialization.json.JsonObject\nimport kotlinx.serialization.json.jsonPrimitive\n\n/*\n* site link: https://yt1s.com/youtube-to-mp3/en1\n* Provides Direct Mp3 , No Need For FFmpeg\n* */\ninterface Yt1sMp3 {\n\n val httpClient: HttpClient\n\n /*\n * Downloadable Mp3 Link for YT videoID.\n * */\n suspend fun getLinkFromYt1sMp3(videoID: String): String? =\n getConvertedMp3Link(videoID, getKey(videoID))?.get(\"dlink\")?.jsonPrimitive?.toString()?.replace(\"\\\"\", \"\")\n\n /*\n * POST:https://yt1s.com/api/ajaxSearch/index\n * Body Form= q:yt video link ,vt:format=mp3\n * */\n private suspend fun getKey(videoID: String): String {\n val response: JsonObject? = httpClient.post(\"${corsApi}https://yt1s.com/api/ajaxSearch/index\") {\n body = FormDataContent(\n Parameters.build {\n append(\"q\", \"https://www.youtube.com/watch?v=$videoID\")\n append(\"vt\", \"mp3\")\n }\n )\n }\n return response?.get(\"kc\")?.jsonPrimitive.toString()\n }\n\n private suspend fun getConvertedMp3Link(videoID: String, key: String): JsonObject? {\n return httpClient.post(\"${corsApi}https://yt1s.com/api/ajaxConvert/convert\") {\n body = FormDataContent(\n Parameters.build {\n append(\"vid\", videoID)\n append(\"k\", key)\n }\n )\n }\n }\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di\n\nimport com.shabinder.common.models.AllPlatforms\nimport com.shabinder.common.models.DownloadResult\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.TrackDetails\nimport io.ktor.client.request.head\nimport kotlinx.coroutines.CoroutineDispatcher\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.flow.MutableSharedFlow\nimport kotlinx.coroutines.flow.collect\nimport kotlinx.coroutines.withContext\n\nactual val currentPlatform: AllPlatforms = AllPlatforms.Js\n\nactual fun openPlatform(packageID: String, platformLink: String) {\n // TODO\n}\n\nactual fun shareApp() {\n // TODO\n}\n\nactual fun giveDonation() {\n // TODO\n}\n\nactual fun queryActiveTracks() {}\n\nactual val dispatcherIO: CoroutineDispatcher = Dispatchers.Default\n\n/*\n* Refactor This\n* */\nprivate suspend fun isInternetAvailable(): Boolean {\n return withContext(dispatcherIO) {\n try {\n ktorHttpClient.head(\"http://google.com\")\n true\n } catch (e: Exception) {\n println(e.message)\n false\n }\n }\n}\n\nactual val isInternetAvailable: Boolean\n get() {\n return true\n /*var result = false\n val job = GlobalScope.launch { result = isInternetAvailable() }\n while(job.isActive){}\n return result*/\n }\n\nval DownloadProgressFlow: MutableSharedFlow> = MutableSharedFlow(1)\n// Error:https://github.com/Kotlin/kotlinx.atomicfu/issues/182\n// val DownloadScope = ParallelExecutor(Dispatchers.Default) //Download Pool of 4 parallel\nval allTracksStatus: HashMap = hashMapOf()\n\nactual suspend fun downloadTracks(\n list: List,\n fetcher: FetchPlatformQueryResult,\n dir: Dir\n) {\n list.forEach {\n withContext(dispatcherIO) {\n allTracksStatus[it.title] = DownloadStatus.Queued\n if (!it.videoID.isNullOrBlank()) { // Video ID already known!\n downloadTrack(it.videoID!!, it, fetcher, dir)\n } else {\n val searchQuery = \"${it.title} - ${it.artists.joinToString(\",\")}\"\n val videoID = fetcher.youtubeMusic.getYTIDBestMatch(searchQuery, it)\n println(videoID + \" : \" + it.title)\n if (videoID.isNullOrBlank()) {\n allTracksStatus[it.title] = DownloadStatus.Failed\n DownloadProgressFlow.emit(allTracksStatus)\n } else { // Found Youtube Video ID\n downloadTrack(videoID, it, fetcher, dir)\n }\n }\n DownloadProgressFlow.emit(allTracksStatus)\n }\n }\n}\n\nsuspend fun downloadTrack(videoID: String, track: TrackDetails, fetcher: FetchPlatformQueryResult, dir: Dir) {\n val url = fetcher.youtubeMp3.getMp3DownloadLink(videoID)\n if (url == null) {\n allTracksStatus[track.title] = DownloadStatus.Failed\n DownloadProgressFlow.emit(allTracksStatus)\n println(\"No URL to Download\")\n } else {\n downloadFile(url).collect {\n when (it) {\n is DownloadResult.Success -> {\n println(\"Download Completed\")\n dir.saveFileWithMetadata(it.byteArray, track)\n }\n is DownloadResult.Error -> {\n allTracksStatus[track.title] = DownloadStatus.Failed\n println(\"Download Error: ${track.title}\")\n }\n is DownloadResult.Progress -> {\n allTracksStatus[track.title] = DownloadStatus.Downloading(it.progress)\n println(\"Download Progress: ${it.progress} : ${track.title}\")\n }\n }\n DownloadProgressFlow.emit(allTracksStatus)\n }\n }\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.di.gaana.corsApi\nimport com.shabinder.common.di.utils.removeIllegalChars\nimport com.shabinder.common.models.DownloadResult\nimport com.shabinder.common.models.DownloadStatus\nimport com.shabinder.common.models.TrackDetails\nimport com.shabinder.database.Database\nimport kotlinext.js.Object\nimport kotlinext.js.js\nimport kotlinx.coroutines.flow.collect\nimport org.khronos.webgl.ArrayBuffer\nimport org.khronos.webgl.Int8Array\nimport org.w3c.dom.ImageBitmap\n\nactual class Dir actual constructor(\n private val logger: Kermit,\n private val database: Database?,\n) {\n\n /*init {\n createDirectories()\n }*/\n\n /*\n * TODO\n * */\n actual fun fileSeparator(): String = \"/\"\n\n actual fun imageCacheDir(): String = \"TODO\" +\n fileSeparator() + \"SpotiFlyer/.images\" + fileSeparator()\n\n actual fun defaultDir(): String = \"TODO\" + fileSeparator() +\n \"SpotiFlyer\" + fileSeparator()\n\n actual fun isPresent(path: String): Boolean = false\n\n actual fun createDirectory(dirPath: String) {}\n\n actual suspend fun clearCache() {}\n\n actual suspend fun cacheImage(image: Any, path: String) {}\n\n @Suppress(\"BlockingMethodInNonBlockingContext\")\n actual suspend fun saveFileWithMetadata(\n mp3ByteArray: ByteArray,\n trackDetails: TrackDetails\n ) {\n val writer = ID3Writer(mp3ByteArray.toArrayBuffer())\n val albumArt = downloadFile(corsApi + trackDetails.albumArtURL)\n albumArt.collect {\n when (it) {\n is DownloadResult.Success -> {\n logger.d { \"Album Art Downloaded Success\" }\n val albumArtObj = js {\n this[\"type\"] = 3\n this[\"data\"] = it.byteArray.toArrayBuffer()\n this[\"description\"] = \"Cover Art\"\n }\n writeTagsAndSave(writer, albumArtObj as Object, trackDetails)\n }\n is DownloadResult.Error -> {\n logger.d { \"Album Art Downloading Error\" }\n writeTagsAndSave(writer, null, trackDetails)\n }\n is DownloadResult.Progress -> logger.d { \"Album Art Downloading: ${it.progress}\" }\n }\n }\n }\n\n private suspend fun writeTagsAndSave(writer: ID3Writer, albumArt: Object?, trackDetails: TrackDetails) {\n writer.apply {\n setFrame(\"TIT2\", trackDetails.title)\n setFrame(\"TPE1\", trackDetails.artists.toTypedArray())\n setFrame(\"TALB\", trackDetails.albumName ?: \"\")\n try { trackDetails.year?.substring(0, 4)?.toInt()?.let { setFrame(\"TYER\", it) } } catch (e: Exception) {}\n setFrame(\"TPE2\", trackDetails.artists.joinToString(\",\"))\n setFrame(\"WOAS\", trackDetails.source.toString())\n setFrame(\"TLEN\", trackDetails.durationSec)\n albumArt?.let { setFrame(\"APIC\", it) }\n }\n writer.addTag()\n allTracksStatus[trackDetails.title] = DownloadStatus.Downloaded\n DownloadProgressFlow.emit(allTracksStatus)\n saveAs(writer.getBlob(), \"${removeIllegalChars(trackDetails.title)}.mp3\")\n }\n\n actual fun addToLibrary(path: String) {}\n\n actual suspend fun loadImage(url: String): Picture {\n return Picture(url)\n }\n\n private fun loadCachedImage(cachePath: String): ImageBitmap? = null\n\n private suspend fun freshImage(url: String): ImageBitmap? = null\n\n actual val db: Database?\n get() = database\n}\n\nfun ByteArray.toArrayBuffer(): ArrayBuffer {\n return this.unsafeCast().buffer\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di\n\nactual data class Picture(\n var imageUrl: String\n)\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.di\n\nimport co.touchlab.kermit.Kermit\nimport com.shabinder.common.models.PlatformQueryResult\nimport io.ktor.client.HttpClient\n\nactual class YoutubeProvider actual constructor(\n httpClient: HttpClient,\n logger: Kermit,\n dir: Dir\n) {\n actual suspend fun query(fullLink: String): PlatformQueryResult? {\n return null // TODO\n }\n}\n","(function (root, factory) {\n if (typeof define === 'function' && define.amd)\n define(['exports', 'kotlin'], factory);\n else if (typeof exports === 'object')\n factory(module.exports, require('kotlin'));\n else {\n if (typeof kotlin === 'undefined') {\n throw new Error(\"Error loading module 'kotlin-wrappers-kotlin-extensions-jsLegacy'. Its dependency 'kotlin' was not found. Please, check whether 'kotlin' is loaded prior to 'kotlin-wrappers-kotlin-extensions-jsLegacy'.\");\n }root['kotlin-wrappers-kotlin-extensions-jsLegacy'] = factory(typeof this['kotlin-wrappers-kotlin-extensions-jsLegacy'] === 'undefined' ? {} : this['kotlin-wrappers-kotlin-extensions-jsLegacy'], kotlin);\n }\n}(this, function (_, Kotlin) {\n 'use strict';\n var getCallableRef = Kotlin.getCallableRef;\n var defineInlineFunction = Kotlin.defineInlineFunction;\n var wrapFunction = Kotlin.wrapFunction;\n function clone(obj) {\n return Object.assign({}, obj);\n }\n function getOwnPropertyNames($receiver) {\n return Object.getOwnPropertyNames($receiver);\n }\n function invoke_3($receiver, strings, values) {\n var tmp$;\n return (tmp$ = $receiver).call.apply(tmp$, [null, strings].concat(values));\n }\n function invoke_4($receiver, string, values) {\n return invoke_3($receiver, [string], values.slice());\n }\n function invoke_5($receiver, values) {\n return invoke_3($receiver, [], values.slice());\n }\n var package$kotlinext = _.kotlinext || (_.kotlinext = {});\n var package$js = package$kotlinext.js || (package$kotlinext.js = {});\n package$js.clone_issdgt$ = clone;\n package$js.getOwnPropertyNames_s8jyvk$ = getOwnPropertyNames;\n package$js.invoke_z5wujd$ = invoke_3;\n package$js.invoke_dgimx$ = invoke_4;\n package$js.invoke_9p99ed$ = invoke_5;\n return _;\n}));\n\n//# sourceMappingURL=kotlin-wrappers-kotlin-extensions-jsLegacy.js.map\n","'use strict'\nvar inherits = require('inherits')\nvar HashBase = require('hash-base')\nvar Buffer = require('safe-buffer').Buffer\n\nvar ARRAY16 = new Array(16)\n\nfunction MD5 () {\n HashBase.call(this, 64)\n\n // state\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n}\n\ninherits(MD5, HashBase)\n\nMD5.prototype._update = function () {\n var M = ARRAY16\n for (var i = 0; i < 16; ++i) M[i] = this._block.readInt32LE(i * 4)\n\n var a = this._a\n var b = this._b\n var c = this._c\n var d = this._d\n\n a = fnF(a, b, c, d, M[0], 0xd76aa478, 7)\n d = fnF(d, a, b, c, M[1], 0xe8c7b756, 12)\n c = fnF(c, d, a, b, M[2], 0x242070db, 17)\n b = fnF(b, c, d, a, M[3], 0xc1bdceee, 22)\n a = fnF(a, b, c, d, M[4], 0xf57c0faf, 7)\n d = fnF(d, a, b, c, M[5], 0x4787c62a, 12)\n c = fnF(c, d, a, b, M[6], 0xa8304613, 17)\n b = fnF(b, c, d, a, M[7], 0xfd469501, 22)\n a = fnF(a, b, c, d, M[8], 0x698098d8, 7)\n d = fnF(d, a, b, c, M[9], 0x8b44f7af, 12)\n c = fnF(c, d, a, b, M[10], 0xffff5bb1, 17)\n b = fnF(b, c, d, a, M[11], 0x895cd7be, 22)\n a = fnF(a, b, c, d, M[12], 0x6b901122, 7)\n d = fnF(d, a, b, c, M[13], 0xfd987193, 12)\n c = fnF(c, d, a, b, M[14], 0xa679438e, 17)\n b = fnF(b, c, d, a, M[15], 0x49b40821, 22)\n\n a = fnG(a, b, c, d, M[1], 0xf61e2562, 5)\n d = fnG(d, a, b, c, M[6], 0xc040b340, 9)\n c = fnG(c, d, a, b, M[11], 0x265e5a51, 14)\n b = fnG(b, c, d, a, M[0], 0xe9b6c7aa, 20)\n a = fnG(a, b, c, d, M[5], 0xd62f105d, 5)\n d = fnG(d, a, b, c, M[10], 0x02441453, 9)\n c = fnG(c, d, a, b, M[15], 0xd8a1e681, 14)\n b = fnG(b, c, d, a, M[4], 0xe7d3fbc8, 20)\n a = fnG(a, b, c, d, M[9], 0x21e1cde6, 5)\n d = fnG(d, a, b, c, M[14], 0xc33707d6, 9)\n c = fnG(c, d, a, b, M[3], 0xf4d50d87, 14)\n b = fnG(b, c, d, a, M[8], 0x455a14ed, 20)\n a = fnG(a, b, c, d, M[13], 0xa9e3e905, 5)\n d = fnG(d, a, b, c, M[2], 0xfcefa3f8, 9)\n c = fnG(c, d, a, b, M[7], 0x676f02d9, 14)\n b = fnG(b, c, d, a, M[12], 0x8d2a4c8a, 20)\n\n a = fnH(a, b, c, d, M[5], 0xfffa3942, 4)\n d = fnH(d, a, b, c, M[8], 0x8771f681, 11)\n c = fnH(c, d, a, b, M[11], 0x6d9d6122, 16)\n b = fnH(b, c, d, a, M[14], 0xfde5380c, 23)\n a = fnH(a, b, c, d, M[1], 0xa4beea44, 4)\n d = fnH(d, a, b, c, M[4], 0x4bdecfa9, 11)\n c = fnH(c, d, a, b, M[7], 0xf6bb4b60, 16)\n b = fnH(b, c, d, a, M[10], 0xbebfbc70, 23)\n a = fnH(a, b, c, d, M[13], 0x289b7ec6, 4)\n d = fnH(d, a, b, c, M[0], 0xeaa127fa, 11)\n c = fnH(c, d, a, b, M[3], 0xd4ef3085, 16)\n b = fnH(b, c, d, a, M[6], 0x04881d05, 23)\n a = fnH(a, b, c, d, M[9], 0xd9d4d039, 4)\n d = fnH(d, a, b, c, M[12], 0xe6db99e5, 11)\n c = fnH(c, d, a, b, M[15], 0x1fa27cf8, 16)\n b = fnH(b, c, d, a, M[2], 0xc4ac5665, 23)\n\n a = fnI(a, b, c, d, M[0], 0xf4292244, 6)\n d = fnI(d, a, b, c, M[7], 0x432aff97, 10)\n c = fnI(c, d, a, b, M[14], 0xab9423a7, 15)\n b = fnI(b, c, d, a, M[5], 0xfc93a039, 21)\n a = fnI(a, b, c, d, M[12], 0x655b59c3, 6)\n d = fnI(d, a, b, c, M[3], 0x8f0ccc92, 10)\n c = fnI(c, d, a, b, M[10], 0xffeff47d, 15)\n b = fnI(b, c, d, a, M[1], 0x85845dd1, 21)\n a = fnI(a, b, c, d, M[8], 0x6fa87e4f, 6)\n d = fnI(d, a, b, c, M[15], 0xfe2ce6e0, 10)\n c = fnI(c, d, a, b, M[6], 0xa3014314, 15)\n b = fnI(b, c, d, a, M[13], 0x4e0811a1, 21)\n a = fnI(a, b, c, d, M[4], 0xf7537e82, 6)\n d = fnI(d, a, b, c, M[11], 0xbd3af235, 10)\n c = fnI(c, d, a, b, M[2], 0x2ad7d2bb, 15)\n b = fnI(b, c, d, a, M[9], 0xeb86d391, 21)\n\n this._a = (this._a + a) | 0\n this._b = (this._b + b) | 0\n this._c = (this._c + c) | 0\n this._d = (this._d + d) | 0\n}\n\nMD5.prototype._digest = function () {\n // create padding and handle blocks\n this._block[this._blockOffset++] = 0x80\n if (this._blockOffset > 56) {\n this._block.fill(0, this._blockOffset, 64)\n this._update()\n this._blockOffset = 0\n }\n\n this._block.fill(0, this._blockOffset, 56)\n this._block.writeUInt32LE(this._length[0], 56)\n this._block.writeUInt32LE(this._length[1], 60)\n this._update()\n\n // produce result\n var buffer = Buffer.allocUnsafe(16)\n buffer.writeInt32LE(this._a, 0)\n buffer.writeInt32LE(this._b, 4)\n buffer.writeInt32LE(this._c, 8)\n buffer.writeInt32LE(this._d, 12)\n return buffer\n}\n\nfunction rotl (x, n) {\n return (x << n) | (x >>> (32 - n))\n}\n\nfunction fnF (a, b, c, d, m, k, s) {\n return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + b) | 0\n}\n\nfunction fnG (a, b, c, d, m, k, s) {\n return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + b) | 0\n}\n\nfunction fnH (a, b, c, d, m, k, s) {\n return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + b) | 0\n}\n\nfunction fnI (a, b, c, d, m, k, s) {\n return (rotl((a + ((c ^ (b | (~d)))) + m + k) | 0, s) + b) | 0\n}\n\nmodule.exports = MD5\n","\n/**\n * Module exports.\n */\n\nmodule.exports = deprecate;\n\n/**\n * Mark that a method should not be used.\n * Returns a modified function which warns once by default.\n *\n * If `localStorage.noDeprecation = true` is set, then it is a no-op.\n *\n * If `localStorage.throwDeprecation = true` is set, then deprecated functions\n * will throw an Error when invoked.\n *\n * If `localStorage.traceDeprecation = true` is set, then deprecated functions\n * will invoke `console.trace()` instead of `console.error()`.\n *\n * @param {Function} fn - the function to deprecate\n * @param {String} msg - the string to print to the console when `fn` is invoked\n * @returns {Function} a new \"deprecated\" version of `fn`\n * @api public\n */\n\nfunction deprecate (fn, msg) {\n if (config('noDeprecation')) {\n return fn;\n }\n\n var warned = false;\n function deprecated() {\n if (!warned) {\n if (config('throwDeprecation')) {\n throw new Error(msg);\n } else if (config('traceDeprecation')) {\n console.trace(msg);\n } else {\n console.warn(msg);\n }\n warned = true;\n }\n return fn.apply(this, arguments);\n }\n\n return deprecated;\n}\n\n/**\n * Checks `localStorage` for boolean values for the given `name`.\n *\n * @param {String} name\n * @returns {Boolean}\n * @api private\n */\n\nfunction config (name) {\n // accessing global.localStorage can trigger a DOMException in sandboxed iframes\n try {\n if (!global.localStorage) return false;\n } catch (_) {\n return false;\n }\n var val = global.localStorage[name];\n if (null == val) return false;\n return String(val).toLowerCase() === 'true';\n}\n","// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n'use strict';\n\nvar ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;\n\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n callback.apply(this, args);\n };\n}\n\nfunction noop() {}\n\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\n\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n\n var onlegacyfinish = function onlegacyfinish() {\n if (!stream.writable) onfinish();\n };\n\n var writableEnded = stream._writableState && stream._writableState.finished;\n\n var onfinish = function onfinish() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n\n var onend = function onend() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n\n var onerror = function onerror(err) {\n callback.call(stream, err);\n };\n\n var onclose = function onclose() {\n var err;\n\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n\n var onrequest = function onrequest() {\n stream.req.on('finish', onfinish);\n };\n\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();else stream.on('request', onrequest);\n } else if (writable && !stream._writableState) {\n // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n return function () {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\n\nmodule.exports = eos;","'use strict'\nvar Buffer = require('buffer').Buffer\nvar inherits = require('inherits')\nvar HashBase = require('hash-base')\n\nvar ARRAY16 = new Array(16)\n\nvar zl = [\n 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,\n 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8,\n 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12,\n 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2,\n 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13\n]\n\nvar zr = [\n 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12,\n 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2,\n 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13,\n 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14,\n 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11\n]\n\nvar sl = [\n 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8,\n 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12,\n 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5,\n 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12,\n 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6\n]\n\nvar sr = [\n 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6,\n 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11,\n 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5,\n 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8,\n 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11\n]\n\nvar hl = [0x00000000, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e]\nvar hr = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0x00000000]\n\nfunction RIPEMD160 () {\n HashBase.call(this, 64)\n\n // state\n this._a = 0x67452301\n this._b = 0xefcdab89\n this._c = 0x98badcfe\n this._d = 0x10325476\n this._e = 0xc3d2e1f0\n}\n\ninherits(RIPEMD160, HashBase)\n\nRIPEMD160.prototype._update = function () {\n var words = ARRAY16\n for (var j = 0; j < 16; ++j) words[j] = this._block.readInt32LE(j * 4)\n\n var al = this._a | 0\n var bl = this._b | 0\n var cl = this._c | 0\n var dl = this._d | 0\n var el = this._e | 0\n\n var ar = this._a | 0\n var br = this._b | 0\n var cr = this._c | 0\n var dr = this._d | 0\n var er = this._e | 0\n\n // computation\n for (var i = 0; i < 80; i += 1) {\n var tl\n var tr\n if (i < 16) {\n tl = fn1(al, bl, cl, dl, el, words[zl[i]], hl[0], sl[i])\n tr = fn5(ar, br, cr, dr, er, words[zr[i]], hr[0], sr[i])\n } else if (i < 32) {\n tl = fn2(al, bl, cl, dl, el, words[zl[i]], hl[1], sl[i])\n tr = fn4(ar, br, cr, dr, er, words[zr[i]], hr[1], sr[i])\n } else if (i < 48) {\n tl = fn3(al, bl, cl, dl, el, words[zl[i]], hl[2], sl[i])\n tr = fn3(ar, br, cr, dr, er, words[zr[i]], hr[2], sr[i])\n } else if (i < 64) {\n tl = fn4(al, bl, cl, dl, el, words[zl[i]], hl[3], sl[i])\n tr = fn2(ar, br, cr, dr, er, words[zr[i]], hr[3], sr[i])\n } else { // if (i<80) {\n tl = fn5(al, bl, cl, dl, el, words[zl[i]], hl[4], sl[i])\n tr = fn1(ar, br, cr, dr, er, words[zr[i]], hr[4], sr[i])\n }\n\n al = el\n el = dl\n dl = rotl(cl, 10)\n cl = bl\n bl = tl\n\n ar = er\n er = dr\n dr = rotl(cr, 10)\n cr = br\n br = tr\n }\n\n // update state\n var t = (this._b + cl + dr) | 0\n this._b = (this._c + dl + er) | 0\n this._c = (this._d + el + ar) | 0\n this._d = (this._e + al + br) | 0\n this._e = (this._a + bl + cr) | 0\n this._a = t\n}\n\nRIPEMD160.prototype._digest = function () {\n // create padding and handle blocks\n this._block[this._blockOffset++] = 0x80\n if (this._blockOffset > 56) {\n this._block.fill(0, this._blockOffset, 64)\n this._update()\n this._blockOffset = 0\n }\n\n this._block.fill(0, this._blockOffset, 56)\n this._block.writeUInt32LE(this._length[0], 56)\n this._block.writeUInt32LE(this._length[1], 60)\n this._update()\n\n // produce result\n var buffer = Buffer.alloc ? Buffer.alloc(20) : new Buffer(20)\n buffer.writeInt32LE(this._a, 0)\n buffer.writeInt32LE(this._b, 4)\n buffer.writeInt32LE(this._c, 8)\n buffer.writeInt32LE(this._d, 12)\n buffer.writeInt32LE(this._e, 16)\n return buffer\n}\n\nfunction rotl (x, n) {\n return (x << n) | (x >>> (32 - n))\n}\n\nfunction fn1 (a, b, c, d, e, m, k, s) {\n return (rotl((a + (b ^ c ^ d) + m + k) | 0, s) + e) | 0\n}\n\nfunction fn2 (a, b, c, d, e, m, k, s) {\n return (rotl((a + ((b & c) | ((~b) & d)) + m + k) | 0, s) + e) | 0\n}\n\nfunction fn3 (a, b, c, d, e, m, k, s) {\n return (rotl((a + ((b | (~c)) ^ d) + m + k) | 0, s) + e) | 0\n}\n\nfunction fn4 (a, b, c, d, e, m, k, s) {\n return (rotl((a + ((b & d) | (c & (~d))) + m + k) | 0, s) + e) | 0\n}\n\nfunction fn5 (a, b, c, d, e, m, k, s) {\n return (rotl((a + (b ^ (c | (~d))) + m + k) | 0, s) + e) | 0\n}\n\nmodule.exports = RIPEMD160\n","var exports = module.exports = function SHA (algorithm) {\n algorithm = algorithm.toLowerCase()\n\n var Algorithm = exports[algorithm]\n if (!Algorithm) throw new Error(algorithm + ' is not supported (we accept pull requests)')\n\n return new Algorithm()\n}\n\nexports.sha = require('./sha')\nexports.sha1 = require('./sha1')\nexports.sha224 = require('./sha224')\nexports.sha256 = require('./sha256')\nexports.sha384 = require('./sha384')\nexports.sha512 = require('./sha512')\n","exports = module.exports = require('./lib/_stream_readable.js');\nexports.Stream = exports;\nexports.Readable = exports;\nexports.Writable = require('./lib/_stream_writable.js');\nexports.Duplex = require('./lib/_stream_duplex.js');\nexports.Transform = require('./lib/_stream_transform.js');\nexports.PassThrough = require('./lib/_stream_passthrough.js');\n","/* eslint-disable node/no-deprecated-api */\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\n// alternative to using Object.keys for old browsers\nfunction copyProps (src, dst) {\n for (var key in src) {\n dst[key] = src[key]\n }\n}\nif (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {\n module.exports = buffer\n} else {\n // Copy properties from require('buffer')\n copyProps(buffer, exports)\n exports.Buffer = SafeBuffer\n}\n\nfunction SafeBuffer (arg, encodingOrOffset, length) {\n return Buffer(arg, encodingOrOffset, length)\n}\n\n// Copy static methods from Buffer\ncopyProps(Buffer, SafeBuffer)\n\nSafeBuffer.from = function (arg, encodingOrOffset, length) {\n if (typeof arg === 'number') {\n throw new TypeError('Argument must not be a number')\n }\n return Buffer(arg, encodingOrOffset, length)\n}\n\nSafeBuffer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n var buf = Buffer(size)\n if (fill !== undefined) {\n if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n } else {\n buf.fill(0)\n }\n return buf\n}\n\nSafeBuffer.allocUnsafe = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return Buffer(size)\n}\n\nSafeBuffer.allocUnsafeSlow = function (size) {\n if (typeof size !== 'number') {\n throw new TypeError('Argument must be a number')\n }\n return buffer.SlowBuffer(size)\n}\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n\n'use strict';\n\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\nmodule.exports = Writable;\n\n/* */\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n}\n\n// It seems a linked list but it is not\n// there will be only 2 of these for each stream\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\nvar asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;\n/**/\n\n/**/\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n\n/**/\nvar util = Object.create(require('core-util-is'));\nutil.inherits = require('inherits');\n/**/\n\n/**/\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\nvar Stream = require('./internal/streams/stream');\n/**/\n\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\nvar OurUint8Array = global.Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/**/\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nutil.inherits(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n var isDuplex = stream instanceof Duplex;\n\n // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n this.objectMode = !!options.objectMode;\n\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;\n\n // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n var hwm = options.highWaterMark;\n var writableHwm = options.writableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (writableHwm || writableHwm === 0)) this.highWaterMark = writableHwm;else this.highWaterMark = defaultHwm;\n\n // cast to ints.\n this.highWaterMark = Math.floor(this.highWaterMark);\n\n // if _final has been called\n this.finalCalled = false;\n\n // drain event flag.\n this.needDrain = false;\n // at the start of calling end()\n this.ending = false;\n // when end() has been called, and returned\n this.ended = false;\n // when 'finish' is emitted\n this.finished = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n this.length = 0;\n\n // a flag to see when we're in the middle of a write.\n this.writing = false;\n\n // when true all writes will be buffered until .uncork() call\n this.corked = 0;\n\n // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n this.sync = true;\n\n // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n this.bufferProcessing = false;\n\n // the callback that's passed to _write(chunk,cb)\n this.onwrite = function (er) {\n onwrite(stream, er);\n };\n\n // the callback that the user supplies to write(chunk,encoding,cb)\n this.writecb = null;\n\n // the amount that is being written when _write is called.\n this.writelen = 0;\n\n this.bufferedRequest = null;\n this.lastBufferedRequest = null;\n\n // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n this.pendingcb = 0;\n\n // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n this.prefinished = false;\n\n // True if the error was already emitted and should not be thrown again\n this.errorEmitted = false;\n\n // count buffered requests\n this.bufferedRequestCount = 0;\n\n // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n while (current) {\n out.push(current);\n current = current.next;\n }\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function () {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})();\n\n// Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\nvar realHasInstance;\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function (object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function (object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n if (!realHasInstance.call(Writable, this) && !(this instanceof Duplex)) {\n return new Writable(options);\n }\n\n this._writableState = new WritableState(options, this);\n\n // legacy.\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n\n if (typeof options.writev === 'function') this._writev = options.writev;\n\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n\n if (typeof options.final === 'function') this._final = options.final;\n }\n\n Stream.call(this);\n}\n\n// Otherwise people can pipe Writable streams, which is just wrong.\nWritable.prototype.pipe = function () {\n this.emit('error', new Error('Cannot pipe, not readable'));\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new Error('write after end');\n // TODO: defer error events consistently everywhere, not just the cb\n stream.emit('error', er);\n pna.nextTick(cb, er);\n}\n\n// Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\nfunction validChunk(stream, state, chunk, cb) {\n var valid = true;\n var er = false;\n\n if (chunk === null) {\n er = new TypeError('May not write null values to stream');\n } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n if (er) {\n stream.emit('error', er);\n pna.nextTick(cb, er);\n valid = false;\n }\n return valid;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n\n if (typeof cb !== 'function') cb = nop;\n\n if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n\n return ret;\n};\n\nWritable.prototype.cork = function () {\n var state = this._writableState;\n\n state.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n\n if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._writableState.highWaterMark;\n }\n});\n\n// if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n var len = state.objectMode ? 1 : chunk.length;\n\n state.length += len;\n\n var ret = state.length < state.highWaterMark;\n // we must ensure that previous needDrain will not be reset to false.\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n pna.nextTick(cb, er);\n // this can emit finish, and it will always happen\n // after error\n pna.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n stream.emit('error', er);\n // this can emit finish, but finish must\n // always follow error\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n\n onwriteStateUpdate(state);\n\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state);\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n /**/\n asyncWrite(afterWrite, stream, state, finished, cb);\n /**/\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n}\n\n// Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n}\n\n// if there's something in the buffer waiting, then process it\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n\n var count = 0;\n var allBuffers = true;\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n buffer.allBuffers = allBuffers;\n\n doWrite(stream, state, true, state.length, buffer, '', holder.finish);\n\n // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n state.pendingcb++;\n state.lastBufferedRequest = null;\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--;\n // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new Error('_write() is not implemented'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);\n\n // .end() fully uncorks\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n }\n\n // ignore unnecessary end() calls.\n if (!state.ending && !state.finished) endWritable(this, state, cb);\n};\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n if (err) {\n stream.emit('error', err);\n }\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function') {\n state.pendingcb++;\n state.finalCalled = true;\n pna.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n if (need) {\n prefinish(stream, state);\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n }\n }\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n if (cb) {\n if (state.finished) pna.nextTick(cb);else stream.once('finish', cb);\n }\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n }\n if (state.corkedRequestsFree) {\n state.corkedRequestsFree.next = corkReq;\n } else {\n state.corkedRequestsFree = corkReq;\n }\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n get: function () {\n if (this._writableState === undefined) {\n return false;\n }\n return this._writableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._writableState.destroyed = value;\n }\n});\n\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\nWritable.prototype._destroy = function (err, cb) {\n this.end();\n cb(err);\n};","'use strict';\n\nvar assert = require('minimalistic-assert');\n\nfunction Cipher(options) {\n this.options = options;\n\n this.type = this.options.type;\n this.blockSize = 8;\n this._init();\n\n this.buffer = new Array(this.blockSize);\n this.bufferOff = 0;\n}\nmodule.exports = Cipher;\n\nCipher.prototype._init = function _init() {\n // Might be overrided\n};\n\nCipher.prototype.update = function update(data) {\n if (data.length === 0)\n return [];\n\n if (this.type === 'decrypt')\n return this._updateDecrypt(data);\n else\n return this._updateEncrypt(data);\n};\n\nCipher.prototype._buffer = function _buffer(data, off) {\n // Append data to buffer\n var min = Math.min(this.buffer.length - this.bufferOff, data.length - off);\n for (var i = 0; i < min; i++)\n this.buffer[this.bufferOff + i] = data[off + i];\n this.bufferOff += min;\n\n // Shift next\n return min;\n};\n\nCipher.prototype._flushBuffer = function _flushBuffer(out, off) {\n this._update(this.buffer, 0, out, off);\n this.bufferOff = 0;\n return this.blockSize;\n};\n\nCipher.prototype._updateEncrypt = function _updateEncrypt(data) {\n var inputOff = 0;\n var outputOff = 0;\n\n var count = ((this.bufferOff + data.length) / this.blockSize) | 0;\n var out = new Array(count * this.blockSize);\n\n if (this.bufferOff !== 0) {\n inputOff += this._buffer(data, inputOff);\n\n if (this.bufferOff === this.buffer.length)\n outputOff += this._flushBuffer(out, outputOff);\n }\n\n // Write blocks\n var max = data.length - ((data.length - inputOff) % this.blockSize);\n for (; inputOff < max; inputOff += this.blockSize) {\n this._update(data, inputOff, out, outputOff);\n outputOff += this.blockSize;\n }\n\n // Queue rest\n for (; inputOff < data.length; inputOff++, this.bufferOff++)\n this.buffer[this.bufferOff] = data[inputOff];\n\n return out;\n};\n\nCipher.prototype._updateDecrypt = function _updateDecrypt(data) {\n var inputOff = 0;\n var outputOff = 0;\n\n var count = Math.ceil((this.bufferOff + data.length) / this.blockSize) - 1;\n var out = new Array(count * this.blockSize);\n\n // TODO(indutny): optimize it, this is far from optimal\n for (; count > 0; count--) {\n inputOff += this._buffer(data, inputOff);\n outputOff += this._flushBuffer(out, outputOff);\n }\n\n // Buffer rest of the input\n inputOff += this._buffer(data, inputOff);\n\n return out;\n};\n\nCipher.prototype.final = function final(buffer) {\n var first;\n if (buffer)\n first = this.update(buffer);\n\n var last;\n if (this.type === 'encrypt')\n last = this._finalEncrypt();\n else\n last = this._finalDecrypt();\n\n if (first)\n return first.concat(last);\n else\n return last;\n};\n\nCipher.prototype._pad = function _pad(buffer, off) {\n if (off === 0)\n return false;\n\n while (off < buffer.length)\n buffer[off++] = 0;\n\n return true;\n};\n\nCipher.prototype._finalEncrypt = function _finalEncrypt() {\n if (!this._pad(this.buffer, this.bufferOff))\n return [];\n\n var out = new Array(this.blockSize);\n this._update(this.buffer, 0, out, 0);\n return out;\n};\n\nCipher.prototype._unpad = function _unpad(buffer) {\n return buffer;\n};\n\nCipher.prototype._finalDecrypt = function _finalDecrypt() {\n assert.equal(this.bufferOff, this.blockSize, 'Not enough data to decrypt');\n var out = new Array(this.blockSize);\n this._flushBuffer(out, 0);\n\n return this._unpad(out);\n};\n","var ciphers = require('./encrypter')\nvar deciphers = require('./decrypter')\nvar modes = require('./modes/list.json')\n\nfunction getCiphers () {\n return Object.keys(modes)\n}\n\nexports.createCipher = exports.Cipher = ciphers.createCipher\nexports.createCipheriv = exports.Cipheriv = ciphers.createCipheriv\nexports.createDecipher = exports.Decipher = deciphers.createDecipher\nexports.createDecipheriv = exports.Decipheriv = deciphers.createDecipheriv\nexports.listCiphers = exports.getCiphers = getCiphers\n","var modeModules = {\n ECB: require('./ecb'),\n CBC: require('./cbc'),\n CFB: require('./cfb'),\n CFB8: require('./cfb8'),\n CFB1: require('./cfb1'),\n OFB: require('./ofb'),\n CTR: require('./ctr'),\n GCM: require('./ctr')\n}\n\nvar modes = require('./list.json')\n\nfor (var key in modes) {\n modes[key].module = modeModules[modes[key].mode]\n}\n\nmodule.exports = modes\n","module.exports = function(module) {\n\tif (!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n","var r;\n\nmodule.exports = function rand(len) {\n if (!r)\n r = new Rand(null);\n\n return r.generate(len);\n};\n\nfunction Rand(rand) {\n this.rand = rand;\n}\nmodule.exports.Rand = Rand;\n\nRand.prototype.generate = function generate(len) {\n return this._rand(len);\n};\n\n// Emulate crypto API using randy\nRand.prototype._rand = function _rand(n) {\n if (this.rand.getBytes)\n return this.rand.getBytes(n);\n\n var res = new Uint8Array(n);\n for (var i = 0; i < res.length; i++)\n res[i] = this.rand.getByte();\n return res;\n};\n\nif (typeof self === 'object') {\n if (self.crypto && self.crypto.getRandomValues) {\n // Modern browsers\n Rand.prototype._rand = function _rand(n) {\n var arr = new Uint8Array(n);\n self.crypto.getRandomValues(arr);\n return arr;\n };\n } else if (self.msCrypto && self.msCrypto.getRandomValues) {\n // IE\n Rand.prototype._rand = function _rand(n) {\n var arr = new Uint8Array(n);\n self.msCrypto.getRandomValues(arr);\n return arr;\n };\n\n // Safari's WebWorkers do not have `crypto`\n } else if (typeof window === 'object') {\n // Old junk\n Rand.prototype._rand = function() {\n throw new Error('Not implemented yet');\n };\n }\n} else {\n // Node.js or Web worker with no crypto support\n try {\n var crypto = require('crypto');\n if (typeof crypto.randomBytes !== 'function')\n throw new Error('Not supported');\n\n Rand.prototype._rand = function _rand(n) {\n return crypto.randomBytes(n);\n };\n } catch (e) {\n }\n}\n","// Ported from https://github.com/mafintosh/end-of-stream with\n// permission from the author, Mathias Buus (@mafintosh).\n'use strict';\n\nvar ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;\n\nfunction once(callback) {\n var called = false;\n return function () {\n if (called) return;\n called = true;\n\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n callback.apply(this, args);\n };\n}\n\nfunction noop() {}\n\nfunction isRequest(stream) {\n return stream.setHeader && typeof stream.abort === 'function';\n}\n\nfunction eos(stream, opts, callback) {\n if (typeof opts === 'function') return eos(stream, null, opts);\n if (!opts) opts = {};\n callback = once(callback || noop);\n var readable = opts.readable || opts.readable !== false && stream.readable;\n var writable = opts.writable || opts.writable !== false && stream.writable;\n\n var onlegacyfinish = function onlegacyfinish() {\n if (!stream.writable) onfinish();\n };\n\n var writableEnded = stream._writableState && stream._writableState.finished;\n\n var onfinish = function onfinish() {\n writable = false;\n writableEnded = true;\n if (!readable) callback.call(stream);\n };\n\n var readableEnded = stream._readableState && stream._readableState.endEmitted;\n\n var onend = function onend() {\n readable = false;\n readableEnded = true;\n if (!writable) callback.call(stream);\n };\n\n var onerror = function onerror(err) {\n callback.call(stream, err);\n };\n\n var onclose = function onclose() {\n var err;\n\n if (readable && !readableEnded) {\n if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n\n if (writable && !writableEnded) {\n if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();\n return callback.call(stream, err);\n }\n };\n\n var onrequest = function onrequest() {\n stream.req.on('finish', onfinish);\n };\n\n if (isRequest(stream)) {\n stream.on('complete', onfinish);\n stream.on('abort', onclose);\n if (stream.req) onrequest();else stream.on('request', onrequest);\n } else if (writable && !stream._writableState) {\n // legacy streams\n stream.on('end', onlegacyfinish);\n stream.on('close', onlegacyfinish);\n }\n\n stream.on('end', onend);\n stream.on('finish', onfinish);\n if (opts.error !== false) stream.on('error', onerror);\n stream.on('close', onclose);\n return function () {\n stream.removeListener('complete', onfinish);\n stream.removeListener('abort', onclose);\n stream.removeListener('request', onrequest);\n if (stream.req) stream.req.removeListener('finish', onfinish);\n stream.removeListener('end', onlegacyfinish);\n stream.removeListener('close', onlegacyfinish);\n stream.removeListener('finish', onfinish);\n stream.removeListener('end', onend);\n stream.removeListener('error', onerror);\n stream.removeListener('close', onclose);\n };\n}\n\nmodule.exports = eos;","var BN = require('bn.js')\nvar randomBytes = require('randombytes')\n\nfunction blind (priv) {\n var r = getr(priv)\n var blinder = r.toRed(BN.mont(priv.modulus)).redPow(new BN(priv.publicExponent)).fromRed()\n return { blinder: blinder, unblinder: r.invm(priv.modulus) }\n}\n\nfunction getr (priv) {\n var len = priv.modulus.byteLength()\n var r\n do {\n r = new BN(randomBytes(len))\n } while (r.cmp(priv.modulus) >= 0 || !r.umod(priv.prime1) || !r.umod(priv.prime2))\n return r\n}\n\nfunction crt (msg, priv) {\n var blinds = blind(priv)\n var len = priv.modulus.byteLength()\n var blinded = new BN(msg).mul(blinds.blinder).umod(priv.modulus)\n var c1 = blinded.toRed(BN.mont(priv.prime1))\n var c2 = blinded.toRed(BN.mont(priv.prime2))\n var qinv = priv.coefficient\n var p = priv.prime1\n var q = priv.prime2\n var m1 = c1.redPow(priv.exponent1).fromRed()\n var m2 = c2.redPow(priv.exponent2).fromRed()\n var h = m1.isub(m2).imul(qinv).umod(p).imul(q)\n return m2.iadd(h).imul(blinds.unblinder).umod(priv.modulus).toArrayLike(Buffer, 'be', len)\n}\ncrt.getr = getr\n\nmodule.exports = crt\n","'use strict';\n\nvar elliptic = exports;\n\nelliptic.version = require('../package.json').version;\nelliptic.utils = require('./elliptic/utils');\nelliptic.rand = require('brorand');\nelliptic.curve = require('./elliptic/curve');\nelliptic.curves = require('./elliptic/curves');\n\n// Protocols\nelliptic.ec = require('./elliptic/ec');\nelliptic.eddsa = require('./elliptic/eddsa');\n","'use strict';\n\nvar curves = exports;\n\nvar hash = require('hash.js');\nvar curve = require('./curve');\nvar utils = require('./utils');\n\nvar assert = utils.assert;\n\nfunction PresetCurve(options) {\n if (options.type === 'short')\n this.curve = new curve.short(options);\n else if (options.type === 'edwards')\n this.curve = new curve.edwards(options);\n else\n this.curve = new curve.mont(options);\n this.g = this.curve.g;\n this.n = this.curve.n;\n this.hash = options.hash;\n\n assert(this.g.validate(), 'Invalid curve');\n assert(this.g.mul(this.n).isInfinity(), 'Invalid curve, G*N != O');\n}\ncurves.PresetCurve = PresetCurve;\n\nfunction defineCurve(name, options) {\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n get: function() {\n var curve = new PresetCurve(options);\n Object.defineProperty(curves, name, {\n configurable: true,\n enumerable: true,\n value: curve,\n });\n return curve;\n },\n });\n}\n\ndefineCurve('p192', {\n type: 'short',\n prime: 'p192',\n p: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc',\n b: '64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1',\n n: 'ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831',\n hash: hash.sha256,\n gRed: false,\n g: [\n '188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012',\n '07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811',\n ],\n});\n\ndefineCurve('p224', {\n type: 'short',\n prime: 'p224',\n p: 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001',\n a: 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe',\n b: 'b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4',\n n: 'ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d',\n hash: hash.sha256,\n gRed: false,\n g: [\n 'b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21',\n 'bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34',\n ],\n});\n\ndefineCurve('p256', {\n type: 'short',\n prime: null,\n p: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff',\n a: 'ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc',\n b: '5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b',\n n: 'ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551',\n hash: hash.sha256,\n gRed: false,\n g: [\n '6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296',\n '4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5',\n ],\n});\n\ndefineCurve('p384', {\n type: 'short',\n prime: null,\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 ffffffff',\n a: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'fffffffe ffffffff 00000000 00000000 fffffffc',\n b: 'b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f ' +\n '5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef',\n n: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 ' +\n 'f4372ddf 581a0db2 48b0a77a ecec196a ccc52973',\n hash: hash.sha384,\n gRed: false,\n g: [\n 'aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 ' +\n '5502f25d bf55296c 3a545e38 72760ab7',\n '3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 ' +\n '0a60b1ce 1d7e819d 7a431d7c 90ea0e5f',\n ],\n});\n\ndefineCurve('p521', {\n type: 'short',\n prime: null,\n p: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff',\n a: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff ffffffff ffffffff fffffffc',\n b: '00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b ' +\n '99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd ' +\n '3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00',\n n: '000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ' +\n 'ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 ' +\n 'f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409',\n hash: hash.sha512,\n gRed: false,\n g: [\n '000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 ' +\n '053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 ' +\n 'a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66',\n '00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 ' +\n '579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 ' +\n '3fad0761 353c7086 a272c240 88be9476 9fd16650',\n ],\n});\n\ndefineCurve('curve25519', {\n type: 'mont',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '76d06',\n b: '1',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '9',\n ],\n});\n\ndefineCurve('ed25519', {\n type: 'edwards',\n prime: 'p25519',\n p: '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed',\n a: '-1',\n c: '1',\n // -121665 * (121666^(-1)) (mod P)\n d: '52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3',\n n: '1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed',\n hash: hash.sha256,\n gRed: false,\n g: [\n '216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a',\n\n // 4/5\n '6666666666666666666666666666666666666666666666666666666666666658',\n ],\n});\n\nvar pre;\ntry {\n pre = require('./precomputed/secp256k1');\n} catch (e) {\n pre = undefined;\n}\n\ndefineCurve('secp256k1', {\n type: 'short',\n prime: 'k256',\n p: 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f',\n a: '0',\n b: '7',\n n: 'ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141',\n h: '1',\n hash: hash.sha256,\n\n // Precomputed endomorphism\n beta: '7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee',\n lambda: '5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72',\n basis: [\n {\n a: '3086d221a7d46bcde86c90e49284eb15',\n b: '-e4437ed6010e88286f547fa90abfe4c3',\n },\n {\n a: '114ca50f7a8e2f3f657c1108d9d44cfd8',\n b: '3086d221a7d46bcde86c90e49284eb15',\n },\n ],\n\n gRed: false,\n g: [\n '79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798',\n '483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8',\n pre,\n ],\n});\n","var hash = exports;\n\nhash.utils = require('./hash/utils');\nhash.common = require('./hash/common');\nhash.sha = require('./hash/sha');\nhash.ripemd = require('./hash/ripemd');\nhash.hmac = require('./hash/hmac');\n\n// Proxy hash functions to the main object\nhash.sha1 = hash.sha.sha1;\nhash.sha256 = hash.sha.sha256;\nhash.sha224 = hash.sha.sha224;\nhash.sha384 = hash.sha.sha384;\nhash.sha512 = hash.sha.sha512;\nhash.ripemd160 = hash.ripemd.ripemd160;\n","/* eslint-disable node/no-deprecated-api */\n\n'use strict'\n\nvar buffer = require('buffer')\nvar Buffer = buffer.Buffer\n\nvar safer = {}\n\nvar key\n\nfor (key in buffer) {\n if (!buffer.hasOwnProperty(key)) continue\n if (key === 'SlowBuffer' || key === 'Buffer') continue\n safer[key] = buffer[key]\n}\n\nvar Safer = safer.Buffer = {}\nfor (key in Buffer) {\n if (!Buffer.hasOwnProperty(key)) continue\n if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue\n Safer[key] = Buffer[key]\n}\n\nsafer.Buffer.prototype = Buffer.prototype\n\nif (!Safer.from || Safer.from === Uint8Array.from) {\n Safer.from = function (value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('The \"value\" argument must not be of type number. Received type ' + typeof value)\n }\n if (value && typeof value.length === 'undefined') {\n throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value)\n }\n return Buffer(value, encodingOrOffset, length)\n }\n}\n\nif (!Safer.alloc) {\n Safer.alloc = function (size, fill, encoding) {\n if (typeof size !== 'number') {\n throw new TypeError('The \"size\" argument must be of type number. Received type ' + typeof size)\n }\n if (size < 0 || size >= 2 * (1 << 30)) {\n throw new RangeError('The value \"' + size + '\" is invalid for option \"size\"')\n }\n var buf = Buffer(size)\n if (!fill || fill.length === 0) {\n buf.fill(0)\n } else if (typeof encoding === 'string') {\n buf.fill(fill, encoding)\n } else {\n buf.fill(fill)\n }\n return buf\n }\n}\n\nif (!safer.kStringMaxLength) {\n try {\n safer.kStringMaxLength = process.binding('buffer').kStringMaxLength\n } catch (e) {\n // we can't determine kStringMaxLength in environments where process.binding\n // is unsupported, so let's not set it\n }\n}\n\nif (!safer.constants) {\n safer.constants = {\n MAX_LENGTH: safer.kMaxLength\n }\n if (safer.kStringMaxLength) {\n safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength\n }\n}\n\nmodule.exports = safer\n","'use strict';\n\nconst Reporter = require('../base/reporter').Reporter;\nconst EncoderBuffer = require('../base/buffer').EncoderBuffer;\nconst DecoderBuffer = require('../base/buffer').DecoderBuffer;\nconst assert = require('minimalistic-assert');\n\n// Supported tags\nconst tags = [\n 'seq', 'seqof', 'set', 'setof', 'objid', 'bool',\n 'gentime', 'utctime', 'null_', 'enum', 'int', 'objDesc',\n 'bitstr', 'bmpstr', 'charstr', 'genstr', 'graphstr', 'ia5str', 'iso646str',\n 'numstr', 'octstr', 'printstr', 't61str', 'unistr', 'utf8str', 'videostr'\n];\n\n// Public methods list\nconst methods = [\n 'key', 'obj', 'use', 'optional', 'explicit', 'implicit', 'def', 'choice',\n 'any', 'contains'\n].concat(tags);\n\n// Overrided methods list\nconst overrided = [\n '_peekTag', '_decodeTag', '_use',\n '_decodeStr', '_decodeObjid', '_decodeTime',\n '_decodeNull', '_decodeInt', '_decodeBool', '_decodeList',\n\n '_encodeComposite', '_encodeStr', '_encodeObjid', '_encodeTime',\n '_encodeNull', '_encodeInt', '_encodeBool'\n];\n\nfunction Node(enc, parent, name) {\n const state = {};\n this._baseState = state;\n\n state.name = name;\n state.enc = enc;\n\n state.parent = parent || null;\n state.children = null;\n\n // State\n state.tag = null;\n state.args = null;\n state.reverseArgs = null;\n state.choice = null;\n state.optional = false;\n state.any = false;\n state.obj = false;\n state.use = null;\n state.useDecoder = null;\n state.key = null;\n state['default'] = null;\n state.explicit = null;\n state.implicit = null;\n state.contains = null;\n\n // Should create new instance on each method\n if (!state.parent) {\n state.children = [];\n this._wrap();\n }\n}\nmodule.exports = Node;\n\nconst stateProps = [\n 'enc', 'parent', 'children', 'tag', 'args', 'reverseArgs', 'choice',\n 'optional', 'any', 'obj', 'use', 'alteredUse', 'key', 'default', 'explicit',\n 'implicit', 'contains'\n];\n\nNode.prototype.clone = function clone() {\n const state = this._baseState;\n const cstate = {};\n stateProps.forEach(function(prop) {\n cstate[prop] = state[prop];\n });\n const res = new this.constructor(cstate.parent);\n res._baseState = cstate;\n return res;\n};\n\nNode.prototype._wrap = function wrap() {\n const state = this._baseState;\n methods.forEach(function(method) {\n this[method] = function _wrappedMethod() {\n const clone = new this.constructor(this);\n state.children.push(clone);\n return clone[method].apply(clone, arguments);\n };\n }, this);\n};\n\nNode.prototype._init = function init(body) {\n const state = this._baseState;\n\n assert(state.parent === null);\n body.call(this);\n\n // Filter children\n state.children = state.children.filter(function(child) {\n return child._baseState.parent === this;\n }, this);\n assert.equal(state.children.length, 1, 'Root node can have only one child');\n};\n\nNode.prototype._useArgs = function useArgs(args) {\n const state = this._baseState;\n\n // Filter children and args\n const children = args.filter(function(arg) {\n return arg instanceof this.constructor;\n }, this);\n args = args.filter(function(arg) {\n return !(arg instanceof this.constructor);\n }, this);\n\n if (children.length !== 0) {\n assert(state.children === null);\n state.children = children;\n\n // Replace parent to maintain backward link\n children.forEach(function(child) {\n child._baseState.parent = this;\n }, this);\n }\n if (args.length !== 0) {\n assert(state.args === null);\n state.args = args;\n state.reverseArgs = args.map(function(arg) {\n if (typeof arg !== 'object' || arg.constructor !== Object)\n return arg;\n\n const res = {};\n Object.keys(arg).forEach(function(key) {\n if (key == (key | 0))\n key |= 0;\n const value = arg[key];\n res[value] = key;\n });\n return res;\n });\n }\n};\n\n//\n// Overrided methods\n//\n\noverrided.forEach(function(method) {\n Node.prototype[method] = function _overrided() {\n const state = this._baseState;\n throw new Error(method + ' not implemented for encoding: ' + state.enc);\n };\n});\n\n//\n// Public methods\n//\n\ntags.forEach(function(tag) {\n Node.prototype[tag] = function _tagMethod() {\n const state = this._baseState;\n const args = Array.prototype.slice.call(arguments);\n\n assert(state.tag === null);\n state.tag = tag;\n\n this._useArgs(args);\n\n return this;\n };\n});\n\nNode.prototype.use = function use(item) {\n assert(item);\n const state = this._baseState;\n\n assert(state.use === null);\n state.use = item;\n\n return this;\n};\n\nNode.prototype.optional = function optional() {\n const state = this._baseState;\n\n state.optional = true;\n\n return this;\n};\n\nNode.prototype.def = function def(val) {\n const state = this._baseState;\n\n assert(state['default'] === null);\n state['default'] = val;\n state.optional = true;\n\n return this;\n};\n\nNode.prototype.explicit = function explicit(num) {\n const state = this._baseState;\n\n assert(state.explicit === null && state.implicit === null);\n state.explicit = num;\n\n return this;\n};\n\nNode.prototype.implicit = function implicit(num) {\n const state = this._baseState;\n\n assert(state.explicit === null && state.implicit === null);\n state.implicit = num;\n\n return this;\n};\n\nNode.prototype.obj = function obj() {\n const state = this._baseState;\n const args = Array.prototype.slice.call(arguments);\n\n state.obj = true;\n\n if (args.length !== 0)\n this._useArgs(args);\n\n return this;\n};\n\nNode.prototype.key = function key(newKey) {\n const state = this._baseState;\n\n assert(state.key === null);\n state.key = newKey;\n\n return this;\n};\n\nNode.prototype.any = function any() {\n const state = this._baseState;\n\n state.any = true;\n\n return this;\n};\n\nNode.prototype.choice = function choice(obj) {\n const state = this._baseState;\n\n assert(state.choice === null);\n state.choice = obj;\n this._useArgs(Object.keys(obj).map(function(key) {\n return obj[key];\n }));\n\n return this;\n};\n\nNode.prototype.contains = function contains(item) {\n const state = this._baseState;\n\n assert(state.use === null);\n state.contains = item;\n\n return this;\n};\n\n//\n// Decoding\n//\n\nNode.prototype._decode = function decode(input, options) {\n const state = this._baseState;\n\n // Decode root node\n if (state.parent === null)\n return input.wrapResult(state.children[0]._decode(input, options));\n\n let result = state['default'];\n let present = true;\n\n let prevKey = null;\n if (state.key !== null)\n prevKey = input.enterKey(state.key);\n\n // Check if tag is there\n if (state.optional) {\n let tag = null;\n if (state.explicit !== null)\n tag = state.explicit;\n else if (state.implicit !== null)\n tag = state.implicit;\n else if (state.tag !== null)\n tag = state.tag;\n\n if (tag === null && !state.any) {\n // Trial and Error\n const save = input.save();\n try {\n if (state.choice === null)\n this._decodeGeneric(state.tag, input, options);\n else\n this._decodeChoice(input, options);\n present = true;\n } catch (e) {\n present = false;\n }\n input.restore(save);\n } else {\n present = this._peekTag(input, tag, state.any);\n\n if (input.isError(present))\n return present;\n }\n }\n\n // Push object on stack\n let prevObj;\n if (state.obj && present)\n prevObj = input.enterObject();\n\n if (present) {\n // Unwrap explicit values\n if (state.explicit !== null) {\n const explicit = this._decodeTag(input, state.explicit);\n if (input.isError(explicit))\n return explicit;\n input = explicit;\n }\n\n const start = input.offset;\n\n // Unwrap implicit and normal values\n if (state.use === null && state.choice === null) {\n let save;\n if (state.any)\n save = input.save();\n const body = this._decodeTag(\n input,\n state.implicit !== null ? state.implicit : state.tag,\n state.any\n );\n if (input.isError(body))\n return body;\n\n if (state.any)\n result = input.raw(save);\n else\n input = body;\n }\n\n if (options && options.track && state.tag !== null)\n options.track(input.path(), start, input.length, 'tagged');\n\n if (options && options.track && state.tag !== null)\n options.track(input.path(), input.offset, input.length, 'content');\n\n // Select proper method for tag\n if (state.any) {\n // no-op\n } else if (state.choice === null) {\n result = this._decodeGeneric(state.tag, input, options);\n } else {\n result = this._decodeChoice(input, options);\n }\n\n if (input.isError(result))\n return result;\n\n // Decode children\n if (!state.any && state.choice === null && state.children !== null) {\n state.children.forEach(function decodeChildren(child) {\n // NOTE: We are ignoring errors here, to let parser continue with other\n // parts of encoded data\n child._decode(input, options);\n });\n }\n\n // Decode contained/encoded by schema, only in bit or octet strings\n if (state.contains && (state.tag === 'octstr' || state.tag === 'bitstr')) {\n const data = new DecoderBuffer(result);\n result = this._getUse(state.contains, input._reporterState.obj)\n ._decode(data, options);\n }\n }\n\n // Pop object\n if (state.obj && present)\n result = input.leaveObject(prevObj);\n\n // Set key\n if (state.key !== null && (result !== null || present === true))\n input.leaveKey(prevKey, state.key, result);\n else if (prevKey !== null)\n input.exitKey(prevKey);\n\n return result;\n};\n\nNode.prototype._decodeGeneric = function decodeGeneric(tag, input, options) {\n const state = this._baseState;\n\n if (tag === 'seq' || tag === 'set')\n return null;\n if (tag === 'seqof' || tag === 'setof')\n return this._decodeList(input, tag, state.args[0], options);\n else if (/str$/.test(tag))\n return this._decodeStr(input, tag, options);\n else if (tag === 'objid' && state.args)\n return this._decodeObjid(input, state.args[0], state.args[1], options);\n else if (tag === 'objid')\n return this._decodeObjid(input, null, null, options);\n else if (tag === 'gentime' || tag === 'utctime')\n return this._decodeTime(input, tag, options);\n else if (tag === 'null_')\n return this._decodeNull(input, options);\n else if (tag === 'bool')\n return this._decodeBool(input, options);\n else if (tag === 'objDesc')\n return this._decodeStr(input, tag, options);\n else if (tag === 'int' || tag === 'enum')\n return this._decodeInt(input, state.args && state.args[0], options);\n\n if (state.use !== null) {\n return this._getUse(state.use, input._reporterState.obj)\n ._decode(input, options);\n } else {\n return input.error('unknown tag: ' + tag);\n }\n};\n\nNode.prototype._getUse = function _getUse(entity, obj) {\n\n const state = this._baseState;\n // Create altered use decoder if implicit is set\n state.useDecoder = this._use(entity, obj);\n assert(state.useDecoder._baseState.parent === null);\n state.useDecoder = state.useDecoder._baseState.children[0];\n if (state.implicit !== state.useDecoder._baseState.implicit) {\n state.useDecoder = state.useDecoder.clone();\n state.useDecoder._baseState.implicit = state.implicit;\n }\n return state.useDecoder;\n};\n\nNode.prototype._decodeChoice = function decodeChoice(input, options) {\n const state = this._baseState;\n let result = null;\n let match = false;\n\n Object.keys(state.choice).some(function(key) {\n const save = input.save();\n const node = state.choice[key];\n try {\n const value = node._decode(input, options);\n if (input.isError(value))\n return false;\n\n result = { type: key, value: value };\n match = true;\n } catch (e) {\n input.restore(save);\n return false;\n }\n return true;\n }, this);\n\n if (!match)\n return input.error('Choice not matched');\n\n return result;\n};\n\n//\n// Encoding\n//\n\nNode.prototype._createEncoderBuffer = function createEncoderBuffer(data) {\n return new EncoderBuffer(data, this.reporter);\n};\n\nNode.prototype._encode = function encode(data, reporter, parent) {\n const state = this._baseState;\n if (state['default'] !== null && state['default'] === data)\n return;\n\n const result = this._encodeValue(data, reporter, parent);\n if (result === undefined)\n return;\n\n if (this._skipDefault(result, reporter, parent))\n return;\n\n return result;\n};\n\nNode.prototype._encodeValue = function encode(data, reporter, parent) {\n const state = this._baseState;\n\n // Decode root node\n if (state.parent === null)\n return state.children[0]._encode(data, reporter || new Reporter());\n\n let result = null;\n\n // Set reporter to share it with a child class\n this.reporter = reporter;\n\n // Check if data is there\n if (state.optional && data === undefined) {\n if (state['default'] !== null)\n data = state['default'];\n else\n return;\n }\n\n // Encode children first\n let content = null;\n let primitive = false;\n if (state.any) {\n // Anything that was given is translated to buffer\n result = this._createEncoderBuffer(data);\n } else if (state.choice) {\n result = this._encodeChoice(data, reporter);\n } else if (state.contains) {\n content = this._getUse(state.contains, parent)._encode(data, reporter);\n primitive = true;\n } else if (state.children) {\n content = state.children.map(function(child) {\n if (child._baseState.tag === 'null_')\n return child._encode(null, reporter, data);\n\n if (child._baseState.key === null)\n return reporter.error('Child should have a key');\n const prevKey = reporter.enterKey(child._baseState.key);\n\n if (typeof data !== 'object')\n return reporter.error('Child expected, but input is not object');\n\n const res = child._encode(data[child._baseState.key], reporter, data);\n reporter.leaveKey(prevKey);\n\n return res;\n }, this).filter(function(child) {\n return child;\n });\n content = this._createEncoderBuffer(content);\n } else {\n if (state.tag === 'seqof' || state.tag === 'setof') {\n // TODO(indutny): this should be thrown on DSL level\n if (!(state.args && state.args.length === 1))\n return reporter.error('Too many args for : ' + state.tag);\n\n if (!Array.isArray(data))\n return reporter.error('seqof/setof, but data is not Array');\n\n const child = this.clone();\n child._baseState.implicit = null;\n content = this._createEncoderBuffer(data.map(function(item) {\n const state = this._baseState;\n\n return this._getUse(state.args[0], data)._encode(item, reporter);\n }, child));\n } else if (state.use !== null) {\n result = this._getUse(state.use, parent)._encode(data, reporter);\n } else {\n content = this._encodePrimitive(state.tag, data);\n primitive = true;\n }\n }\n\n // Encode data itself\n if (!state.any && state.choice === null) {\n const tag = state.implicit !== null ? state.implicit : state.tag;\n const cls = state.implicit === null ? 'universal' : 'context';\n\n if (tag === null) {\n if (state.use === null)\n reporter.error('Tag could be omitted only for .use()');\n } else {\n if (state.use === null)\n result = this._encodeComposite(tag, primitive, cls, content);\n }\n }\n\n // Wrap in explicit\n if (state.explicit !== null)\n result = this._encodeComposite(state.explicit, false, 'context', result);\n\n return result;\n};\n\nNode.prototype._encodeChoice = function encodeChoice(data, reporter) {\n const state = this._baseState;\n\n const node = state.choice[data.type];\n if (!node) {\n assert(\n false,\n data.type + ' not found in ' +\n JSON.stringify(Object.keys(state.choice)));\n }\n return node._encode(data.value, reporter);\n};\n\nNode.prototype._encodePrimitive = function encodePrimitive(tag, data) {\n const state = this._baseState;\n\n if (/str$/.test(tag))\n return this._encodeStr(data, tag);\n else if (tag === 'objid' && state.args)\n return this._encodeObjid(data, state.reverseArgs[0], state.args[1]);\n else if (tag === 'objid')\n return this._encodeObjid(data, null, null);\n else if (tag === 'gentime' || tag === 'utctime')\n return this._encodeTime(data, tag);\n else if (tag === 'null_')\n return this._encodeNull();\n else if (tag === 'int' || tag === 'enum')\n return this._encodeInt(data, state.args && state.reverseArgs[0]);\n else if (tag === 'bool')\n return this._encodeBool(data);\n else if (tag === 'objDesc')\n return this._encodeStr(data, tag);\n else\n throw new Error('Unsupported tag: ' + tag);\n};\n\nNode.prototype._isNumstr = function isNumstr(str) {\n return /^[0-9 ]*$/.test(str);\n};\n\nNode.prototype._isPrintstr = function isPrintstr(str) {\n return /^[A-Za-z0-9 '()+,-./:=?]*$/.test(str);\n};\n","'use strict';\n\nconst inherits = require('inherits');\n\nfunction Reporter(options) {\n this._reporterState = {\n obj: null,\n path: [],\n options: options || {},\n errors: []\n };\n}\nexports.Reporter = Reporter;\n\nReporter.prototype.isError = function isError(obj) {\n return obj instanceof ReporterError;\n};\n\nReporter.prototype.save = function save() {\n const state = this._reporterState;\n\n return { obj: state.obj, pathLen: state.path.length };\n};\n\nReporter.prototype.restore = function restore(data) {\n const state = this._reporterState;\n\n state.obj = data.obj;\n state.path = state.path.slice(0, data.pathLen);\n};\n\nReporter.prototype.enterKey = function enterKey(key) {\n return this._reporterState.path.push(key);\n};\n\nReporter.prototype.exitKey = function exitKey(index) {\n const state = this._reporterState;\n\n state.path = state.path.slice(0, index - 1);\n};\n\nReporter.prototype.leaveKey = function leaveKey(index, key, value) {\n const state = this._reporterState;\n\n this.exitKey(index);\n if (state.obj !== null)\n state.obj[key] = value;\n};\n\nReporter.prototype.path = function path() {\n return this._reporterState.path.join('/');\n};\n\nReporter.prototype.enterObject = function enterObject() {\n const state = this._reporterState;\n\n const prev = state.obj;\n state.obj = {};\n return prev;\n};\n\nReporter.prototype.leaveObject = function leaveObject(prev) {\n const state = this._reporterState;\n\n const now = state.obj;\n state.obj = prev;\n return now;\n};\n\nReporter.prototype.error = function error(msg) {\n let err;\n const state = this._reporterState;\n\n const inherited = msg instanceof ReporterError;\n if (inherited) {\n err = msg;\n } else {\n err = new ReporterError(state.path.map(function(elem) {\n return '[' + JSON.stringify(elem) + ']';\n }).join(''), msg.message || msg, msg.stack);\n }\n\n if (!state.options.partial)\n throw err;\n\n if (!inherited)\n state.errors.push(err);\n\n return err;\n};\n\nReporter.prototype.wrapResult = function wrapResult(result) {\n const state = this._reporterState;\n if (!state.options.partial)\n return result;\n\n return {\n result: this.isError(result) ? null : result,\n errors: state.errors\n };\n};\n\nfunction ReporterError(path, msg) {\n this.path = path;\n this.rethrow(msg);\n}\ninherits(ReporterError, Error);\n\nReporterError.prototype.rethrow = function rethrow(msg) {\n this.message = msg + ' at: ' + (this.path || '(shallow)');\n if (Error.captureStackTrace)\n Error.captureStackTrace(this, ReporterError);\n\n if (!this.stack) {\n try {\n // IE only adds stack when thrown\n throw new Error(this.message);\n } catch (e) {\n this.stack = e.stack;\n }\n }\n return this;\n};\n","'use strict';\n\n// Helper\nfunction reverse(map) {\n const res = {};\n\n Object.keys(map).forEach(function(key) {\n // Convert key to integer if it is stringified\n if ((key | 0) == key)\n key = key | 0;\n\n const value = map[key];\n res[value] = key;\n });\n\n return res;\n}\n\nexports.tagClass = {\n 0: 'universal',\n 1: 'application',\n 2: 'context',\n 3: 'private'\n};\nexports.tagClassByName = reverse(exports.tagClass);\n\nexports.tag = {\n 0x00: 'end',\n 0x01: 'bool',\n 0x02: 'int',\n 0x03: 'bitstr',\n 0x04: 'octstr',\n 0x05: 'null_',\n 0x06: 'objid',\n 0x07: 'objDesc',\n 0x08: 'external',\n 0x09: 'real',\n 0x0a: 'enum',\n 0x0b: 'embed',\n 0x0c: 'utf8str',\n 0x0d: 'relativeOid',\n 0x10: 'seq',\n 0x11: 'set',\n 0x12: 'numstr',\n 0x13: 'printstr',\n 0x14: 't61str',\n 0x15: 'videostr',\n 0x16: 'ia5str',\n 0x17: 'utctime',\n 0x18: 'gentime',\n 0x19: 'graphstr',\n 0x1a: 'iso646str',\n 0x1b: 'genstr',\n 0x1c: 'unistr',\n 0x1d: 'charstr',\n 0x1e: 'bmpstr'\n};\nexports.tagByName = reverse(exports.tag);\n",null,null,null,null,null,null,"/*\n * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\npackage kotlin.reflect\n\nimport findAssociatedObject\n\n/**\n * The experimental marker for associated objects API.\n *\n * Any usage of a declaration annotated with `@ExperimentalAssociatedObjects` must be accepted either by\n * annotating that usage with the [OptIn] annotation, e.g. `@OptIn(ExperimentalAssociatedObjects::class)`,\n * or by using the compiler argument `-Xopt-in=kotlin.reflect.ExperimentalAssociatedObjects`.\n */\n@RequiresOptIn(level = RequiresOptIn.Level.ERROR)\n@Retention(value = AnnotationRetention.BINARY)\npublic annotation class ExperimentalAssociatedObjects\n\n/**\n * Makes the annotated annotation class an associated object key.\n *\n * An associated object key annotation should have single [KClass] parameter.\n * When applied to a class with reference to an object declaration as an argument, it binds\n * the object to the class, making this binding discoverable at runtime using [findAssociatedObject].\n */\n@ExperimentalAssociatedObjects\n@Retention(AnnotationRetention.BINARY)\n@Target(AnnotationTarget.ANNOTATION_CLASS)\npublic annotation class AssociatedObjectKey\n\n/**\n * If [T] is an @[AssociatedObjectKey]-annotated annotation class and [this] class is annotated with @[T] (`S::class`),\n * returns object `S`.\n *\n * Otherwise returns `null`.\n */\n@ExperimentalAssociatedObjects\npublic inline fun KClass<*>.findAssociatedObject(): Any? =\n this.findAssociatedObject(T::class)",null,null,"/*\n * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.\n * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.\n */\n\n@file:kotlin.jvm.JvmName(\"GroupingKt\")\n@file:kotlin.jvm.JvmMultifileClass\n\npackage kotlin.collections\n\n/**\n * Represents a source of elements with a [keyOf] function, which can be applied to each element to get its key.\n *\n * A [Grouping] structure serves as an intermediate step in group-and-fold operations:\n * they group elements by their keys and then fold each group with some aggregating operation.\n *\n * It is created by attaching `keySelector: (T) -> K` function to a source of elements.\n * To get an instance of [Grouping] use one of `groupingBy` extension functions:\n * - [Iterable.groupingBy]\n * - [Sequence.groupingBy]\n * - [Array.groupingBy]\n * - [CharSequence.groupingBy]\n *\n * For the list of group-and-fold operations available, see the [extension functions](#extension-functions) for `Grouping`.\n */\n@SinceKotlin(\"1.1\")\npublic interface Grouping {\n /** Returns an [Iterator] over the elements of the source of this grouping. */\n fun sourceIterator(): Iterator\n /** Extracts the key of an [element]. */\n fun keyOf(element: T): K\n}\n\n/**\n * Groups elements from the [Grouping] source by key and applies [operation] to the elements of each group sequentially,\n * passing the previously accumulated value and the current element as arguments, and stores the results in a new map.\n *\n * The key for each element is provided by the [Grouping.keyOf] function.\n *\n * @param operation function is invoked on each element with the following parameters:\n * - `key`: the key of the group this element belongs to;\n * - `accumulator`: the current value of the accumulator of the group, can be `null` if it's the first `element` encountered in the group;\n * - `element`: the element from the source being aggregated;\n * - `first`: indicates whether it's the first `element` encountered in the group.\n *\n * @return a [Map] associating the key of each group with the result of aggregation of the group elements.\n * @sample samples.collections.Grouping.aggregateByRadix\n */\n@SinceKotlin(\"1.1\")\npublic inline fun Grouping.aggregate(\n operation: (key: K, accumulator: R?, element: T, first: Boolean) -> R\n): Map {\n return aggregateTo(mutableMapOf(), operation)\n}\n\n/**\n * Groups elements from the [Grouping] source by key and applies [operation] to the elements of each group sequentially,\n * passing the previously accumulated value and the current element as arguments,\n * and stores the results in the given [destination] map.\n *\n * The key for each element is provided by the [Grouping.keyOf] function.\n *\n * @param operation a function that is invoked on each element with the following parameters:\n * - `key`: the key of the group this element belongs to;\n * - `accumulator`: the current value of the accumulator of the group, can be `null` if it's the first `element` encountered in the group;\n * - `element`: the element from the source being aggregated;\n * - `first`: indicates whether it's the first `element` encountered in the group.\n *\n * If the [destination] map already has a value corresponding to some key,\n * then the elements being aggregated for that key are never considered as `first`.\n *\n * @return the [destination] map associating the key of each group with the result of aggregation of the group elements.\n * @sample samples.collections.Grouping.aggregateByRadixTo\n */\n@SinceKotlin(\"1.1\")\npublic inline fun > Grouping.aggregateTo(\n destination: M,\n operation: (key: K, accumulator: R?, element: T, first: Boolean) -> R\n): M {\n for (e in this.sourceIterator()) {\n val key = keyOf(e)\n val accumulator = destination[key]\n destination[key] = operation(key, accumulator, e, accumulator == null && !destination.containsKey(key))\n }\n return destination\n}\n\n/**\n * Groups elements from the [Grouping] source by key and applies [operation] to the elements of each group sequentially,\n * passing the previously accumulated value and the current element as arguments, and stores the results in a new map.\n * An initial value of accumulator is provided by [initialValueSelector] function.\n *\n * @param initialValueSelector a function that provides an initial value of accumulator for each group.\n * It's invoked with parameters:\n * - `key`: the key of the group;\n * - `element`: the first element being encountered in that group.\n *\n * @param operation a function that is invoked on each element with the following parameters:\n * - `key`: the key of the group this element belongs to;\n * - `accumulator`: the current value of the accumulator of the group;\n * - `element`: the element from the source being accumulated.\n *\n * @return a [Map] associating the key of each group with the result of accumulating the group elements.\n * @sample samples.collections.Grouping.foldByEvenLengthWithComputedInitialValue\n */\n@SinceKotlin(\"1.1\")\npublic inline fun Grouping.fold(\n initialValueSelector: (key: K, element: T) -> R,\n operation: (key: K, accumulator: R, element: T) -> R\n): Map =\n @Suppress(\"UNCHECKED_CAST\")\n aggregate { key, acc, e, first -> operation(key, if (first) initialValueSelector(key, e) else acc as R, e) }\n\n/**\n * Groups elements from the [Grouping] source by key and applies [operation] to the elements of each group sequentially,\n * passing the previously accumulated value and the current element as arguments,\n * and stores the results in the given [destination] map.\n * An initial value of accumulator is provided by [initialValueSelector] function.\n *\n * @param initialValueSelector a function that provides an initial value of accumulator for each group.\n * It's invoked with parameters:\n * - `key`: the key of the group;\n * - `element`: the first element being encountered in that group.\n *\n * If the [destination] map already has a value corresponding to some key, that value is used as an initial value of\n * the accumulator for that group and the [initialValueSelector] function is not called for that group.\n *\n * @param operation a function that is invoked on each element with the following parameters:\n * - `key`: the key of the group this element belongs to;\n * - `accumulator`: the current value of the accumulator of the group;\n * - `element`: the element from the source being accumulated.\n *\n * @return the [destination] map associating the key of each group with the result of accumulating the group elements.\n * @sample samples.collections.Grouping.foldByEvenLengthWithComputedInitialValueTo\n */\n@SinceKotlin(\"1.1\")\npublic inline fun > Grouping.foldTo(\n destination: M,\n initialValueSelector: (key: K, element: T) -> R,\n operation: (key: K, accumulator: R, element: T) -> R\n): M =\n @Suppress(\"UNCHECKED_CAST\")\n aggregateTo(destination) { key, acc, e, first -> operation(key, if (first) initialValueSelector(key, e) else acc as R, e) }\n\n\n/**\n * Groups elements from the [Grouping] source by key and applies [operation] to the elements of each group sequentially,\n * passing the previously accumulated value and the current element as arguments, and stores the results in a new map.\n * An initial value of accumulator is the same [initialValue] for each group.\n *\n * @param operation a function that is invoked on each element with the following parameters:\n * - `accumulator`: the current value of the accumulator of the group;\n * - `element`: the element from the source being accumulated.\n *\n * @return a [Map] associating the key of each group with the result of accumulating the group elements.\n * @sample samples.collections.Grouping.foldByEvenLengthWithConstantInitialValue\n */\n@SinceKotlin(\"1.1\")\npublic inline fun Grouping.fold(\n initialValue: R,\n operation: (accumulator: R, element: T) -> R\n): Map =\n @Suppress(\"UNCHECKED_CAST\")\n aggregate { _, acc, e, first -> operation(if (first) initialValue else acc as R, e) }\n\n/**\n * Groups elements from the [Grouping] source by key and applies [operation] to the elements of each group sequentially,\n * passing the previously accumulated value and the current element as arguments,\n * and stores the results in the given [destination] map.\n * An initial value of accumulator is the same [initialValue] for each group.\n *\n * If the [destination] map already has a value corresponding to the key of some group,\n * that value is used as an initial value of the accumulator for that group.\n *\n * @param operation a function that is invoked on each element with the following parameters:\n * - `accumulator`: the current value of the accumulator of the group;\n * - `element`: the element from the source being accumulated.\n *\n * @return the [destination] map associating the key of each group with the result of accumulating the group elements.\n * @sample samples.collections.Grouping.foldByEvenLengthWithConstantInitialValueTo\n */\n@SinceKotlin(\"1.1\")\npublic inline fun > Grouping.foldTo(\n destination: M,\n initialValue: R,\n operation: (accumulator: R, element: T) -> R\n): M =\n @Suppress(\"UNCHECKED_CAST\")\n aggregateTo(destination) { _, acc, e, first -> operation(if (first) initialValue else acc as R, e) }\n\n\n/**\n * Groups elements from the [Grouping] source by key and applies the reducing [operation] to the elements of each group\n * sequentially starting from the second element of the group,\n * passing the previously accumulated value and the current element as arguments,\n * and stores the results in a new map.\n * An initial value of accumulator is the first element of the group.\n *\n * @param operation a function that is invoked on each subsequent element of the group with the following parameters:\n * - `key`: the key of the group this element belongs to;\n * - `accumulator`: the current value of the accumulator of the group;\n * - `element`: the element from the source being accumulated.\n *\n * @return a [Map] associating the key of each group with the result of accumulating the group elements.\n * @sample samples.collections.Grouping.reduceByMaxVowels\n */\n@SinceKotlin(\"1.1\")\npublic inline fun Grouping.reduce(\n operation: (key: K, accumulator: S, element: T) -> S\n): Map =\n aggregate { key, acc, e, first ->\n @Suppress(\"UNCHECKED_CAST\")\n if (first) e else operation(key, acc as S, e)\n }\n\n/**\n * Groups elements from the [Grouping] source by key and applies the reducing [operation] to the elements of each group\n * sequentially starting from the second element of the group,\n * passing the previously accumulated value and the current element as arguments,\n * and stores the results in the given [destination] map.\n * An initial value of accumulator is the first element of the group.\n *\n * If the [destination] map already has a value corresponding to the key of some group,\n * that value is used as an initial value of the accumulator for that group and the first element of that group is also\n * subjected to the [operation].\n\n * @param operation a function that is invoked on each subsequent element of the group with the following parameters:\n * - `accumulator`: the current value of the accumulator of the group;\n * - `element`: the element from the source being folded;\n *\n * @return the [destination] map associating the key of each group with the result of accumulating the group elements.\n * @sample samples.collections.Grouping.reduceByMaxVowelsTo\n */\n@SinceKotlin(\"1.1\")\npublic inline fun > Grouping.reduceTo(\n destination: M,\n operation: (key: K, accumulator: S, element: T) -> S\n): M =\n aggregateTo(destination) { key, acc, e, first ->\n @Suppress(\"UNCHECKED_CAST\")\n if (first) e else operation(key, acc as S, e)\n }\n\n\n/**\n * Groups elements from the [Grouping] source by key and counts elements in each group to the given [destination] map.\n *\n * If the [destination] map already has a value corresponding to the key of some group,\n * that value is used as an initial value of the counter for that group.\n *\n * @return the [destination] map associating the key of each group with the count of elements in the group.\n *\n * @sample samples.collections.Grouping.groupingByEachCount\n */\n@SinceKotlin(\"1.1\")\npublic fun > Grouping.eachCountTo(destination: M): M =\n foldTo(destination, 0) { acc, _ -> acc + 1 }\n\n/*\n/**\n * Groups elements from the [Grouping] source by key and sums values provided by the [valueSelector] function for elements in each group\n * to the given [destination] map.\n *\n *\n * If the [destination] map already has a value corresponding to the key of some group,\n * that value is used as an initial value of the sum for that group.\n *\n * @return the [destination] map associating the key of each group with the sum of elements in the group.\n */\n@SinceKotlin(\"1.1\")\npublic inline fun > Grouping.eachSumOfTo(destination: M, valueSelector: (T) -> Int): M =\n foldTo(destination, 0) { acc, e -> acc + valueSelector(e)}\n*/\n\n\n/*\n// TODO: sum by long and by double overloads\n\npublic inline fun > Grouping.sumEachByLongTo(destination: M, valueSelector: (T) -> Long): M =\n foldTo(destination, 0L) { acc, e -> acc + valueSelector(e)}\n\npublic inline fun Grouping.sumEachByLong(valueSelector: (T) -> Long): Map =\n fold(0L) { acc, e -> acc + valueSelector(e)}\n\npublic inline fun > Grouping.sumEachByDoubleTo(destination: M, valueSelector: (T) -> Double): M =\n foldTo(destination, 0.0) { acc, e -> acc + valueSelector(e)}\n\npublic inline fun Grouping.sumEachByDouble(valueSelector: (T) -> Double): Map =\n fold(0.0) { acc, e -> acc + valueSelector(e)}\n*/\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"package kotlinx.html\r\n\r\nimport org.w3c.dom.events.*\r\n\r\ninterface TagConsumer {\r\n fun onTagStart(tag: Tag)\r\n fun onTagAttributeChange(tag: Tag, attribute: String, value: String?)\r\n fun onTagEvent(tag: Tag, event: String, value: (Event) -> Unit)\r\n fun onTagEnd(tag: Tag)\r\n fun onTagContent(content: CharSequence)\r\n fun onTagContentEntity(entity: Entities)\r\n fun onTagContentUnsafe(block: Unsafe.() -> Unit)\r\n fun onTagComment(content: CharSequence)\r\n fun onTagError(tag: Tag, exception: Throwable): Unit = throw exception\r\n fun finalize(): R\r\n}\r\n\r\n@HtmlTagMarker\r\ninterface Tag {\r\n val tagName: String\r\n val consumer: TagConsumer<*>\r\n val namespace: String?\r\n\r\n val attributes: MutableMap\r\n val attributesEntries: Collection>\r\n\r\n val inlineTag: Boolean\r\n val emptyTag: Boolean\r\n\r\n operator fun Entities.unaryPlus(): Unit {\r\n entity(this)\r\n }\r\n\r\n operator fun String.unaryPlus(): Unit {\r\n text(this)\r\n }\r\n\r\n fun text(s: String) {\r\n consumer.onTagContent(s)\r\n }\r\n\r\n fun text(n: Number) {\r\n text(n.toString())\r\n }\r\n\r\n fun entity(e: Entities) {\r\n consumer.onTagContentEntity(e)\r\n }\r\n\r\n fun comment(s: String) {\r\n consumer.onTagComment(s)\r\n }\r\n}\r\n\r\n@HtmlTagMarker\r\ninterface Unsafe {\r\n operator fun String.unaryPlus()\r\n operator fun Entities.unaryPlus() = +text\r\n\r\n fun raw(s: String) {\r\n +s\r\n }\r\n\r\n fun raw(entity: Entities) {\r\n +entity\r\n }\r\n\r\n fun raw(n: Number) {\r\n +n.toString()\r\n }\r\n}\r\n\r\ninterface AttributeEnum {\r\n val realValue: String\r\n}\r\n\r\ninline fun T.visit(crossinline block: T.() -> Unit) = visitTag { block() }\r\n\r\ninline fun T.visitAndFinalize(consumer: TagConsumer, crossinline block: T.() -> Unit): R\r\n = visitTagAndFinalize(consumer) { block() }\r\n\r\nfun attributesMapOf() = emptyMap\r\nfun attributesMapOf(key: String, value: String?): Map = when (value) {\r\n null -> emptyMap\r\n else -> singletonMapOf(key, value)\r\n}\r\n\r\nfun attributesMapOf(vararg pairs: String?): Map {\r\n var result: MutableMap? = null\r\n\r\n for (i in 0..pairs.size - 1 step 2) {\r\n val k = pairs[i]\r\n val v = pairs[i + 1]\r\n if (k != null && v != null) {\r\n if (result == null) {\r\n result = linkedMapOf()\r\n }\r\n result.put(k, v)\r\n }\r\n }\r\n\r\n return result ?: emptyMap\r\n}\r\n\r\nfun singletonMapOf(key: String, value: String): Map = SingletonStringMap(key, value)\r\n\r\nfun HTMLTag.unsafe(block: Unsafe.() -> Unit): Unit = consumer.onTagContentUnsafe(block)\r\n\r\nval emptyMap: Map = emptyMap()\r\n\r\nclass DefaultUnsafe : Unsafe {\r\n private val sb = StringBuilder()\r\n\r\n override fun String.unaryPlus() {\r\n sb.append(this)\r\n }\r\n\r\n override fun toString(): String = sb.toString()\r\n}\r\n\r\n@DslMarker\r\nannotation class HtmlTagMarker\r\n\r\ntypealias HtmlContent = FlowOrPhrasingContent\r\n\r\nprivate data class SingletonStringMap(override val key: String, override val value: String) : Map, Map.Entry {\r\n override val entries: Set>\r\n get() = setOf(this)\r\n\r\n override val keys: Set\r\n get() = setOf(key)\r\n\r\n override val size: Int\r\n get() = 1\r\n\r\n override val values: Collection\r\n get() = listOf(value)\r\n\r\n override fun containsKey(key: String) = key == this.key\r\n override fun containsValue(value: String) = value == this.value\r\n override fun get(key: String): String? = if (key == this.key) value else null\r\n override fun isEmpty() = false\r\n}\r\n","package kotlinx.html.attributes\r\n\r\nimport kotlinx.html.*\r\n\r\ninterface AttributeEncoder {\r\n fun encode(attributeName: String, value : T) : String\r\n fun decode(attributeName: String, value : String) : T\r\n fun empty(attributeName: String, tag: Tag) : T = throw IllegalStateException(\"Attribute $attributeName is not yet defined for tag ${tag.tagName}\")\r\n}\r\n\r\nabstract class Attribute(val encoder : AttributeEncoder) {\r\n open operator fun get(thisRef: Tag, attributeName: String) : T =\r\n thisRef.attributes[attributeName]?.let {\r\n encoder.decode(attributeName, it)\r\n } ?: encoder.empty(attributeName, thisRef)\r\n\r\n open operator fun set(thisRef: Tag, attributeName: String, value : T) {\r\n thisRef.attributes.put(attributeName, encoder.encode(attributeName, value))\r\n }\r\n}\r\n\r\nobject StringEncoder : AttributeEncoder {\r\n override fun encode(attributeName: String, value: String): String = value\r\n override fun decode(attributeName: String, value: String): String = value\r\n}\r\n\r\nclass StringAttribute : Attribute(StringEncoder)\r\n\r\n//public class IntAttribute : Attribute() {\r\n// override fun encode(desc: PropertyMetadata, value: Int): String = value.toString()\r\n// override fun decode(desc: PropertyMetadata, value: String): Int = value.toInt()\r\n//}\r\n\r\nfun Boolean.booleanEncode() = toString()\r\nclass BooleanEncoder(val trueValue: String = \"true\", val falseValue: String = \"false\") : AttributeEncoder {\r\n override fun encode(attributeName: String, value : Boolean): String = if (value) trueValue else falseValue\r\n override fun decode(attributeName: String, value: String): Boolean = when (value) {\r\n trueValue -> true\r\n falseValue -> false\r\n else -> throw IllegalArgumentException(\"Unknown value $value for $attributeName\")\r\n }\r\n}\r\n\r\nclass BooleanAttribute(trueValue: String = \"true\", falseValue: String = \"false\") : Attribute(BooleanEncoder(trueValue, falseValue))\r\n\r\nfun Boolean.tickerEncode(attributeName: String) : String = if (this) attributeName else \"\"\r\nobject TickerEncoder : AttributeEncoder {\r\n override fun encode(attributeName: String, value: Boolean): String = value.tickerEncode(attributeName)\r\n override fun decode(attributeName: String, value: String): Boolean = value == attributeName\r\n}\r\n\r\nclass TickerAttribute : Attribute(TickerEncoder) {\r\n override fun set(thisRef: Tag, attributeName: String, value: Boolean) {\r\n if (value) {\r\n thisRef.attributes.put(attributeName, attributeName)\r\n } else {\r\n thisRef.attributes.remove(attributeName)\r\n }\r\n }\r\n}\r\n\r\nclass EnumEncoder(val valuesMap : Map) : AttributeEncoder {\r\n override fun encode(attributeName: String, value: T): String = value.realValue\r\n override fun decode(attributeName: String, value: String): T = valuesMap[value] ?: throw IllegalArgumentException(\"Unknown value $value for $attributeName\")\r\n}\r\n\r\nfun AttributeEnum.enumEncode() : String = realValue\r\nclass EnumAttribute(val values : Map) : Attribute(EnumEncoder(values))\r\n\r\nfun stringSetDecode(value: String?): Set? = value?.split(\"\\\\s+\".toRegex())?.filterNot {it.isEmpty()}?.toSet()\r\nfun Set.stringSetEncode() = joinToString(\" \")\r\nobject StringSetEncoder : AttributeEncoder> {\r\n override fun encode(attributeName: String, value: Set): String = value.joinToString(\" \")\r\n override fun decode(attributeName: String, value: String): Set = stringSetDecode(value)!!\r\n override fun empty(attributeName: String, tag: Tag) = emptySet()\r\n}\r\nclass StringSetAttribute : Attribute>(StringSetEncoder)","package kotlinx.html.impl\r\n\r\nimport kotlinx.html.*\r\n\r\nclass DelegatingMap(initialValues : Map, private val tag : Tag, private val consumer : () -> TagConsumer<*>) : MutableMap {\r\n private var backing: Map = initialValues\r\n private var backingMutable = false\r\n\r\n override val size: Int\r\n get() = backing.size\r\n\r\n override fun isEmpty(): Boolean = backing.isEmpty()\r\n\r\n override fun containsKey(key: String): Boolean = backing.containsKey(key)\r\n override fun containsValue(value: String): Boolean = backing.containsValue(value)\r\n override fun get(key: String): String? = backing[key]\r\n\r\n override fun put(key: String, value: String): String? {\r\n val mutable = switchToMutable()\r\n\r\n val old = mutable.put(key, value)\r\n if (old != value) {\r\n consumer().onTagAttributeChange(tag, key, value)\r\n }\r\n\r\n return old\r\n }\r\n\r\n override fun remove(key: String): String? {\r\n val mutable = switchToMutable()\r\n\r\n return mutable.remove(key)?.let { removed ->\r\n consumer().onTagAttributeChange(tag, key, null)\r\n removed\r\n }\r\n }\r\n\r\n override fun putAll(from: Map) {\r\n if (from.isEmpty()) return\r\n\r\n val consumer = consumer()\r\n val mutable = switchToMutable()\r\n\r\n from.entries.forEach { e ->\r\n if (mutable.put(e.key, e.value) != e.value) {\r\n consumer.onTagAttributeChange(tag, e.key, e.value)\r\n }\r\n }\r\n }\r\n\r\n override fun clear() {\r\n backing.forEach { e -> consumer().onTagAttributeChange(tag, e.key, null) }\r\n backing = emptyMap()\r\n backingMutable = false\r\n }\r\n\r\n val immutableEntries: Collection>\r\n get() = backing.entries\r\n\r\n private fun switchToMutable(): MutableMap = if (backingMutable) {\r\n backing\r\n } else {\r\n backingMutable = true\r\n backing = LinkedHashMap(backing)\r\n backing\r\n } as MutableMap\r\n\r\n override val keys: MutableSet\r\n get() = switchToMutable().keys // TODO we need to handle changes too\r\n\r\n override val values: MutableCollection\r\n get() = switchToMutable().values // TODO we need to handle changes too\r\n\r\n override val entries: MutableSet>\r\n get() = switchToMutable().entries // TODO we need to handle changes too\r\n}\r\n","package kotlinx.html\r\n\r\nimport kotlinx.html.*\r\n\r\n/*******************************************************************************\r\n DO NOT EDIT\r\n This file was generated by module generate\r\n*******************************************************************************/\r\n\r\n@Suppress(\"unused\")\r\nenum class Dir(override val realValue : String) : AttributeEnum {\r\n ltr(\"ltr\"),\r\n rtl(\"rtl\")\r\n}\r\n\r\ninternal val dirValues : Map = Dir.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nenum class Draggable(override val realValue : String) : AttributeEnum {\r\n htmlTrue(\"true\"),\r\n htmlFalse(\"false\"),\r\n auto(\"auto\")\r\n}\r\n\r\ninternal val draggableValues : Map = Draggable.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nenum class RunAt(override val realValue : String) : AttributeEnum {\r\n server(\"server\")\r\n}\r\n\r\ninternal val runAtValues : Map = RunAt.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nobject ATarget {\r\n val blank : String = \"_blank\"\r\n val parent : String = \"_parent\"\r\n val self : String = \"_self\"\r\n val top : String = \"_top\"\r\n\r\n val values : List = listOf(\"blank\", \"parent\", \"self\", \"top\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nobject ARel {\r\n val alternate : String = \"Alternate\"\r\n val appEndIx : String = \"Appendix\"\r\n val bookmark : String = \"Bookmark\"\r\n val chapter : String = \"Chapter\"\r\n val contentS : String = \"Contents\"\r\n val copyright : String = \"Copyright\"\r\n val glossary : String = \"Glossary\"\r\n val help : String = \"Help\"\r\n val index : String = \"Index\"\r\n val next : String = \"Next\"\r\n val prev : String = \"Prev\"\r\n val section : String = \"Section\"\r\n val start : String = \"Start\"\r\n val stylesheet : String = \"Stylesheet\"\r\n val subsection : String = \"Subsection\"\r\n\r\n val values : List = listOf(\"alternate\", \"appEndIx\", \"bookmark\", \"chapter\", \"contentS\", \"copyright\", \"glossary\", \"help\", \"index\", \"next\", \"prev\", \"section\", \"start\", \"stylesheet\", \"subsection\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nobject AType {\r\n val textAsp : String = \"text/asp\"\r\n val textAsa : String = \"text/asa\"\r\n val textCss : String = \"text/css\"\r\n val textHtml : String = \"text/html\"\r\n val textJavaScript : String = \"text/javascript\"\r\n val textPlain : String = \"text/plain\"\r\n val textScriptLet : String = \"text/scriptlet\"\r\n val textXComponent : String = \"text/x-component\"\r\n val textXHtmlInsertion : String = \"text/x-html-insertion\"\r\n val textXml : String = \"text/xml\"\r\n\r\n val values : List = listOf(\"textAsp\", \"textAsa\", \"textCss\", \"textHtml\", \"textJavaScript\", \"textPlain\", \"textScriptLet\", \"textXComponent\", \"textXHtmlInsertion\", \"textXml\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nenum class AreaShape(override val realValue : String) : AttributeEnum {\r\n rect(\"rect\"),\r\n circle(\"circle\"),\r\n poly(\"poly\"),\r\n default(\"default\")\r\n}\r\n\r\ninternal val areaShapeValues : Map = AreaShape.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nobject AreaTarget {\r\n val blank : String = \"_blank\"\r\n val parent : String = \"_parent\"\r\n val self : String = \"_self\"\r\n val top : String = \"_top\"\r\n\r\n val values : List = listOf(\"blank\", \"parent\", \"self\", \"top\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nobject AreaRel {\r\n val alternate : String = \"Alternate\"\r\n val appEndIx : String = \"Appendix\"\r\n val bookmark : String = \"Bookmark\"\r\n val chapter : String = \"Chapter\"\r\n val contentS : String = \"Contents\"\r\n val copyright : String = \"Copyright\"\r\n val glossary : String = \"Glossary\"\r\n val help : String = \"Help\"\r\n val index : String = \"Index\"\r\n val next : String = \"Next\"\r\n val prev : String = \"Prev\"\r\n val section : String = \"Section\"\r\n val start : String = \"Start\"\r\n val stylesheet : String = \"Stylesheet\"\r\n val subsection : String = \"Subsection\"\r\n\r\n val values : List = listOf(\"alternate\", \"appEndIx\", \"bookmark\", \"chapter\", \"contentS\", \"copyright\", \"glossary\", \"help\", \"index\", \"next\", \"prev\", \"section\", \"start\", \"stylesheet\", \"subsection\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nobject BaseTarget {\r\n val blank : String = \"_blank\"\r\n val parent : String = \"_parent\"\r\n val self : String = \"_self\"\r\n val top : String = \"_top\"\r\n\r\n val values : List = listOf(\"blank\", \"parent\", \"self\", \"top\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nenum class ButtonFormEncType(override val realValue : String) : AttributeEnum {\r\n multipartFormData(\"multipart/form-data\"),\r\n applicationXWwwFormUrlEncoded(\"application/x-www-form-urlencoded\"),\r\n textPlain(\"text/plain\")\r\n}\r\n\r\ninternal val buttonFormEncTypeValues : Map = ButtonFormEncType.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nenum class ButtonFormMethod(override val realValue : String) : AttributeEnum {\r\n get(\"get\"),\r\n post(\"post\"),\r\n @Deprecated(\"method is not allowed in browsers\") put(\"put\"),\r\n @Deprecated(\"method is not allowed in browsers\") delete(\"delete\"),\r\n @Deprecated(\"method is not allowed in browsers\") patch(\"patch\")\r\n}\r\n\r\ninternal val buttonFormMethodValues : Map = ButtonFormMethod.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nobject ButtonFormTarget {\r\n val blank : String = \"_blank\"\r\n val parent : String = \"_parent\"\r\n val self : String = \"_self\"\r\n val top : String = \"_top\"\r\n\r\n val values : List = listOf(\"blank\", \"parent\", \"self\", \"top\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nenum class ButtonType(override val realValue : String) : AttributeEnum {\r\n button(\"button\"),\r\n reset(\"reset\"),\r\n submit(\"submit\")\r\n}\r\n\r\ninternal val buttonTypeValues : Map = ButtonType.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nenum class CommandType(override val realValue : String) : AttributeEnum {\r\n command(\"command\"),\r\n checkBox(\"checkbox\"),\r\n radio(\"radio\")\r\n}\r\n\r\ninternal val commandTypeValues : Map = CommandType.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nenum class FormEncType(override val realValue : String) : AttributeEnum {\r\n multipartFormData(\"multipart/form-data\"),\r\n applicationXWwwFormUrlEncoded(\"application/x-www-form-urlencoded\"),\r\n textPlain(\"text/plain\")\r\n}\r\n\r\ninternal val formEncTypeValues : Map = FormEncType.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nenum class FormMethod(override val realValue : String) : AttributeEnum {\r\n get(\"get\"),\r\n post(\"post\"),\r\n @Deprecated(\"method is not allowed in browsers\") put(\"put\"),\r\n @Deprecated(\"method is not allowed in browsers\") delete(\"delete\"),\r\n @Deprecated(\"method is not allowed in browsers\") patch(\"patch\")\r\n}\r\n\r\ninternal val formMethodValues : Map = FormMethod.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nobject FormTarget {\r\n val blank : String = \"_blank\"\r\n val parent : String = \"_parent\"\r\n val self : String = \"_self\"\r\n val top : String = \"_top\"\r\n\r\n val values : List = listOf(\"blank\", \"parent\", \"self\", \"top\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nobject IframeName {\r\n val blank : String = \"_blank\"\r\n val parent : String = \"_parent\"\r\n val self : String = \"_self\"\r\n val top : String = \"_top\"\r\n\r\n val values : List = listOf(\"blank\", \"parent\", \"self\", \"top\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nenum class IframeSandbox(override val realValue : String) : AttributeEnum {\r\n allowSameOrigin(\"allow-same-origin\"),\r\n allowFormS(\"allow-forms\"),\r\n allowScripts(\"allow-scripts\")\r\n}\r\n\r\ninternal val iframeSandboxValues : Map = IframeSandbox.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nenum class InputType(override val realValue : String) : AttributeEnum {\r\n button(\"button\"),\r\n checkBox(\"checkbox\"),\r\n color(\"color\"),\r\n date(\"date\"),\r\n dateTime(\"datetime\"),\r\n dateTimeLocal(\"datetime-local\"),\r\n email(\"email\"),\r\n file(\"file\"),\r\n hidden(\"hidden\"),\r\n image(\"image\"),\r\n month(\"month\"),\r\n number(\"number\"),\r\n password(\"password\"),\r\n radio(\"radio\"),\r\n range(\"range\"),\r\n reset(\"reset\"),\r\n search(\"search\"),\r\n submit(\"submit\"),\r\n text(\"text\"),\r\n tel(\"tel\"),\r\n time(\"time\"),\r\n url(\"url\"),\r\n week(\"week\")\r\n}\r\n\r\ninternal val inputTypeValues : Map = InputType.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nenum class InputFormEncType(override val realValue : String) : AttributeEnum {\r\n multipartFormData(\"multipart/form-data\"),\r\n applicationXWwwFormUrlEncoded(\"application/x-www-form-urlencoded\"),\r\n textPlain(\"text/plain\")\r\n}\r\n\r\ninternal val inputFormEncTypeValues : Map = InputFormEncType.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nenum class InputFormMethod(override val realValue : String) : AttributeEnum {\r\n get(\"get\"),\r\n post(\"post\"),\r\n @Deprecated(\"method is not allowed in browsers\") put(\"put\"),\r\n @Deprecated(\"method is not allowed in browsers\") delete(\"delete\"),\r\n @Deprecated(\"method is not allowed in browsers\") patch(\"patch\")\r\n}\r\n\r\ninternal val inputFormMethodValues : Map = InputFormMethod.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nobject InputFormTarget {\r\n val blank : String = \"_blank\"\r\n val parent : String = \"_parent\"\r\n val self : String = \"_self\"\r\n val top : String = \"_top\"\r\n\r\n val values : List = listOf(\"blank\", \"parent\", \"self\", \"top\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nenum class KeyGenKeyType(override val realValue : String) : AttributeEnum {\r\n rsa(\"rsa\")\r\n}\r\n\r\ninternal val keyGenKeyTypeValues : Map = KeyGenKeyType.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nobject LinkRel {\r\n val alternate : String = \"Alternate\"\r\n val appEndIx : String = \"Appendix\"\r\n val bookmark : String = \"Bookmark\"\r\n val chapter : String = \"Chapter\"\r\n val contentS : String = \"Contents\"\r\n val copyright : String = \"Copyright\"\r\n val glossary : String = \"Glossary\"\r\n val help : String = \"Help\"\r\n val index : String = \"Index\"\r\n val next : String = \"Next\"\r\n val prev : String = \"Prev\"\r\n val section : String = \"Section\"\r\n val start : String = \"Start\"\r\n val stylesheet : String = \"Stylesheet\"\r\n val subsection : String = \"Subsection\"\r\n\r\n val values : List = listOf(\"alternate\", \"appEndIx\", \"bookmark\", \"chapter\", \"contentS\", \"copyright\", \"glossary\", \"help\", \"index\", \"next\", \"prev\", \"section\", \"start\", \"stylesheet\", \"subsection\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nobject LinkMedia {\r\n val screen : String = \"screen\"\r\n val print : String = \"print\"\r\n val tty : String = \"tty\"\r\n val tv : String = \"tv\"\r\n val projection : String = \"projection\"\r\n val handheld : String = \"handheld\"\r\n val braille : String = \"braille\"\r\n val aural : String = \"aural\"\r\n val all : String = \"all\"\r\n\r\n val values : List = listOf(\"screen\", \"print\", \"tty\", \"tv\", \"projection\", \"handheld\", \"braille\", \"aural\", \"all\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nobject LinkType {\r\n val textAsp : String = \"text/asp\"\r\n val textAsa : String = \"text/asa\"\r\n val textCss : String = \"text/css\"\r\n val textHtml : String = \"text/html\"\r\n val textJavaScript : String = \"text/javascript\"\r\n val textPlain : String = \"text/plain\"\r\n val textScriptLet : String = \"text/scriptlet\"\r\n val textXComponent : String = \"text/x-component\"\r\n val textXHtmlInsertion : String = \"text/x-html-insertion\"\r\n val textXml : String = \"text/xml\"\r\n\r\n val values : List = listOf(\"textAsp\", \"textAsa\", \"textCss\", \"textHtml\", \"textJavaScript\", \"textPlain\", \"textScriptLet\", \"textXComponent\", \"textXHtmlInsertion\", \"textXml\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nobject MetaHttpEquiv {\r\n val contentLanguage : String = \"content-language\"\r\n val contentType : String = \"content-type\"\r\n val defaultStyle : String = \"default-style\"\r\n val refresh : String = \"refresh\"\r\n\r\n val values : List = listOf(\"contentLanguage\", \"contentType\", \"defaultStyle\", \"refresh\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nobject ObjectName {\r\n val blank : String = \"_blank\"\r\n val parent : String = \"_parent\"\r\n val self : String = \"_self\"\r\n val top : String = \"_top\"\r\n\r\n val values : List = listOf(\"blank\", \"parent\", \"self\", \"top\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nobject ScriptType {\r\n val textEcmaScript : String = \"text/ecmascript\"\r\n val textJavaScript : String = \"text/javascript\"\r\n val textJavaScript10 : String = \"text/javascript1.0\"\r\n val textJavaScript11 : String = \"text/javascript1.1\"\r\n val textJavaScript12 : String = \"text/javascript1.2\"\r\n val textJavaScript13 : String = \"text/javascript1.3\"\r\n val textJavaScript14 : String = \"text/javascript1.4\"\r\n val textJavaScript15 : String = \"text/javascript1.5\"\r\n val textJScript : String = \"text/jscript\"\r\n val textXJavaScript : String = \"text/x-javascript\"\r\n val textXEcmaScript : String = \"text/x-ecmascript\"\r\n val textVbScript : String = \"text/vbscript\"\r\n\r\n val values : List = listOf(\"textEcmaScript\", \"textJavaScript\", \"textJavaScript10\", \"textJavaScript11\", \"textJavaScript12\", \"textJavaScript13\", \"textJavaScript14\", \"textJavaScript15\", \"textJScript\", \"textXJavaScript\", \"textXEcmaScript\", \"textVbScript\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nobject StyleType {\r\n val textCss : String = \"text/css\"\r\n\r\n val values : List = listOf(\"textCss\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nobject StyleMedia {\r\n val screen : String = \"screen\"\r\n val print : String = \"print\"\r\n val tty : String = \"tty\"\r\n val tv : String = \"tv\"\r\n val projection : String = \"projection\"\r\n val handheld : String = \"handheld\"\r\n val braille : String = \"braille\"\r\n val aural : String = \"aural\"\r\n val all : String = \"all\"\r\n\r\n val values : List = listOf(\"screen\", \"print\", \"tty\", \"tv\", \"projection\", \"handheld\", \"braille\", \"aural\", \"all\")\r\n}\r\n\r\n@Suppress(\"unused\")\r\nenum class TextAreaWrap(override val realValue : String) : AttributeEnum {\r\n hard(\"hard\"),\r\n soft(\"soft\")\r\n}\r\n\r\ninternal val textAreaWrapValues : Map = TextAreaWrap.values().associateBy { it.realValue }\r\n@Suppress(\"unused\")\r\nenum class ThScope(override val realValue : String) : AttributeEnum {\r\n col(\"col\"),\r\n colGroup(\"colgroup\"),\r\n row(\"row\"),\r\n rowGroup(\"rowgroup\")\r\n}\r\n\r\ninternal val thScopeValues : Map = ThScope.values().associateBy { it.realValue }\r\n","package kotlinx.html\r\n\r\nimport kotlinx.html.*\r\nimport kotlinx.html.impl.*\r\nimport kotlinx.html.attributes.*\r\n\r\n/*******************************************************************************\r\n DO NOT EDIT\r\n This file was generated by module generate\r\n*******************************************************************************/\r\n\r\n@Suppress(\"unused\")\r\nopen class A(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"a\", consumer, initialAttributes, null, true, false), CommonAttributeGroupFacadeFlowInteractivePhrasingContent {\r\n var href : String\r\n get() = attributeStringString.get(this, \"href\")\r\n set(newValue) {attributeStringString.set(this, \"href\", newValue)}\r\n\r\n var target : String\r\n get() = attributeStringString.get(this, \"target\")\r\n set(newValue) {attributeStringString.set(this, \"target\", newValue)}\r\n\r\n var ping : String\r\n get() = attributeStringString.get(this, \"ping\")\r\n set(newValue) {attributeStringString.set(this, \"ping\", newValue)}\r\n\r\n var rel : String\r\n get() = attributeStringString.get(this, \"rel\")\r\n set(newValue) {attributeStringString.set(this, \"rel\", newValue)}\r\n\r\n var hrefLang : String\r\n get() = attributeStringString.get(this, \"hreflang\")\r\n set(newValue) {attributeStringString.set(this, \"hreflang\", newValue)}\r\n\r\n var type : String\r\n get() = attributeStringString.get(this, \"type\")\r\n set(newValue) {attributeStringString.set(this, \"type\", newValue)}\r\n\r\n\r\n}\r\nval A.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval A.asInteractiveContent : InteractiveContent\r\n get() = this\r\n\r\nval A.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class ABBR(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"abbr\", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag {\r\n\r\n}\r\nval ABBR.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval ABBR.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class ADDRESS(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"address\", consumer, initialAttributes, null, false, false), HtmlBlockTag {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class AREA(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"area\", consumer, initialAttributes, null, true, true), HtmlBlockInlineTag {\r\n var coords : String\r\n get() = attributeStringString.get(this, \"coords\")\r\n set(newValue) {attributeStringString.set(this, \"coords\", newValue)}\r\n\r\n var href : String\r\n get() = attributeStringString.get(this, \"href\")\r\n set(newValue) {attributeStringString.set(this, \"href\", newValue)}\r\n\r\n var hrefLang : String\r\n get() = attributeStringString.get(this, \"hreflang\")\r\n set(newValue) {attributeStringString.set(this, \"hreflang\", newValue)}\r\n\r\n var alt : String\r\n get() = attributeStringString.get(this, \"alt\")\r\n set(newValue) {attributeStringString.set(this, \"alt\", newValue)}\r\n\r\n var target : String\r\n get() = attributeStringString.get(this, \"target\")\r\n set(newValue) {attributeStringString.set(this, \"target\", newValue)}\r\n\r\n var media : String\r\n get() = attributeStringString.get(this, \"media\")\r\n set(newValue) {attributeStringString.set(this, \"media\", newValue)}\r\n\r\n var rel : String\r\n get() = attributeStringString.get(this, \"rel\")\r\n set(newValue) {attributeStringString.set(this, \"rel\", newValue)}\r\n\r\n var ping : String\r\n get() = attributeStringString.get(this, \"ping\")\r\n set(newValue) {attributeStringString.set(this, \"ping\", newValue)}\r\n\r\n var type : String\r\n get() = attributeStringString.get(this, \"type\")\r\n set(newValue) {attributeStringString.set(this, \"type\", newValue)}\r\n\r\n\r\n}\r\nval AREA.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval AREA.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class ARTICLE(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"article\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowSectioningContent {\r\n\r\n}\r\nval ARTICLE.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval ARTICLE.asSectioningContent : SectioningContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class ASIDE(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"aside\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowSectioningContent {\r\n\r\n}\r\nval ASIDE.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval ASIDE.asSectioningContent : SectioningContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class AUDIO(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"audio\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowInteractivePhrasingContent {\r\n var src : String\r\n get() = attributeStringString.get(this, \"src\")\r\n set(newValue) {attributeStringString.set(this, \"src\", newValue)}\r\n\r\n var autoBuffer : Boolean\r\n get() = attributeBooleanTicker.get(this, \"autobuffer\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"autobuffer\", newValue)}\r\n\r\n var autoPlay : Boolean\r\n get() = attributeBooleanTicker.get(this, \"autoplay\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"autoplay\", newValue)}\r\n\r\n var loop : Boolean\r\n get() = attributeBooleanTicker.get(this, \"loop\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"loop\", newValue)}\r\n\r\n var controls : Boolean\r\n get() = attributeBooleanTicker.get(this, \"controls\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"controls\", newValue)}\r\n\r\n\r\n}\r\n/**\r\n * Media source for \r\n */\r\n@HtmlTagMarker\r\ninline fun AUDIO.source(classes : String? = null, crossinline block : SOURCE.() -> Unit = {}) : Unit = SOURCE(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n\r\nval AUDIO.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval AUDIO.asInteractiveContent : InteractiveContent\r\n get() = this\r\n\r\nval AUDIO.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n","package kotlinx.html\r\n\r\nimport kotlinx.html.*\r\nimport kotlinx.html.impl.*\r\nimport kotlinx.html.attributes.*\r\n\r\n/*******************************************************************************\r\n DO NOT EDIT\r\n This file was generated by module generate\r\n*******************************************************************************/\r\n\r\n@Suppress(\"unused\")\r\nopen class B(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"b\", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag {\r\n\r\n}\r\nval B.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval B.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class BASE(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"base\", consumer, initialAttributes, null, true, true), HtmlHeadTag {\r\n var href : String\r\n get() = attributeStringString.get(this, \"href\")\r\n set(newValue) {attributeStringString.set(this, \"href\", newValue)}\r\n\r\n var target : String\r\n get() = attributeStringString.get(this, \"target\")\r\n set(newValue) {attributeStringString.set(this, \"target\", newValue)}\r\n\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class BDI(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"bdi\", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag {\r\n\r\n}\r\nval BDI.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval BDI.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class BDO(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"bdo\", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag {\r\n\r\n}\r\nval BDO.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval BDO.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class BLOCKQUOTE(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"blockquote\", consumer, initialAttributes, null, false, false), HtmlBlockTag {\r\n var cite : String\r\n get() = attributeStringString.get(this, \"cite\")\r\n set(newValue) {attributeStringString.set(this, \"cite\", newValue)}\r\n\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class BODY(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"body\", consumer, initialAttributes, null, false, false), HtmlBlockTag {\r\n var onAfterprint : String\r\n get() = attributeStringString.get(this, \"onafterprint\")\r\n set(newValue) {attributeStringString.set(this, \"onafterprint\", newValue)}\r\n\r\n var onBeforeprint : String\r\n get() = attributeStringString.get(this, \"onbeforeprint\")\r\n set(newValue) {attributeStringString.set(this, \"onbeforeprint\", newValue)}\r\n\r\n var onBeforeunLoad : String\r\n get() = attributeStringString.get(this, \"onbeforeunload\")\r\n set(newValue) {attributeStringString.set(this, \"onbeforeunload\", newValue)}\r\n\r\n var onHashChange : String\r\n get() = attributeStringString.get(this, \"onhashchange\")\r\n set(newValue) {attributeStringString.set(this, \"onhashchange\", newValue)}\r\n\r\n var onMessage : String\r\n get() = attributeStringString.get(this, \"onmessage\")\r\n set(newValue) {attributeStringString.set(this, \"onmessage\", newValue)}\r\n\r\n var onOffline : String\r\n get() = attributeStringString.get(this, \"onoffline\")\r\n set(newValue) {attributeStringString.set(this, \"onoffline\", newValue)}\r\n\r\n var onOnline : String\r\n get() = attributeStringString.get(this, \"ononline\")\r\n set(newValue) {attributeStringString.set(this, \"ononline\", newValue)}\r\n\r\n var onPopstate : String\r\n get() = attributeStringString.get(this, \"onpopstate\")\r\n set(newValue) {attributeStringString.set(this, \"onpopstate\", newValue)}\r\n\r\n var onRedo : String\r\n get() = attributeStringString.get(this, \"onredo\")\r\n set(newValue) {attributeStringString.set(this, \"onredo\", newValue)}\r\n\r\n var onResize : String\r\n get() = attributeStringString.get(this, \"onresize\")\r\n set(newValue) {attributeStringString.set(this, \"onresize\", newValue)}\r\n\r\n var onStorage : String\r\n get() = attributeStringString.get(this, \"onstorage\")\r\n set(newValue) {attributeStringString.set(this, \"onstorage\", newValue)}\r\n\r\n var onUndo : String\r\n get() = attributeStringString.get(this, \"onundo\")\r\n set(newValue) {attributeStringString.set(this, \"onundo\", newValue)}\r\n\r\n var onUnLoad : String\r\n get() = attributeStringString.get(this, \"onunload\")\r\n set(newValue) {attributeStringString.set(this, \"onunload\", newValue)}\r\n\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class BR(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"br\", consumer, initialAttributes, null, true, true), HtmlBlockInlineTag {\r\n\r\n}\r\nval BR.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval BR.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class BUTTON(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"button\", consumer, initialAttributes, null, true, false), CommonAttributeGroupFacadeFlowInteractivePhrasingContent {\r\n var autoFocus : Boolean\r\n get() = attributeBooleanTicker.get(this, \"autofocus\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"autofocus\", newValue)}\r\n\r\n var disabled : Boolean\r\n get() = attributeBooleanTicker.get(this, \"disabled\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"disabled\", newValue)}\r\n\r\n var form : String\r\n get() = attributeStringString.get(this, \"form\")\r\n set(newValue) {attributeStringString.set(this, \"form\", newValue)}\r\n\r\n var formAction : String\r\n get() = attributeStringString.get(this, \"formaction\")\r\n set(newValue) {attributeStringString.set(this, \"formaction\", newValue)}\r\n\r\n var formEncType : ButtonFormEncType\r\n get() = attributeButtonFormEncTypeEnumButtonFormEncTypeValues.get(this, \"formenctype\")\r\n set(newValue) {attributeButtonFormEncTypeEnumButtonFormEncTypeValues.set(this, \"formenctype\", newValue)}\r\n\r\n var formMethod : ButtonFormMethod\r\n get() = attributeButtonFormMethodEnumButtonFormMethodValues.get(this, \"formmethod\")\r\n set(newValue) {attributeButtonFormMethodEnumButtonFormMethodValues.set(this, \"formmethod\", newValue)}\r\n\r\n var formNovalidate : Boolean\r\n get() = attributeBooleanTicker.get(this, \"formnovalidate\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"formnovalidate\", newValue)}\r\n\r\n var formTarget : String\r\n get() = attributeStringString.get(this, \"formtarget\")\r\n set(newValue) {attributeStringString.set(this, \"formtarget\", newValue)}\r\n\r\n var name : String\r\n get() = attributeStringString.get(this, \"name\")\r\n set(newValue) {attributeStringString.set(this, \"name\", newValue)}\r\n\r\n var value : String\r\n get() = attributeStringString.get(this, \"value\")\r\n set(newValue) {attributeStringString.set(this, \"value\", newValue)}\r\n\r\n var type : ButtonType\r\n get() = attributeButtonTypeEnumButtonTypeValues.get(this, \"type\")\r\n set(newValue) {attributeButtonTypeEnumButtonTypeValues.set(this, \"type\", newValue)}\r\n\r\n\r\n}\r\nval BUTTON.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval BUTTON.asInteractiveContent : InteractiveContent\r\n get() = this\r\n\r\nval BUTTON.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n","package kotlinx.html\r\n\r\nimport kotlinx.html.*\r\nimport kotlinx.html.impl.*\r\nimport kotlinx.html.attributes.*\r\n\r\n/*******************************************************************************\r\n DO NOT EDIT\r\n This file was generated by module generate\r\n*******************************************************************************/\r\n\r\n@Suppress(\"unused\")\r\nopen class DATALIST(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"datalist\", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag {\r\n\r\n}\r\n/**\r\n * Selectable choice\r\n */\r\n@HtmlTagMarker\r\ninline fun DATALIST.option(classes : String? = null, crossinline block : OPTION.() -> Unit = {}) : Unit = OPTION(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n/**\r\n * Selectable choice\r\n */\r\n@HtmlTagMarker\r\nfun DATALIST.option(classes : String? = null, content : String = \"\") : Unit = OPTION(attributesMapOf(\"class\", classes), consumer).visit({+content})\r\n\r\nval DATALIST.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval DATALIST.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class DD(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"dd\", consumer, initialAttributes, null, false, false), HtmlBlockTag {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class DEL(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"del\", consumer, initialAttributes, null, false, false), HtmlBlockInlineTag {\r\n var cite : String\r\n get() = attributeStringString.get(this, \"cite\")\r\n set(newValue) {attributeStringString.set(this, \"cite\", newValue)}\r\n\r\n var dateTime : String\r\n get() = attributeStringString.get(this, \"datetime\")\r\n set(newValue) {attributeStringString.set(this, \"datetime\", newValue)}\r\n\r\n\r\n}\r\nval DEL.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval DEL.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class DETAILS(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"details\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowInteractiveContent {\r\n var open : Boolean\r\n get() = attributeBooleanTicker.get(this, \"open\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"open\", newValue)}\r\n\r\n\r\n}\r\n/**\r\n * Fieldset legend\r\n */\r\n@HtmlTagMarker\r\ninline fun DETAILS.legend(classes : String? = null, crossinline block : LEGEND.() -> Unit = {}) : Unit = LEGEND(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n\r\nval DETAILS.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval DETAILS.asInteractiveContent : InteractiveContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class DFN(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"dfn\", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag {\r\n\r\n}\r\nval DFN.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval DFN.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class DIALOG(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"dialog\", consumer, initialAttributes, null, false, false), HtmlBlockTag {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class DIV(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"div\", consumer, initialAttributes, null, false, false), HtmlBlockTag {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class DL(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"dl\", consumer, initialAttributes, null, false, false), HtmlBlockTag {\r\n\r\n}\r\n/**\r\n * Definition description\r\n */\r\n@HtmlTagMarker\r\ninline fun DL.dd(classes : String? = null, crossinline block : DD.() -> Unit = {}) : Unit = DD(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n\r\n/**\r\n * Definition term\r\n */\r\n@HtmlTagMarker\r\ninline fun DL.dt(classes : String? = null, crossinline block : DT.() -> Unit = {}) : Unit = DT(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class DT(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"dt\", consumer, initialAttributes, null, false, false), HtmlInlineTag {\r\n\r\n}\r\n\r\n","package kotlinx.html\r\n\r\nimport kotlinx.html.*\r\nimport kotlinx.html.impl.*\r\nimport kotlinx.html.attributes.*\r\n\r\n/*******************************************************************************\r\n DO NOT EDIT\r\n This file was generated by module generate\r\n*******************************************************************************/\r\n\r\n@Suppress(\"unused\")\r\nopen class FIELDSET(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"fieldset\", consumer, initialAttributes, null, false, false), HtmlBlockTag {\r\n var disabled : Boolean\r\n get() = attributeBooleanTicker.get(this, \"disabled\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"disabled\", newValue)}\r\n\r\n var form : String\r\n get() = attributeStringString.get(this, \"form\")\r\n set(newValue) {attributeStringString.set(this, \"form\", newValue)}\r\n\r\n var name : String\r\n get() = attributeStringString.get(this, \"name\")\r\n set(newValue) {attributeStringString.set(this, \"name\", newValue)}\r\n\r\n\r\n}\r\n/**\r\n * Fieldset legend\r\n */\r\n@HtmlTagMarker\r\ninline fun FIELDSET.legend(classes : String? = null, crossinline block : LEGEND.() -> Unit = {}) : Unit = LEGEND(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class FIGCAPTION(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"figcaption\", consumer, initialAttributes, null, false, false), HtmlBlockTag {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class FIGURE(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"figure\", consumer, initialAttributes, null, false, false), HtmlBlockTag {\r\n\r\n}\r\n/**\r\n * Fieldset legend\r\n */\r\n@HtmlTagMarker\r\ninline fun FIGURE.legend(classes : String? = null, crossinline block : LEGEND.() -> Unit = {}) : Unit = LEGEND(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n\r\n/**\r\n * Caption for \r\n */\r\n@HtmlTagMarker\r\ninline fun FIGURE.figcaption(classes : String? = null, crossinline block : FIGCAPTION.() -> Unit = {}) : Unit = FIGCAPTION(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class FOOTER(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"footer\", consumer, initialAttributes, null, false, false), HtmlBlockTag {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class FORM(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"form\", consumer, initialAttributes, null, false, false), HtmlBlockTag {\r\n var acceptCharset : String\r\n get() = attributeStringString.get(this, \"accept-charset\")\r\n set(newValue) {attributeStringString.set(this, \"accept-charset\", newValue)}\r\n\r\n var action : String\r\n get() = attributeStringString.get(this, \"action\")\r\n set(newValue) {attributeStringString.set(this, \"action\", newValue)}\r\n\r\n var autoComplete : Boolean\r\n get() = attributeBooleanBooleanOnOff.get(this, \"autocomplete\")\r\n set(newValue) {attributeBooleanBooleanOnOff.set(this, \"autocomplete\", newValue)}\r\n\r\n var encType : FormEncType\r\n get() = attributeFormEncTypeEnumFormEncTypeValues.get(this, \"enctype\")\r\n set(newValue) {attributeFormEncTypeEnumFormEncTypeValues.set(this, \"enctype\", newValue)}\r\n\r\n var method : FormMethod\r\n get() = attributeFormMethodEnumFormMethodValues.get(this, \"method\")\r\n set(newValue) {attributeFormMethodEnumFormMethodValues.set(this, \"method\", newValue)}\r\n\r\n var name : String\r\n get() = attributeStringString.get(this, \"name\")\r\n set(newValue) {attributeStringString.set(this, \"name\", newValue)}\r\n\r\n var novalidate : Boolean\r\n get() = attributeBooleanTicker.get(this, \"novalidate\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"novalidate\", newValue)}\r\n\r\n var target : String\r\n get() = attributeStringString.get(this, \"target\")\r\n set(newValue) {attributeStringString.set(this, \"target\", newValue)}\r\n\r\n\r\n}\r\n\r\n","package kotlinx.html\r\n\r\nimport kotlinx.html.*\r\nimport kotlinx.html.impl.*\r\nimport kotlinx.html.attributes.*\r\n\r\n/*******************************************************************************\r\n DO NOT EDIT\r\n This file was generated by module generate\r\n*******************************************************************************/\r\n\r\n@Suppress(\"unused\")\r\nopen class H1(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"h1\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowHeadingPhrasingContent {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class H2(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"h2\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowHeadingPhrasingContent {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class H3(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"h3\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowHeadingPhrasingContent {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class H4(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"h4\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowHeadingPhrasingContent {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class H5(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"h5\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowHeadingPhrasingContent {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class H6(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"h6\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowHeadingPhrasingContent {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class HEAD(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"head\", consumer, initialAttributes, null, false, false), HtmlHeadTag {\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override operator fun Entities.unaryPlus() : Unit {\r\n @Suppress(\"DEPRECATION\") entity(this)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override operator fun String.unaryPlus() : Unit {\r\n @Suppress(\"DEPRECATION\") text(this)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override fun text(s : String) : Unit {\r\n super.text(s)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override fun text(n : Number) : Unit {\r\n super.text(n)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override fun entity(e : Entities) : Unit {\r\n super.entity(e)\r\n }\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class HEADER(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"header\", consumer, initialAttributes, null, false, false), HtmlBlockTag {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class HGROUP(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"hgroup\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowHeadingContent {\r\n\r\n}\r\n/**\r\n * Heading\r\n */\r\n@HtmlTagMarker\r\ninline fun HGROUP.h1(classes : String? = null, crossinline block : H1.() -> Unit = {}) : Unit = H1(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n\r\n/**\r\n * Heading\r\n */\r\n@HtmlTagMarker\r\ninline fun HGROUP.h2(classes : String? = null, crossinline block : H2.() -> Unit = {}) : Unit = H2(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n\r\n/**\r\n * Heading\r\n */\r\n@HtmlTagMarker\r\ninline fun HGROUP.h3(classes : String? = null, crossinline block : H3.() -> Unit = {}) : Unit = H3(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n\r\n/**\r\n * Heading\r\n */\r\n@HtmlTagMarker\r\ninline fun HGROUP.h4(classes : String? = null, crossinline block : H4.() -> Unit = {}) : Unit = H4(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n\r\n/**\r\n * Heading\r\n */\r\n@HtmlTagMarker\r\ninline fun HGROUP.h5(classes : String? = null, crossinline block : H5.() -> Unit = {}) : Unit = H5(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n\r\n/**\r\n * Heading\r\n */\r\n@HtmlTagMarker\r\ninline fun HGROUP.h6(classes : String? = null, crossinline block : H6.() -> Unit = {}) : Unit = H6(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n\r\nval HGROUP.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval HGROUP.asHeadingContent : HeadingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class HR(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"hr\", consumer, initialAttributes, null, false, true), HtmlBlockTag {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class HTML(initialAttributes : Map, override val consumer : TagConsumer<*>, namespace : String? = null) : HTMLTag(\"html\", consumer, initialAttributes, namespace, false, false), CommonAttributeGroupFacade {\r\n var manifest : String\r\n get() = attributeStringString.get(this, \"manifest\")\r\n set(newValue) {attributeStringString.set(this, \"manifest\", newValue)}\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override operator fun Entities.unaryPlus() : Unit {\r\n @Suppress(\"DEPRECATION\") entity(this)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override operator fun String.unaryPlus() : Unit {\r\n @Suppress(\"DEPRECATION\") text(this)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override fun text(s : String) : Unit {\r\n super.text(s)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override fun text(n : Number) : Unit {\r\n super.text(n)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override fun entity(e : Entities) : Unit {\r\n super.entity(e)\r\n }\r\n\r\n}\r\n/**\r\n * Document body\r\n */\r\n@HtmlTagMarker\r\ninline fun HTML.body(classes : String? = null, crossinline block : BODY.() -> Unit = {}) : Unit = BODY(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n\r\n/**\r\n * Document head\r\n */\r\n@HtmlTagMarker\r\ninline fun HTML.head(crossinline block : HEAD.() -> Unit = {}) : Unit = HEAD(emptyMap, consumer).visit(block)\r\n@Deprecated(\"This tag doesn't support content or requires unsafe (try unsafe {})\")\r\n@Suppress(\"DEPRECATION\")\r\n/**\r\n * Document head\r\n */\r\n@HtmlTagMarker\r\nfun HTML.head(content : String = \"\") : Unit = HEAD(emptyMap, consumer).visit({+content})\r\n\r\n\r\n","package kotlinx.html\r\n\r\nimport kotlinx.html.*\r\nimport kotlinx.html.impl.*\r\nimport kotlinx.html.attributes.*\r\n\r\n/*******************************************************************************\r\n DO NOT EDIT\r\n This file was generated by module generate\r\n*******************************************************************************/\r\n\r\n@Suppress(\"unused\")\r\nopen class I(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"i\", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag {\r\n\r\n}\r\nval I.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval I.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class IFRAME(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"iframe\", consumer, initialAttributes, null, true, false), CommonAttributeGroupFacadeFlowInteractivePhrasingContent {\r\n var name : String\r\n get() = attributeStringString.get(this, \"name\")\r\n set(newValue) {attributeStringString.set(this, \"name\", newValue)}\r\n\r\n var src : String\r\n get() = attributeStringString.get(this, \"src\")\r\n set(newValue) {attributeStringString.set(this, \"src\", newValue)}\r\n\r\n var height : String\r\n get() = attributeStringString.get(this, \"height\")\r\n set(newValue) {attributeStringString.set(this, \"height\", newValue)}\r\n\r\n var width : String\r\n get() = attributeStringString.get(this, \"width\")\r\n set(newValue) {attributeStringString.set(this, \"width\", newValue)}\r\n\r\n var sandbox : IframeSandbox\r\n get() = attributeIframeSandboxEnumIframeSandboxValues.get(this, \"sandbox\")\r\n set(newValue) {attributeIframeSandboxEnumIframeSandboxValues.set(this, \"sandbox\", newValue)}\r\n\r\n var seamless : Boolean\r\n get() = attributeBooleanTicker.get(this, \"seamless\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"seamless\", newValue)}\r\n\r\n\r\n}\r\nval IFRAME.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval IFRAME.asInteractiveContent : InteractiveContent\r\n get() = this\r\n\r\nval IFRAME.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class IMG(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"img\", consumer, initialAttributes, null, true, true), CommonAttributeGroupFacadeFlowInteractivePhrasingContent {\r\n var alt : String\r\n get() = attributeStringString.get(this, \"alt\")\r\n set(newValue) {attributeStringString.set(this, \"alt\", newValue)}\r\n\r\n var src : String\r\n get() = attributeStringString.get(this, \"src\")\r\n set(newValue) {attributeStringString.set(this, \"src\", newValue)}\r\n\r\n var height : String\r\n get() = attributeStringString.get(this, \"height\")\r\n set(newValue) {attributeStringString.set(this, \"height\", newValue)}\r\n\r\n var width : String\r\n get() = attributeStringString.get(this, \"width\")\r\n set(newValue) {attributeStringString.set(this, \"width\", newValue)}\r\n\r\n var usemap : String\r\n get() = attributeStringString.get(this, \"usemap\")\r\n set(newValue) {attributeStringString.set(this, \"usemap\", newValue)}\r\n\r\n var ismap : Boolean\r\n get() = attributeBooleanTicker.get(this, \"ismap\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"ismap\", newValue)}\r\n\r\n\r\n}\r\nval IMG.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval IMG.asInteractiveContent : InteractiveContent\r\n get() = this\r\n\r\nval IMG.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class INPUT(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"input\", consumer, initialAttributes, null, true, true), CommonAttributeGroupFacadeFlowInteractivePhrasingContent {\r\n var type : InputType\r\n get() = attributeInputTypeEnumInputTypeValues.get(this, \"type\")\r\n set(newValue) {attributeInputTypeEnumInputTypeValues.set(this, \"type\", newValue)}\r\n\r\n var accept : String\r\n get() = attributeStringString.get(this, \"accept\")\r\n set(newValue) {attributeStringString.set(this, \"accept\", newValue)}\r\n\r\n var alt : String\r\n get() = attributeStringString.get(this, \"alt\")\r\n set(newValue) {attributeStringString.set(this, \"alt\", newValue)}\r\n\r\n var autoFocus : Boolean\r\n get() = attributeBooleanTicker.get(this, \"autofocus\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"autofocus\", newValue)}\r\n\r\n var autoComplete : Boolean\r\n get() = attributeBooleanBooleanOnOff.get(this, \"autocomplete\")\r\n set(newValue) {attributeBooleanBooleanOnOff.set(this, \"autocomplete\", newValue)}\r\n\r\n var checked : Boolean\r\n get() = attributeBooleanTicker.get(this, \"checked\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"checked\", newValue)}\r\n\r\n var disabled : Boolean\r\n get() = attributeBooleanTicker.get(this, \"disabled\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"disabled\", newValue)}\r\n\r\n var form : String\r\n get() = attributeStringString.get(this, \"form\")\r\n set(newValue) {attributeStringString.set(this, \"form\", newValue)}\r\n\r\n var formAction : String\r\n get() = attributeStringString.get(this, \"formaction\")\r\n set(newValue) {attributeStringString.set(this, \"formaction\", newValue)}\r\n\r\n var formEncType : InputFormEncType\r\n get() = attributeInputFormEncTypeEnumInputFormEncTypeValues.get(this, \"formenctype\")\r\n set(newValue) {attributeInputFormEncTypeEnumInputFormEncTypeValues.set(this, \"formenctype\", newValue)}\r\n\r\n var formMethod : InputFormMethod\r\n get() = attributeInputFormMethodEnumInputFormMethodValues.get(this, \"formmethod\")\r\n set(newValue) {attributeInputFormMethodEnumInputFormMethodValues.set(this, \"formmethod\", newValue)}\r\n\r\n var formNovalidate : Boolean\r\n get() = attributeBooleanTicker.get(this, \"formnovalidate\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"formnovalidate\", newValue)}\r\n\r\n var formTarget : String\r\n get() = attributeStringString.get(this, \"formtarget\")\r\n set(newValue) {attributeStringString.set(this, \"formtarget\", newValue)}\r\n\r\n var height : String\r\n get() = attributeStringString.get(this, \"height\")\r\n set(newValue) {attributeStringString.set(this, \"height\", newValue)}\r\n\r\n var list : String\r\n get() = attributeStringString.get(this, \"list\")\r\n set(newValue) {attributeStringString.set(this, \"list\", newValue)}\r\n\r\n var max : String\r\n get() = attributeStringString.get(this, \"max\")\r\n set(newValue) {attributeStringString.set(this, \"max\", newValue)}\r\n\r\n var maxLength : String\r\n get() = attributeStringString.get(this, \"maxlength\")\r\n set(newValue) {attributeStringString.set(this, \"maxlength\", newValue)}\r\n\r\n var minLength : String\r\n get() = attributeStringString.get(this, \"minlength\")\r\n set(newValue) {attributeStringString.set(this, \"minlength\", newValue)}\r\n\r\n var min : String\r\n get() = attributeStringString.get(this, \"min\")\r\n set(newValue) {attributeStringString.set(this, \"min\", newValue)}\r\n\r\n var multiple : Boolean\r\n get() = attributeBooleanTicker.get(this, \"multiple\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"multiple\", newValue)}\r\n\r\n var pattern : String\r\n get() = attributeStringString.get(this, \"pattern\")\r\n set(newValue) {attributeStringString.set(this, \"pattern\", newValue)}\r\n\r\n var placeholder : String\r\n get() = attributeStringString.get(this, \"placeholder\")\r\n set(newValue) {attributeStringString.set(this, \"placeholder\", newValue)}\r\n\r\n var readonly : Boolean\r\n get() = attributeBooleanTicker.get(this, \"readonly\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"readonly\", newValue)}\r\n\r\n var required : Boolean\r\n get() = attributeBooleanTicker.get(this, \"required\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"required\", newValue)}\r\n\r\n var size : String\r\n get() = attributeStringString.get(this, \"size\")\r\n set(newValue) {attributeStringString.set(this, \"size\", newValue)}\r\n\r\n var src : String\r\n get() = attributeStringString.get(this, \"src\")\r\n set(newValue) {attributeStringString.set(this, \"src\", newValue)}\r\n\r\n var step : String\r\n get() = attributeStringString.get(this, \"step\")\r\n set(newValue) {attributeStringString.set(this, \"step\", newValue)}\r\n\r\n var width : String\r\n get() = attributeStringString.get(this, \"width\")\r\n set(newValue) {attributeStringString.set(this, \"width\", newValue)}\r\n\r\n var files : String\r\n get() = attributeStringString.get(this, \"files\")\r\n set(newValue) {attributeStringString.set(this, \"files\", newValue)}\r\n\r\n var value : String\r\n get() = attributeStringString.get(this, \"value\")\r\n set(newValue) {attributeStringString.set(this, \"value\", newValue)}\r\n\r\n var name : String\r\n get() = attributeStringString.get(this, \"name\")\r\n set(newValue) {attributeStringString.set(this, \"name\", newValue)}\r\n\r\n\r\n}\r\nval INPUT.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval INPUT.asInteractiveContent : InteractiveContent\r\n get() = this\r\n\r\nval INPUT.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class INS(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"ins\", consumer, initialAttributes, null, false, false), HtmlBlockInlineTag {\r\n var cite : String\r\n get() = attributeStringString.get(this, \"cite\")\r\n set(newValue) {attributeStringString.set(this, \"cite\", newValue)}\r\n\r\n var dateTime : String\r\n get() = attributeStringString.get(this, \"datetime\")\r\n set(newValue) {attributeStringString.set(this, \"datetime\", newValue)}\r\n\r\n\r\n}\r\nval INS.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval INS.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n","package kotlinx.html\r\n\r\nimport kotlinx.html.*\r\nimport kotlinx.html.impl.*\r\nimport kotlinx.html.attributes.*\r\n\r\n/*******************************************************************************\r\n DO NOT EDIT\r\n This file was generated by module generate\r\n*******************************************************************************/\r\n\r\n@Suppress(\"unused\")\r\nopen class NAV(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"nav\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowSectioningContent {\r\n\r\n}\r\nval NAV.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval NAV.asSectioningContent : SectioningContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class NOSCRIPT(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"noscript\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowMetaDataPhrasingContent {\r\n\r\n}\r\nval NOSCRIPT.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval NOSCRIPT.asMetaDataContent : MetaDataContent\r\n get() = this\r\n\r\nval NOSCRIPT.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n","package kotlinx.html\r\n\r\nimport kotlinx.html.*\r\nimport kotlinx.html.impl.*\r\nimport kotlinx.html.attributes.*\r\n\r\n/*******************************************************************************\r\n DO NOT EDIT\r\n This file was generated by module generate\r\n*******************************************************************************/\r\n\r\n@Suppress(\"unused\")\r\nopen class SAMP(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"samp\", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag {\r\n\r\n}\r\nval SAMP.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval SAMP.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class SCRIPT(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"script\", consumer, initialAttributes, null, false, false), FlowMetaDataPhrasingContent {\r\n var charset : String\r\n get() = attributeStringString.get(this, \"charset\")\r\n set(newValue) {attributeStringString.set(this, \"charset\", newValue)}\r\n\r\n var type : String\r\n get() = attributeStringString.get(this, \"type\")\r\n set(newValue) {attributeStringString.set(this, \"type\", newValue)}\r\n\r\n var src : String\r\n get() = attributeStringString.get(this, \"src\")\r\n set(newValue) {attributeStringString.set(this, \"src\", newValue)}\r\n\r\n var defer : Boolean\r\n get() = attributeBooleanTicker.get(this, \"defer\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"defer\", newValue)}\r\n\r\n var async : Boolean\r\n get() = attributeBooleanTicker.get(this, \"async\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"async\", newValue)}\r\n\r\n var nonce : String\r\n get() = attributeStringString.get(this, \"nonce\")\r\n set(newValue) {attributeStringString.set(this, \"nonce\", newValue)}\r\n\r\n var integrity : String\r\n get() = attributeStringString.get(this, \"integrity\")\r\n set(newValue) {attributeStringString.set(this, \"integrity\", newValue)}\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override operator fun Entities.unaryPlus() : Unit {\r\n @Suppress(\"DEPRECATION\") entity(this)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override operator fun String.unaryPlus() : Unit {\r\n @Suppress(\"DEPRECATION\") text(this)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override fun text(s : String) : Unit {\r\n super.text(s)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override fun text(n : Number) : Unit {\r\n super.text(n)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override fun entity(e : Entities) : Unit {\r\n super.entity(e)\r\n }\r\n\r\n}\r\nval SCRIPT.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval SCRIPT.asMetaDataContent : MetaDataContent\r\n get() = this\r\n\r\nval SCRIPT.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class SECTION(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"section\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowSectioningContent {\r\n\r\n}\r\nval SECTION.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval SECTION.asSectioningContent : SectioningContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class SELECT(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"select\", consumer, initialAttributes, null, true, false), CommonAttributeGroupFacadeFlowInteractivePhrasingContent {\r\n var autoFocus : Boolean\r\n get() = attributeBooleanTicker.get(this, \"autofocus\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"autofocus\", newValue)}\r\n\r\n var disabled : Boolean\r\n get() = attributeBooleanTicker.get(this, \"disabled\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"disabled\", newValue)}\r\n\r\n var form : String\r\n get() = attributeStringString.get(this, \"form\")\r\n set(newValue) {attributeStringString.set(this, \"form\", newValue)}\r\n\r\n var multiple : Boolean\r\n get() = attributeBooleanTicker.get(this, \"multiple\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"multiple\", newValue)}\r\n\r\n var name : String\r\n get() = attributeStringString.get(this, \"name\")\r\n set(newValue) {attributeStringString.set(this, \"name\", newValue)}\r\n\r\n var size : String\r\n get() = attributeStringString.get(this, \"size\")\r\n set(newValue) {attributeStringString.set(this, \"size\", newValue)}\r\n\r\n var required : Boolean\r\n get() = attributeBooleanTicker.get(this, \"required\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"required\", newValue)}\r\n\r\n\r\n}\r\n/**\r\n * Selectable choice\r\n */\r\n@HtmlTagMarker\r\ninline fun SELECT.option(classes : String? = null, crossinline block : OPTION.() -> Unit = {}) : Unit = OPTION(attributesMapOf(\"class\", classes), consumer).visit(block)\r\n/**\r\n * Selectable choice\r\n */\r\n@HtmlTagMarker\r\nfun SELECT.option(classes : String? = null, content : String = \"\") : Unit = OPTION(attributesMapOf(\"class\", classes), consumer).visit({+content})\r\n\r\n/**\r\n * Option group\r\n */\r\n@HtmlTagMarker\r\ninline fun SELECT.optGroup(label : String? = null, classes : String? = null, crossinline block : OPTGROUP.() -> Unit = {}) : Unit = OPTGROUP(attributesMapOf(\"label\", label,\"class\", classes), consumer).visit(block)\r\n\r\nval SELECT.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval SELECT.asInteractiveContent : InteractiveContent\r\n get() = this\r\n\r\nval SELECT.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class SMALL(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"small\", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag {\r\n\r\n}\r\nval SMALL.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval SMALL.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class SOURCE(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"source\", consumer, initialAttributes, null, true, true), CommonAttributeGroupFacade {\r\n var src : String\r\n get() = attributeStringString.get(this, \"src\")\r\n set(newValue) {attributeStringString.set(this, \"src\", newValue)}\r\n\r\n var type : String\r\n get() = attributeStringString.get(this, \"type\")\r\n set(newValue) {attributeStringString.set(this, \"type\", newValue)}\r\n\r\n var media : String\r\n get() = attributeStringString.get(this, \"media\")\r\n set(newValue) {attributeStringString.set(this, \"media\", newValue)}\r\n\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class SPAN(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"span\", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag {\r\n\r\n}\r\nval SPAN.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval SPAN.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class STRONG(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"strong\", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag {\r\n\r\n}\r\nval STRONG.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval STRONG.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class STYLE(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"style\", consumer, initialAttributes, null, false, false), CommonAttributeGroupFacadeFlowMetaDataContent {\r\n var type : String\r\n get() = attributeStringString.get(this, \"type\")\r\n set(newValue) {attributeStringString.set(this, \"type\", newValue)}\r\n\r\n var media : String\r\n get() = attributeStringString.get(this, \"media\")\r\n set(newValue) {attributeStringString.set(this, \"media\", newValue)}\r\n\r\n var scoped : Boolean\r\n get() = attributeBooleanTicker.get(this, \"scoped\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"scoped\", newValue)}\r\n\r\n var nonce : String\r\n get() = attributeStringString.get(this, \"nonce\")\r\n set(newValue) {attributeStringString.set(this, \"nonce\", newValue)}\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override operator fun Entities.unaryPlus() : Unit {\r\n @Suppress(\"DEPRECATION\") entity(this)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override operator fun String.unaryPlus() : Unit {\r\n @Suppress(\"DEPRECATION\") text(this)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override fun text(s : String) : Unit {\r\n super.text(s)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override fun text(n : Number) : Unit {\r\n super.text(n)\r\n }\r\n\r\n @Deprecated(\"This tag most likely doesn't support text content or requires unsafe content (try unsafe {}\")\r\n override fun entity(e : Entities) : Unit {\r\n super.entity(e)\r\n }\r\n\r\n}\r\nval STYLE.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval STYLE.asMetaDataContent : MetaDataContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class SUB(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"sub\", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag {\r\n\r\n}\r\nval SUB.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval SUB.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class SUMMARY(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"summary\", consumer, initialAttributes, null, true, false), CommonAttributeGroupFacadeFlowHeadingPhrasingContent {\r\n\r\n}\r\n\r\n@Suppress(\"unused\")\r\nopen class SUP(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"sup\", consumer, initialAttributes, null, true, false), HtmlBlockInlineTag {\r\n\r\n}\r\nval SUP.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval SUP.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n@Suppress(\"unused\")\r\nopen class SVG(initialAttributes : Map, override val consumer : TagConsumer<*>) : HTMLTag(\"svg\", consumer, initialAttributes, \"http://www.w3.org/2000/svg\", false, false), HtmlBlockInlineTag {\r\n\r\n}\r\nval SVG.asFlowContent : FlowContent\r\n get() = this\r\n\r\nval SVG.asPhrasingContent : PhrasingContent\r\n get() = this\r\n\r\n\r\n","package kotlinx.html\r\n\r\nimport kotlinx.html.impl.*\r\n\r\nopen class HTMLTag(\r\n override val tagName : String,\r\n override val consumer : TagConsumer<*>,\r\n initialAttributes : Map,\r\n override val namespace : String? = null,\r\n override val inlineTag: Boolean,\r\n override val emptyTag: Boolean) : Tag {\r\n\r\n override val attributes : DelegatingMap = DelegatingMap(initialAttributes, this) { consumer }\r\n\r\n override val attributesEntries: Collection>\r\n get() = attributes.immutableEntries\r\n}\r\n","package kotlinx.html.stream\r\n\r\nimport kotlinx.html.*\r\nimport kotlinx.html.consumers.*\r\nimport org.w3c.dom.events.*\r\n\r\nclass HTMLStreamBuilder(val out : O, val prettyPrint : Boolean, val xhtmlCompatible: Boolean) : TagConsumer {\r\n private var level = 0\r\n private var ln = true\r\n\r\n override fun onTagStart(tag: Tag) {\r\n if (prettyPrint && !tag.inlineTag) {\r\n indent()\r\n }\r\n level++\r\n\r\n out.append(\"<\")\r\n out.append(tag.tagName)\r\n\r\n if (tag.namespace != null) {\r\n out.append(\" xmlns=\\\"\")\r\n out.append(tag.namespace)\r\n out.append(\"\\\"\")\r\n }\r\n\r\n if (tag.attributes.isNotEmpty()) {\r\n tag.attributesEntries.forEachIndexed { _, e ->\r\n if (!e.key.isValidXmlAttributeName()) {\r\n throw IllegalArgumentException(\"Tag ${tag.tagName} has invalid attribute name ${e.key}\")\r\n }\r\n\r\n out.append(' ')\r\n out.append(e.key)\r\n out.append(\"=\\\"\")\r\n out.escapeAppend(e.value)\r\n out.append('\\\"')\r\n }\r\n }\r\n\r\n if (xhtmlCompatible && tag.emptyTag) {\r\n out.append(\"/\")\r\n }\r\n\r\n out.append(\">\")\r\n ln = false\r\n }\r\n\r\n override fun onTagAttributeChange(tag : Tag, attribute: String, value: String?) {\r\n throw UnsupportedOperationException(\"tag attribute can't be changed as it was already written to the stream. Use with DelayedConsumer to be able to modify attributes\")\r\n }\r\n\r\n override fun onTagEvent(tag: Tag, event: String, value: (Event) -> Unit) {\r\n throw UnsupportedOperationException(\"you can't assign lambda event handler when building text\")\r\n }\r\n\r\n override fun onTagEnd(tag: Tag) {\r\n level--\r\n if (ln) {\r\n indent()\r\n }\r\n\r\n if (!tag.emptyTag) {\r\n out.append(\"\")\r\n }\r\n\r\n if (prettyPrint && !tag.inlineTag) {\r\n appendln()\r\n }\r\n }\r\n\r\n override fun onTagContent(content: CharSequence) {\r\n out.escapeAppend(content)\r\n ln = false\r\n }\r\n\r\n override fun onTagContentEntity(entity: Entities) {\r\n out.append(entity.text)\r\n ln = false\r\n }\r\n\r\n override fun finalize(): O = out\r\n\r\n override fun onTagContentUnsafe(block: Unsafe.() -> Unit) {\r\n UnsafeImpl.block()\r\n }\r\n\r\n override fun onTagComment(content: CharSequence) {\r\n if (prettyPrint) {\r\n indent()\r\n }\r\n\r\n out.append(\"\")\r\n\r\n ln = false\r\n }\r\n\r\n val UnsafeImpl = object : Unsafe {\r\n override operator fun String.unaryPlus() {\r\n out.append(this)\r\n }\r\n }\r\n\r\n private fun appendln() {\r\n if (prettyPrint && !ln) {\r\n out.append(\"\\n\")\r\n ln = true\r\n }\r\n }\r\n\r\n private fun indent() {\r\n if (prettyPrint) {\r\n if (!ln) {\r\n out.append(\"\\n\")\r\n }\r\n var remaining = level\r\n while (remaining >= 4) {\r\n out.append(\" \")\r\n remaining -= 4\r\n }\r\n while (remaining >= 2) {\r\n out.append(\" \")\r\n remaining -= 2\r\n }\r\n if (remaining > 0) {\r\n out.append(\" \")\r\n }\r\n ln = false\r\n }\r\n }\r\n}\r\n\r\nprivate val AVERAGE_PAGE_SIZE = 32768\r\n\r\nfun createHTML(prettyPrint: Boolean = true, xhtmlCompatible: Boolean = false): TagConsumer =\r\n HTMLStreamBuilder(StringBuilder(AVERAGE_PAGE_SIZE), prettyPrint, xhtmlCompatible).onFinalizeMap { sb, _ -> sb.toString() }.delayed()\r\n\r\nfun O.appendHTML(prettyPrint: Boolean = true, xhtmlCompatible: Boolean = false): TagConsumer =\r\n HTMLStreamBuilder(this, prettyPrint, xhtmlCompatible).delayed()\r\n\r\n@Deprecated(\"Should be resolved to the previous implementation\", level = DeprecationLevel.HIDDEN)\r\nfun O.appendHTML(prettyPrint: Boolean = true): TagConsumer =\r\n appendHTML(prettyPrint, false)\r\n\r\nprivate val escapeMap = mapOf(\r\n '<' to \"<\",\r\n '>' to \">\",\r\n '&' to \"&\",\r\n '\\\"' to \""\"\r\n).let { mappings ->\r\n val maxCode = mappings.keys.map { it.toInt() }.max() ?: -1\r\n\r\n Array(maxCode + 1) { mappings[it.toChar()] }\r\n}\r\n\r\nprivate val letterRangeLowerCase = 'a' .. 'z'\r\nprivate val letterRangeUpperCase = 'A' .. 'Z'\r\nprivate val digitRange = '0' .. '9'\r\n\r\nprivate fun Char._isLetter() = this in letterRangeLowerCase || this in letterRangeUpperCase\r\nprivate fun Char._isDigit() = this in digitRange\r\n\r\nprivate fun String.isValidXmlAttributeName() =\r\n !startsWithXml()\r\n && this.isNotEmpty()\r\n && (this[0]._isLetter() || this[0] == '_')\r\n && this.all { it._isLetter() || it._isDigit() || it in \"._:-\" }\r\n\r\nprivate fun String.startsWithXml() = length >= 3\r\n && (this[0].let { it == 'x' || it == 'X' })\r\n && (this[1].let { it == 'm' || it == 'M' })\r\n && (this[2].let { it == 'l' || it == 'L' })\r\n\r\nprivate fun Appendable.escapeAppend(s : CharSequence) {\r\n var lastIndex = 0\r\n val mappings = escapeMap\r\n val size = mappings.size\r\n\r\n for (idx in 0 .. s.length - 1) {\r\n val ch = s[idx].toInt()\r\n if (ch < 0 || ch >= size) continue\r\n val escape = mappings[ch]\r\n if (escape != null) {\r\n append(s.substring(lastIndex, idx))\r\n append(escape)\r\n lastIndex = idx + 1\r\n }\r\n }\r\n\r\n if (lastIndex < s.length) {\r\n append(s.substring(lastIndex, s.length))\r\n }\r\n}\r\n\r\nprivate fun Appendable.escapeComment(s: CharSequence) {\r\n var start = 0\r\n while (start < s.length) {\r\n val index = s.indexOf(\"--\")\r\n if (index == -1) {\r\n if (start == 0) {\r\n append(s)\r\n } else {\r\n append(s, start, s.length)\r\n }\r\n break\r\n }\r\n\r\n append(s, start, index)\r\n start += 2\r\n }\r\n}","package kotlinx.html.dom\r\n\r\nimport kotlinx.html.*\r\nimport kotlinx.html.consumers.*\r\nimport org.w3c.dom.*\r\nimport org.w3c.dom.events.*\r\n\r\n@Suppress(\"NOTHING_TO_INLINE\")\r\nprivate inline fun HTMLElement.setEvent(name: String, noinline callback : (Event) -> Unit) : Unit {\r\n asDynamic()[name] = callback\r\n}\r\n\r\nclass JSDOMBuilder(val document : Document) : TagConsumer {\r\n private val path = arrayListOf()\r\n private var lastLeaved : HTMLElement? = null\r\n\r\n override fun onTagStart(tag: Tag) {\r\n val element: HTMLElement = when {\r\n tag.namespace != null -> document.createElementNS(tag.namespace!!, tag.tagName).asDynamic()\r\n else -> document.createElement(tag.tagName) as HTMLElement\r\n }\r\n\r\n tag.attributesEntries.forEach {\r\n element.setAttribute(it.key, it.value)\r\n }\r\n\r\n if (path.isNotEmpty()) {\r\n path.last().appendChild(element)\r\n }\r\n\r\n path.add(element)\r\n }\r\n\r\n override fun onTagAttributeChange(tag: Tag, attribute: String, value: String?) {\r\n when {\r\n path.isEmpty() -> throw IllegalStateException(\"No current tag\")\r\n path.last().tagName.toLowerCase() != tag.tagName.toLowerCase() -> throw IllegalStateException(\"Wrong current tag\")\r\n else -> path.last().let { node ->\r\n if (value == null) {\r\n node.removeAttribute(attribute)\r\n } else {\r\n node.setAttribute(attribute, value)\r\n }\r\n }\r\n }\r\n }\r\n\r\n override fun onTagEvent(tag: Tag, event: String, value: (Event) -> Unit) {\r\n when {\r\n path.isEmpty() -> throw IllegalStateException(\"No current tag\")\r\n path.last().tagName.toLowerCase() != tag.tagName.toLowerCase() -> throw IllegalStateException(\"Wrong current tag\")\r\n else -> path.last().setEvent(event, value)\r\n }\r\n }\r\n\r\n override fun onTagEnd(tag: Tag) {\r\n if (path.isEmpty() || path.last().tagName.toLowerCase() != tag.tagName.toLowerCase()) {\r\n throw IllegalStateException(\"We haven't entered tag ${tag.tagName} but trying to leave\")\r\n }\r\n\r\n lastLeaved = path.removeAt(path.lastIndex)\r\n }\r\n\r\n override fun onTagContent(content: CharSequence) {\r\n if (path.isEmpty()) {\r\n throw IllegalStateException(\"No current DOM node\")\r\n }\r\n\r\n path.last().appendChild(document.createTextNode(content.toString()))\r\n }\r\n\r\n override fun onTagContentEntity(entity: Entities) {\r\n if (path.isEmpty()) {\r\n throw IllegalStateException(\"No current DOM node\")\r\n }\r\n\r\n // stupid hack as browsers doesn't support createEntityReference\r\n val s = document.createElement(\"span\") as HTMLElement\r\n s.innerHTML = entity.text\r\n path.last().appendChild(s.childNodes.asList().filter { it.nodeType == Node.TEXT_NODE }.first())\r\n\r\n // other solution would be\r\n// pathLast().innerHTML += entity.text\r\n }\r\n\r\n override fun onTagContentUnsafe(block: Unsafe.() -> Unit) {\r\n with(DefaultUnsafe()) {\r\n block()\r\n\r\n path.last().innerHTML += toString()\r\n }\r\n }\r\n\r\n\r\n override fun onTagComment(content: CharSequence) {\r\n if (path.isEmpty()) {\r\n throw IllegalStateException(\"No current DOM node\")\r\n }\r\n\r\n path.last().appendChild(document.createComment(content.toString()))\r\n }\r\n\r\n override fun finalize(): R = lastLeaved?.asR() ?: throw IllegalStateException(\"We can't finalize as there was no tags\")\r\n\r\n @Suppress(\"UNCHECKED_CAST\")\r\n private fun HTMLElement.asR(): R = this.asDynamic()\r\n\r\n}\r\n\r\n\r\n fun Document.createTree() : TagConsumer = JSDOMBuilder(this)\r\n val Document.create : TagConsumer\r\n get() = JSDOMBuilder(this)\r\n\r\nfun Node.append(block: TagConsumer.() -> Unit): List =\r\n ArrayList().let { result ->\r\n ownerDocumentExt.createTree().onFinalize { it, partial ->\r\n if (!partial) {\r\n result.add(it); appendChild(it)\r\n }\r\n }.block()\r\n\r\n result\r\n }\r\n\r\nfun Node.prepend(block: TagConsumer.() -> Unit): List =\r\n ArrayList().let { result ->\r\n ownerDocumentExt.createTree().onFinalize { it, partial ->\r\n if (!partial) {\r\n result.add(it)\r\n insertBefore(it, firstChild)\r\n }\r\n }.block()\r\n\r\n result\r\n }\r\n\r\nval HTMLElement.append: TagConsumer\r\n get() = ownerDocumentExt.createTree().onFinalize { element, partial ->\r\n if (!partial) {\r\n this@append.appendChild(element)\r\n }\r\n }\r\n\r\nval HTMLElement.prepend: TagConsumer\r\n get() = ownerDocumentExt.createTree().onFinalize { element, partial ->\r\n if (!partial) {\r\n this@prepend.insertBefore(element, this@prepend.firstChild)\r\n }\r\n }\r\n\r\nprivate val Node.ownerDocumentExt: Document\r\n get() = when {\r\n this is Document -> this\r\n else -> ownerDocument ?: throw IllegalStateException(\"Node has no ownerDocument\")\r\n }\r\n","package kotlinx.html\r\n\r\nimport kotlinx.html.*\r\nimport kotlinx.html.impl.*\r\n\r\n/*******************************************************************************\r\n DO NOT EDIT\r\n This file was generated by module generate\r\n*******************************************************************************/\r\n\r\ninterface CommonAttributeGroupFacade : Tag {\r\n}\r\nvar CommonAttributeGroupFacade.enableTheming : Boolean\r\n get() = attributeBooleanBoolean.get(this, \"EnableTheming\")\r\n set(newValue) {attributeBooleanBoolean.set(this, \"EnableTheming\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.enableViewState : Boolean\r\n get() = attributeBooleanBoolean.get(this, \"EnableViewState\")\r\n set(newValue) {attributeBooleanBoolean.set(this, \"EnableViewState\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.skinID : String\r\n get() = attributeStringString.get(this, \"SkinID\")\r\n set(newValue) {attributeStringString.set(this, \"SkinID\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.visible : Boolean\r\n get() = attributeBooleanBoolean.get(this, \"Visible\")\r\n set(newValue) {attributeBooleanBoolean.set(this, \"Visible\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.accessKey : String\r\n get() = attributeStringString.get(this, \"accesskey\")\r\n set(newValue) {attributeStringString.set(this, \"accesskey\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.classes : Set\r\n get() = attributeSetStringStringSet.get(this, \"class\")\r\n set(newValue) {attributeSetStringStringSet.set(this, \"class\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.contentEditable : Boolean\r\n get() = attributeBooleanBoolean.get(this, \"contenteditable\")\r\n set(newValue) {attributeBooleanBoolean.set(this, \"contenteditable\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.contextMenu : String\r\n get() = attributeStringString.get(this, \"contextmenu\")\r\n set(newValue) {attributeStringString.set(this, \"contextmenu\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.dataFolderName : String\r\n get() = attributeStringString.get(this, \"data-FolderName\")\r\n set(newValue) {attributeStringString.set(this, \"data-FolderName\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.dataMsgId : String\r\n get() = attributeStringString.get(this, \"data-MsgId\")\r\n set(newValue) {attributeStringString.set(this, \"data-MsgId\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.dir : Dir\r\n get() = attributeDirEnumDirValues.get(this, \"dir\")\r\n set(newValue) {attributeDirEnumDirValues.set(this, \"dir\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.draggable : Draggable\r\n get() = attributeDraggableEnumDraggableValues.get(this, \"draggable\")\r\n set(newValue) {attributeDraggableEnumDraggableValues.set(this, \"draggable\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.hidden : Boolean\r\n get() = attributeBooleanTicker.get(this, \"hidden\")\r\n set(newValue) {attributeBooleanTicker.set(this, \"hidden\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.id : String\r\n get() = attributeStringString.get(this, \"id\")\r\n set(newValue) {attributeStringString.set(this, \"id\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.itemProp : String\r\n get() = attributeStringString.get(this, \"itemprop\")\r\n set(newValue) {attributeStringString.set(this, \"itemprop\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.lang : String\r\n get() = attributeStringString.get(this, \"lang\")\r\n set(newValue) {attributeStringString.set(this, \"lang\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onAbort : String\r\n get() = attributeStringString.get(this, \"onabort\")\r\n set(newValue) {attributeStringString.set(this, \"onabort\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onBlur : String\r\n get() = attributeStringString.get(this, \"onblur\")\r\n set(newValue) {attributeStringString.set(this, \"onblur\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onCanPlay : String\r\n get() = attributeStringString.get(this, \"oncanplay\")\r\n set(newValue) {attributeStringString.set(this, \"oncanplay\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onCanPlayThrough : String\r\n get() = attributeStringString.get(this, \"oncanplaythrough\")\r\n set(newValue) {attributeStringString.set(this, \"oncanplaythrough\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onChange : String\r\n get() = attributeStringString.get(this, \"onchange\")\r\n set(newValue) {attributeStringString.set(this, \"onchange\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onClick : String\r\n get() = attributeStringString.get(this, \"onclick\")\r\n set(newValue) {attributeStringString.set(this, \"onclick\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onContextMenu : String\r\n get() = attributeStringString.get(this, \"oncontextmenu\")\r\n set(newValue) {attributeStringString.set(this, \"oncontextmenu\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDoubleClick : String\r\n get() = attributeStringString.get(this, \"ondblclick\")\r\n set(newValue) {attributeStringString.set(this, \"ondblclick\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDrag : String\r\n get() = attributeStringString.get(this, \"ondrag\")\r\n set(newValue) {attributeStringString.set(this, \"ondrag\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDragEnd : String\r\n get() = attributeStringString.get(this, \"ondragend\")\r\n set(newValue) {attributeStringString.set(this, \"ondragend\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDragEnter : String\r\n get() = attributeStringString.get(this, \"ondragenter\")\r\n set(newValue) {attributeStringString.set(this, \"ondragenter\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDragLeave : String\r\n get() = attributeStringString.get(this, \"ondragleave\")\r\n set(newValue) {attributeStringString.set(this, \"ondragleave\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDragOver : String\r\n get() = attributeStringString.get(this, \"ondragover\")\r\n set(newValue) {attributeStringString.set(this, \"ondragover\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDragStart : String\r\n get() = attributeStringString.get(this, \"ondragstart\")\r\n set(newValue) {attributeStringString.set(this, \"ondragstart\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDrop : String\r\n get() = attributeStringString.get(this, \"ondrop\")\r\n set(newValue) {attributeStringString.set(this, \"ondrop\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDurationChange : String\r\n get() = attributeStringString.get(this, \"ondurationchange\")\r\n set(newValue) {attributeStringString.set(this, \"ondurationchange\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onEmptied : String\r\n get() = attributeStringString.get(this, \"onemptied\")\r\n set(newValue) {attributeStringString.set(this, \"onemptied\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onEnded : String\r\n get() = attributeStringString.get(this, \"onended\")\r\n set(newValue) {attributeStringString.set(this, \"onended\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onError : String\r\n get() = attributeStringString.get(this, \"onerror\")\r\n set(newValue) {attributeStringString.set(this, \"onerror\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onFocus : String\r\n get() = attributeStringString.get(this, \"onfocus\")\r\n set(newValue) {attributeStringString.set(this, \"onfocus\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onFocusIn : String\r\n get() = attributeStringString.get(this, \"onfocusin\")\r\n set(newValue) {attributeStringString.set(this, \"onfocusin\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onFocusOut : String\r\n get() = attributeStringString.get(this, \"onfocusout\")\r\n set(newValue) {attributeStringString.set(this, \"onfocusout\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onFormChange : String\r\n get() = attributeStringString.get(this, \"onformchange\")\r\n set(newValue) {attributeStringString.set(this, \"onformchange\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onFormInput : String\r\n get() = attributeStringString.get(this, \"onforminput\")\r\n set(newValue) {attributeStringString.set(this, \"onforminput\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onInput : String\r\n get() = attributeStringString.get(this, \"oninput\")\r\n set(newValue) {attributeStringString.set(this, \"oninput\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onInvalid : String\r\n get() = attributeStringString.get(this, \"oninvalid\")\r\n set(newValue) {attributeStringString.set(this, \"oninvalid\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onKeyDown : String\r\n get() = attributeStringString.get(this, \"onkeydown\")\r\n set(newValue) {attributeStringString.set(this, \"onkeydown\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onKeyPress : String\r\n get() = attributeStringString.get(this, \"onkeypress\")\r\n set(newValue) {attributeStringString.set(this, \"onkeypress\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onKeyUp : String\r\n get() = attributeStringString.get(this, \"onkeyup\")\r\n set(newValue) {attributeStringString.set(this, \"onkeyup\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onLoad : String\r\n get() = attributeStringString.get(this, \"onload\")\r\n set(newValue) {attributeStringString.set(this, \"onload\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onLoadedData : String\r\n get() = attributeStringString.get(this, \"onloadeddata\")\r\n set(newValue) {attributeStringString.set(this, \"onloadeddata\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onLoadedMetaData : String\r\n get() = attributeStringString.get(this, \"onloadedmetadata\")\r\n set(newValue) {attributeStringString.set(this, \"onloadedmetadata\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onLoadStart : String\r\n get() = attributeStringString.get(this, \"onloadstart\")\r\n set(newValue) {attributeStringString.set(this, \"onloadstart\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onMouseDown : String\r\n get() = attributeStringString.get(this, \"onmousedown\")\r\n set(newValue) {attributeStringString.set(this, \"onmousedown\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onMouseMove : String\r\n get() = attributeStringString.get(this, \"onmousemove\")\r\n set(newValue) {attributeStringString.set(this, \"onmousemove\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onMouseOut : String\r\n get() = attributeStringString.get(this, \"onmouseout\")\r\n set(newValue) {attributeStringString.set(this, \"onmouseout\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onMouseOver : String\r\n get() = attributeStringString.get(this, \"onmouseover\")\r\n set(newValue) {attributeStringString.set(this, \"onmouseover\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onMouseUp : String\r\n get() = attributeStringString.get(this, \"onmouseup\")\r\n set(newValue) {attributeStringString.set(this, \"onmouseup\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onMouseWheel : String\r\n get() = attributeStringString.get(this, \"onmousewheel\")\r\n set(newValue) {attributeStringString.set(this, \"onmousewheel\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onPause : String\r\n get() = attributeStringString.get(this, \"onpause\")\r\n set(newValue) {attributeStringString.set(this, \"onpause\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onPlay : String\r\n get() = attributeStringString.get(this, \"onplay\")\r\n set(newValue) {attributeStringString.set(this, \"onplay\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onPlaying : String\r\n get() = attributeStringString.get(this, \"onplaying\")\r\n set(newValue) {attributeStringString.set(this, \"onplaying\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onProgress : String\r\n get() = attributeStringString.get(this, \"onprogress\")\r\n set(newValue) {attributeStringString.set(this, \"onprogress\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onRateChange : String\r\n get() = attributeStringString.get(this, \"onratechange\")\r\n set(newValue) {attributeStringString.set(this, \"onratechange\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onReadyStateChange : String\r\n get() = attributeStringString.get(this, \"onreadystatechange\")\r\n set(newValue) {attributeStringString.set(this, \"onreadystatechange\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onScroll : String\r\n get() = attributeStringString.get(this, \"onscroll\")\r\n set(newValue) {attributeStringString.set(this, \"onscroll\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onSearch : String\r\n get() = attributeStringString.get(this, \"onsearch\")\r\n set(newValue) {attributeStringString.set(this, \"onsearch\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onSeeked : String\r\n get() = attributeStringString.get(this, \"onseeked\")\r\n set(newValue) {attributeStringString.set(this, \"onseeked\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onSeeking : String\r\n get() = attributeStringString.get(this, \"onseeking\")\r\n set(newValue) {attributeStringString.set(this, \"onseeking\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onSelect : String\r\n get() = attributeStringString.get(this, \"onselect\")\r\n set(newValue) {attributeStringString.set(this, \"onselect\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onShow : String\r\n get() = attributeStringString.get(this, \"onshow\")\r\n set(newValue) {attributeStringString.set(this, \"onshow\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onStalled : String\r\n get() = attributeStringString.get(this, \"onstalled\")\r\n set(newValue) {attributeStringString.set(this, \"onstalled\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onSubmit : String\r\n get() = attributeStringString.get(this, \"onsubmit\")\r\n set(newValue) {attributeStringString.set(this, \"onsubmit\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onSuspend : String\r\n get() = attributeStringString.get(this, \"onsuspend\")\r\n set(newValue) {attributeStringString.set(this, \"onsuspend\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onTimeUpdate : String\r\n get() = attributeStringString.get(this, \"ontimeupdate\")\r\n set(newValue) {attributeStringString.set(this, \"ontimeupdate\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onTouchCancel : String\r\n get() = attributeStringString.get(this, \"ontouchcancel\")\r\n set(newValue) {attributeStringString.set(this, \"ontouchcancel\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onTouchEnd : String\r\n get() = attributeStringString.get(this, \"ontouchend\")\r\n set(newValue) {attributeStringString.set(this, \"ontouchend\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onTouchMove : String\r\n get() = attributeStringString.get(this, \"ontouchmove\")\r\n set(newValue) {attributeStringString.set(this, \"ontouchmove\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onTouchStart : String\r\n get() = attributeStringString.get(this, \"ontouchstart\")\r\n set(newValue) {attributeStringString.set(this, \"ontouchstart\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onVolumeChange : String\r\n get() = attributeStringString.get(this, \"onvolumechange\")\r\n set(newValue) {attributeStringString.set(this, \"onvolumechange\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onWaiting : String\r\n get() = attributeStringString.get(this, \"onwaiting\")\r\n set(newValue) {attributeStringString.set(this, \"onwaiting\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onWheel : String\r\n get() = attributeStringString.get(this, \"onwheel\")\r\n set(newValue) {attributeStringString.set(this, \"onwheel\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.role : String\r\n get() = attributeStringString.get(this, \"role\")\r\n set(newValue) {attributeStringString.set(this, \"role\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.runAt : RunAt\r\n get() = attributeRunAtEnumRunAtValues.get(this, \"runat\")\r\n set(newValue) {attributeRunAtEnumRunAtValues.set(this, \"runat\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.spellCheck : Boolean\r\n get() = attributeBooleanBoolean.get(this, \"spellcheck\")\r\n set(newValue) {attributeBooleanBoolean.set(this, \"spellcheck\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.style : String\r\n get() = attributeStringString.get(this, \"style\")\r\n set(newValue) {attributeStringString.set(this, \"style\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.subject : String\r\n get() = attributeStringString.get(this, \"subject\")\r\n set(newValue) {attributeStringString.set(this, \"subject\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.tabIndex : String\r\n get() = attributeStringString.get(this, \"tabIndex\")\r\n set(newValue) {attributeStringString.set(this, \"tabIndex\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.title : String\r\n get() = attributeStringString.get(this, \"title\")\r\n set(newValue) {attributeStringString.set(this, \"title\", newValue)}\r\n\r\n\r\ninterface FormServerAttributeGroupFacade : Tag {\r\n}\r\nvar FormServerAttributeGroupFacade.defaultButton : String\r\n get() = attributeStringString.get(this, \"DefaultButton\")\r\n set(newValue) {attributeStringString.set(this, \"DefaultButton\", newValue)}\r\n\r\nvar FormServerAttributeGroupFacade.defaultFocus : String\r\n get() = attributeStringString.get(this, \"DefaultFocus\")\r\n set(newValue) {attributeStringString.set(this, \"DefaultFocus\", newValue)}\r\n\r\nvar FormServerAttributeGroupFacade.submitDisabledControls : Boolean\r\n get() = attributeBooleanBoolean.get(this, \"SubmitDisabledControls\")\r\n set(newValue) {attributeBooleanBoolean.set(this, \"SubmitDisabledControls\", newValue)}\r\n\r\n\r\ninterface InputServerAttributeGroupFacade : Tag {\r\n}\r\nvar InputServerAttributeGroupFacade.causesValidation : Boolean\r\n get() = attributeBooleanBoolean.get(this, \"CausesValidation\")\r\n set(newValue) {attributeBooleanBoolean.set(this, \"CausesValidation\", newValue)}\r\n\r\nvar InputServerAttributeGroupFacade.validationGroup : String\r\n get() = attributeStringString.get(this, \"ValidationGroup\")\r\n set(newValue) {attributeStringString.set(this, \"ValidationGroup\", newValue)}\r\n\r\n\r\ninterface SelectServerAttributeGroupFacade : Tag {\r\n}\r\nvar SelectServerAttributeGroupFacade.dataSourceID : String\r\n get() = attributeStringString.get(this, \"DataSourceID\")\r\n set(newValue) {attributeStringString.set(this, \"DataSourceID\", newValue)}\r\n\r\nvar SelectServerAttributeGroupFacade.dataTextField : String\r\n get() = attributeStringString.get(this, \"DataTextField\")\r\n set(newValue) {attributeStringString.set(this, \"DataTextField\", newValue)}\r\n\r\nvar SelectServerAttributeGroupFacade.dataValueField : String\r\n get() = attributeStringString.get(this, \"DataValueField\")\r\n set(newValue) {attributeStringString.set(this, \"DataValueField\", newValue)}\r\n\r\n\r\n","package kotlinx.html.js\r\n\r\nimport kotlinx.html.*\r\nimport kotlinx.html.attributes.*\r\nimport kotlinx.html.dom.*\r\nimport org.w3c.dom.events.*\r\n\r\n/*******************************************************************************\r\n DO NOT EDIT\r\n This file was generated by module generate\r\n*******************************************************************************/\r\n\r\nvar CommonAttributeGroupFacade.onAbortFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onAbort\")\r\n set(newValue) {consumer.onTagEvent(this, \"onabort\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onBlurFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onBlur\")\r\n set(newValue) {consumer.onTagEvent(this, \"onblur\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onCanPlayFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onCanPlay\")\r\n set(newValue) {consumer.onTagEvent(this, \"oncanplay\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onCanPlayThroughFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onCanPlayThrough\")\r\n set(newValue) {consumer.onTagEvent(this, \"oncanplaythrough\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onChangeFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onChange\")\r\n set(newValue) {consumer.onTagEvent(this, \"onchange\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onClickFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onClick\")\r\n set(newValue) {consumer.onTagEvent(this, \"onclick\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onContextMenuFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onContextMenu\")\r\n set(newValue) {consumer.onTagEvent(this, \"oncontextmenu\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDoubleClickFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onDoubleClick\")\r\n set(newValue) {consumer.onTagEvent(this, \"ondblclick\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDragFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onDrag\")\r\n set(newValue) {consumer.onTagEvent(this, \"ondrag\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDragEndFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onDragEnd\")\r\n set(newValue) {consumer.onTagEvent(this, \"ondragend\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDragEnterFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onDragEnter\")\r\n set(newValue) {consumer.onTagEvent(this, \"ondragenter\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDragLeaveFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onDragLeave\")\r\n set(newValue) {consumer.onTagEvent(this, \"ondragleave\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDragOverFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onDragOver\")\r\n set(newValue) {consumer.onTagEvent(this, \"ondragover\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDragStartFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onDragStart\")\r\n set(newValue) {consumer.onTagEvent(this, \"ondragstart\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDropFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onDrop\")\r\n set(newValue) {consumer.onTagEvent(this, \"ondrop\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onDurationChangeFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onDurationChange\")\r\n set(newValue) {consumer.onTagEvent(this, \"ondurationchange\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onEmptiedFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onEmptied\")\r\n set(newValue) {consumer.onTagEvent(this, \"onemptied\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onEndedFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onEnded\")\r\n set(newValue) {consumer.onTagEvent(this, \"onended\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onErrorFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onError\")\r\n set(newValue) {consumer.onTagEvent(this, \"onerror\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onFocusFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onFocus\")\r\n set(newValue) {consumer.onTagEvent(this, \"onfocus\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onFocusInFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onFocusIn\")\r\n set(newValue) {consumer.onTagEvent(this, \"onfocusin\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onFocusOutFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onFocusOut\")\r\n set(newValue) {consumer.onTagEvent(this, \"onfocusout\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onFormChangeFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onFormChange\")\r\n set(newValue) {consumer.onTagEvent(this, \"onformchange\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onFormInputFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onFormInput\")\r\n set(newValue) {consumer.onTagEvent(this, \"onforminput\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onInputFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onInput\")\r\n set(newValue) {consumer.onTagEvent(this, \"oninput\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onInvalidFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onInvalid\")\r\n set(newValue) {consumer.onTagEvent(this, \"oninvalid\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onKeyDownFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onKeyDown\")\r\n set(newValue) {consumer.onTagEvent(this, \"onkeydown\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onKeyPressFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onKeyPress\")\r\n set(newValue) {consumer.onTagEvent(this, \"onkeypress\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onKeyUpFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onKeyUp\")\r\n set(newValue) {consumer.onTagEvent(this, \"onkeyup\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onLoadFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onLoad\")\r\n set(newValue) {consumer.onTagEvent(this, \"onload\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onLoadedDataFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onLoadedData\")\r\n set(newValue) {consumer.onTagEvent(this, \"onloadeddata\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onLoadedMetaDataFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onLoadedMetaData\")\r\n set(newValue) {consumer.onTagEvent(this, \"onloadedmetadata\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onLoadStartFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onLoadStart\")\r\n set(newValue) {consumer.onTagEvent(this, \"onloadstart\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onMouseDownFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onMouseDown\")\r\n set(newValue) {consumer.onTagEvent(this, \"onmousedown\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onMouseMoveFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onMouseMove\")\r\n set(newValue) {consumer.onTagEvent(this, \"onmousemove\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onMouseOutFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onMouseOut\")\r\n set(newValue) {consumer.onTagEvent(this, \"onmouseout\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onMouseOverFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onMouseOver\")\r\n set(newValue) {consumer.onTagEvent(this, \"onmouseover\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onMouseUpFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onMouseUp\")\r\n set(newValue) {consumer.onTagEvent(this, \"onmouseup\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onMouseWheelFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onMouseWheel\")\r\n set(newValue) {consumer.onTagEvent(this, \"onmousewheel\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onPauseFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onPause\")\r\n set(newValue) {consumer.onTagEvent(this, \"onpause\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onPlayFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onPlay\")\r\n set(newValue) {consumer.onTagEvent(this, \"onplay\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onPlayingFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onPlaying\")\r\n set(newValue) {consumer.onTagEvent(this, \"onplaying\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onProgressFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onProgress\")\r\n set(newValue) {consumer.onTagEvent(this, \"onprogress\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onRateChangeFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onRateChange\")\r\n set(newValue) {consumer.onTagEvent(this, \"onratechange\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onReadyStateChangeFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onReadyStateChange\")\r\n set(newValue) {consumer.onTagEvent(this, \"onreadystatechange\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onScrollFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onScroll\")\r\n set(newValue) {consumer.onTagEvent(this, \"onscroll\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onSearchFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onSearch\")\r\n set(newValue) {consumer.onTagEvent(this, \"onsearch\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onSeekedFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onSeeked\")\r\n set(newValue) {consumer.onTagEvent(this, \"onseeked\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onSeekingFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onSeeking\")\r\n set(newValue) {consumer.onTagEvent(this, \"onseeking\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onSelectFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onSelect\")\r\n set(newValue) {consumer.onTagEvent(this, \"onselect\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onShowFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onShow\")\r\n set(newValue) {consumer.onTagEvent(this, \"onshow\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onStalledFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onStalled\")\r\n set(newValue) {consumer.onTagEvent(this, \"onstalled\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onSubmitFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onSubmit\")\r\n set(newValue) {consumer.onTagEvent(this, \"onsubmit\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onSuspendFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onSuspend\")\r\n set(newValue) {consumer.onTagEvent(this, \"onsuspend\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onTimeUpdateFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onTimeUpdate\")\r\n set(newValue) {consumer.onTagEvent(this, \"ontimeupdate\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onTouchCancelFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onTouchCancel\")\r\n set(newValue) {consumer.onTagEvent(this, \"ontouchcancel\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onTouchEndFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onTouchEnd\")\r\n set(newValue) {consumer.onTagEvent(this, \"ontouchend\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onTouchMoveFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onTouchMove\")\r\n set(newValue) {consumer.onTagEvent(this, \"ontouchmove\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onTouchStartFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onTouchStart\")\r\n set(newValue) {consumer.onTagEvent(this, \"ontouchstart\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onVolumeChangeFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onVolumeChange\")\r\n set(newValue) {consumer.onTagEvent(this, \"onvolumechange\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onWaitingFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onWaiting\")\r\n set(newValue) {consumer.onTagEvent(this, \"onwaiting\", newValue)}\r\n\r\nvar CommonAttributeGroupFacade.onWheelFunction : (Event) -> Unit\r\n get() = throw UnsupportedOperationException(\"You can't read variable onWheel\")\r\n set(newValue) {consumer.onTagEvent(this, \"onwheel\", newValue)}\r\n\r\n","package kotlinx.html\r\n\r\nimport kotlinx.html.*\r\nimport kotlinx.html.attributes.*\r\n\r\n/*******************************************************************************\r\n DO NOT EDIT\r\n This file was generated by module generate\r\n*******************************************************************************/\r\n\r\ninternal val attributeStringString : Attribute = StringAttribute()\r\n\r\ninternal val attributeSetStringStringSet : Attribute> = StringSetAttribute()\r\n\r\ninternal val attributeBooleanBoolean : Attribute = BooleanAttribute()\r\n\r\ninternal val attributeBooleanBooleanOnOff : Attribute = BooleanAttribute(\"on\", \"off\")\r\n\r\ninternal val attributeBooleanTicker : Attribute = TickerAttribute()\r\n\r\ninternal val attributeButtonFormEncTypeEnumButtonFormEncTypeValues : Attribute = EnumAttribute(buttonFormEncTypeValues)\r\n\r\ninternal val attributeButtonFormMethodEnumButtonFormMethodValues : Attribute = EnumAttribute(buttonFormMethodValues)\r\n\r\ninternal val attributeButtonTypeEnumButtonTypeValues : Attribute = EnumAttribute(buttonTypeValues)\r\n\r\ninternal val attributeCommandTypeEnumCommandTypeValues : Attribute = EnumAttribute(commandTypeValues)\r\n\r\ninternal val attributeDirEnumDirValues : Attribute = EnumAttribute(dirValues)\r\n\r\ninternal val attributeDraggableEnumDraggableValues : Attribute = EnumAttribute(draggableValues)\r\n\r\ninternal val attributeFormEncTypeEnumFormEncTypeValues : Attribute = EnumAttribute(formEncTypeValues)\r\n\r\ninternal val attributeFormMethodEnumFormMethodValues : Attribute = EnumAttribute(formMethodValues)\r\n\r\ninternal val attributeIframeSandboxEnumIframeSandboxValues : Attribute = EnumAttribute(iframeSandboxValues)\r\n\r\ninternal val attributeInputFormEncTypeEnumInputFormEncTypeValues : Attribute = EnumAttribute(inputFormEncTypeValues)\r\n\r\ninternal val attributeInputFormMethodEnumInputFormMethodValues : Attribute = EnumAttribute(inputFormMethodValues)\r\n\r\ninternal val attributeInputTypeEnumInputTypeValues : Attribute = EnumAttribute(inputTypeValues)\r\n\r\ninternal val attributeKeyGenKeyTypeEnumKeyGenKeyTypeValues : Attribute = EnumAttribute(keyGenKeyTypeValues)\r\n\r\ninternal val attributeRunAtEnumRunAtValues : Attribute = EnumAttribute(runAtValues)\r\n\r\ninternal val attributeTextAreaWrapEnumTextAreaWrapValues : Attribute = EnumAttribute(textAreaWrapValues)\r\n\r\ninternal val attributeThScopeEnumThScopeValues : Attribute = EnumAttribute(thScopeValues)\r\n\r\n","/*\n * __ ___\n * _____/ /___ __/ (_)____\n * / ___/ __/ / / / / / ___/\n * (__ ) /_/ /_/ / / (__ )\n * /____/\\__/\\__, /_/_/____/\n * /____/\n *\n * light - weight css preprocessor @licence MIT\n */\n(function (factory) {/* eslint-disable */\n\ttypeof exports === 'object' && typeof module !== 'undefined' ? (module['exports'] = factory(null)) :\n\t\ttypeof define === 'function' && define['amd'] ? define(factory(null)) :\n\t\t\t(window['stylis'] = factory(null))\n}(/** @param {*=} options */function factory (options) {/* eslint-disable */\n\n\t'use strict'\n\n\t/**\n\t * Notes\n\t *\n\t * The [''] pattern is used to support closure compiler\n\t * the jsdoc signatures are also used to the same effect\n\t *\n\t * ----\n\t *\n\t * int + int + int === n4 [faster]\n\t *\n\t * vs\n\t *\n\t * int === n1 && int === n2 && int === n3\n\t *\n\t * ----\n\t *\n\t * switch (int) { case ints...} [faster]\n\t *\n\t * vs\n\t *\n\t * if (int == 1 && int === 2 ...)\n\t *\n\t * ----\n\t *\n\t * The (first*n1 + second*n2 + third*n3) format used in the property parser\n\t * is a simple way to hash the sequence of characters\n\t * taking into account the index they occur in\n\t * since any number of 3 character sequences could produce duplicates.\n\t *\n\t * On the other hand sequences that are directly tied to the index of the character\n\t * resolve a far more accurate measure, it's also faster\n\t * to evaluate one condition in a switch statement\n\t * than three in an if statement regardless of the added math.\n\t *\n\t * This allows the vendor prefixer to be both small and fast.\n\t */\n\n\tvar nullptn = /^\\0+/g /* matches leading null characters */\n\tvar formatptn = /[\\0\\r\\f]/g /* matches new line, null and formfeed characters */\n\tvar colonptn = /: */g /* splits animation rules */\n\tvar cursorptn = /zoo|gra/ /* assert cursor varient */\n\tvar transformptn = /([,: ])(transform)/g /* vendor prefix transform, older webkit */\n\tvar animationptn = /,+\\s*(?![^(]*[)])/g /* splits multiple shorthand notation animations */\n\tvar propertiesptn = / +\\s*(?![^(]*[)])/g /* animation properties */\n\tvar elementptn = / *[\\0] */g /* selector elements */\n\tvar selectorptn = /,\\r+?/g /* splits selectors */\n\tvar andptn = /([\\t\\r\\n ])*\\f?&/g /* match & */\n\tvar escapeptn = /:global\\(((?:[^\\(\\)\\[\\]]*|\\[.*\\]|\\([^\\(\\)]*\\))*)\\)/g /* matches :global(.*) */\n\tvar invalidptn = /\\W+/g /* removes invalid characters from keyframes */\n\tvar keyframeptn = /@(k\\w+)\\s*(\\S*)\\s*/ /* matches @keyframes $1 */\n\tvar plcholdrptn = /::(place)/g /* match ::placeholder varient */\n\tvar readonlyptn = /:(read-only)/g /* match :read-only varient */\n\tvar beforeptn = /\\s+(?=[{\\];=:>])/g /* matches \\s before ] ; = : */\n\tvar afterptn = /([[}=:>])\\s+/g /* matches \\s after characters [ } = : */\n\tvar tailptn = /(\\{[^{]+?);(?=\\})/g /* matches tail semi-colons ;} */\n\tvar whiteptn = /\\s{2,}/g /* matches repeating whitespace */\n\tvar pseudoptn = /([^\\(])(:+) */g /* pseudo element */\n\tvar writingptn = /[svh]\\w+-[tblr]{2}/ /* match writing mode property values */\n\tvar gradientptn = /([\\w-]+t\\()/g /* match *gradient property */\n\tvar supportsptn = /\\(\\s*(.*)\\s*\\)/g /* match supports (groups) */\n\tvar propertyptn = /([\\s\\S]*?);/g /* match properties leading semicolon */\n\tvar selfptn = /-self|flex-/g /* match flex- and -self in align-self: flex-*; */\n\tvar pseudofmt = /[^]*?(:[rp][el]a[\\w-]+)[^]*/ /* extrats :readonly or :placholder from selector */\n\tvar trimptn = /[ \\t]+$/ /* match tail whitspace */\n\tvar dimensionptn = /stretch|:\\s*\\w+\\-(?:conte|avail)/ /* match max/min/fit-content, fill-available */\n\tvar imgsrcptn = /([^-])(image-set\\()/\n\n\t/* vendors */\n\tvar webkit = '-webkit-'\n\tvar moz = '-moz-'\n\tvar ms = '-ms-'\n\n\t/* character codes */\n\tvar SEMICOLON = 59 /* ; */\n\tvar CLOSEBRACES = 125 /* } */\n\tvar OPENBRACES = 123 /* { */\n\tvar OPENPARENTHESES = 40 /* ( */\n\tvar CLOSEPARENTHESES = 41 /* ) */\n\tvar OPENBRACKET = 91 /* [ */\n\tvar CLOSEBRACKET = 93 /* ] */\n\tvar NEWLINE = 10 /* \\n */\n\tvar CARRIAGE = 13 /* \\r */\n\tvar TAB = 9 /* \\t */\n\tvar AT = 64 /* @ */\n\tvar SPACE = 32 /* */\n\tvar AND = 38 /* & */\n\tvar DASH = 45 /* - */\n\tvar UNDERSCORE = 95 /* _ */\n\tvar STAR = 42 /* * */\n\tvar COMMA = 44 /* , */\n\tvar COLON = 58 /* : */\n\tvar SINGLEQUOTE = 39 /* ' */\n\tvar DOUBLEQUOTE = 34 /* \" */\n\tvar FOWARDSLASH = 47 /* / */\n\tvar GREATERTHAN = 62 /* > */\n\tvar PLUS = 43 /* + */\n\tvar TILDE = 126 /* ~ */\n\tvar NULL = 0 /* \\0 */\n\tvar FORMFEED = 12 /* \\f */\n\tvar VERTICALTAB = 11 /* \\v */\n\n\t/* special identifiers */\n\tvar KEYFRAME = 107 /* k */\n\tvar MEDIA = 109 /* m */\n\tvar SUPPORTS = 115 /* s */\n\tvar PLACEHOLDER = 112 /* p */\n\tvar READONLY = 111 /* o */\n\tvar IMPORT = 105 /* i */\n\tvar CHARSET = 99 /* c */\n\tvar DOCUMENT = 100 /* d */\n\tvar PAGE = 112 /* p */\n\n\tvar column = 1 /* current column */\n\tvar line = 1 /* current line numebr */\n\tvar pattern = 0 /* :pattern */\n\n\tvar cascade = 1 /* #id h1 h2 vs h1#id h2#id */\n\tvar prefix = 1 /* vendor prefix */\n\tvar escape = 1 /* escape :global() pattern */\n\tvar compress = 0 /* compress output */\n\tvar semicolon = 0 /* no/semicolon option */\n\tvar preserve = 0 /* preserve empty selectors */\n\n\t/* empty reference */\n\tvar array = []\n\n\t/* plugins */\n\tvar plugins = []\n\tvar plugged = 0\n\tvar should = null\n\n\t/* plugin context */\n\tvar POSTS = -2\n\tvar PREPS = -1\n\tvar UNKWN = 0\n\tvar PROPS = 1\n\tvar BLCKS = 2\n\tvar ATRUL = 3\n\n\t/* plugin newline context */\n\tvar unkwn = 0\n\n\t/* keyframe animation */\n\tvar keyed = 1\n\tvar key = ''\n\n\t/* selector namespace */\n\tvar nscopealt = ''\n\tvar nscope = ''\n\n\t/**\n\t * Compile\n\t *\n\t * @param {Array} parent\n\t * @param {Array} current\n\t * @param {string} body\n\t * @param {number} id\n\t * @param {number} depth\n\t * @return {string}\n\t */\n\tfunction compile (parent, current, body, id, depth) {\n\t\tvar bracket = 0 /* brackets [] */\n\t\tvar comment = 0 /* comments /* // or /* */\n\t\tvar parentheses = 0 /* functions () */\n\t\tvar quote = 0 /* quotes '', \"\" */\n\n\t\tvar first = 0 /* first character code */\n\t\tvar second = 0 /* second character code */\n\t\tvar code = 0 /* current character code */\n\t\tvar tail = 0 /* previous character code */\n\t\tvar trail = 0 /* character before previous code */\n\t\tvar peak = 0 /* previous non-whitespace code */\n\n\t\tvar counter = 0 /* count sequence termination */\n\t\tvar context = 0 /* track current context */\n\t\tvar atrule = 0 /* track @at-rule context */\n\t\tvar pseudo = 0 /* track pseudo token index */\n\t\tvar caret = 0 /* current character index */\n\t\tvar format = 0 /* control character formating context */\n\t\tvar insert = 0 /* auto semicolon insertion */\n\t\tvar invert = 0 /* inverted selector pattern */\n\t\tvar length = 0 /* generic length address */\n\t\tvar eof = body.length /* end of file(length) */\n\t\tvar eol = eof - 1 /* end of file(characters) */\n\n\t\tvar char = '' /* current character */\n\t\tvar chars = '' /* current buffer of characters */\n\t\tvar child = '' /* next buffer of characters */\n\t\tvar out = '' /* compiled body */\n\t\tvar children = '' /* compiled children */\n\t\tvar flat = '' /* compiled leafs */\n\t\tvar selector /* generic selector address */\n\t\tvar result /* generic address */\n\n\t\t// ...build body\n\t\twhile (caret < eof) {\n\t\t\tcode = body.charCodeAt(caret)\n\n\t\t\t// eof varient\n\t\t\tif (caret === eol) {\n\t\t\t\t// last character + noop context, add synthetic padding for noop context to terminate\n\t\t\t\tif (comment + quote + parentheses + bracket !== 0) {\n\t\t\t\t\tif (comment !== 0) {\n\t\t\t\t\t\tcode = comment === FOWARDSLASH ? NEWLINE : FOWARDSLASH\n\t\t\t\t\t}\n\n\t\t\t\t\tquote = parentheses = bracket = 0\n\t\t\t\t\teof++\n\t\t\t\t\teol++\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (comment + quote + parentheses + bracket === 0) {\n\t\t\t\t// eof varient\n\t\t\t\tif (caret === eol) {\n\t\t\t\t\tif (format > 0) {\n\t\t\t\t\t\tchars = chars.replace(formatptn, '')\n\t\t\t\t\t}\n\n\t\t\t\t\tif (chars.trim().length > 0) {\n\t\t\t\t\t\tswitch (code) {\n\t\t\t\t\t\t\tcase SPACE:\n\t\t\t\t\t\t\tcase TAB:\n\t\t\t\t\t\t\tcase SEMICOLON:\n\t\t\t\t\t\t\tcase CARRIAGE:\n\t\t\t\t\t\t\tcase NEWLINE: {\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\tchars += body.charAt(caret)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcode = SEMICOLON\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// auto semicolon insertion\n\t\t\t\tif (insert === 1) {\n\t\t\t\t\tswitch (code) {\n\t\t\t\t\t\t// false flags\n\t\t\t\t\t\tcase OPENBRACES:\n\t\t\t\t\t\tcase CLOSEBRACES:\n\t\t\t\t\t\tcase SEMICOLON:\n\t\t\t\t\t\tcase DOUBLEQUOTE:\n\t\t\t\t\t\tcase SINGLEQUOTE:\n\t\t\t\t\t\tcase OPENPARENTHESES:\n\t\t\t\t\t\tcase CLOSEPARENTHESES:\n\t\t\t\t\t\tcase COMMA: {\n\t\t\t\t\t\t\tinsert = 0\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// ignore\n\t\t\t\t\t\tcase TAB:\n\t\t\t\t\t\tcase CARRIAGE:\n\t\t\t\t\t\tcase NEWLINE:\n\t\t\t\t\t\tcase SPACE: {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// valid\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\tinsert = 0\n\t\t\t\t\t\t\tlength = caret\n\t\t\t\t\t\t\tfirst = code\n\t\t\t\t\t\t\tcaret--\n\t\t\t\t\t\t\tcode = SEMICOLON\n\n\t\t\t\t\t\t\twhile (length < eof) {\n\t\t\t\t\t\t\t\tswitch (body.charCodeAt(length++)) {\n\t\t\t\t\t\t\t\t\tcase NEWLINE:\n\t\t\t\t\t\t\t\t\tcase CARRIAGE:\n\t\t\t\t\t\t\t\t\tcase SEMICOLON: {\n\t\t\t\t\t\t\t\t\t\t++caret\n\t\t\t\t\t\t\t\t\t\tcode = first\n\t\t\t\t\t\t\t\t\t\tlength = eof\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase COLON: {\n\t\t\t\t\t\t\t\t\t\tif (format > 0) {\n\t\t\t\t\t\t\t\t\t\t\t++caret\n\t\t\t\t\t\t\t\t\t\t\tcode = first\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcase OPENBRACES: {\n\t\t\t\t\t\t\t\t\t\tlength = eof\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// token varient\n\t\t\t\tswitch (code) {\n\t\t\t\t\tcase OPENBRACES: {\n\t\t\t\t\t\tchars = chars.trim()\n\t\t\t\t\t\tfirst = chars.charCodeAt(0)\n\t\t\t\t\t\tcounter = 1\n\t\t\t\t\t\tlength = ++caret\n\n\t\t\t\t\t\twhile (caret < eof) {\n\t\t\t\t\t\t\tswitch (code = body.charCodeAt(caret)) {\n\t\t\t\t\t\t\t\tcase OPENBRACES: {\n\t\t\t\t\t\t\t\t\tcounter++\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase CLOSEBRACES: {\n\t\t\t\t\t\t\t\t\tcounter--\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase FOWARDSLASH: {\n\t\t\t\t\t\t\t\t\tswitch (second = body.charCodeAt(caret + 1)) {\n\t\t\t\t\t\t\t\t\t\t// /*, //\n\t\t\t\t\t\t\t\t\t\tcase STAR:\n\t\t\t\t\t\t\t\t\t\tcase FOWARDSLASH: {\n\t\t\t\t\t\t\t\t\t\t\tcaret = delimited(second, caret, eol, body)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// given \"[\" === 91 & \"]\" === 93 hence forth 91 + 1 + 1 === 93\n\t\t\t\t\t\t\t\tcase OPENBRACKET: {\n\t\t\t\t\t\t\t\t\tcode++\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// given \"(\" === 40 & \")\" === 41 hence forth 40 + 1 === 41\n\t\t\t\t\t\t\t\tcase OPENPARENTHESES: {\n\t\t\t\t\t\t\t\t\tcode++\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// quote tail delimiter is identical to the head delimiter hence noop,\n\t\t\t\t\t\t\t\t// fallthrough clauses have been shifted to the correct tail delimiter\n\t\t\t\t\t\t\t\tcase DOUBLEQUOTE:\n\t\t\t\t\t\t\t\tcase SINGLEQUOTE: {\n\t\t\t\t\t\t\t\t\twhile (caret++ < eol) {\n\t\t\t\t\t\t\t\t\t\tif (body.charCodeAt(caret) === code) {\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (counter === 0) {\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tcaret++\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tchild = body.substring(length, caret)\n\n\t\t\t\t\t\tif (first === NULL) {\n\t\t\t\t\t\t\tfirst = (chars = chars.replace(nullptn, '').trim()).charCodeAt(0)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tswitch (first) {\n\t\t\t\t\t\t\t// @at-rule\n\t\t\t\t\t\t\tcase AT: {\n\t\t\t\t\t\t\t\tif (format > 0) {\n\t\t\t\t\t\t\t\t\tchars = chars.replace(formatptn, '')\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tsecond = chars.charCodeAt(1)\n\n\t\t\t\t\t\t\t\tswitch (second) {\n\t\t\t\t\t\t\t\t\tcase DOCUMENT:\n\t\t\t\t\t\t\t\t\tcase MEDIA:\n\t\t\t\t\t\t\t\t\tcase SUPPORTS:\n\t\t\t\t\t\t\t\t\tcase DASH: {\n\t\t\t\t\t\t\t\t\t\tselector = current\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\t\t\tselector = array\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tchild = compile(current, selector, child, second, depth+1)\n\t\t\t\t\t\t\t\tlength = child.length\n\n\t\t\t\t\t\t\t\t// preserve empty @at-rule\n\t\t\t\t\t\t\t\tif (preserve > 0 && length === 0) {\n\t\t\t\t\t\t\t\t\tlength = chars.length\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t// execute plugins, @at-rule context\n\t\t\t\t\t\t\t\tif (plugged > 0) {\n\t\t\t\t\t\t\t\t\tselector = select(array, chars, invert)\n\t\t\t\t\t\t\t\t\tresult = proxy(ATRUL, child, selector, current, line, column, length, second, depth, id)\n\t\t\t\t\t\t\t\t\tchars = selector.join('')\n\n\t\t\t\t\t\t\t\t\tif (result !== void 0) {\n\t\t\t\t\t\t\t\t\t\tif ((length = (child = result.trim()).length) === 0) {\n\t\t\t\t\t\t\t\t\t\t\tsecond = 0\n\t\t\t\t\t\t\t\t\t\t\tchild = ''\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (length > 0) {\n\t\t\t\t\t\t\t\t\tswitch (second) {\n\t\t\t\t\t\t\t\t\t\tcase SUPPORTS: {\n\t\t\t\t\t\t\t\t\t\t\tchars = chars.replace(supportsptn, supports)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase DOCUMENT:\n\t\t\t\t\t\t\t\t\t\tcase MEDIA:\n\t\t\t\t\t\t\t\t\t\tcase DASH: {\n\t\t\t\t\t\t\t\t\t\t\tchild = chars + '{' + child + '}'\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tcase KEYFRAME: {\n\t\t\t\t\t\t\t\t\t\t\tchars = chars.replace(keyframeptn, '$1 $2' + (keyed > 0 ? key : ''))\n\t\t\t\t\t\t\t\t\t\t\tchild = chars + '{' + child + '}'\n\n\t\t\t\t\t\t\t\t\t\t\tif (prefix === 1 || (prefix === 2 && vendor('@'+child, 3))) {\n\t\t\t\t\t\t\t\t\t\t\t\tchild = '@' + webkit + child + '@' + child\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tchild = '@' + child\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\t\t\t\tchild = chars + child\n\n\t\t\t\t\t\t\t\t\t\t\tif (id === PAGE) {\n\t\t\t\t\t\t\t\t\t\t\t\tchild = (out += child, '')\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tchild = ''\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// selector\n\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\tchild = compile(current, select(current, chars, invert), child, id, depth+1)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tchildren += child\n\n\t\t\t\t\t\t// reset\n\t\t\t\t\t\tcontext = 0\n\t\t\t\t\t\tinsert = 0\n\t\t\t\t\t\tpseudo = 0\n\t\t\t\t\t\tformat = 0\n\t\t\t\t\t\tinvert = 0\n\t\t\t\t\t\tatrule = 0\n\t\t\t\t\t\tchars = ''\n\t\t\t\t\t\tchild = ''\n\t\t\t\t\t\tcode = body.charCodeAt(++caret)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase CLOSEBRACES:\n\t\t\t\t\tcase SEMICOLON: {\n\t\t\t\t\t\tchars = (format > 0 ? chars.replace(formatptn, '') : chars).trim()\n\n\t\t\t\t\t\tif ((length = chars.length) > 1) {\n\t\t\t\t\t\t\t// monkey-patch missing colon\n\t\t\t\t\t\t\tif (pseudo === 0) {\n\t\t\t\t\t\t\t\tfirst = chars.charCodeAt(0)\n\n\t\t\t\t\t\t\t\t// first character is a letter or dash, buffer has a space character\n\t\t\t\t\t\t\t\tif ((first === DASH || first > 96 && first < 123)) {\n\t\t\t\t\t\t\t\t\tlength = (chars = chars.replace(' ', ':')).length\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t// execute plugins, property context\n\t\t\t\t\t\t\tif (plugged > 0) {\n\t\t\t\t\t\t\t\tif ((result = proxy(PROPS, chars, current, parent, line, column, out.length, id, depth, id)) !== void 0) {\n\t\t\t\t\t\t\t\t\tif ((length = (chars = result.trim()).length) === 0) {\n\t\t\t\t\t\t\t\t\t\tchars = '\\0\\0'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfirst = chars.charCodeAt(0)\n\t\t\t\t\t\t\tsecond = chars.charCodeAt(1)\n\n\t\t\t\t\t\t\tswitch (first) {\n\t\t\t\t\t\t\t\tcase NULL: {\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase AT: {\n\t\t\t\t\t\t\t\t\tif (second === IMPORT || second === CHARSET) {\n\t\t\t\t\t\t\t\t\t\tflat += chars + body.charAt(caret)\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\t\tif (chars.charCodeAt(length-1) === COLON) {\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tout += property(chars, first, second, chars.charCodeAt(2))\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// reset\n\t\t\t\t\t\tcontext = 0\n\t\t\t\t\t\tinsert = 0\n\t\t\t\t\t\tpseudo = 0\n\t\t\t\t\t\tformat = 0\n\t\t\t\t\t\tinvert = 0\n\t\t\t\t\t\tchars = ''\n\t\t\t\t\t\tcode = body.charCodeAt(++caret)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// parse characters\n\t\t\tswitch (code) {\n\t\t\t\tcase CARRIAGE:\n\t\t\t\tcase NEWLINE: {\n\t\t\t\t\t// auto insert semicolon\n\t\t\t\t\tif (comment + quote + parentheses + bracket + semicolon === 0) {\n\t\t\t\t\t\t// valid non-whitespace characters that\n\t\t\t\t\t\t// may precede a newline\n\t\t\t\t\t\tswitch (peak) {\n\t\t\t\t\t\t\tcase CLOSEPARENTHESES:\n\t\t\t\t\t\t\tcase SINGLEQUOTE:\n\t\t\t\t\t\t\tcase DOUBLEQUOTE:\n\t\t\t\t\t\t\tcase AT:\n\t\t\t\t\t\t\tcase TILDE:\n\t\t\t\t\t\t\tcase GREATERTHAN:\n\t\t\t\t\t\t\tcase STAR:\n\t\t\t\t\t\t\tcase PLUS:\n\t\t\t\t\t\t\tcase FOWARDSLASH:\n\t\t\t\t\t\t\tcase DASH:\n\t\t\t\t\t\t\tcase COLON:\n\t\t\t\t\t\t\tcase COMMA:\n\t\t\t\t\t\t\tcase SEMICOLON:\n\t\t\t\t\t\t\tcase OPENBRACES:\n\t\t\t\t\t\t\tcase CLOSEBRACES: {\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\t// current buffer has a colon\n\t\t\t\t\t\t\t\tif (pseudo > 0) {\n\t\t\t\t\t\t\t\t\tinsert = 1\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// terminate line comment\n\t\t\t\t\tif (comment === FOWARDSLASH) {\n\t\t\t\t\t\tcomment = 0\n\t\t\t\t\t} else if (cascade + context === 0 && id !== KEYFRAME && chars.length > 0) {\n\t\t\t\t\t\tformat = 1\n\t\t\t\t\t\tchars += '\\0'\n\t\t\t\t\t}\n\n\t\t\t\t\t// execute plugins, newline context\n\t\t\t\t\tif (plugged * unkwn > 0) {\n\t\t\t\t\t\tproxy(UNKWN, chars, current, parent, line, column, out.length, id, depth, id)\n\t\t\t\t\t}\n\n\t\t\t\t\t// next line, reset column position\n\t\t\t\t\tcolumn = 1\n\t\t\t\t\tline++\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase SEMICOLON:\n\t\t\t\tcase CLOSEBRACES: {\n\t\t\t\t\tif (comment + quote + parentheses + bracket === 0) {\n\t\t\t\t\t\tcolumn++\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\t// increment column position\n\t\t\t\t\tcolumn++\n\n\t\t\t\t\t// current character\n\t\t\t\t\tchar = body.charAt(caret)\n\n\t\t\t\t\t// remove comments, escape functions, strings, attributes and prepare selectors\n\t\t\t\t\tswitch (code) {\n\t\t\t\t\t\tcase TAB:\n\t\t\t\t\t\tcase SPACE: {\n\t\t\t\t\t\t\tif (quote + bracket + comment === 0) {\n\t\t\t\t\t\t\t\tswitch (tail) {\n\t\t\t\t\t\t\t\t\tcase COMMA:\n\t\t\t\t\t\t\t\t\tcase COLON:\n\t\t\t\t\t\t\t\t\tcase TAB:\n\t\t\t\t\t\t\t\t\tcase SPACE: {\n\t\t\t\t\t\t\t\t\t\tchar = ''\n\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\t\t\tif (code !== SPACE) {\n\t\t\t\t\t\t\t\t\t\t\tchar = ' '\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// escape breaking control characters\n\t\t\t\t\t\tcase NULL: {\n\t\t\t\t\t\t\tchar = '\\\\0'\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase FORMFEED: {\n\t\t\t\t\t\t\tchar = '\\\\f'\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase VERTICALTAB: {\n\t\t\t\t\t\t\tchar = '\\\\v'\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// &\n\t\t\t\t\t\tcase AND: {\n\t\t\t\t\t\t\t// inverted selector pattern i.e html &\n\t\t\t\t\t\t\tif (quote + comment + bracket === 0 && cascade > 0) {\n\t\t\t\t\t\t\t\tinvert = 1\n\t\t\t\t\t\t\t\tformat = 1\n\t\t\t\t\t\t\t\tchar = '\\f' + char\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// ::paceholder, l\n\t\t\t\t\t\t// :read-ony, l\n\t\t\t\t\t\tcase 108: {\n\t\t\t\t\t\t\tif (quote + comment + bracket + pattern === 0 && pseudo > 0) {\n\t\t\t\t\t\t\t\tswitch (caret - pseudo) {\n\t\t\t\t\t\t\t\t\t// ::placeholder\n\t\t\t\t\t\t\t\t\tcase 2: {\n\t\t\t\t\t\t\t\t\t\tif (tail === PLACEHOLDER && body.charCodeAt(caret-3) === COLON) {\n\t\t\t\t\t\t\t\t\t\t\tpattern = tail\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// :read-only\n\t\t\t\t\t\t\t\t\tcase 8: {\n\t\t\t\t\t\t\t\t\t\tif (trail === READONLY) {\n\t\t\t\t\t\t\t\t\t\t\tpattern = trail\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// :\n\t\t\t\t\t\tcase COLON: {\n\t\t\t\t\t\t\tif (quote + comment + bracket === 0) {\n\t\t\t\t\t\t\t\tpseudo = caret\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// selectors\n\t\t\t\t\t\tcase COMMA: {\n\t\t\t\t\t\t\tif (comment + parentheses + quote + bracket === 0) {\n\t\t\t\t\t\t\t\tformat = 1\n\t\t\t\t\t\t\t\tchar += '\\r'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// quotes\n\t\t\t\t\t\tcase DOUBLEQUOTE:\n\t\t\t\t\t\tcase SINGLEQUOTE: {\n\t\t\t\t\t\t\tif (comment === 0) {\n\t\t\t\t\t\t\t\tquote = quote === code ? 0 : (quote === 0 ? code : quote)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// attributes\n\t\t\t\t\t\tcase OPENBRACKET: {\n\t\t\t\t\t\t\tif (quote + comment + parentheses === 0) {\n\t\t\t\t\t\t\t\tbracket++\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase CLOSEBRACKET: {\n\t\t\t\t\t\t\tif (quote + comment + parentheses === 0) {\n\t\t\t\t\t\t\t\tbracket--\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// functions\n\t\t\t\t\t\tcase CLOSEPARENTHESES: {\n\t\t\t\t\t\t\tif (quote + comment + bracket === 0) {\n\t\t\t\t\t\t\t\tparentheses--\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase OPENPARENTHESES: {\n\t\t\t\t\t\t\tif (quote + comment + bracket === 0) {\n\t\t\t\t\t\t\t\tif (context === 0) {\n\t\t\t\t\t\t\t\t\tswitch (tail*2 + trail*3) {\n\t\t\t\t\t\t\t\t\t\t// :matches\n\t\t\t\t\t\t\t\t\t\tcase 533: {\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t// :global, :not, :nth-child etc...\n\t\t\t\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\t\t\t\tcounter = 0\n\t\t\t\t\t\t\t\t\t\t\tcontext = 1\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tparentheses++\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase AT: {\n\t\t\t\t\t\t\tif (comment + parentheses + quote + bracket + pseudo + atrule === 0) {\n\t\t\t\t\t\t\t\tatrule = 1\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// block/line comments\n\t\t\t\t\t\tcase STAR:\n\t\t\t\t\t\tcase FOWARDSLASH: {\n\t\t\t\t\t\t\tif (quote + bracket + parentheses > 0) {\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tswitch (comment) {\n\t\t\t\t\t\t\t\t// initialize line/block comment context\n\t\t\t\t\t\t\t\tcase 0: {\n\t\t\t\t\t\t\t\t\tswitch (code*2 + body.charCodeAt(caret+1)*3) {\n\t\t\t\t\t\t\t\t\t\t// //\n\t\t\t\t\t\t\t\t\t\tcase 235: {\n\t\t\t\t\t\t\t\t\t\t\tcomment = FOWARDSLASH\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t// /*\n\t\t\t\t\t\t\t\t\t\tcase 220: {\n\t\t\t\t\t\t\t\t\t\t\tlength = caret\n\t\t\t\t\t\t\t\t\t\t\tcomment = STAR\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t// end block comment context\n\t\t\t\t\t\t\t\tcase STAR: {\n\t\t\t\t\t\t\t\t\tif (code === FOWARDSLASH && tail === STAR && length + 2 !== caret) {\n\t\t\t\t\t\t\t\t\t\t// /* ... */, !\n\t\t\t\t\t\t\t\t\t\tif (body.charCodeAt(length+2) === 33) {\n\t\t\t\t\t\t\t\t\t\t\tout += body.substring(length, caret+1)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tchar = ''\n\t\t\t\t\t\t\t\t\t\tcomment = 0\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t// ignore comment blocks\n\t\t\t\t\tif (comment === 0) {\n\t\t\t\t\t\t// aggressive isolation mode, divide each individual selector\n\t\t\t\t\t\t// including selectors in :not function but excluding selectors in :global function\n\t\t\t\t\t\tif (cascade + quote + bracket + atrule === 0 && id !== KEYFRAME && code !== SEMICOLON) {\n\t\t\t\t\t\t\tswitch (code) {\n\t\t\t\t\t\t\t\tcase COMMA:\n\t\t\t\t\t\t\t\tcase TILDE:\n\t\t\t\t\t\t\t\tcase GREATERTHAN:\n\t\t\t\t\t\t\t\tcase PLUS:\n\t\t\t\t\t\t\t\tcase CLOSEPARENTHESES:\n\t\t\t\t\t\t\t\tcase OPENPARENTHESES: {\n\t\t\t\t\t\t\t\t\tif (context === 0) {\n\t\t\t\t\t\t\t\t\t\t// outside of an isolated context i.e nth-child(<...>)\n\t\t\t\t\t\t\t\t\t\tswitch (tail) {\n\t\t\t\t\t\t\t\t\t\t\tcase TAB:\n\t\t\t\t\t\t\t\t\t\t\tcase SPACE:\n\t\t\t\t\t\t\t\t\t\t\tcase NEWLINE:\n\t\t\t\t\t\t\t\t\t\t\tcase CARRIAGE: {\n\t\t\t\t\t\t\t\t\t\t\t\tchar = char + '\\0'\n\t\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\t\t\t\t\tchar = '\\0' + char + (code === COMMA ? '' : '\\0')\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tformat = 1\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t// within an isolated context, sleep untill it's terminated\n\t\t\t\t\t\t\t\t\t\tswitch (code) {\n\t\t\t\t\t\t\t\t\t\t\tcase OPENPARENTHESES: {\n\t\t\t\t\t\t\t\t\t\t\t\t// :globa(\n\t\t\t\t\t\t\t\t\t\t\t\tif (pseudo + 7 === caret && tail === 108) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tpseudo = 0\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tcontext = ++counter\n\t\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\tcase CLOSEPARENTHESES: {\n\t\t\t\t\t\t\t\t\t\t\t\tif ((context = --counter) === 0) {\n\t\t\t\t\t\t\t\t\t\t\t\t\tformat = 1\n\t\t\t\t\t\t\t\t\t\t\t\t\tchar += '\\0'\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcase TAB:\n\t\t\t\t\t\t\t\tcase SPACE: {\n\t\t\t\t\t\t\t\t\tswitch (tail) {\n\t\t\t\t\t\t\t\t\t\tcase NULL:\n\t\t\t\t\t\t\t\t\t\tcase OPENBRACES:\n\t\t\t\t\t\t\t\t\t\tcase CLOSEBRACES:\n\t\t\t\t\t\t\t\t\t\tcase SEMICOLON:\n\t\t\t\t\t\t\t\t\t\tcase COMMA:\n\t\t\t\t\t\t\t\t\t\tcase FORMFEED:\n\t\t\t\t\t\t\t\t\t\tcase TAB:\n\t\t\t\t\t\t\t\t\t\tcase SPACE:\n\t\t\t\t\t\t\t\t\t\tcase NEWLINE:\n\t\t\t\t\t\t\t\t\t\tcase CARRIAGE: {\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\t\t\t\t// ignore in isolated contexts\n\t\t\t\t\t\t\t\t\t\t\tif (context === 0) {\n\t\t\t\t\t\t\t\t\t\t\t\tformat = 1\n\t\t\t\t\t\t\t\t\t\t\t\tchar += '\\0'\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// concat buffer of characters\n\t\t\t\t\t\tchars += char\n\n\t\t\t\t\t\t// previous non-whitespace character code\n\t\t\t\t\t\tif (code !== SPACE && code !== TAB) {\n\t\t\t\t\t\t\tpeak = code\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// tail character codes\n\t\t\ttrail = tail\n\t\t\ttail = code\n\n\t\t\t// visit every character\n\t\t\tcaret++\n\t\t}\n\n\t\tlength = out.length\n\n\t\t// preserve empty selector\n \t\tif (preserve > 0) {\n \t\t\tif (length === 0 && children.length === 0 && (current[0].length === 0) === false) {\n \t\t\t\tif (id !== MEDIA || (current.length === 1 && (cascade > 0 ? nscopealt : nscope) === current[0])) {\n\t\t\t\t\tlength = current.join(',').length + 2\n \t\t\t\t}\n \t\t\t}\n\t\t}\n\n\t\tif (length > 0) {\n\t\t\t// cascade isolation mode?\n\t\t\tselector = cascade === 0 && id !== KEYFRAME ? isolate(current) : current\n\n\t\t\t// execute plugins, block context\n\t\t\tif (plugged > 0) {\n\t\t\t\tresult = proxy(BLCKS, out, selector, parent, line, column, length, id, depth, id)\n\n\t\t\t\tif (result !== void 0 && (out = result).length === 0) {\n\t\t\t\t\treturn flat + out + children\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tout = selector.join(',') + '{' + out + '}'\n\n\t\t\tif (prefix*pattern !== 0) {\n\t\t\t\tif (prefix === 2 && !vendor(out, 2))\n\t\t\t\t\tpattern = 0\n\n\t\t\t\tswitch (pattern) {\n\t\t\t\t\t// ::read-only\n\t\t\t\t\tcase READONLY: {\n\t\t\t\t\t\tout = out.replace(readonlyptn, ':'+moz+'$1')+out\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\t// ::placeholder\n\t\t\t\t\tcase PLACEHOLDER: {\n\t\t\t\t\t\tout = (\n\t\t\t\t\t\t\tout.replace(plcholdrptn, '::' + webkit + 'input-$1') +\n\t\t\t\t\t\t\tout.replace(plcholdrptn, '::' + moz + '$1') +\n\t\t\t\t\t\t\tout.replace(plcholdrptn, ':' + ms + 'input-$1') + out\n\t\t\t\t\t\t)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tpattern = 0\n\t\t\t}\n\t\t}\n\n\t\treturn flat + out + children\n\t}\n\n\t/**\n\t * Select\n\t *\n\t * @param {Array} parent\n\t * @param {string} current\n\t * @param {number} invert\n\t * @return {Array}\n\t */\n\tfunction select (parent, current, invert) {\n\t\tvar selectors = current.trim().split(selectorptn)\n\t\tvar out = selectors\n\n\t\tvar length = selectors.length\n\t\tvar l = parent.length\n\n\t\tswitch (l) {\n\t\t\t// 0-1 parent selectors\n\t\t\tcase 0:\n\t\t\tcase 1: {\n\t\t\t\tfor (var i = 0, selector = l === 0 ? '' : parent[0] + ' '; i < length; ++i) {\n\t\t\t\t\tout[i] = scope(selector, out[i], invert, l).trim()\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// >2 parent selectors, nested\n\t\t\tdefault: {\n\t\t\t\tfor (var i = 0, j = 0, out = []; i < length; ++i) {\n\t\t\t\t\tfor (var k = 0; k < l; ++k) {\n\t\t\t\t\t\tout[j++] = scope(parent[k] + ' ', selectors[i], invert, l).trim()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn out\n\t}\n\n\t/**\n\t * Scope\n\t *\n\t * @param {string} parent\n\t * @param {string} current\n\t * @param {number} invert\n\t * @param {number} level\n\t * @return {string}\n\t */\n\tfunction scope (parent, current, invert, level) {\n\t\tvar selector = current\n\t\tvar code = selector.charCodeAt(0)\n\n\t\t// trim leading whitespace\n\t\tif (code < 33) {\n\t\t\tcode = (selector = selector.trim()).charCodeAt(0)\n\t\t}\n\n\t\tswitch (code) {\n\t\t\t// &\n\t\t\tcase AND: {\n\t\t\t\tswitch (cascade + level) {\n\t\t\t\t\tcase 0:\n\t\t\t\t\tcase 1: {\n\t\t\t\t\t\tif (parent.trim().length === 0) {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\treturn selector.replace(andptn, '$1'+parent.trim())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// :\n\t\t\tcase COLON: {\n\t\t\t\tswitch (selector.charCodeAt(1)) {\n\t\t\t\t\t// g in :global\n\t\t\t\t\tcase 103: {\n\t\t\t\t\t\tif (escape > 0 && cascade > 0) {\n\t\t\t\t\t\t\treturn selector.replace(escapeptn, '$1').replace(andptn, '$1'+nscope)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\t// :hover\n\t\t\t\t\t\treturn parent.trim() + selector.replace(andptn, '$1'+parent.trim())\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\t// html &\n\t\t\t\tif (invert*cascade > 0 && selector.indexOf('\\f') > 0) {\n\t\t\t\t\treturn selector.replace(andptn, (parent.charCodeAt(0) === COLON ? '' : '$1')+parent.trim())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn parent + selector\n\t}\n\n\t/**\n\t * Property\n\t *\n\t * @param {string} input\n\t * @param {number} first\n\t * @param {number} second\n\t * @param {number} third\n\t * @return {string}\n\t */\n\tfunction property (input, first, second, third) {\n\t\tvar index = 0\n\t\tvar out = input + ';'\n\t\tvar hash = (first*2) + (second*3) + (third*4)\n\t\tvar cache\n\n\t\t// animation: a, n, i characters\n\t\tif (hash === 944) {\n\t\t\treturn animation(out)\n\t\t} else if (prefix === 0 || (prefix === 2 && !vendor(out, 1))) {\n\t\t\treturn out\n\t\t}\n\n\t\t// vendor prefix\n\t\tswitch (hash) {\n\t\t\t// text-decoration/text-size-adjust/text-shadow/text-align/text-transform: t, e, x\n\t\t\tcase 1015: {\n\t\t\t\t// text-shadow/text-align/text-transform, a\n\t\t\t\treturn out.charCodeAt(10) === 97 ? webkit + out + out : out\n\t\t\t}\n\t\t\t// filter/fill f, i, l\n\t\t\tcase 951: {\n\t\t\t\t// filter, t\n\t\t\t\treturn out.charCodeAt(3) === 116 ? webkit + out + out : out\n\t\t\t}\n\t\t\t// color/column, c, o, l\n\t\t\tcase 963: {\n\t\t\t\t// column, n\n\t\t\t\treturn out.charCodeAt(5) === 110 ? webkit + out + out : out\n\t\t\t}\n\t\t\t// box-decoration-break, b, o, x\n\t\t\tcase 1009: {\n\t\t\t\tif (out.charCodeAt(4) !== 100) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\t// mask, m, a, s\n\t\t\t// clip-path, c, l, i\n\t\t\tcase 969:\n\t\t\tcase 942: {\n\t\t\t\treturn webkit + out + out\n\t\t\t}\n\t\t\t// appearance: a, p, p\n\t\t\tcase 978: {\n\t\t\t\treturn webkit + out + moz + out + out\n\t\t\t}\n\t\t\t// hyphens: h, y, p\n\t\t\t// user-select: u, s, e\n\t\t\tcase 1019:\n\t\t\tcase 983: {\n\t\t\t\treturn webkit + out + moz + out + ms + out + out\n\t\t\t}\n\t\t\t// background/backface-visibility, b, a, c\n\t\t\tcase 883: {\n\t\t\t\t// backface-visibility, -\n\t\t\t\tif (out.charCodeAt(8) === DASH) {\n\t\t\t\t\treturn webkit + out + out\n\t\t\t\t}\n\n\t\t\t\t// image-set(...)\n\t\t\t\tif (out.indexOf('image-set(', 11) > 0) {\n\t\t\t\t\treturn out.replace(imgsrcptn, '$1'+webkit+'$2') + out\n\t\t\t\t}\n\n\t\t\t\treturn out\n\t\t\t}\n\t\t\t// flex: f, l, e\n\t\t\tcase 932: {\n\t\t\t\tif (out.charCodeAt(4) === DASH) {\n\t\t\t\t\tswitch (out.charCodeAt(5)) {\n\t\t\t\t\t\t// flex-grow, g\n\t\t\t\t\t\tcase 103: {\n\t\t\t\t\t\t\treturn webkit + 'box-' + out.replace('-grow', '') + webkit + out + ms + out.replace('grow', 'positive') + out\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// flex-shrink, s\n\t\t\t\t\t\tcase 115: {\n\t\t\t\t\t\t\treturn webkit + out + ms + out.replace('shrink', 'negative') + out\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// flex-basis, b\n\t\t\t\t\t\tcase 98: {\n\t\t\t\t\t\t\treturn webkit + out + ms + out.replace('basis', 'preferred-size') + out\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn webkit + out + ms + out + out\n\t\t\t}\n\t\t\t// order: o, r, d\n\t\t\tcase 964: {\n\t\t\t\treturn webkit + out + ms + 'flex' + '-' + out + out\n\t\t\t}\n\t\t\t// justify-items/justify-content, j, u, s\n\t\t\tcase 1023: {\n\t\t\t\t// justify-content, c\n\t\t\t\tif (out.charCodeAt(8) !== 99) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tcache = out.substring(out.indexOf(':', 15)).replace('flex-', '').replace('space-between', 'justify')\n\t\t\t\treturn webkit + 'box-pack' + cache + webkit + out + ms + 'flex-pack' + cache + out\n\t\t\t}\n\t\t\t// cursor, c, u, r\n\t\t\tcase 1005: {\n\t\t\t\treturn cursorptn.test(out) ? out.replace(colonptn, ':' + webkit) + out.replace(colonptn, ':' + moz) + out : out\n\t\t\t}\n\t\t\t// writing-mode, w, r, i\n\t\t\tcase 1000: {\n\t\t\t\tcache = out.substring(13).trim()\n\t\t\t\tindex = cache.indexOf('-') + 1\n\n\t\t\t\tswitch (cache.charCodeAt(0)+cache.charCodeAt(index)) {\n\t\t\t\t\t// vertical-lr\n\t\t\t\t\tcase 226: {\n\t\t\t\t\t\tcache = out.replace(writingptn, 'tb')\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\t// vertical-rl\n\t\t\t\t\tcase 232: {\n\t\t\t\t\t\tcache = out.replace(writingptn, 'tb-rl')\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\t// horizontal-tb\n\t\t\t\t\tcase 220: {\n\t\t\t\t\t\tcache = out.replace(writingptn, 'lr')\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\treturn out\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn webkit + out + ms + cache + out\n\t\t\t}\n\t\t\t// position: sticky\n\t\t\tcase 1017: {\n\t\t\t\tif (out.indexOf('sticky', 9) === -1) {\n\t\t\t\t\treturn out\n\t\t\t\t}\n\t\t\t}\n\t\t\t// display(flex/inline-flex/inline-box): d, i, s\n\t\t\tcase 975: {\n\t\t\t\tindex = (out = input).length - 10\n\t\t\t\tcache = (out.charCodeAt(index) === 33 ? out.substring(0, index) : out).substring(input.indexOf(':', 7) + 1).trim()\n\n\t\t\t\tswitch (hash = cache.charCodeAt(0) + (cache.charCodeAt(7)|0)) {\n\t\t\t\t\t// inline-\n\t\t\t\t\tcase 203: {\n\t\t\t\t\t\t// inline-box\n\t\t\t\t\t\tif (cache.charCodeAt(8) < 111) {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t// inline-box/sticky\n\t\t\t\t\tcase 115: {\n\t\t\t\t\t\tout = out.replace(cache, webkit+cache)+';'+out\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\t// inline-flex\n\t\t\t\t\t// flex\n\t\t\t\t\tcase 207:\n\t\t\t\t\tcase 102: {\n\t\t\t\t\t\tout = (\n\t\t\t\t\t\t\tout.replace(cache, webkit+(hash > 102 ? 'inline-' : '')+'box')+';'+\n\t\t\t\t\t\t\tout.replace(cache, webkit+cache)+';'+\n\t\t\t\t\t\t\tout.replace(cache, ms+cache+'box')+';'+\n\t\t\t\t\t\t\tout\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn out + ';'\n\t\t\t}\n\t\t\t// align-items, align-center, align-self: a, l, i, -\n\t\t\tcase 938: {\n\t\t\t\tif (out.charCodeAt(5) === DASH) {\n\t\t\t\t\tswitch (out.charCodeAt(6)) {\n\t\t\t\t\t\t// align-items, i\n\t\t\t\t\t\tcase 105: {\n\t\t\t\t\t\t\tcache = out.replace('-items', '')\n\t\t\t\t\t\t\treturn webkit + out + webkit + 'box-' + cache + ms + 'flex-' + cache + out\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// align-self, s\n\t\t\t\t\t\tcase 115: {\n\t\t\t\t\t\t\treturn webkit + out + ms + 'flex-item-' + out.replace(selfptn, '') + out\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// align-content\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\treturn webkit + out + ms + 'flex-line-pack' + out.replace('align-content', '').replace(selfptn, '') + out\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// min/max\n\t\t\tcase 973:\n\t\t\tcase 989: {\n\t\t\t\t// min-/max- height/width/block-size/inline-size\n\t\t\t\tif (out.charCodeAt(3) !== DASH || out.charCodeAt(4) === 122) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\t// height/width: min-content / width: max-content\n\t\t\tcase 931:\n\t\t\tcase 953: {\n\t\t\t\tif (dimensionptn.test(input) === true) {\n\t\t\t\t\t// stretch\n\t\t\t\t\tif ((cache = input.substring(input.indexOf(':') + 1)).charCodeAt(0) === 115)\n\t\t\t\t\t\treturn property(input.replace('stretch', 'fill-available'), first, second, third).replace(':fill-available', ':stretch')\n\t\t\t\t\telse\n\t\t\t\t\t\treturn out.replace(cache, webkit + cache) + out.replace(cache, moz + cache.replace('fill-', '')) + out\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// transform, transition: t, r, a\n\t\t\tcase 962: {\n\t\t\t\tout = webkit + out + (out.charCodeAt(5) === 102 ? ms + out : '') + out\n\n\t\t\t\t// transitions\n\t\t\t\tif (second + third === 211 && out.charCodeAt(13) === 105 && out.indexOf('transform', 10) > 0) {\n\t\t\t\t\treturn out.substring(0, out.indexOf(';', 27) + 1).replace(transformptn, '$1' + webkit + '$2') + out\n\t\t\t\t}\n\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\treturn out\n\t}\n\n\t/**\n\t * Vendor\n\t *\n\t * @param {string} content\n\t * @param {number} context\n\t * @return {boolean}\n\t */\n\tfunction vendor (content, context) {\n\t\tvar index = content.indexOf(context === 1 ? ':' : '{')\n\t\tvar key = content.substring(0, context !== 3 ? index : 10)\n\t\tvar value = content.substring(index + 1, content.length - 1)\n\n\t\treturn should(context !== 2 ? key : key.replace(pseudofmt, '$1'), value, context)\n\t}\n\n\t/**\n\t * Supports\n\t *\n\t * @param {string} match\n\t * @param {string} group\n\t * @return {string}\n\t */\n\tfunction supports (match, group) {\n\t\tvar out = property(group, group.charCodeAt(0), group.charCodeAt(1), group.charCodeAt(2))\n\n\t\treturn out !== group+';' ? out.replace(propertyptn, ' or ($1)').substring(4) : '('+group+')'\n\t}\n\n\t/**\n\t * Animation\n\t *\n\t * @param {string} input\n\t * @return {string}\n\t */\n\tfunction animation (input) {\n\t\tvar length = input.length\n\t\tvar index = input.indexOf(':', 9) + 1\n\t\tvar declare = input.substring(0, index).trim()\n\t\tvar out = input.substring(index, length-1).trim()\n\n\t\tswitch (input.charCodeAt(9)*keyed) {\n\t\t\tcase 0: {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\t// animation-*, -\n\t\t\tcase DASH: {\n\t\t\t\t// animation-name, n\n\t\t\t\tif (input.charCodeAt(10) !== 110) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\t// animation/animation-name\n\t\t\tdefault: {\n\t\t\t\t// split in case of multiple animations\n\t\t\t\tvar list = out.split((out = '', animationptn))\n\n\t\t\t\tfor (var i = 0, index = 0, length = list.length; i < length; index = 0, ++i) {\n\t\t\t\t\tvar value = list[i]\n\t\t\t\t\tvar items = value.split(propertiesptn)\n\n\t\t\t\t\twhile (value = items[index]) {\n\t\t\t\t\t\tvar peak = value.charCodeAt(0)\n\n\t\t\t\t\t\tif (keyed === 1 && (\n\t\t\t\t\t\t\t// letters\n\t\t\t\t\t\t\t(peak > AT && peak < 90) || (peak > 96 && peak < 123) || peak === UNDERSCORE ||\n\t\t\t\t\t\t\t// dash but not in sequence i.e --\n\t\t\t\t\t\t\t(peak === DASH && value.charCodeAt(1) !== DASH)\n\t\t\t\t\t\t)) {\n\t\t\t\t\t\t\t// not a number/function\n\t\t\t\t\t\t\tswitch (isNaN(parseFloat(value)) + (value.indexOf('(') !== -1)) {\n\t\t\t\t\t\t\t\tcase 1: {\n\t\t\t\t\t\t\t\t\tswitch (value) {\n\t\t\t\t\t\t\t\t\t\t// not a valid reserved keyword\n\t\t\t\t\t\t\t\t\t\tcase 'infinite': case 'alternate': case 'backwards': case 'running':\n\t\t\t\t\t\t\t\t\t\tcase 'normal': case 'forwards': case 'both': case 'none': case 'linear':\n\t\t\t\t\t\t\t\t\t\tcase 'ease': case 'ease-in': case 'ease-out': case 'ease-in-out':\n\t\t\t\t\t\t\t\t\t\tcase 'paused': case 'reverse': case 'alternate-reverse': case 'inherit':\n\t\t\t\t\t\t\t\t\t\tcase 'initial': case 'unset': case 'step-start': case 'step-end': {\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\t\t\t\tvalue += key\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\titems[index++] = value\n\t\t\t\t\t}\n\n\t\t\t\t\tout += (i === 0 ? '' : ',') + items.join(' ')\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tout = declare + out + ';'\n\n\t\tif (prefix === 1 || (prefix === 2 && vendor(out, 1)))\n\t\t\treturn webkit + out + out\n\n\t\treturn out\n\t}\n\n\t/**\n\t * Isolate\n\t *\n\t * @param {Array} current\n\t */\n\tfunction isolate (current) {\n\t\tfor (var i = 0, length = current.length, selector = Array(length), padding, element; i < length; ++i) {\n\t\t\t// split individual elements in a selector i.e h1 h2 === [h1, h2]\n\t\t\tvar elements = current[i].split(elementptn)\n\t\t\tvar out = ''\n\n\t\t\tfor (var j = 0, size = 0, tail = 0, code = 0, l = elements.length; j < l; ++j) {\n\t\t\t\t// empty element\n\t\t\t\tif ((size = (element = elements[j]).length) === 0 && l > 1) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\ttail = out.charCodeAt(out.length-1)\n\t\t\t\tcode = element.charCodeAt(0)\n\t\t\t\tpadding = ''\n\n\t\t\t\tif (j !== 0) {\n\t\t\t\t\t// determine if we need padding\n\t\t\t\t\tswitch (tail) {\n\t\t\t\t\t\tcase STAR:\n\t\t\t\t\t\tcase TILDE:\n\t\t\t\t\t\tcase GREATERTHAN:\n\t\t\t\t\t\tcase PLUS:\n\t\t\t\t\t\tcase SPACE:\n\t\t\t\t\t\tcase OPENPARENTHESES: {\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\tpadding = ' '\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tswitch (code) {\n\t\t\t\t\tcase AND: {\n\t\t\t\t\t\telement = padding + nscopealt\n\t\t\t\t\t}\n\t\t\t\t\tcase TILDE:\n\t\t\t\t\tcase GREATERTHAN:\n\t\t\t\t\tcase PLUS:\n\t\t\t\t\tcase SPACE:\n\t\t\t\t\tcase CLOSEPARENTHESES:\n\t\t\t\t\tcase OPENPARENTHESES: {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase OPENBRACKET: {\n\t\t\t\t\t\telement = padding + element + nscopealt\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase COLON: {\n\t\t\t\t\t\tswitch (element.charCodeAt(1)*2 + element.charCodeAt(2)*3) {\n\t\t\t\t\t\t\t// :global\n\t\t\t\t\t\t\tcase 530: {\n\t\t\t\t\t\t\t\tif (escape > 0) {\n\t\t\t\t\t\t\t\t\telement = padding + element.substring(8, size - 1)\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// :hover, :nth-child(), ...\n\t\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\t\tif (j < 1 || elements[j-1].length < 1) {\n\t\t\t\t\t\t\t\t\telement = padding + nscopealt + element\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase COMMA: {\n\t\t\t\t\t\tpadding = ''\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tif (size > 1 && element.indexOf(':') > 0) {\n\t\t\t\t\t\t\telement = padding + element.replace(pseudoptn, '$1' + nscopealt + '$2')\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\telement = padding + element + nscopealt\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tout += element\n\t\t\t}\n\n\t\t\tselector[i] = out.replace(formatptn, '').trim()\n\t\t}\n\n\t\treturn selector\n\t}\n\n\t/**\n\t * Proxy\n\t *\n\t * @param {number} context\n\t * @param {string} content\n\t * @param {Array} selectors\n\t * @param {Array} parents\n\t * @param {number} line\n\t * @param {number} column\n\t * @param {number} length\n\t * @param {number} id\n\t * @param {number} depth\n\t * @param {number} at\n\t * @return {(string|void|*)}\n\t */\n\tfunction proxy (context, content, selectors, parents, line, column, length, id, depth, at) {\n\t\tfor (var i = 0, out = content, next; i < plugged; ++i) {\n\t\t\tswitch (next = plugins[i].call(stylis, context, out, selectors, parents, line, column, length, id, depth, at)) {\n\t\t\t\tcase void 0:\n\t\t\t\tcase false:\n\t\t\t\tcase true:\n\t\t\t\tcase null: {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tout = next\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (out !== content) {\n\t\t return out\n\t\t}\n\t}\n\n\t/**\n\t * @param {number} code\n\t * @param {number} index\n\t * @param {number} length\n\t * @param {string} body\n\t * @return {number}\n\t */\n\tfunction delimited (code, index, length, body) {\n\t\tfor (var i = index + 1; i < length; ++i) {\n\t\t\tswitch (body.charCodeAt(i)) {\n\t\t\t\t// /*\n\t\t\t\tcase FOWARDSLASH: {\n\t\t\t\t\tif (code === STAR) {\n\t\t\t\t\t\tif (body.charCodeAt(i - 1) === STAR && index + 2 !== i) {\n\t\t\t\t\t\t\treturn i + 1\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\t// //\n\t\t\t\tcase NEWLINE: {\n\t\t\t\t\tif (code === FOWARDSLASH) {\n\t\t\t\t\t\treturn i + 1\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn i\n\t}\n\n\t/**\n\t * @param {number} type\n\t * @param {number} index\n\t * @param {number} length\n\t * @param {number} find\n\t * @param {string} body\n\t * @return {number}\n\t */\n\tfunction match (type, index, length, body) {\n\t\tfor (var i = index + 1; i < length; ++i) {\n\t\t\tswitch (body.charCodeAt(i)) {\n\t\t\t\tcase type: {\n\t\t\t\t\treturn i\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn i\n\t}\n\n\t/**\n\t * Minify\n\t *\n\t * @param {(string|*)} output\n\t * @return {string}\n\t */\n\tfunction minify (output) {\n\t\treturn output\n\t\t\t.replace(formatptn, '')\n\t\t\t.replace(beforeptn, '')\n\t\t\t.replace(afterptn, '$1')\n\t\t\t.replace(tailptn, '$1')\n\t\t\t.replace(whiteptn, ' ')\n\t}\n\n\t/**\n\t * Use\n\t *\n\t * @param {(Array|function(...?)|number|void)?} plugin\n\t */\n\tfunction use (plugin) {\n\t\tswitch (plugin) {\n\t\t\tcase void 0:\n\t\t\tcase null: {\n\t\t\t\tplugged = plugins.length = 0\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault: {\n\t\t\t\tif (typeof plugin === 'function') {\n\t\t\t\t\tplugins[plugged++] = plugin\n\t\t\t\t}\telse if (typeof plugin === 'object') {\n\t\t\t\t\tfor (var i = 0, length = plugin.length; i < length; ++i) {\n\t\t\t\t\t\tuse(plugin[i])\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tunkwn = !!plugin|0\n\t\t\t\t}\n\t\t\t}\n \t\t}\n\n \t\treturn use\n\t}\n\n\t/**\n\t * Set\n\t *\n\t * @param {*} options\n\t */\n\tfunction set (options) {\n\t\tfor (var name in options) {\n\t\t\tvar value = options[name]\n\t\t\tswitch (name) {\n\t\t\t\tcase 'keyframe': keyed = value|0; break\n\t\t\t\tcase 'global': escape = value|0; break\n\t\t\t\tcase 'cascade': cascade = value|0; break\n\t\t\t\tcase 'compress': compress = value|0; break\n\t\t\t\tcase 'semicolon': semicolon = value|0; break\n\t\t\t\tcase 'preserve': preserve = value|0; break\n\t\t\t\tcase 'prefix':\n\t\t\t\t\tshould = null\n\n\t\t\t\t\tif (!value) {\n\t\t\t\t\t\tprefix = 0\n\t\t\t\t\t} else if (typeof value !== 'function') {\n\t\t\t\t\t\tprefix = 1\n\t\t\t\t\t} else {\n\t\t\t\t\t\tprefix = 2\n\t\t\t\t\t\tshould = value\n\t\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn set\n\t}\n\n\t/**\n\t * Stylis\n\t *\n\t * @param {string} selector\n\t * @param {string} input\n\t * @return {*}\n\t */\n\tfunction stylis (selector, input) {\n\t\tif (this !== void 0 && this.constructor === stylis) {\n\t\t\treturn factory(selector)\n\t\t}\n\n\t\t// setup\n\t\tvar ns = selector\n\t\tvar code = ns.charCodeAt(0)\n\n\t\t// trim leading whitespace\n\t\tif (code < 33) {\n\t\t\tcode = (ns = ns.trim()).charCodeAt(0)\n\t\t}\n\n\t\t// keyframe/animation namespace\n\t\tif (keyed > 0) {\n\t\t\tkey = ns.replace(invalidptn, code === OPENBRACKET ? '' : '-')\n\t\t}\n\n\t\t// reset, used to assert if a plugin is moneky-patching the return value\n\t\tcode = 1\n\n\t\t// cascade/isolate\n\t\tif (cascade === 1) {\n\t\t\tnscope = ns\n\t\t} else {\n\t\t\tnscopealt = ns\n\t\t}\n\n\t\tvar selectors = [nscope]\n\t\tvar result\n\n\t\t// execute plugins, pre-process context\n\t\tif (plugged > 0) {\n\t\t\tresult = proxy(PREPS, input, selectors, selectors, line, column, 0, 0, 0, 0)\n\n\t\t\tif (result !== void 0 && typeof result === 'string') {\n\t\t\t\tinput = result\n\t\t\t}\n\t\t}\n\n\t\t// build\n\t\tvar output = compile(array, selectors, input, 0, 0)\n\n\t\t// execute plugins, post-process context\n\t\tif (plugged > 0) {\n\t\t\tresult = proxy(POSTS, output, selectors, selectors, line, column, output.length, 0, 0, 0)\n\n\t\t\t// bypass minification\n\t\t\tif (result !== void 0 && typeof(output = result) !== 'string') {\n\t\t\t\tcode = 0\n\t\t\t}\n\t\t}\n\n\t\t// reset\n\t\tkey = ''\n\t\tnscope = ''\n\t\tnscopealt = ''\n\t\tpattern = 0\n\t\tline = 1\n\t\tcolumn = 1\n\n\t\treturn compress*code === 0 ? output : minify(output)\n\t}\n\n\tstylis['use'] = use\n\tstylis['set'] = set\n\n\tif (options !== void 0) {\n\t\tset(options)\n\t}\n\n\treturn stylis\n}));\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n","function areInputsEqual(newInputs, lastInputs) {\n if (newInputs.length !== lastInputs.length) {\n return false;\n }\n for (var i = 0; i < newInputs.length; i++) {\n if (newInputs[i] !== lastInputs[i]) {\n return false;\n }\n }\n return true;\n}\n\nfunction memoizeOne(resultFn, isEqual) {\n if (isEqual === void 0) { isEqual = areInputsEqual; }\n var lastThis;\n var lastArgs = [];\n var lastResult;\n var calledOnce = false;\n function memoized() {\n var newArgs = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n newArgs[_i] = arguments[_i];\n }\n if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {\n return lastResult;\n }\n lastResult = resultFn.apply(this, newArgs);\n calledOnce = true;\n lastThis = this;\n lastArgs = newArgs;\n return lastResult;\n }\n return memoized;\n}\n\nexport default memoizeOne;\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","package com.arkivanov.mvikotlin.rx.internal\n\nimport com.arkivanov.mvikotlin.rx.Observer\nimport com.arkivanov.mvikotlin.utils.internal.atomic\nimport com.arkivanov.mvikotlin.utils.internal.getValue\nimport com.arkivanov.mvikotlin.utils.internal.setValue\n\ninterface BehaviorSubject : Subject {\n\n val value: T\n}\n\n@Suppress(\"FunctionName\")\nfun BehaviorSubject(initialValue: T): BehaviorSubject = BehaviorSubjectImpl(initialValue)\n\nprivate class BehaviorSubjectImpl(initialValue: T) : ThreadLocalSubject(), BehaviorSubject {\n\n override var value: T by atomic(initialValue)\n private set\n\n override fun onSubscribed(observer: Observer) {\n super.onSubscribed(observer)\n\n observer.onNext(value)\n }\n\n override fun onNext(value: T) {\n this.value = value\n\n super.onNext(value)\n }\n}\n","package com.arkivanov.mvikotlin.rx.internal\n\ninterface PublishSubject : Subject\n\n@Suppress(\"FunctionName\")\nfun PublishSubject(): PublishSubject = PublishSubjectImpl()\n\nprivate class PublishSubjectImpl : ThreadLocalSubject(), PublishSubject\n","package com.arkivanov.mvikotlin.rx.internal\n\nimport com.arkivanov.mvikotlin.rx.Disposable\nimport com.arkivanov.mvikotlin.utils.internal.atomic\nimport com.arkivanov.mvikotlin.utils.internal.getValue\nimport com.arkivanov.mvikotlin.utils.internal.setValue\n\n@Suppress(\"FunctionName\")\ninline fun Disposable(crossinline onDispose: Disposable.() -> Unit = {}): Disposable =\n object : Disposable {\n @Suppress(\"ObjectPropertyName\")\n override var isDisposed: Boolean by atomic(false)\n\n override fun dispose() {\n isDisposed = true\n onDispose()\n }\n }\n","package com.arkivanov.mvikotlin.rx.internal\n\nimport com.arkivanov.mvikotlin.rx.Disposable\nimport com.arkivanov.mvikotlin.rx.Observer\nimport com.arkivanov.mvikotlin.utils.internal.assertOnMainThread\nimport kotlin.native.concurrent.ThreadLocal\n\ninternal open class ThreadLocalSubject : Subject {\n\n init {\n @Suppress(\"ReplacePutWithAssignment\", \"LeakingThis\") // This is safe in this particular case\n state[this] = MutableState()\n }\n\n override val isActive: Boolean get() = state.containsKey(this)\n\n override fun subscribe(observer: Observer): Disposable {\n val mutableState: MutableState? = getMutableState()\n\n return if (mutableState == null) {\n observer.onComplete()\n Disposable().also(Disposable::dispose)\n } else {\n val disposable = disposable()\n mutableState.map += disposable to observer\n onSubscribed(observer)\n disposable\n }\n }\n\n private fun disposable(): Disposable =\n Disposable {\n assertOnMainThread()\n getMutableState()?.also { it.map -= this }\n }\n\n protected open fun onSubscribed(observer: Observer) {\n }\n\n override fun onNext(value: T) {\n val mutableState = getMutableState() ?: return\n mutableState.queue += value\n mutableState.drainIfNeeded()\n }\n\n override fun onComplete() {\n val mutableState = removeMutableState() ?: return\n mutableState.isCompleted = true\n mutableState.drainIfNeeded()\n }\n\n private fun MutableState.drainIfNeeded() {\n if (!isDraining) {\n isDraining = true\n try {\n drain()\n } finally {\n isDraining = false\n }\n }\n }\n\n private fun MutableState.drain() {\n while (queue.isNotEmpty()) {\n val value = queue.removeAt(0)\n map.values.forEach { it.onNext(value) }\n }\n\n if (isCompleted) {\n map.forEach { (disposable, observer) ->\n disposable.dispose()\n observer.onComplete()\n }\n }\n }\n\n @Suppress(\"UNCHECKED_CAST\")\n private fun getMutableState(): MutableState? = state[this] as MutableState?\n\n @Suppress(\"UNCHECKED_CAST\")\n private fun removeMutableState(): MutableState? = state.remove(this) as MutableState?\n\n @ThreadLocal\n private companion object {\n private val state: MutableMap, MutableState<*>> = HashMap()\n }\n\n private class MutableState {\n var map = mapOf>()\n val queue = ArrayList()\n var isCompleted = false\n var isDraining = false\n }\n}\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"var toString = {}.toString;\n\nmodule.exports = Array.isArray || function (arr) {\n return toString.call(arr) == '[object Array]';\n};\n","'use strict'\nvar Buffer = require('safe-buffer').Buffer\nvar Transform = require('readable-stream').Transform\nvar inherits = require('inherits')\n\nfunction throwIfNotStringOrBuffer (val, prefix) {\n if (!Buffer.isBuffer(val) && typeof val !== 'string') {\n throw new TypeError(prefix + ' must be a string or a buffer')\n }\n}\n\nfunction HashBase (blockSize) {\n Transform.call(this)\n\n this._block = Buffer.allocUnsafe(blockSize)\n this._blockSize = blockSize\n this._blockOffset = 0\n this._length = [0, 0, 0, 0]\n\n this._finalized = false\n}\n\ninherits(HashBase, Transform)\n\nHashBase.prototype._transform = function (chunk, encoding, callback) {\n var error = null\n try {\n this.update(chunk, encoding)\n } catch (err) {\n error = err\n }\n\n callback(error)\n}\n\nHashBase.prototype._flush = function (callback) {\n var error = null\n try {\n this.push(this.digest())\n } catch (err) {\n error = err\n }\n\n callback(error)\n}\n\nHashBase.prototype.update = function (data, encoding) {\n throwIfNotStringOrBuffer(data, 'Data')\n if (this._finalized) throw new Error('Digest already called')\n if (!Buffer.isBuffer(data)) data = Buffer.from(data, encoding)\n\n // consume data\n var block = this._block\n var offset = 0\n while (this._blockOffset + data.length - offset >= this._blockSize) {\n for (var i = this._blockOffset; i < this._blockSize;) block[i++] = data[offset++]\n this._update()\n this._blockOffset = 0\n }\n while (offset < data.length) block[this._blockOffset++] = data[offset++]\n\n // update length\n for (var j = 0, carry = data.length * 8; carry > 0; ++j) {\n this._length[j] += carry\n carry = (this._length[j] / 0x0100000000) | 0\n if (carry > 0) this._length[j] -= 0x0100000000 * carry\n }\n\n return this\n}\n\nHashBase.prototype._update = function () {\n throw new Error('_update is not implemented')\n}\n\nHashBase.prototype.digest = function (encoding) {\n if (this._finalized) throw new Error('Digest already called')\n this._finalized = true\n\n var digest = this._digest()\n if (encoding !== undefined) digest = digest.toString(encoding)\n\n // reset state\n this._block.fill(0)\n this._blockOffset = 0\n for (var i = 0; i < 4; ++i) this._length[i] = 0\n\n return digest\n}\n\nHashBase.prototype._digest = function () {\n throw new Error('_digest is not implemented')\n}\n\nmodule.exports = HashBase\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nmodule.exports = Readable;\n/**/\n\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n/**/\n\nvar EE = require('events').EventEmitter;\n\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\n\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n\nvar Buffer = require('buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n/**/\n\n\nvar debugUtil = require('util');\n\nvar debug;\n\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/**/\n\n\nvar BufferList = require('./internal/streams/buffer_list');\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance.\n\n\nvar StringDecoder;\nvar createReadableStreamAsyncIterator;\nvar from;\n\nrequire('inherits')(Readable, Stream);\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n\n this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n\n this.sync = true; // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish')\n\n this.autoDestroy = !!options.autoDestroy; // has it been destroyed\n\n this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s\n\n this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled\n\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex); // legacy\n\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\n\nReadable.prototype._destroy = function (err, cb) {\n cb(err);\n}; // Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\n\n\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n}; // Unshift should *always* be something directly out of read()\n\n\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug('readableAddChunk', chunk);\n var state = stream._readableState;\n\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n } // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n\n\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit('data', chunk);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);\n }\n\n return er;\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n}; // backwards compatibility.\n\n\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8\n\n this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers:\n\n var p = this._readableState.buffer.head;\n var content = '';\n\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n\n this._readableState.buffer.clear();\n\n if (content !== '') this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n}; // Don't raise the hwm > 1GB\n\n\nvar MAX_HWM = 0x40000000;\n\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n\n return n;\n} // This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.\n\n\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.\n\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n } // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n // if we need a readable event, then we need to do some reading.\n\n\n var doRead = state.needReadable;\n debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some\n\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n } // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n\n\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true; // if the length is currently zero, then we *need* a readable event.\n\n if (state.length === 0) state.needReadable = true; // call internal read method\n\n this._read(state.highWaterMark);\n\n state.sync = false; // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.\n\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n debug('onEofChunk');\n if (state.ended) return;\n\n if (state.decoder) {\n var chunk = state.decoder.end();\n\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n\n state.ended = true;\n\n if (state.sync) {\n // if we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call\n emitReadable(stream);\n } else {\n // emit 'readable' now to make sure it gets picked up.\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n} // Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\n\n\nfunction emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}\n\nfunction emitReadable_(stream) {\n var state = stream._readableState;\n debug('emitReadable_', state.destroyed, state.length, state.ended);\n\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit('readable');\n state.emittedReadable = false;\n } // The stream needs another readable event if\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n\n\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n} // at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\n\n\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length) // didn't get any data, stop spinning.\n break;\n }\n\n state.readingMore = false;\n} // abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\n\n\nReadable.prototype._read = function (n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n\n default:\n state.pipes.push(dest);\n break;\n }\n\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n } // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n\n\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n\n function cleanup() {\n debug('cleanup'); // cleanup event handlers once the pipe is broken\n\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true; // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n\n src.on('data', ondata);\n\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n debug('dest.write', ret);\n\n if (ret === false) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n }\n\n src.pause();\n }\n } // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n\n\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);\n } // Make sure our error handler is attached before userland ones.\n\n\n prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.\n\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n\n dest.once('close', onclose);\n\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n } // tell the dest that it's being piped to\n\n\n dest.emit('pipe', src); // start the flow if it hasn't been started already.\n\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n }; // if we're not piping anywhere, then do nothing.\n\n if (state.pipesCount === 0) return this; // just one destination. most common case.\n\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes; // got a match.\n\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n } // slow case. multiple pipe destinations.\n\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit('unpipe', this, {\n hasUnpiped: false\n });\n }\n\n return this;\n } // try to find the right one.\n\n\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n}; // set up data events if they are asked for\n// Ensure readable listeners eventually get something\n\n\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n\n if (ev === 'data') {\n // update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused\n\n if (state.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug('on readable', state.length, state.reading);\n\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n\n return res;\n};\n\nReadable.prototype.addListener = Readable.prototype.on;\n\nReadable.prototype.removeListener = function (ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nReadable.prototype.removeAllListeners = function (ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nfunction updateReadableListening(self) {\n var state = self._readableState;\n state.readableListening = self.listenerCount('readable') > 0;\n\n if (state.resumeScheduled && !state.paused) {\n // flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true; // crude way to check if we should resume\n } else if (self.listenerCount('data') > 0) {\n self.resume();\n }\n}\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n} // pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\n\n\nReadable.prototype.resume = function () {\n var state = this._readableState;\n\n if (!state.flowing) {\n debug('resume'); // we flow only if there is no one listening\n // for readable, but we still have to call\n // resume()\n\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n\n state.paused = false;\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n debug('resume', state.reading);\n\n if (!state.reading) {\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n\n if (this._readableState.flowing !== false) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n\n this._readableState.paused = true;\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n\n while (state.flowing && stream.read() !== null) {\n ;\n }\n} // wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\n\n\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode\n\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n\n if (!ret) {\n paused = true;\n stream.pause();\n }\n }); // proxy all the other methods.\n // important when wrapping filters and duplexes.\n\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n } // proxy certain important events.\n\n\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n } // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n\n\n this._read = function (n) {\n debug('wrapped _read', n);\n\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nif (typeof Symbol === 'function') {\n Readable.prototype[Symbol.asyncIterator] = function () {\n if (createReadableStreamAsyncIterator === undefined) {\n createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');\n }\n\n return createReadableStreamAsyncIterator(this);\n };\n}\n\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableFlowing', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n}); // exposed for testing purposes only.\n\nReadable._fromList = fromList;\nObject.defineProperty(Readable.prototype, 'readableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n}); // Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n debug('endReadable', state.endEmitted);\n\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift.\n\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well\n var wState = stream._writableState;\n\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n}\n\nif (typeof Symbol === 'function') {\n Readable.from = function (iterable, opts) {\n if (from === undefined) {\n from = require('./internal/streams/from');\n }\n\n return from(Readable, iterable, opts);\n };\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n\n return -1;\n}","module.exports = require('events').EventEmitter;\n","'use strict'; // undocumented cb() API, needed for core, not for public API\n\nfunction destroy(err, cb) {\n var _this = this;\n\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n\n return this;\n } // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n } // if this is a duplex stream mark the writable part as destroyed as well\n\n\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n\n return this;\n}\n\nfunction emitErrorAndCloseNT(self, err) {\n emitErrorNT(self, err);\n emitCloseNT(self);\n}\n\nfunction emitCloseNT(self) {\n if (self._writableState && !self._writableState.emitClose) return;\n if (self._readableState && !self._readableState.emitClose) return;\n self.emit('close');\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\nfunction errorOrDestroy(stream, err) {\n // We have tests that rely on errors being emitted\n // in the same tick, so changing this is semver major.\n // For now when you opt-in to autoDestroy we allow\n // the error to be emitted nextTick. In a future\n // semver major update we should change the default to this.\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);\n}\n\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy,\n errorOrDestroy: errorOrDestroy\n};","'use strict';\n\nvar ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;\n\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n}\n\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : 'highWaterMark';\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n\n return Math.floor(hwm);\n } // Default value\n\n\n return state.objectMode ? 16 : 16 * 1024;\n}\n\nmodule.exports = {\n getHighWaterMark: getHighWaterMark\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n'use strict';\n\nmodule.exports = Writable;\n/* */\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n} // It seems a linked list but it is not\n// there will be only 2 of these for each stream\n\n\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\n\n\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n/**/\n\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n\nvar Buffer = require('buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\n\nrequire('inherits')(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called\n\n this.finalCalled = false; // drain event flag.\n\n this.needDrain = false; // at the start of calling end()\n\n this.ending = false; // when end() has been called, and returned\n\n this.ended = false; // when 'finish' is emitted\n\n this.finished = false; // has it been destroyed\n\n this.destroyed = false; // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n\n this.length = 0; // a flag to see when we're in the middle of a write.\n\n this.writing = false; // when true all writes will be buffered until .uncork() call\n\n this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n\n this.sync = true; // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n\n this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)\n\n this.onwrite = function (er) {\n onwrite(stream, er);\n }; // the callback that the user supplies to write(chunk,encoding,cb)\n\n\n this.writecb = null; // the amount that is being written when _write is called.\n\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null; // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n\n this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n\n this.prefinished = false; // True if the error was already emitted and should not be thrown again\n\n this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')\n\n this.autoDestroy = !!options.autoDestroy; // count buffered requests\n\n this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n\n while (current) {\n out.push(current);\n current = current.next;\n }\n\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})(); // Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\n\n\nvar realHasInstance;\n\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex); // legacy.\n\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n\n Stream.call(this);\n} // Otherwise people can pipe Writable streams, which is just wrong.\n\n\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb\n\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n} // Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\n\n\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n\n return true;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\n\nWritable.prototype.cork = function () {\n this._writableState.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n}); // if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\n\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.\n\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er); // this can emit finish, and it will always happen\n // after error\n\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er); // this can emit finish, but finish must\n // always follow error\n\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state) || stream.destroyed;\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n} // Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\n\n\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it\n\n\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n\n state.pendingcb++;\n state.lastBufferedRequest = null;\n\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks\n\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n } // ignore unnecessary end() calls.\n\n\n if (!state.ending) endWritable(this, state, cb);\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\n\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n\n if (err) {\n errorOrDestroy(stream, err);\n }\n\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n\n if (need) {\n prefinish(stream, state);\n\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well\n var rState = stream._readableState;\n\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n\n if (cb) {\n if (state.finished) process.nextTick(cb);else stream.once('finish', cb);\n }\n\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n } // reuse the free corkReq.\n\n\n state.corkedRequestsFree.next = corkReq;\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\n\nWritable.prototype._destroy = function (err, cb) {\n cb(err);\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n'use strict';\n\nmodule.exports = Transform;\n\nvar _require$codes = require('../errors').codes,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,\n ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\n\nvar Duplex = require('./_stream_duplex');\n\nrequire('inherits')(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n\n if (cb === null) {\n return this.emit('error', new ERR_MULTIPLE_CALLBACK());\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n }; // start out asking for a readable event once data is transformed.\n\n this._readableState.needReadable = true; // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n } // When the writable side finishes, then flush out anything remaining.\n\n\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function' && !this._readableState.destroyed) {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n}; // This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\n\n\nTransform.prototype._transform = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n}; // Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\n\n\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data); // TODO(BridgeAR): Write a test for these two error cases\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n\n if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n}","/**\n * A JavaScript implementation of the Secure Hash Algorithm, SHA-256, as defined\n * in FIPS 180-2\n * Version 2.2-beta Copyright Angel Marin, Paul Johnston 2000 - 2009.\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n *\n */\n\nvar inherits = require('inherits')\nvar Hash = require('./hash')\nvar Buffer = require('safe-buffer').Buffer\n\nvar K = [\n 0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,\n 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,\n 0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,\n 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,\n 0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,\n 0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,\n 0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,\n 0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,\n 0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,\n 0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,\n 0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,\n 0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,\n 0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,\n 0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,\n 0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,\n 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2\n]\n\nvar W = new Array(64)\n\nfunction Sha256 () {\n this.init()\n\n this._w = W // new Array(64)\n\n Hash.call(this, 64, 56)\n}\n\ninherits(Sha256, Hash)\n\nSha256.prototype.init = function () {\n this._a = 0x6a09e667\n this._b = 0xbb67ae85\n this._c = 0x3c6ef372\n this._d = 0xa54ff53a\n this._e = 0x510e527f\n this._f = 0x9b05688c\n this._g = 0x1f83d9ab\n this._h = 0x5be0cd19\n\n return this\n}\n\nfunction ch (x, y, z) {\n return z ^ (x & (y ^ z))\n}\n\nfunction maj (x, y, z) {\n return (x & y) | (z & (x | y))\n}\n\nfunction sigma0 (x) {\n return (x >>> 2 | x << 30) ^ (x >>> 13 | x << 19) ^ (x >>> 22 | x << 10)\n}\n\nfunction sigma1 (x) {\n return (x >>> 6 | x << 26) ^ (x >>> 11 | x << 21) ^ (x >>> 25 | x << 7)\n}\n\nfunction gamma0 (x) {\n return (x >>> 7 | x << 25) ^ (x >>> 18 | x << 14) ^ (x >>> 3)\n}\n\nfunction gamma1 (x) {\n return (x >>> 17 | x << 15) ^ (x >>> 19 | x << 13) ^ (x >>> 10)\n}\n\nSha256.prototype._update = function (M) {\n var W = this._w\n\n var a = this._a | 0\n var b = this._b | 0\n var c = this._c | 0\n var d = this._d | 0\n var e = this._e | 0\n var f = this._f | 0\n var g = this._g | 0\n var h = this._h | 0\n\n for (var i = 0; i < 16; ++i) W[i] = M.readInt32BE(i * 4)\n for (; i < 64; ++i) W[i] = (gamma1(W[i - 2]) + W[i - 7] + gamma0(W[i - 15]) + W[i - 16]) | 0\n\n for (var j = 0; j < 64; ++j) {\n var T1 = (h + sigma1(e) + ch(e, f, g) + K[j] + W[j]) | 0\n var T2 = (sigma0(a) + maj(a, b, c)) | 0\n\n h = g\n g = f\n f = e\n e = (d + T1) | 0\n d = c\n c = b\n b = a\n a = (T1 + T2) | 0\n }\n\n this._a = (a + this._a) | 0\n this._b = (b + this._b) | 0\n this._c = (c + this._c) | 0\n this._d = (d + this._d) | 0\n this._e = (e + this._e) | 0\n this._f = (f + this._f) | 0\n this._g = (g + this._g) | 0\n this._h = (h + this._h) | 0\n}\n\nSha256.prototype._hash = function () {\n var H = Buffer.allocUnsafe(32)\n\n H.writeInt32BE(this._a, 0)\n H.writeInt32BE(this._b, 4)\n H.writeInt32BE(this._c, 8)\n H.writeInt32BE(this._d, 12)\n H.writeInt32BE(this._e, 16)\n H.writeInt32BE(this._f, 20)\n H.writeInt32BE(this._g, 24)\n H.writeInt32BE(this._h, 28)\n\n return H\n}\n\nmodule.exports = Sha256\n","var inherits = require('inherits')\nvar Hash = require('./hash')\nvar Buffer = require('safe-buffer').Buffer\n\nvar K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n]\n\nvar W = new Array(160)\n\nfunction Sha512 () {\n this.init()\n this._w = W\n\n Hash.call(this, 128, 112)\n}\n\ninherits(Sha512, Hash)\n\nSha512.prototype.init = function () {\n this._ah = 0x6a09e667\n this._bh = 0xbb67ae85\n this._ch = 0x3c6ef372\n this._dh = 0xa54ff53a\n this._eh = 0x510e527f\n this._fh = 0x9b05688c\n this._gh = 0x1f83d9ab\n this._hh = 0x5be0cd19\n\n this._al = 0xf3bcc908\n this._bl = 0x84caa73b\n this._cl = 0xfe94f82b\n this._dl = 0x5f1d36f1\n this._el = 0xade682d1\n this._fl = 0x2b3e6c1f\n this._gl = 0xfb41bd6b\n this._hl = 0x137e2179\n\n return this\n}\n\nfunction Ch (x, y, z) {\n return z ^ (x & (y ^ z))\n}\n\nfunction maj (x, y, z) {\n return (x & y) | (z & (x | y))\n}\n\nfunction sigma0 (x, xl) {\n return (x >>> 28 | xl << 4) ^ (xl >>> 2 | x << 30) ^ (xl >>> 7 | x << 25)\n}\n\nfunction sigma1 (x, xl) {\n return (x >>> 14 | xl << 18) ^ (x >>> 18 | xl << 14) ^ (xl >>> 9 | x << 23)\n}\n\nfunction Gamma0 (x, xl) {\n return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7)\n}\n\nfunction Gamma0l (x, xl) {\n return (x >>> 1 | xl << 31) ^ (x >>> 8 | xl << 24) ^ (x >>> 7 | xl << 25)\n}\n\nfunction Gamma1 (x, xl) {\n return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6)\n}\n\nfunction Gamma1l (x, xl) {\n return (x >>> 19 | xl << 13) ^ (xl >>> 29 | x << 3) ^ (x >>> 6 | xl << 26)\n}\n\nfunction getCarry (a, b) {\n return (a >>> 0) < (b >>> 0) ? 1 : 0\n}\n\nSha512.prototype._update = function (M) {\n var W = this._w\n\n var ah = this._ah | 0\n var bh = this._bh | 0\n var ch = this._ch | 0\n var dh = this._dh | 0\n var eh = this._eh | 0\n var fh = this._fh | 0\n var gh = this._gh | 0\n var hh = this._hh | 0\n\n var al = this._al | 0\n var bl = this._bl | 0\n var cl = this._cl | 0\n var dl = this._dl | 0\n var el = this._el | 0\n var fl = this._fl | 0\n var gl = this._gl | 0\n var hl = this._hl | 0\n\n for (var i = 0; i < 32; i += 2) {\n W[i] = M.readInt32BE(i * 4)\n W[i + 1] = M.readInt32BE(i * 4 + 4)\n }\n for (; i < 160; i += 2) {\n var xh = W[i - 15 * 2]\n var xl = W[i - 15 * 2 + 1]\n var gamma0 = Gamma0(xh, xl)\n var gamma0l = Gamma0l(xl, xh)\n\n xh = W[i - 2 * 2]\n xl = W[i - 2 * 2 + 1]\n var gamma1 = Gamma1(xh, xl)\n var gamma1l = Gamma1l(xl, xh)\n\n // W[i] = gamma0 + W[i - 7] + gamma1 + W[i - 16]\n var Wi7h = W[i - 7 * 2]\n var Wi7l = W[i - 7 * 2 + 1]\n\n var Wi16h = W[i - 16 * 2]\n var Wi16l = W[i - 16 * 2 + 1]\n\n var Wil = (gamma0l + Wi7l) | 0\n var Wih = (gamma0 + Wi7h + getCarry(Wil, gamma0l)) | 0\n Wil = (Wil + gamma1l) | 0\n Wih = (Wih + gamma1 + getCarry(Wil, gamma1l)) | 0\n Wil = (Wil + Wi16l) | 0\n Wih = (Wih + Wi16h + getCarry(Wil, Wi16l)) | 0\n\n W[i] = Wih\n W[i + 1] = Wil\n }\n\n for (var j = 0; j < 160; j += 2) {\n Wih = W[j]\n Wil = W[j + 1]\n\n var majh = maj(ah, bh, ch)\n var majl = maj(al, bl, cl)\n\n var sigma0h = sigma0(ah, al)\n var sigma0l = sigma0(al, ah)\n var sigma1h = sigma1(eh, el)\n var sigma1l = sigma1(el, eh)\n\n // t1 = h + sigma1 + ch + K[j] + W[j]\n var Kih = K[j]\n var Kil = K[j + 1]\n\n var chh = Ch(eh, fh, gh)\n var chl = Ch(el, fl, gl)\n\n var t1l = (hl + sigma1l) | 0\n var t1h = (hh + sigma1h + getCarry(t1l, hl)) | 0\n t1l = (t1l + chl) | 0\n t1h = (t1h + chh + getCarry(t1l, chl)) | 0\n t1l = (t1l + Kil) | 0\n t1h = (t1h + Kih + getCarry(t1l, Kil)) | 0\n t1l = (t1l + Wil) | 0\n t1h = (t1h + Wih + getCarry(t1l, Wil)) | 0\n\n // t2 = sigma0 + maj\n var t2l = (sigma0l + majl) | 0\n var t2h = (sigma0h + majh + getCarry(t2l, sigma0l)) | 0\n\n hh = gh\n hl = gl\n gh = fh\n gl = fl\n fh = eh\n fl = el\n el = (dl + t1l) | 0\n eh = (dh + t1h + getCarry(el, dl)) | 0\n dh = ch\n dl = cl\n ch = bh\n cl = bl\n bh = ah\n bl = al\n al = (t1l + t2l) | 0\n ah = (t1h + t2h + getCarry(al, t1l)) | 0\n }\n\n this._al = (this._al + al) | 0\n this._bl = (this._bl + bl) | 0\n this._cl = (this._cl + cl) | 0\n this._dl = (this._dl + dl) | 0\n this._el = (this._el + el) | 0\n this._fl = (this._fl + fl) | 0\n this._gl = (this._gl + gl) | 0\n this._hl = (this._hl + hl) | 0\n\n this._ah = (this._ah + ah + getCarry(this._al, al)) | 0\n this._bh = (this._bh + bh + getCarry(this._bl, bl)) | 0\n this._ch = (this._ch + ch + getCarry(this._cl, cl)) | 0\n this._dh = (this._dh + dh + getCarry(this._dl, dl)) | 0\n this._eh = (this._eh + eh + getCarry(this._el, el)) | 0\n this._fh = (this._fh + fh + getCarry(this._fl, fl)) | 0\n this._gh = (this._gh + gh + getCarry(this._gl, gl)) | 0\n this._hh = (this._hh + hh + getCarry(this._hl, hl)) | 0\n}\n\nSha512.prototype._hash = function () {\n var H = Buffer.allocUnsafe(64)\n\n function writeInt64BE (h, l, offset) {\n H.writeInt32BE(h, offset)\n H.writeInt32BE(l, offset + 4)\n }\n\n writeInt64BE(this._ah, this._al, 0)\n writeInt64BE(this._bh, this._bl, 8)\n writeInt64BE(this._ch, this._cl, 16)\n writeInt64BE(this._dh, this._dl, 24)\n writeInt64BE(this._eh, this._el, 32)\n writeInt64BE(this._fh, this._fl, 40)\n writeInt64BE(this._gh, this._gl, 48)\n writeInt64BE(this._hh, this._hl, 56)\n\n return H\n}\n\nmodule.exports = Sha512\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n'use strict';\n\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\nmodule.exports = Readable;\n\n/**/\nvar isArray = require('isarray');\n/**/\n\n/**/\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n\n/**/\nvar EE = require('events').EventEmitter;\n\nvar EElistenerCount = function (emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\nvar Stream = require('./internal/streams/stream');\n/**/\n\n/**/\n\nvar Buffer = require('safe-buffer').Buffer;\nvar OurUint8Array = global.Uint8Array || function () {};\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\n/**/\n\n/**/\nvar util = Object.create(require('core-util-is'));\nutil.inherits = require('inherits');\n/**/\n\n/**/\nvar debugUtil = require('util');\nvar debug = void 0;\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function () {};\n}\n/**/\n\nvar BufferList = require('./internal/streams/BufferList');\nvar destroyImpl = require('./internal/streams/destroy');\nvar StringDecoder;\n\nutil.inherits(Readable, Stream);\n\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);\n\n // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream) {\n Duplex = Duplex || require('./_stream_duplex');\n\n options = options || {};\n\n // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n var isDuplex = stream instanceof Duplex;\n\n // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n this.objectMode = !!options.objectMode;\n\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;\n\n // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n var hwm = options.highWaterMark;\n var readableHwm = options.readableHighWaterMark;\n var defaultHwm = this.objectMode ? 16 : 16 * 1024;\n\n if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm;\n\n // cast to ints.\n this.highWaterMark = Math.floor(this.highWaterMark);\n\n // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false;\n\n // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n this.sync = true;\n\n // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n\n // has it been destroyed\n this.destroyed = false;\n\n // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n this.defaultEncoding = options.defaultEncoding || 'utf8';\n\n // the number of writers that are awaiting a drain event in .pipe()s\n this.awaitDrain = 0;\n\n // if true, a maybeReadMore has been scheduled\n this.readingMore = false;\n\n this.decoder = null;\n this.encoding = null;\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n\n if (!(this instanceof Readable)) return new Readable(options);\n\n this._readableState = new ReadableState(options, this);\n\n // legacy\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n get: function () {\n if (this._readableState === undefined) {\n return false;\n }\n return this._readableState.destroyed;\n },\n set: function (value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n }\n\n // backward compatibility, the user is explicitly\n // managing destroyed\n this._readableState.destroyed = value;\n }\n});\n\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\nReadable.prototype._destroy = function (err, cb) {\n this.push(null);\n cb(err);\n};\n\n// Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n};\n\n// Unshift should *always* be something directly out of read()\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n var state = stream._readableState;\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n if (er) {\n stream.emit('error', er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n stream.emit('error', new Error('stream.push() after EOF'));\n } else {\n state.reading = false;\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n }\n }\n\n return needMoreData(state);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n stream.emit('data', chunk);\n stream.read(0);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n\n if (state.needReadable) emitReadable(stream);\n }\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new TypeError('Invalid non-string/buffer chunk');\n }\n return er;\n}\n\n// if it's past the high water mark, we can push in some more.\n// Also, if we have no data yet, we can stand some\n// more bytes. This is to work around cases where hwm=0,\n// such as the repl. Also, if the push() triggered a\n// readable event, and the user called read(largeNumber) such that\n// needReadable was set, then we ought to push more, so that another\n// 'readable' event will be triggered.\nfunction needMoreData(state) {\n return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0);\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n};\n\n// backwards compatibility.\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this._readableState.decoder = new StringDecoder(enc);\n this._readableState.encoding = enc;\n return this;\n};\n\n// Don't raise the hwm > 8MB\nvar MAX_HWM = 0x800000;\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n return n;\n}\n\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n }\n // If we're asking for more than the current hwm, then raise the hwm.\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n;\n // Don't have enough\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n return state.length;\n}\n\n// you can override either this method, or the async _read(n) below.\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n\n if (n !== 0) state.emittedReadable = false;\n\n // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state);\n\n // if we've ended, and we're now clear, then finish it up.\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n }\n\n // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n\n // if we need a readable event, then we need to do some reading.\n var doRead = state.needReadable;\n debug('need readable', doRead);\n\n // if we currently have less than the highWaterMark, then also read some\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n }\n\n // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true;\n // if the length is currently zero, then we *need* a readable event.\n if (state.length === 0) state.needReadable = true;\n // call internal read method\n this._read(state.highWaterMark);\n state.sync = false;\n // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = true;\n n = 0;\n } else {\n state.length -= n;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true;\n\n // If we tried to read() past the EOF, then emit end on the next tick.\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit('data', ret);\n\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n if (state.ended) return;\n if (state.decoder) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n state.ended = true;\n\n // emit 'readable' now to make sure it gets picked up.\n emitReadable(stream);\n}\n\n// Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\nfunction emitReadable(stream) {\n var state = stream._readableState;\n state.needReadable = false;\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream);\n }\n}\n\nfunction emitReadable_(stream) {\n debug('emit readable');\n stream.emit('readable');\n flow(stream);\n}\n\n// at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n pna.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n var len = state.length;\n while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) {\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length)\n // didn't get any data, stop spinning.\n break;else len = state.length;\n }\n state.readingMore = false;\n}\n\n// abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\nReadable.prototype._read = function (n) {\n this.emit('error', new Error('_read() is not implemented'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n default:\n state.pipes.push(dest);\n break;\n }\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn);\n\n dest.on('unpipe', onunpipe);\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n }\n\n // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n\n var cleanedUp = false;\n function cleanup() {\n debug('cleanup');\n // cleanup event handlers once the pipe is broken\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n\n cleanedUp = true;\n\n // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n\n // If the user pushes more data while we're writing to dest then we'll end up\n // in ondata again. However, we only want to increase awaitDrain once because\n // dest will only emit one 'drain' event for the multiple writes.\n // => Introduce a guard on increasing awaitDrain.\n var increasedAwaitDrain = false;\n src.on('data', ondata);\n function ondata(chunk) {\n debug('ondata');\n increasedAwaitDrain = false;\n var ret = dest.write(chunk);\n if (false === ret && !increasedAwaitDrain) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', src._readableState.awaitDrain);\n src._readableState.awaitDrain++;\n increasedAwaitDrain = true;\n }\n src.pause();\n }\n }\n\n // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er);\n }\n\n // Make sure our error handler is attached before userland ones.\n prependListener(dest, 'error', onerror);\n\n // Both close and finish should trigger unpipe, but only once.\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n dest.once('close', onclose);\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n }\n\n // tell the dest that it's being piped to\n dest.emit('pipe', src);\n\n // start the flow if it hasn't been started already.\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function () {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = { hasUnpiped: false };\n\n // if we're not piping anywhere, then do nothing.\n if (state.pipesCount === 0) return this;\n\n // just one destination. most common case.\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n\n if (!dest) dest = state.pipes;\n\n // got a match.\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n }\n\n // slow case. multiple pipe destinations.\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit('unpipe', this, unpipeInfo);\n }return this;\n }\n\n // try to find the right one.\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n\n dest.emit('unpipe', this, unpipeInfo);\n\n return this;\n};\n\n// set up data events if they are asked for\n// Ensure readable listeners eventually get something\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n\n if (ev === 'data') {\n // Start flowing on next tick if stream isn't explicitly paused\n if (this._readableState.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n var state = this._readableState;\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.emittedReadable = false;\n if (!state.reading) {\n pna.nextTick(nReadingNextTick, this);\n } else if (state.length) {\n emitReadable(this);\n }\n }\n }\n\n return res;\n};\nReadable.prototype.addListener = Readable.prototype.on;\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n}\n\n// pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\nReadable.prototype.resume = function () {\n var state = this._readableState;\n if (!state.flowing) {\n debug('resume');\n state.flowing = true;\n resume(this, state);\n }\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n pna.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n if (!state.reading) {\n debug('resume read 0');\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n state.awaitDrain = 0;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n if (false !== this._readableState.flowing) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n while (state.flowing && stream.read() !== null) {}\n}\n\n// wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n\n stream.on('end', function () {\n debug('wrapped end');\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk);\n\n // don't skip over falsy values in objectMode\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n if (!ret) {\n paused = true;\n stream.pause();\n }\n });\n\n // proxy all the other methods.\n // important when wrapping filters and duplexes.\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function (method) {\n return function () {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n }\n\n // proxy certain important events.\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n }\n\n // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n this._read = function (n) {\n debug('wrapped _read', n);\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function () {\n return this._readableState.highWaterMark;\n }\n});\n\n// exposed for testing purposes only.\nReadable._fromList = fromList;\n\n// Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = fromListPartial(n, state.buffer, state.decoder);\n }\n\n return ret;\n}\n\n// Extracts only enough buffered data to satisfy the amount requested.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction fromListPartial(n, list, hasStrings) {\n var ret;\n if (n < list.head.data.length) {\n // slice is the same for buffers and strings\n ret = list.head.data.slice(0, n);\n list.head.data = list.head.data.slice(n);\n } else if (n === list.head.data.length) {\n // first chunk is a perfect match\n ret = list.shift();\n } else {\n // result spans more than one buffer\n ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);\n }\n return ret;\n}\n\n// Copies a specified amount of characters from the list of buffered data\n// chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction copyFromBufferString(n, list) {\n var p = list.head;\n var c = 1;\n var ret = p.data;\n n -= ret.length;\n while (p = p.next) {\n var str = p.data;\n var nb = n > str.length ? str.length : n;\n if (nb === str.length) ret += str;else ret += str.slice(0, n);\n n -= nb;\n if (n === 0) {\n if (nb === str.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = str.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}\n\n// Copies a specified amount of bytes from the list of buffered data chunks.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\nfunction copyFromBuffer(n, list) {\n var ret = Buffer.allocUnsafe(n);\n var p = list.head;\n var c = 1;\n p.data.copy(ret);\n n -= p.data.length;\n while (p = p.next) {\n var buf = p.data;\n var nb = n > buf.length ? buf.length : n;\n buf.copy(ret, ret.length - n, 0, nb);\n n -= nb;\n if (n === 0) {\n if (nb === buf.length) {\n ++c;\n if (p.next) list.head = p.next;else list.head = list.tail = null;\n } else {\n list.head = p;\n p.data = buf.slice(nb);\n }\n break;\n }\n ++c;\n }\n list.length -= c;\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n\n // If we get here before consuming all the bytes, then that is a\n // bug in node. Should never happen.\n if (state.length > 0) throw new Error('\"endReadable()\" called on non-empty stream');\n\n if (!state.endEmitted) {\n state.ended = true;\n pna.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n // Check that we didn't get one last unshift.\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n }\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n return -1;\n}","module.exports = require('events').EventEmitter;\n","'use strict';\n\n/**/\n\nvar pna = require('process-nextick-args');\n/**/\n\n// undocumented cb() API, needed for core, not for public API\nfunction destroy(err, cb) {\n var _this = this;\n\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {\n pna.nextTick(emitErrorNT, this, err);\n }\n return this;\n }\n\n // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n }\n\n // if this is a duplex stream mark the writable part as destroyed as well\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n pna.nextTick(emitErrorNT, _this, err);\n if (_this._writableState) {\n _this._writableState.errorEmitted = true;\n }\n } else if (cb) {\n cb(err);\n }\n });\n\n return this;\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n\n'use strict';\n\nmodule.exports = Transform;\n\nvar Duplex = require('./_stream_duplex');\n\n/**/\nvar util = Object.create(require('core-util-is'));\nutil.inherits = require('inherits');\n/**/\n\nutil.inherits(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n\n var cb = ts.writecb;\n\n if (!cb) {\n return this.emit('error', new Error('write callback called multiple times'));\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n\n cb(er);\n\n var rs = this._readableState;\n rs.reading = false;\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n\n Duplex.call(this, options);\n\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n };\n\n // start out asking for a readable event once data is transformed.\n this._readableState.needReadable = true;\n\n // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n\n if (typeof options.flush === 'function') this._flush = options.flush;\n }\n\n // When the writable side finishes, then flush out anything remaining.\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function') {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n};\n\n// This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\nTransform.prototype._transform = function (chunk, encoding, cb) {\n throw new Error('_transform() is not implemented');\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n};\n\n// Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && ts.writecb && !ts.transforming) {\n ts.transforming = true;\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n var _this2 = this;\n\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n _this2.emit('close');\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data);\n\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0');\n\n if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming');\n\n return stream.push(null);\n}","'use strict'\nvar inherits = require('inherits')\nvar Legacy = require('./legacy')\nvar Base = require('cipher-base')\nvar Buffer = require('safe-buffer').Buffer\nvar md5 = require('create-hash/md5')\nvar RIPEMD160 = require('ripemd160')\n\nvar sha = require('sha.js')\n\nvar ZEROS = Buffer.alloc(128)\n\nfunction Hmac (alg, key) {\n Base.call(this, 'digest')\n if (typeof key === 'string') {\n key = Buffer.from(key)\n }\n\n var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64\n\n this._alg = alg\n this._key = key\n if (key.length > blocksize) {\n var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)\n key = hash.update(key).digest()\n } else if (key.length < blocksize) {\n key = Buffer.concat([key, ZEROS], blocksize)\n }\n\n var ipad = this._ipad = Buffer.allocUnsafe(blocksize)\n var opad = this._opad = Buffer.allocUnsafe(blocksize)\n\n for (var i = 0; i < blocksize; i++) {\n ipad[i] = key[i] ^ 0x36\n opad[i] = key[i] ^ 0x5C\n }\n this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)\n this._hash.update(ipad)\n}\n\ninherits(Hmac, Base)\n\nHmac.prototype._update = function (data) {\n this._hash.update(data)\n}\n\nHmac.prototype._final = function () {\n var h = this._hash.digest()\n var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg)\n return hash.update(this._opad).update(h).digest()\n}\n\nmodule.exports = function createHmac (alg, key) {\n alg = alg.toLowerCase()\n if (alg === 'rmd160' || alg === 'ripemd160') {\n return new Hmac('rmd160', key)\n }\n if (alg === 'md5') {\n return new Legacy(md5, key)\n }\n return new Hmac(alg, key)\n}\n","var MD5 = require('md5.js')\n\nmodule.exports = function (buffer) {\n return new MD5().update(buffer).digest()\n}\n","exports.pbkdf2 = require('./lib/async')\nexports.pbkdf2Sync = require('./lib/sync')\n","var MAX_ALLOC = Math.pow(2, 30) - 1 // default in iojs\n\nmodule.exports = function (iterations, keylen) {\n if (typeof iterations !== 'number') {\n throw new TypeError('Iterations not a number')\n }\n\n if (iterations < 0) {\n throw new TypeError('Bad iterations')\n }\n\n if (typeof keylen !== 'number') {\n throw new TypeError('Key length not a number')\n }\n\n if (keylen < 0 || keylen > MAX_ALLOC || keylen !== keylen) { /* eslint no-self-compare: 0 */\n throw new TypeError('Bad key length')\n }\n}\n","var defaultEncoding\n/* istanbul ignore next */\nif (process.browser) {\n defaultEncoding = 'utf-8'\n} else if (process.version) {\n var pVersionMajor = parseInt(process.version.split('.')[0].slice(1), 10)\n\n defaultEncoding = pVersionMajor >= 6 ? 'utf-8' : 'binary'\n} else {\n defaultEncoding = 'utf-8'\n}\nmodule.exports = defaultEncoding\n","var md5 = require('create-hash/md5')\nvar RIPEMD160 = require('ripemd160')\nvar sha = require('sha.js')\nvar Buffer = require('safe-buffer').Buffer\n\nvar checkParameters = require('./precondition')\nvar defaultEncoding = require('./default-encoding')\nvar toBuffer = require('./to-buffer')\n\nvar ZEROS = Buffer.alloc(128)\nvar sizes = {\n md5: 16,\n sha1: 20,\n sha224: 28,\n sha256: 32,\n sha384: 48,\n sha512: 64,\n rmd160: 20,\n ripemd160: 20\n}\n\nfunction Hmac (alg, key, saltLen) {\n var hash = getDigest(alg)\n var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64\n\n if (key.length > blocksize) {\n key = hash(key)\n } else if (key.length < blocksize) {\n key = Buffer.concat([key, ZEROS], blocksize)\n }\n\n var ipad = Buffer.allocUnsafe(blocksize + sizes[alg])\n var opad = Buffer.allocUnsafe(blocksize + sizes[alg])\n for (var i = 0; i < blocksize; i++) {\n ipad[i] = key[i] ^ 0x36\n opad[i] = key[i] ^ 0x5C\n }\n\n var ipad1 = Buffer.allocUnsafe(blocksize + saltLen + 4)\n ipad.copy(ipad1, 0, 0, blocksize)\n this.ipad1 = ipad1\n this.ipad2 = ipad\n this.opad = opad\n this.alg = alg\n this.blocksize = blocksize\n this.hash = hash\n this.size = sizes[alg]\n}\n\nHmac.prototype.run = function (data, ipad) {\n data.copy(ipad, this.blocksize)\n var h = this.hash(ipad)\n h.copy(this.opad, this.blocksize)\n return this.hash(this.opad)\n}\n\nfunction getDigest (alg) {\n function shaFunc (data) {\n return sha(alg).update(data).digest()\n }\n function rmd160Func (data) {\n return new RIPEMD160().update(data).digest()\n }\n\n if (alg === 'rmd160' || alg === 'ripemd160') return rmd160Func\n if (alg === 'md5') return md5\n return shaFunc\n}\n\nfunction pbkdf2 (password, salt, iterations, keylen, digest) {\n checkParameters(iterations, keylen)\n password = toBuffer(password, defaultEncoding, 'Password')\n salt = toBuffer(salt, defaultEncoding, 'Salt')\n\n digest = digest || 'sha1'\n\n var hmac = new Hmac(digest, password, salt.length)\n\n var DK = Buffer.allocUnsafe(keylen)\n var block1 = Buffer.allocUnsafe(salt.length + 4)\n salt.copy(block1, 0, 0, salt.length)\n\n var destPos = 0\n var hLen = sizes[digest]\n var l = Math.ceil(keylen / hLen)\n\n for (var i = 1; i <= l; i++) {\n block1.writeUInt32BE(i, salt.length)\n\n var T = hmac.run(block1, hmac.ipad1)\n var U = T\n\n for (var j = 1; j < iterations; j++) {\n U = hmac.run(U, hmac.ipad2)\n for (var k = 0; k < hLen; k++) T[k] ^= U[k]\n }\n\n T.copy(DK, destPos)\n destPos += hLen\n }\n\n return DK\n}\n\nmodule.exports = pbkdf2\n","var Buffer = require('safe-buffer').Buffer\n\nmodule.exports = function (thing, encoding, name) {\n if (Buffer.isBuffer(thing)) {\n return thing\n } else if (typeof thing === 'string') {\n return Buffer.from(thing, encoding)\n } else if (ArrayBuffer.isView(thing)) {\n return Buffer.from(thing.buffer)\n } else {\n throw new TypeError(name + ' must be a string, a Buffer, a typed array or a DataView')\n }\n}\n","'use strict';\n\nexports.readUInt32BE = function readUInt32BE(bytes, off) {\n var res = (bytes[0 + off] << 24) |\n (bytes[1 + off] << 16) |\n (bytes[2 + off] << 8) |\n bytes[3 + off];\n return res >>> 0;\n};\n\nexports.writeUInt32BE = function writeUInt32BE(bytes, value, off) {\n bytes[0 + off] = value >>> 24;\n bytes[1 + off] = (value >>> 16) & 0xff;\n bytes[2 + off] = (value >>> 8) & 0xff;\n bytes[3 + off] = value & 0xff;\n};\n\nexports.ip = function ip(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n\n for (var i = 6; i >= 0; i -= 2) {\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inR >>> (j + i)) & 1;\n }\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inL >>> (j + i)) & 1;\n }\n }\n\n for (var i = 6; i >= 0; i -= 2) {\n for (var j = 1; j <= 25; j += 8) {\n outR <<= 1;\n outR |= (inR >>> (j + i)) & 1;\n }\n for (var j = 1; j <= 25; j += 8) {\n outR <<= 1;\n outR |= (inL >>> (j + i)) & 1;\n }\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.rip = function rip(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n\n for (var i = 0; i < 4; i++) {\n for (var j = 24; j >= 0; j -= 8) {\n outL <<= 1;\n outL |= (inR >>> (j + i)) & 1;\n outL <<= 1;\n outL |= (inL >>> (j + i)) & 1;\n }\n }\n for (var i = 4; i < 8; i++) {\n for (var j = 24; j >= 0; j -= 8) {\n outR <<= 1;\n outR |= (inR >>> (j + i)) & 1;\n outR <<= 1;\n outR |= (inL >>> (j + i)) & 1;\n }\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.pc1 = function pc1(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n\n // 7, 15, 23, 31, 39, 47, 55, 63\n // 6, 14, 22, 30, 39, 47, 55, 63\n // 5, 13, 21, 29, 39, 47, 55, 63\n // 4, 12, 20, 28\n for (var i = 7; i >= 5; i--) {\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inR >> (j + i)) & 1;\n }\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inL >> (j + i)) & 1;\n }\n }\n for (var j = 0; j <= 24; j += 8) {\n outL <<= 1;\n outL |= (inR >> (j + i)) & 1;\n }\n\n // 1, 9, 17, 25, 33, 41, 49, 57\n // 2, 10, 18, 26, 34, 42, 50, 58\n // 3, 11, 19, 27, 35, 43, 51, 59\n // 36, 44, 52, 60\n for (var i = 1; i <= 3; i++) {\n for (var j = 0; j <= 24; j += 8) {\n outR <<= 1;\n outR |= (inR >> (j + i)) & 1;\n }\n for (var j = 0; j <= 24; j += 8) {\n outR <<= 1;\n outR |= (inL >> (j + i)) & 1;\n }\n }\n for (var j = 0; j <= 24; j += 8) {\n outR <<= 1;\n outR |= (inL >> (j + i)) & 1;\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.r28shl = function r28shl(num, shift) {\n return ((num << shift) & 0xfffffff) | (num >>> (28 - shift));\n};\n\nvar pc2table = [\n // inL => outL\n 14, 11, 17, 4, 27, 23, 25, 0,\n 13, 22, 7, 18, 5, 9, 16, 24,\n 2, 20, 12, 21, 1, 8, 15, 26,\n\n // inR => outR\n 15, 4, 25, 19, 9, 1, 26, 16,\n 5, 11, 23, 8, 12, 7, 17, 0,\n 22, 3, 10, 14, 6, 20, 27, 24\n];\n\nexports.pc2 = function pc2(inL, inR, out, off) {\n var outL = 0;\n var outR = 0;\n\n var len = pc2table.length >>> 1;\n for (var i = 0; i < len; i++) {\n outL <<= 1;\n outL |= (inL >>> pc2table[i]) & 0x1;\n }\n for (var i = len; i < pc2table.length; i++) {\n outR <<= 1;\n outR |= (inR >>> pc2table[i]) & 0x1;\n }\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nexports.expand = function expand(r, out, off) {\n var outL = 0;\n var outR = 0;\n\n outL = ((r & 1) << 5) | (r >>> 27);\n for (var i = 23; i >= 15; i -= 4) {\n outL <<= 6;\n outL |= (r >>> i) & 0x3f;\n }\n for (var i = 11; i >= 3; i -= 4) {\n outR |= (r >>> i) & 0x3f;\n outR <<= 6;\n }\n outR |= ((r & 0x1f) << 1) | (r >>> 31);\n\n out[off + 0] = outL >>> 0;\n out[off + 1] = outR >>> 0;\n};\n\nvar sTable = [\n 14, 0, 4, 15, 13, 7, 1, 4, 2, 14, 15, 2, 11, 13, 8, 1,\n 3, 10, 10, 6, 6, 12, 12, 11, 5, 9, 9, 5, 0, 3, 7, 8,\n 4, 15, 1, 12, 14, 8, 8, 2, 13, 4, 6, 9, 2, 1, 11, 7,\n 15, 5, 12, 11, 9, 3, 7, 14, 3, 10, 10, 0, 5, 6, 0, 13,\n\n 15, 3, 1, 13, 8, 4, 14, 7, 6, 15, 11, 2, 3, 8, 4, 14,\n 9, 12, 7, 0, 2, 1, 13, 10, 12, 6, 0, 9, 5, 11, 10, 5,\n 0, 13, 14, 8, 7, 10, 11, 1, 10, 3, 4, 15, 13, 4, 1, 2,\n 5, 11, 8, 6, 12, 7, 6, 12, 9, 0, 3, 5, 2, 14, 15, 9,\n\n 10, 13, 0, 7, 9, 0, 14, 9, 6, 3, 3, 4, 15, 6, 5, 10,\n 1, 2, 13, 8, 12, 5, 7, 14, 11, 12, 4, 11, 2, 15, 8, 1,\n 13, 1, 6, 10, 4, 13, 9, 0, 8, 6, 15, 9, 3, 8, 0, 7,\n 11, 4, 1, 15, 2, 14, 12, 3, 5, 11, 10, 5, 14, 2, 7, 12,\n\n 7, 13, 13, 8, 14, 11, 3, 5, 0, 6, 6, 15, 9, 0, 10, 3,\n 1, 4, 2, 7, 8, 2, 5, 12, 11, 1, 12, 10, 4, 14, 15, 9,\n 10, 3, 6, 15, 9, 0, 0, 6, 12, 10, 11, 1, 7, 13, 13, 8,\n 15, 9, 1, 4, 3, 5, 14, 11, 5, 12, 2, 7, 8, 2, 4, 14,\n\n 2, 14, 12, 11, 4, 2, 1, 12, 7, 4, 10, 7, 11, 13, 6, 1,\n 8, 5, 5, 0, 3, 15, 15, 10, 13, 3, 0, 9, 14, 8, 9, 6,\n 4, 11, 2, 8, 1, 12, 11, 7, 10, 1, 13, 14, 7, 2, 8, 13,\n 15, 6, 9, 15, 12, 0, 5, 9, 6, 10, 3, 4, 0, 5, 14, 3,\n\n 12, 10, 1, 15, 10, 4, 15, 2, 9, 7, 2, 12, 6, 9, 8, 5,\n 0, 6, 13, 1, 3, 13, 4, 14, 14, 0, 7, 11, 5, 3, 11, 8,\n 9, 4, 14, 3, 15, 2, 5, 12, 2, 9, 8, 5, 12, 15, 3, 10,\n 7, 11, 0, 14, 4, 1, 10, 7, 1, 6, 13, 0, 11, 8, 6, 13,\n\n 4, 13, 11, 0, 2, 11, 14, 7, 15, 4, 0, 9, 8, 1, 13, 10,\n 3, 14, 12, 3, 9, 5, 7, 12, 5, 2, 10, 15, 6, 8, 1, 6,\n 1, 6, 4, 11, 11, 13, 13, 8, 12, 1, 3, 4, 7, 10, 14, 7,\n 10, 9, 15, 5, 6, 0, 8, 15, 0, 14, 5, 2, 9, 3, 2, 12,\n\n 13, 1, 2, 15, 8, 13, 4, 8, 6, 10, 15, 3, 11, 7, 1, 4,\n 10, 12, 9, 5, 3, 6, 14, 11, 5, 0, 0, 14, 12, 9, 7, 2,\n 7, 2, 11, 1, 4, 14, 1, 7, 9, 4, 12, 10, 14, 8, 2, 13,\n 0, 15, 6, 12, 10, 9, 13, 0, 15, 3, 3, 5, 5, 6, 8, 11\n];\n\nexports.substitute = function substitute(inL, inR) {\n var out = 0;\n for (var i = 0; i < 4; i++) {\n var b = (inL >>> (18 - i * 6)) & 0x3f;\n var sb = sTable[i * 0x40 + b];\n\n out <<= 4;\n out |= sb;\n }\n for (var i = 0; i < 4; i++) {\n var b = (inR >>> (18 - i * 6)) & 0x3f;\n var sb = sTable[4 * 0x40 + i * 0x40 + b];\n\n out <<= 4;\n out |= sb;\n }\n return out >>> 0;\n};\n\nvar permuteTable = [\n 16, 25, 12, 11, 3, 20, 4, 15, 31, 17, 9, 6, 27, 14, 1, 22,\n 30, 24, 8, 18, 0, 5, 29, 23, 13, 19, 2, 26, 10, 21, 28, 7\n];\n\nexports.permute = function permute(num) {\n var out = 0;\n for (var i = 0; i < permuteTable.length; i++) {\n out <<= 1;\n out |= (num >>> permuteTable[i]) & 0x1;\n }\n return out >>> 0;\n};\n\nexports.padSplit = function padSplit(num, size, group) {\n var str = num.toString(2);\n while (str.length < size)\n str = '0' + str;\n\n var out = [];\n for (var i = 0; i < size; i += group)\n out.push(str.slice(i, i + group));\n return out.join(' ');\n};\n","'use strict';\n\nvar assert = require('minimalistic-assert');\nvar inherits = require('inherits');\n\nvar utils = require('./utils');\nvar Cipher = require('./cipher');\n\nfunction DESState() {\n this.tmp = new Array(2);\n this.keys = null;\n}\n\nfunction DES(options) {\n Cipher.call(this, options);\n\n var state = new DESState();\n this._desState = state;\n\n this.deriveKeys(state, options.key);\n}\ninherits(DES, Cipher);\nmodule.exports = DES;\n\nDES.create = function create(options) {\n return new DES(options);\n};\n\nvar shiftTable = [\n 1, 1, 2, 2, 2, 2, 2, 2,\n 1, 2, 2, 2, 2, 2, 2, 1\n];\n\nDES.prototype.deriveKeys = function deriveKeys(state, key) {\n state.keys = new Array(16 * 2);\n\n assert.equal(key.length, this.blockSize, 'Invalid key length');\n\n var kL = utils.readUInt32BE(key, 0);\n var kR = utils.readUInt32BE(key, 4);\n\n utils.pc1(kL, kR, state.tmp, 0);\n kL = state.tmp[0];\n kR = state.tmp[1];\n for (var i = 0; i < state.keys.length; i += 2) {\n var shift = shiftTable[i >>> 1];\n kL = utils.r28shl(kL, shift);\n kR = utils.r28shl(kR, shift);\n utils.pc2(kL, kR, state.keys, i);\n }\n};\n\nDES.prototype._update = function _update(inp, inOff, out, outOff) {\n var state = this._desState;\n\n var l = utils.readUInt32BE(inp, inOff);\n var r = utils.readUInt32BE(inp, inOff + 4);\n\n // Initial Permutation\n utils.ip(l, r, state.tmp, 0);\n l = state.tmp[0];\n r = state.tmp[1];\n\n if (this.type === 'encrypt')\n this._encrypt(state, l, r, state.tmp, 0);\n else\n this._decrypt(state, l, r, state.tmp, 0);\n\n l = state.tmp[0];\n r = state.tmp[1];\n\n utils.writeUInt32BE(out, l, outOff);\n utils.writeUInt32BE(out, r, outOff + 4);\n};\n\nDES.prototype._pad = function _pad(buffer, off) {\n var value = buffer.length - off;\n for (var i = off; i < buffer.length; i++)\n buffer[i] = value;\n\n return true;\n};\n\nDES.prototype._unpad = function _unpad(buffer) {\n var pad = buffer[buffer.length - 1];\n for (var i = buffer.length - pad; i < buffer.length; i++)\n assert.equal(buffer[i], pad);\n\n return buffer.slice(0, buffer.length - pad);\n};\n\nDES.prototype._encrypt = function _encrypt(state, lStart, rStart, out, off) {\n var l = lStart;\n var r = rStart;\n\n // Apply f() x16 times\n for (var i = 0; i < state.keys.length; i += 2) {\n var keyL = state.keys[i];\n var keyR = state.keys[i + 1];\n\n // f(r, k)\n utils.expand(r, state.tmp, 0);\n\n keyL ^= state.tmp[0];\n keyR ^= state.tmp[1];\n var s = utils.substitute(keyL, keyR);\n var f = utils.permute(s);\n\n var t = r;\n r = (l ^ f) >>> 0;\n l = t;\n }\n\n // Reverse Initial Permutation\n utils.rip(r, l, out, off);\n};\n\nDES.prototype._decrypt = function _decrypt(state, lStart, rStart, out, off) {\n var l = rStart;\n var r = lStart;\n\n // Apply f() x16 times\n for (var i = state.keys.length - 2; i >= 0; i -= 2) {\n var keyL = state.keys[i];\n var keyR = state.keys[i + 1];\n\n // f(r, k)\n utils.expand(l, state.tmp, 0);\n\n keyL ^= state.tmp[0];\n keyR ^= state.tmp[1];\n var s = utils.substitute(keyL, keyR);\n var f = utils.permute(s);\n\n var t = l;\n l = (r ^ f) >>> 0;\n r = t;\n }\n\n // Reverse Initial Permutation\n utils.rip(l, r, out, off);\n};\n","var xor = require('buffer-xor')\nvar Buffer = require('safe-buffer').Buffer\nvar incr32 = require('../incr32')\n\nfunction getBlock (self) {\n var out = self._cipher.encryptBlockRaw(self._prev)\n incr32(self._prev)\n return out\n}\n\nvar blockSize = 16\nexports.encrypt = function (self, chunk) {\n var chunkNum = Math.ceil(chunk.length / blockSize)\n var start = self._cache.length\n self._cache = Buffer.concat([\n self._cache,\n Buffer.allocUnsafe(chunkNum * blockSize)\n ])\n for (var i = 0; i < chunkNum; i++) {\n var out = getBlock(self)\n var offset = start + i * blockSize\n self._cache.writeUInt32BE(out[0], offset + 0)\n self._cache.writeUInt32BE(out[1], offset + 4)\n self._cache.writeUInt32BE(out[2], offset + 8)\n self._cache.writeUInt32BE(out[3], offset + 12)\n }\n var pad = self._cache.slice(0, chunk.length)\n self._cache = self._cache.slice(chunk.length)\n return xor(chunk, pad)\n}\n","function incr32 (iv) {\n var len = iv.length\n var item\n while (len--) {\n item = iv.readUInt8(len)\n if (item === 255) {\n iv.writeUInt8(0, len)\n } else {\n item++\n iv.writeUInt8(item, len)\n break\n }\n }\n}\nmodule.exports = incr32\n","var aes = require('./aes')\nvar Buffer = require('safe-buffer').Buffer\nvar Transform = require('cipher-base')\nvar inherits = require('inherits')\nvar GHASH = require('./ghash')\nvar xor = require('buffer-xor')\nvar incr32 = require('./incr32')\n\nfunction xorTest (a, b) {\n var out = 0\n if (a.length !== b.length) out++\n\n var len = Math.min(a.length, b.length)\n for (var i = 0; i < len; ++i) {\n out += (a[i] ^ b[i])\n }\n\n return out\n}\n\nfunction calcIv (self, iv, ck) {\n if (iv.length === 12) {\n self._finID = Buffer.concat([iv, Buffer.from([0, 0, 0, 1])])\n return Buffer.concat([iv, Buffer.from([0, 0, 0, 2])])\n }\n var ghash = new GHASH(ck)\n var len = iv.length\n var toPad = len % 16\n ghash.update(iv)\n if (toPad) {\n toPad = 16 - toPad\n ghash.update(Buffer.alloc(toPad, 0))\n }\n ghash.update(Buffer.alloc(8, 0))\n var ivBits = len * 8\n var tail = Buffer.alloc(8)\n tail.writeUIntBE(ivBits, 0, 8)\n ghash.update(tail)\n self._finID = ghash.state\n var out = Buffer.from(self._finID)\n incr32(out)\n return out\n}\nfunction StreamCipher (mode, key, iv, decrypt) {\n Transform.call(this)\n\n var h = Buffer.alloc(4, 0)\n\n this._cipher = new aes.AES(key)\n var ck = this._cipher.encryptBlock(h)\n this._ghash = new GHASH(ck)\n iv = calcIv(this, iv, ck)\n\n this._prev = Buffer.from(iv)\n this._cache = Buffer.allocUnsafe(0)\n this._secCache = Buffer.allocUnsafe(0)\n this._decrypt = decrypt\n this._alen = 0\n this._len = 0\n this._mode = mode\n\n this._authTag = null\n this._called = false\n}\n\ninherits(StreamCipher, Transform)\n\nStreamCipher.prototype._update = function (chunk) {\n if (!this._called && this._alen) {\n var rump = 16 - (this._alen % 16)\n if (rump < 16) {\n rump = Buffer.alloc(rump, 0)\n this._ghash.update(rump)\n }\n }\n\n this._called = true\n var out = this._mode.encrypt(this, chunk)\n if (this._decrypt) {\n this._ghash.update(chunk)\n } else {\n this._ghash.update(out)\n }\n this._len += chunk.length\n return out\n}\n\nStreamCipher.prototype._final = function () {\n if (this._decrypt && !this._authTag) throw new Error('Unsupported state or unable to authenticate data')\n\n var tag = xor(this._ghash.final(this._alen * 8, this._len * 8), this._cipher.encryptBlock(this._finID))\n if (this._decrypt && xorTest(tag, this._authTag)) throw new Error('Unsupported state or unable to authenticate data')\n\n this._authTag = tag\n this._cipher.scrub()\n}\n\nStreamCipher.prototype.getAuthTag = function getAuthTag () {\n if (this._decrypt || !Buffer.isBuffer(this._authTag)) throw new Error('Attempting to get auth tag in unsupported state')\n\n return this._authTag\n}\n\nStreamCipher.prototype.setAuthTag = function setAuthTag (tag) {\n if (!this._decrypt) throw new Error('Attempting to set auth tag in unsupported state')\n\n this._authTag = tag\n}\n\nStreamCipher.prototype.setAAD = function setAAD (buf) {\n if (this._called) throw new Error('Attempting to set AAD in unsupported state')\n\n this._ghash.update(buf)\n this._alen += buf.length\n}\n\nmodule.exports = StreamCipher\n","var aes = require('./aes')\nvar Buffer = require('safe-buffer').Buffer\nvar Transform = require('cipher-base')\nvar inherits = require('inherits')\n\nfunction StreamCipher (mode, key, iv, decrypt) {\n Transform.call(this)\n\n this._cipher = new aes.AES(key)\n this._prev = Buffer.from(iv)\n this._cache = Buffer.allocUnsafe(0)\n this._secCache = Buffer.allocUnsafe(0)\n this._decrypt = decrypt\n this._mode = mode\n}\n\ninherits(StreamCipher, Transform)\n\nStreamCipher.prototype._update = function (chunk) {\n return this._mode.encrypt(this, chunk, this._decrypt)\n}\n\nStreamCipher.prototype._final = function () {\n this._cipher.scrub()\n}\n\nmodule.exports = StreamCipher\n","var randomBytes = require('randombytes');\nmodule.exports = findPrime;\nfindPrime.simpleSieve = simpleSieve;\nfindPrime.fermatTest = fermatTest;\nvar BN = require('bn.js');\nvar TWENTYFOUR = new BN(24);\nvar MillerRabin = require('miller-rabin');\nvar millerRabin = new MillerRabin();\nvar ONE = new BN(1);\nvar TWO = new BN(2);\nvar FIVE = new BN(5);\nvar SIXTEEN = new BN(16);\nvar EIGHT = new BN(8);\nvar TEN = new BN(10);\nvar THREE = new BN(3);\nvar SEVEN = new BN(7);\nvar ELEVEN = new BN(11);\nvar FOUR = new BN(4);\nvar TWELVE = new BN(12);\nvar primes = null;\n\nfunction _getPrimes() {\n if (primes !== null)\n return primes;\n\n var limit = 0x100000;\n var res = [];\n res[0] = 2;\n for (var i = 1, k = 3; k < limit; k += 2) {\n var sqrt = Math.ceil(Math.sqrt(k));\n for (var j = 0; j < i && res[j] <= sqrt; j++)\n if (k % res[j] === 0)\n break;\n\n if (i !== j && res[j] <= sqrt)\n continue;\n\n res[i++] = k;\n }\n primes = res;\n return res;\n}\n\nfunction simpleSieve(p) {\n var primes = _getPrimes();\n\n for (var i = 0; i < primes.length; i++)\n if (p.modn(primes[i]) === 0) {\n if (p.cmpn(primes[i]) === 0) {\n return true;\n } else {\n return false;\n }\n }\n\n return true;\n}\n\nfunction fermatTest(p) {\n var red = BN.mont(p);\n return TWO.toRed(red).redPow(p.subn(1)).fromRed().cmpn(1) === 0;\n}\n\nfunction findPrime(bits, gen) {\n if (bits < 16) {\n // this is what openssl does\n if (gen === 2 || gen === 5) {\n return new BN([0x8c, 0x7b]);\n } else {\n return new BN([0x8c, 0x27]);\n }\n }\n gen = new BN(gen);\n\n var num, n2;\n\n while (true) {\n num = new BN(randomBytes(Math.ceil(bits / 8)));\n while (num.bitLength() > bits) {\n num.ishrn(1);\n }\n if (num.isEven()) {\n num.iadd(ONE);\n }\n if (!num.testn(1)) {\n num.iadd(TWO);\n }\n if (!gen.cmp(TWO)) {\n while (num.mod(TWENTYFOUR).cmp(ELEVEN)) {\n num.iadd(FOUR);\n }\n } else if (!gen.cmp(FIVE)) {\n while (num.mod(TEN).cmp(THREE)) {\n num.iadd(FOUR);\n }\n }\n n2 = num.shrn(1);\n if (simpleSieve(n2) && simpleSieve(num) &&\n fermatTest(n2) && fermatTest(num) &&\n millerRabin.test(n2) && millerRabin.test(num)) {\n return num;\n }\n }\n\n}\n","var bn = require('bn.js');\nvar brorand = require('brorand');\n\nfunction MillerRabin(rand) {\n this.rand = rand || new brorand.Rand();\n}\nmodule.exports = MillerRabin;\n\nMillerRabin.create = function create(rand) {\n return new MillerRabin(rand);\n};\n\nMillerRabin.prototype._randbelow = function _randbelow(n) {\n var len = n.bitLength();\n var min_bytes = Math.ceil(len / 8);\n\n // Generage random bytes until a number less than n is found.\n // This ensures that 0..n-1 have an equal probability of being selected.\n do\n var a = new bn(this.rand.generate(min_bytes));\n while (a.cmp(n) >= 0);\n\n return a;\n};\n\nMillerRabin.prototype._randrange = function _randrange(start, stop) {\n // Generate a random number greater than or equal to start and less than stop.\n var size = stop.sub(start);\n return start.add(this._randbelow(size));\n};\n\nMillerRabin.prototype.test = function test(n, k, cb) {\n var len = n.bitLength();\n var red = bn.mont(n);\n var rone = new bn(1).toRed(red);\n\n if (!k)\n k = Math.max(1, (len / 48) | 0);\n\n // Find d and s, (n - 1) = (2 ^ s) * d;\n var n1 = n.subn(1);\n for (var s = 0; !n1.testn(s); s++) {}\n var d = n.shrn(s);\n\n var rn1 = n1.toRed(red);\n\n var prime = true;\n for (; k > 0; k--) {\n var a = this._randrange(new bn(2), n1);\n if (cb)\n cb(a);\n\n var x = a.toRed(red).redPow(d);\n if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)\n continue;\n\n for (var i = 1; i < s; i++) {\n x = x.redSqr();\n\n if (x.cmp(rone) === 0)\n return false;\n if (x.cmp(rn1) === 0)\n break;\n }\n\n if (i === s)\n return false;\n }\n\n return prime;\n};\n\nMillerRabin.prototype.getDivisor = function getDivisor(n, k) {\n var len = n.bitLength();\n var red = bn.mont(n);\n var rone = new bn(1).toRed(red);\n\n if (!k)\n k = Math.max(1, (len / 48) | 0);\n\n // Find d and s, (n - 1) = (2 ^ s) * d;\n var n1 = n.subn(1);\n for (var s = 0; !n1.testn(s); s++) {}\n var d = n.shrn(s);\n\n var rn1 = n1.toRed(red);\n\n for (; k > 0; k--) {\n var a = this._randrange(new bn(2), n1);\n\n var g = n.gcd(a);\n if (g.cmpn(1) !== 0)\n return g;\n\n var x = a.toRed(red).redPow(d);\n if (x.cmp(rone) === 0 || x.cmp(rn1) === 0)\n continue;\n\n for (var i = 1; i < s; i++) {\n x = x.redSqr();\n\n if (x.cmp(rone) === 0)\n return x.fromRed().subn(1).gcd(n);\n if (x.cmp(rn1) === 0)\n break;\n }\n\n if (i === s) {\n x = x.redSqr();\n return x.fromRed().subn(1).gcd(n);\n }\n }\n\n return false;\n};\n","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n'use strict';\n\nmodule.exports = Readable;\n/**/\n\nvar Duplex;\n/**/\n\nReadable.ReadableState = ReadableState;\n/**/\n\nvar EE = require('events').EventEmitter;\n\nvar EElistenerCount = function EElistenerCount(emitter, type) {\n return emitter.listeners(type).length;\n};\n/**/\n\n/**/\n\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n\nvar Buffer = require('buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n/**/\n\n\nvar debugUtil = require('util');\n\nvar debug;\n\nif (debugUtil && debugUtil.debuglog) {\n debug = debugUtil.debuglog('stream');\n} else {\n debug = function debug() {};\n}\n/**/\n\n\nvar BufferList = require('./internal/streams/buffer_list');\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance.\n\n\nvar StringDecoder;\nvar createReadableStreamAsyncIterator;\nvar from;\n\nrequire('inherits')(Readable, Stream);\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\nvar kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];\n\nfunction prependListener(emitter, event, fn) {\n // Sadly this is not cacheable as some libraries bundle their own\n // event emitter implementation with them.\n if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any\n // userland ones. NEVER DO THIS. This is here only because this code needs\n // to continue to work with older versions of Node.js that do not include\n // the prependListener() method. The goal is to eventually remove this hack.\n\n if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];\n}\n\nfunction ReadableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream.\n // These options can be provided separately as readableXXX and writableXXX.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to\n // make all the buffer merging and length checks go away\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer\n // Note: 0 is a valid value, means \"don't call _read preemptively ever\"\n\n this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the\n // linked list can remove elements from the beginning faster than\n // array.shift()\n\n this.buffer = new BufferList();\n this.length = 0;\n this.pipes = null;\n this.pipesCount = 0;\n this.flowing = null;\n this.ended = false;\n this.endEmitted = false;\n this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted\n // immediately, or on a later tick. We set this to true at first, because\n // any actions that shouldn't happen until \"later\" should generally also\n // not happen before the first read call.\n\n this.sync = true; // whenever we return null, then we set a flag to say\n // that we're awaiting a 'readable' event emission.\n\n this.needReadable = false;\n this.emittedReadable = false;\n this.readableListening = false;\n this.resumeScheduled = false;\n this.paused = true; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish')\n\n this.autoDestroy = !!options.autoDestroy; // has it been destroyed\n\n this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s\n\n this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled\n\n this.readingMore = false;\n this.decoder = null;\n this.encoding = null;\n\n if (options.encoding) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n this.decoder = new StringDecoder(options.encoding);\n this.encoding = options.encoding;\n }\n}\n\nfunction Readable(options) {\n Duplex = Duplex || require('./_stream_duplex');\n if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside\n // the ReadableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n this._readableState = new ReadableState(options, this, isDuplex); // legacy\n\n this.readable = true;\n\n if (options) {\n if (typeof options.read === 'function') this._read = options.read;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n }\n\n Stream.call(this);\n}\n\nObject.defineProperty(Readable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._readableState === undefined) {\n return false;\n }\n\n return this._readableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._readableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._readableState.destroyed = value;\n }\n});\nReadable.prototype.destroy = destroyImpl.destroy;\nReadable.prototype._undestroy = destroyImpl.undestroy;\n\nReadable.prototype._destroy = function (err, cb) {\n cb(err);\n}; // Manually shove something into the read() buffer.\n// This returns true if the highWaterMark has not been hit yet,\n// similar to how Writable.write() returns true if you should\n// write() some more.\n\n\nReadable.prototype.push = function (chunk, encoding) {\n var state = this._readableState;\n var skipChunkCheck;\n\n if (!state.objectMode) {\n if (typeof chunk === 'string') {\n encoding = encoding || state.defaultEncoding;\n\n if (encoding !== state.encoding) {\n chunk = Buffer.from(chunk, encoding);\n encoding = '';\n }\n\n skipChunkCheck = true;\n }\n } else {\n skipChunkCheck = true;\n }\n\n return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);\n}; // Unshift should *always* be something directly out of read()\n\n\nReadable.prototype.unshift = function (chunk) {\n return readableAddChunk(this, chunk, null, true, false);\n};\n\nfunction readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {\n debug('readableAddChunk', chunk);\n var state = stream._readableState;\n\n if (chunk === null) {\n state.reading = false;\n onEofChunk(stream, state);\n } else {\n var er;\n if (!skipChunkCheck) er = chunkInvalid(state, chunk);\n\n if (er) {\n errorOrDestroy(stream, er);\n } else if (state.objectMode || chunk && chunk.length > 0) {\n if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (addToFront) {\n if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);\n } else if (state.ended) {\n errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF());\n } else if (state.destroyed) {\n return false;\n } else {\n state.reading = false;\n\n if (state.decoder && !encoding) {\n chunk = state.decoder.write(chunk);\n if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);\n } else {\n addChunk(stream, state, chunk, false);\n }\n }\n } else if (!addToFront) {\n state.reading = false;\n maybeReadMore(stream, state);\n }\n } // We can push more data if we are below the highWaterMark.\n // Also, if we have no data yet, we can stand some more bytes.\n // This is to work around cases where hwm=0, such as the repl.\n\n\n return !state.ended && (state.length < state.highWaterMark || state.length === 0);\n}\n\nfunction addChunk(stream, state, chunk, addToFront) {\n if (state.flowing && state.length === 0 && !state.sync) {\n state.awaitDrain = 0;\n stream.emit('data', chunk);\n } else {\n // update the buffer info.\n state.length += state.objectMode ? 1 : chunk.length;\n if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);\n if (state.needReadable) emitReadable(stream);\n }\n\n maybeReadMore(stream, state);\n}\n\nfunction chunkInvalid(state, chunk) {\n var er;\n\n if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);\n }\n\n return er;\n}\n\nReadable.prototype.isPaused = function () {\n return this._readableState.flowing === false;\n}; // backwards compatibility.\n\n\nReadable.prototype.setEncoding = function (enc) {\n if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;\n var decoder = new StringDecoder(enc);\n this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8\n\n this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers:\n\n var p = this._readableState.buffer.head;\n var content = '';\n\n while (p !== null) {\n content += decoder.write(p.data);\n p = p.next;\n }\n\n this._readableState.buffer.clear();\n\n if (content !== '') this._readableState.buffer.push(content);\n this._readableState.length = content.length;\n return this;\n}; // Don't raise the hwm > 1GB\n\n\nvar MAX_HWM = 0x40000000;\n\nfunction computeNewHighWaterMark(n) {\n if (n >= MAX_HWM) {\n // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.\n n = MAX_HWM;\n } else {\n // Get the next highest power of 2 to prevent increasing hwm excessively in\n // tiny amounts\n n--;\n n |= n >>> 1;\n n |= n >>> 2;\n n |= n >>> 4;\n n |= n >>> 8;\n n |= n >>> 16;\n n++;\n }\n\n return n;\n} // This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\n\nfunction howMuchToRead(n, state) {\n if (n <= 0 || state.length === 0 && state.ended) return 0;\n if (state.objectMode) return 1;\n\n if (n !== n) {\n // Only flow one buffer at a time\n if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;\n } // If we're asking for more than the current hwm, then raise the hwm.\n\n\n if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);\n if (n <= state.length) return n; // Don't have enough\n\n if (!state.ended) {\n state.needReadable = true;\n return 0;\n }\n\n return state.length;\n} // you can override either this method, or the async _read(n) below.\n\n\nReadable.prototype.read = function (n) {\n debug('read', n);\n n = parseInt(n, 10);\n var state = this._readableState;\n var nOrig = n;\n if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we\n // already have a bunch of data in the buffer, then just trigger\n // the 'readable' event and move on.\n\n if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {\n debug('read: emitReadable', state.length, state.ended);\n if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);\n return null;\n }\n\n n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.\n\n if (n === 0 && state.ended) {\n if (state.length === 0) endReadable(this);\n return null;\n } // All the actual chunk generation logic needs to be\n // *below* the call to _read. The reason is that in certain\n // synthetic stream cases, such as passthrough streams, _read\n // may be a completely synchronous operation which may change\n // the state of the read buffer, providing enough data when\n // before there was *not* enough.\n //\n // So, the steps are:\n // 1. Figure out what the state of things will be after we do\n // a read from the buffer.\n //\n // 2. If that resulting state will trigger a _read, then call _read.\n // Note that this may be asynchronous, or synchronous. Yes, it is\n // deeply ugly to write APIs this way, but that still doesn't mean\n // that the Readable class should behave improperly, as streams are\n // designed to be sync/async agnostic.\n // Take note if the _read call is sync or async (ie, if the read call\n // has returned yet), so that we know whether or not it's safe to emit\n // 'readable' etc.\n //\n // 3. Actually pull the requested chunks out of the buffer and return.\n // if we need a readable event, then we need to do some reading.\n\n\n var doRead = state.needReadable;\n debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some\n\n if (state.length === 0 || state.length - n < state.highWaterMark) {\n doRead = true;\n debug('length less than watermark', doRead);\n } // however, if we've ended, then there's no point, and if we're already\n // reading, then it's unnecessary.\n\n\n if (state.ended || state.reading) {\n doRead = false;\n debug('reading or ended', doRead);\n } else if (doRead) {\n debug('do read');\n state.reading = true;\n state.sync = true; // if the length is currently zero, then we *need* a readable event.\n\n if (state.length === 0) state.needReadable = true; // call internal read method\n\n this._read(state.highWaterMark);\n\n state.sync = false; // If _read pushed data synchronously, then `reading` will be false,\n // and we need to re-evaluate how much data we can return to the user.\n\n if (!state.reading) n = howMuchToRead(nOrig, state);\n }\n\n var ret;\n if (n > 0) ret = fromList(n, state);else ret = null;\n\n if (ret === null) {\n state.needReadable = state.length <= state.highWaterMark;\n n = 0;\n } else {\n state.length -= n;\n state.awaitDrain = 0;\n }\n\n if (state.length === 0) {\n // If we have nothing in the buffer, then we want to know\n // as soon as we *do* get something into the buffer.\n if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.\n\n if (nOrig !== n && state.ended) endReadable(this);\n }\n\n if (ret !== null) this.emit('data', ret);\n return ret;\n};\n\nfunction onEofChunk(stream, state) {\n debug('onEofChunk');\n if (state.ended) return;\n\n if (state.decoder) {\n var chunk = state.decoder.end();\n\n if (chunk && chunk.length) {\n state.buffer.push(chunk);\n state.length += state.objectMode ? 1 : chunk.length;\n }\n }\n\n state.ended = true;\n\n if (state.sync) {\n // if we are sync, wait until next tick to emit the data.\n // Otherwise we risk emitting data in the flow()\n // the readable code triggers during a read() call\n emitReadable(stream);\n } else {\n // emit 'readable' now to make sure it gets picked up.\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n state.emittedReadable = true;\n emitReadable_(stream);\n }\n }\n} // Don't emit readable right away in sync mode, because this can trigger\n// another read() call => stack overflow. This way, it might trigger\n// a nextTick recursion warning, but that's not so bad.\n\n\nfunction emitReadable(stream) {\n var state = stream._readableState;\n debug('emitReadable', state.needReadable, state.emittedReadable);\n state.needReadable = false;\n\n if (!state.emittedReadable) {\n debug('emitReadable', state.flowing);\n state.emittedReadable = true;\n process.nextTick(emitReadable_, stream);\n }\n}\n\nfunction emitReadable_(stream) {\n var state = stream._readableState;\n debug('emitReadable_', state.destroyed, state.length, state.ended);\n\n if (!state.destroyed && (state.length || state.ended)) {\n stream.emit('readable');\n state.emittedReadable = false;\n } // The stream needs another readable event if\n // 1. It is not flowing, as the flow mechanism will take\n // care of it.\n // 2. It is not ended.\n // 3. It is below the highWaterMark, so we can schedule\n // another readable later.\n\n\n state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;\n flow(stream);\n} // at this point, the user has presumably seen the 'readable' event,\n// and called read() to consume some data. that may have triggered\n// in turn another _read(n) call, in which case reading = true if\n// it's in progress.\n// However, if we're not ended, or reading, and the length < hwm,\n// then go ahead and try to read some more preemptively.\n\n\nfunction maybeReadMore(stream, state) {\n if (!state.readingMore) {\n state.readingMore = true;\n process.nextTick(maybeReadMore_, stream, state);\n }\n}\n\nfunction maybeReadMore_(stream, state) {\n // Attempt to read more data if we should.\n //\n // The conditions for reading more data are (one of):\n // - Not enough data buffered (state.length < state.highWaterMark). The loop\n // is responsible for filling the buffer with enough data if such data\n // is available. If highWaterMark is 0 and we are not in the flowing mode\n // we should _not_ attempt to buffer any extra data. We'll get more data\n // when the stream consumer calls read() instead.\n // - No data in the buffer, and the stream is in flowing mode. In this mode\n // the loop below is responsible for ensuring read() is called. Failing to\n // call read here would abort the flow and there's no other mechanism for\n // continuing the flow if the stream consumer has just subscribed to the\n // 'data' event.\n //\n // In addition to the above conditions to keep reading data, the following\n // conditions prevent the data from being read:\n // - The stream has ended (state.ended).\n // - There is already a pending 'read' operation (state.reading). This is a\n // case where the the stream has called the implementation defined _read()\n // method, but they are processing the call asynchronously and have _not_\n // called push() with new data. In this case we skip performing more\n // read()s. The execution ends in this method again after the _read() ends\n // up calling push() with more data.\n while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {\n var len = state.length;\n debug('maybeReadMore read 0');\n stream.read(0);\n if (len === state.length) // didn't get any data, stop spinning.\n break;\n }\n\n state.readingMore = false;\n} // abstract method. to be overridden in specific implementation classes.\n// call cb(er, data) where data is <= n in length.\n// for virtual (non-string, non-buffer) streams, \"length\" is somewhat\n// arbitrary, and perhaps not very meaningful.\n\n\nReadable.prototype._read = function (n) {\n errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));\n};\n\nReadable.prototype.pipe = function (dest, pipeOpts) {\n var src = this;\n var state = this._readableState;\n\n switch (state.pipesCount) {\n case 0:\n state.pipes = dest;\n break;\n\n case 1:\n state.pipes = [state.pipes, dest];\n break;\n\n default:\n state.pipes.push(dest);\n break;\n }\n\n state.pipesCount += 1;\n debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);\n var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;\n var endFn = doEnd ? onend : unpipe;\n if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);\n dest.on('unpipe', onunpipe);\n\n function onunpipe(readable, unpipeInfo) {\n debug('onunpipe');\n\n if (readable === src) {\n if (unpipeInfo && unpipeInfo.hasUnpiped === false) {\n unpipeInfo.hasUnpiped = true;\n cleanup();\n }\n }\n }\n\n function onend() {\n debug('onend');\n dest.end();\n } // when the dest drains, it reduces the awaitDrain counter\n // on the source. This would be more elegant with a .once()\n // handler in flow(), but adding and removing repeatedly is\n // too slow.\n\n\n var ondrain = pipeOnDrain(src);\n dest.on('drain', ondrain);\n var cleanedUp = false;\n\n function cleanup() {\n debug('cleanup'); // cleanup event handlers once the pipe is broken\n\n dest.removeListener('close', onclose);\n dest.removeListener('finish', onfinish);\n dest.removeListener('drain', ondrain);\n dest.removeListener('error', onerror);\n dest.removeListener('unpipe', onunpipe);\n src.removeListener('end', onend);\n src.removeListener('end', unpipe);\n src.removeListener('data', ondata);\n cleanedUp = true; // if the reader is waiting for a drain event from this\n // specific writer, then it would cause it to never start\n // flowing again.\n // So, if this is awaiting a drain, then we just call it now.\n // If we don't know, then assume that we are waiting for one.\n\n if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();\n }\n\n src.on('data', ondata);\n\n function ondata(chunk) {\n debug('ondata');\n var ret = dest.write(chunk);\n debug('dest.write', ret);\n\n if (ret === false) {\n // If the user unpiped during `dest.write()`, it is possible\n // to get stuck in a permanently paused state if that write\n // also returned false.\n // => Check whether `dest` is still a piping destination.\n if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {\n debug('false write response, pause', state.awaitDrain);\n state.awaitDrain++;\n }\n\n src.pause();\n }\n } // if the dest has an error, then stop piping into it.\n // however, don't suppress the throwing behavior for this.\n\n\n function onerror(er) {\n debug('onerror', er);\n unpipe();\n dest.removeListener('error', onerror);\n if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);\n } // Make sure our error handler is attached before userland ones.\n\n\n prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.\n\n function onclose() {\n dest.removeListener('finish', onfinish);\n unpipe();\n }\n\n dest.once('close', onclose);\n\n function onfinish() {\n debug('onfinish');\n dest.removeListener('close', onclose);\n unpipe();\n }\n\n dest.once('finish', onfinish);\n\n function unpipe() {\n debug('unpipe');\n src.unpipe(dest);\n } // tell the dest that it's being piped to\n\n\n dest.emit('pipe', src); // start the flow if it hasn't been started already.\n\n if (!state.flowing) {\n debug('pipe resume');\n src.resume();\n }\n\n return dest;\n};\n\nfunction pipeOnDrain(src) {\n return function pipeOnDrainFunctionResult() {\n var state = src._readableState;\n debug('pipeOnDrain', state.awaitDrain);\n if (state.awaitDrain) state.awaitDrain--;\n\n if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {\n state.flowing = true;\n flow(src);\n }\n };\n}\n\nReadable.prototype.unpipe = function (dest) {\n var state = this._readableState;\n var unpipeInfo = {\n hasUnpiped: false\n }; // if we're not piping anywhere, then do nothing.\n\n if (state.pipesCount === 0) return this; // just one destination. most common case.\n\n if (state.pipesCount === 1) {\n // passed in one, but it's not the right one.\n if (dest && dest !== state.pipes) return this;\n if (!dest) dest = state.pipes; // got a match.\n\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n if (dest) dest.emit('unpipe', this, unpipeInfo);\n return this;\n } // slow case. multiple pipe destinations.\n\n\n if (!dest) {\n // remove all.\n var dests = state.pipes;\n var len = state.pipesCount;\n state.pipes = null;\n state.pipesCount = 0;\n state.flowing = false;\n\n for (var i = 0; i < len; i++) {\n dests[i].emit('unpipe', this, {\n hasUnpiped: false\n });\n }\n\n return this;\n } // try to find the right one.\n\n\n var index = indexOf(state.pipes, dest);\n if (index === -1) return this;\n state.pipes.splice(index, 1);\n state.pipesCount -= 1;\n if (state.pipesCount === 1) state.pipes = state.pipes[0];\n dest.emit('unpipe', this, unpipeInfo);\n return this;\n}; // set up data events if they are asked for\n// Ensure readable listeners eventually get something\n\n\nReadable.prototype.on = function (ev, fn) {\n var res = Stream.prototype.on.call(this, ev, fn);\n var state = this._readableState;\n\n if (ev === 'data') {\n // update readableListening so that resume() may be a no-op\n // a few lines down. This is needed to support once('readable').\n state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused\n\n if (state.flowing !== false) this.resume();\n } else if (ev === 'readable') {\n if (!state.endEmitted && !state.readableListening) {\n state.readableListening = state.needReadable = true;\n state.flowing = false;\n state.emittedReadable = false;\n debug('on readable', state.length, state.reading);\n\n if (state.length) {\n emitReadable(this);\n } else if (!state.reading) {\n process.nextTick(nReadingNextTick, this);\n }\n }\n }\n\n return res;\n};\n\nReadable.prototype.addListener = Readable.prototype.on;\n\nReadable.prototype.removeListener = function (ev, fn) {\n var res = Stream.prototype.removeListener.call(this, ev, fn);\n\n if (ev === 'readable') {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nReadable.prototype.removeAllListeners = function (ev) {\n var res = Stream.prototype.removeAllListeners.apply(this, arguments);\n\n if (ev === 'readable' || ev === undefined) {\n // We need to check if there is someone still listening to\n // readable and reset the state. However this needs to happen\n // after readable has been emitted but before I/O (nextTick) to\n // support once('readable', fn) cycles. This means that calling\n // resume within the same tick will have no\n // effect.\n process.nextTick(updateReadableListening, this);\n }\n\n return res;\n};\n\nfunction updateReadableListening(self) {\n var state = self._readableState;\n state.readableListening = self.listenerCount('readable') > 0;\n\n if (state.resumeScheduled && !state.paused) {\n // flowing needs to be set to true now, otherwise\n // the upcoming resume will not flow.\n state.flowing = true; // crude way to check if we should resume\n } else if (self.listenerCount('data') > 0) {\n self.resume();\n }\n}\n\nfunction nReadingNextTick(self) {\n debug('readable nexttick read 0');\n self.read(0);\n} // pause() and resume() are remnants of the legacy readable stream API\n// If the user uses them, then switch into old mode.\n\n\nReadable.prototype.resume = function () {\n var state = this._readableState;\n\n if (!state.flowing) {\n debug('resume'); // we flow only if there is no one listening\n // for readable, but we still have to call\n // resume()\n\n state.flowing = !state.readableListening;\n resume(this, state);\n }\n\n state.paused = false;\n return this;\n};\n\nfunction resume(stream, state) {\n if (!state.resumeScheduled) {\n state.resumeScheduled = true;\n process.nextTick(resume_, stream, state);\n }\n}\n\nfunction resume_(stream, state) {\n debug('resume', state.reading);\n\n if (!state.reading) {\n stream.read(0);\n }\n\n state.resumeScheduled = false;\n stream.emit('resume');\n flow(stream);\n if (state.flowing && !state.reading) stream.read(0);\n}\n\nReadable.prototype.pause = function () {\n debug('call pause flowing=%j', this._readableState.flowing);\n\n if (this._readableState.flowing !== false) {\n debug('pause');\n this._readableState.flowing = false;\n this.emit('pause');\n }\n\n this._readableState.paused = true;\n return this;\n};\n\nfunction flow(stream) {\n var state = stream._readableState;\n debug('flow', state.flowing);\n\n while (state.flowing && stream.read() !== null) {\n ;\n }\n} // wrap an old-style stream as the async data source.\n// This is *not* part of the readable stream interface.\n// It is an ugly unfortunate mess of history.\n\n\nReadable.prototype.wrap = function (stream) {\n var _this = this;\n\n var state = this._readableState;\n var paused = false;\n stream.on('end', function () {\n debug('wrapped end');\n\n if (state.decoder && !state.ended) {\n var chunk = state.decoder.end();\n if (chunk && chunk.length) _this.push(chunk);\n }\n\n _this.push(null);\n });\n stream.on('data', function (chunk) {\n debug('wrapped data');\n if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode\n\n if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;\n\n var ret = _this.push(chunk);\n\n if (!ret) {\n paused = true;\n stream.pause();\n }\n }); // proxy all the other methods.\n // important when wrapping filters and duplexes.\n\n for (var i in stream) {\n if (this[i] === undefined && typeof stream[i] === 'function') {\n this[i] = function methodWrap(method) {\n return function methodWrapReturnFunction() {\n return stream[method].apply(stream, arguments);\n };\n }(i);\n }\n } // proxy certain important events.\n\n\n for (var n = 0; n < kProxyEvents.length; n++) {\n stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));\n } // when we try to consume some more bytes, simply unpause the\n // underlying stream.\n\n\n this._read = function (n) {\n debug('wrapped _read', n);\n\n if (paused) {\n paused = false;\n stream.resume();\n }\n };\n\n return this;\n};\n\nif (typeof Symbol === 'function') {\n Readable.prototype[Symbol.asyncIterator] = function () {\n if (createReadableStreamAsyncIterator === undefined) {\n createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');\n }\n\n return createReadableStreamAsyncIterator(this);\n };\n}\n\nObject.defineProperty(Readable.prototype, 'readableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.highWaterMark;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState && this._readableState.buffer;\n }\n});\nObject.defineProperty(Readable.prototype, 'readableFlowing', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.flowing;\n },\n set: function set(state) {\n if (this._readableState) {\n this._readableState.flowing = state;\n }\n }\n}); // exposed for testing purposes only.\n\nReadable._fromList = fromList;\nObject.defineProperty(Readable.prototype, 'readableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._readableState.length;\n }\n}); // Pluck off n bytes from an array of buffers.\n// Length is the combined lengths of all the buffers in the list.\n// This function is designed to be inlinable, so please take care when making\n// changes to the function body.\n\nfunction fromList(n, state) {\n // nothing buffered\n if (state.length === 0) return null;\n var ret;\n if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {\n // read it all, truncate the list\n if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length);\n state.buffer.clear();\n } else {\n // read part of list\n ret = state.buffer.consume(n, state.decoder);\n }\n return ret;\n}\n\nfunction endReadable(stream) {\n var state = stream._readableState;\n debug('endReadable', state.endEmitted);\n\n if (!state.endEmitted) {\n state.ended = true;\n process.nextTick(endReadableNT, state, stream);\n }\n}\n\nfunction endReadableNT(state, stream) {\n debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift.\n\n if (!state.endEmitted && state.length === 0) {\n state.endEmitted = true;\n stream.readable = false;\n stream.emit('end');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the writable side is ready for autoDestroy as well\n var wState = stream._writableState;\n\n if (!wState || wState.autoDestroy && wState.finished) {\n stream.destroy();\n }\n }\n }\n}\n\nif (typeof Symbol === 'function') {\n Readable.from = function (iterable, opts) {\n if (from === undefined) {\n from = require('./internal/streams/from');\n }\n\n return from(Readable, iterable, opts);\n };\n}\n\nfunction indexOf(xs, x) {\n for (var i = 0, l = xs.length; i < l; i++) {\n if (xs[i] === x) return i;\n }\n\n return -1;\n}","module.exports = require('events').EventEmitter;\n","'use strict'; // undocumented cb() API, needed for core, not for public API\n\nfunction destroy(err, cb) {\n var _this = this;\n\n var readableDestroyed = this._readableState && this._readableState.destroyed;\n var writableDestroyed = this._writableState && this._writableState.destroyed;\n\n if (readableDestroyed || writableDestroyed) {\n if (cb) {\n cb(err);\n } else if (err) {\n if (!this._writableState) {\n process.nextTick(emitErrorNT, this, err);\n } else if (!this._writableState.errorEmitted) {\n this._writableState.errorEmitted = true;\n process.nextTick(emitErrorNT, this, err);\n }\n }\n\n return this;\n } // we set destroyed to true before firing error callbacks in order\n // to make it re-entrance safe in case destroy() is called within callbacks\n\n\n if (this._readableState) {\n this._readableState.destroyed = true;\n } // if this is a duplex stream mark the writable part as destroyed as well\n\n\n if (this._writableState) {\n this._writableState.destroyed = true;\n }\n\n this._destroy(err || null, function (err) {\n if (!cb && err) {\n if (!_this._writableState) {\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else if (!_this._writableState.errorEmitted) {\n _this._writableState.errorEmitted = true;\n process.nextTick(emitErrorAndCloseNT, _this, err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n } else if (cb) {\n process.nextTick(emitCloseNT, _this);\n cb(err);\n } else {\n process.nextTick(emitCloseNT, _this);\n }\n });\n\n return this;\n}\n\nfunction emitErrorAndCloseNT(self, err) {\n emitErrorNT(self, err);\n emitCloseNT(self);\n}\n\nfunction emitCloseNT(self) {\n if (self._writableState && !self._writableState.emitClose) return;\n if (self._readableState && !self._readableState.emitClose) return;\n self.emit('close');\n}\n\nfunction undestroy() {\n if (this._readableState) {\n this._readableState.destroyed = false;\n this._readableState.reading = false;\n this._readableState.ended = false;\n this._readableState.endEmitted = false;\n }\n\n if (this._writableState) {\n this._writableState.destroyed = false;\n this._writableState.ended = false;\n this._writableState.ending = false;\n this._writableState.finalCalled = false;\n this._writableState.prefinished = false;\n this._writableState.finished = false;\n this._writableState.errorEmitted = false;\n }\n}\n\nfunction emitErrorNT(self, err) {\n self.emit('error', err);\n}\n\nfunction errorOrDestroy(stream, err) {\n // We have tests that rely on errors being emitted\n // in the same tick, so changing this is semver major.\n // For now when you opt-in to autoDestroy we allow\n // the error to be emitted nextTick. In a future\n // semver major update we should change the default to this.\n var rState = stream._readableState;\n var wState = stream._writableState;\n if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);\n}\n\nmodule.exports = {\n destroy: destroy,\n undestroy: undestroy,\n errorOrDestroy: errorOrDestroy\n};","'use strict';\n\nvar ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;\n\nfunction highWaterMarkFrom(options, isDuplex, duplexKey) {\n return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;\n}\n\nfunction getHighWaterMark(state, options, duplexKey, isDuplex) {\n var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);\n\n if (hwm != null) {\n if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {\n var name = isDuplex ? duplexKey : 'highWaterMark';\n throw new ERR_INVALID_OPT_VALUE(name, hwm);\n }\n\n return Math.floor(hwm);\n } // Default value\n\n\n return state.objectMode ? 16 : 16 * 1024;\n}\n\nmodule.exports = {\n getHighWaterMark: getHighWaterMark\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// A bit simpler than readable streams.\n// Implement an async ._write(chunk, encoding, cb), and it'll handle all\n// the drain event emission and buffering.\n'use strict';\n\nmodule.exports = Writable;\n/* */\n\nfunction WriteReq(chunk, encoding, cb) {\n this.chunk = chunk;\n this.encoding = encoding;\n this.callback = cb;\n this.next = null;\n} // It seems a linked list but it is not\n// there will be only 2 of these for each stream\n\n\nfunction CorkedRequest(state) {\n var _this = this;\n\n this.next = null;\n this.entry = null;\n\n this.finish = function () {\n onCorkedFinish(_this, state);\n };\n}\n/* */\n\n/**/\n\n\nvar Duplex;\n/**/\n\nWritable.WritableState = WritableState;\n/**/\n\nvar internalUtil = {\n deprecate: require('util-deprecate')\n};\n/**/\n\n/**/\n\nvar Stream = require('./internal/streams/stream');\n/**/\n\n\nvar Buffer = require('buffer').Buffer;\n\nvar OurUint8Array = global.Uint8Array || function () {};\n\nfunction _uint8ArrayToBuffer(chunk) {\n return Buffer.from(chunk);\n}\n\nfunction _isUint8Array(obj) {\n return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;\n}\n\nvar destroyImpl = require('./internal/streams/destroy');\n\nvar _require = require('./internal/streams/state'),\n getHighWaterMark = _require.getHighWaterMark;\n\nvar _require$codes = require('../errors').codes,\n ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,\n ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,\n ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,\n ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,\n ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;\n\nvar errorOrDestroy = destroyImpl.errorOrDestroy;\n\nrequire('inherits')(Writable, Stream);\n\nfunction nop() {}\n\nfunction WritableState(options, stream, isDuplex) {\n Duplex = Duplex || require('./_stream_duplex');\n options = options || {}; // Duplex streams are both readable and writable, but share\n // the same options object.\n // However, some cases require setting options to different\n // values for the readable and the writable sides of the duplex stream,\n // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.\n\n if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream\n // contains buffers or objects.\n\n this.objectMode = !!options.objectMode;\n if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false\n // Note: 0 is a valid value, means that we always return false if\n // the entire buffer is not flushed immediately on write()\n\n this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called\n\n this.finalCalled = false; // drain event flag.\n\n this.needDrain = false; // at the start of calling end()\n\n this.ending = false; // when end() has been called, and returned\n\n this.ended = false; // when 'finish' is emitted\n\n this.finished = false; // has it been destroyed\n\n this.destroyed = false; // should we decode strings into buffers before passing to _write?\n // this is here so that some node-core streams can optimize string\n // handling at a lower level.\n\n var noDecode = options.decodeStrings === false;\n this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string\n // encoding is 'binary' so we have to make this configurable.\n // Everything else in the universe uses 'utf8', though.\n\n this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement\n // of how much we're waiting to get pushed to some underlying\n // socket or file.\n\n this.length = 0; // a flag to see when we're in the middle of a write.\n\n this.writing = false; // when true all writes will be buffered until .uncork() call\n\n this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,\n // or on a later tick. We set this to true at first, because any\n // actions that shouldn't happen until \"later\" should generally also\n // not happen before the first write call.\n\n this.sync = true; // a flag to know if we're processing previously buffered items, which\n // may call the _write() callback in the same tick, so that we don't\n // end up in an overlapped onwrite situation.\n\n this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)\n\n this.onwrite = function (er) {\n onwrite(stream, er);\n }; // the callback that the user supplies to write(chunk,encoding,cb)\n\n\n this.writecb = null; // the amount that is being written when _write is called.\n\n this.writelen = 0;\n this.bufferedRequest = null;\n this.lastBufferedRequest = null; // number of pending user-supplied write callbacks\n // this must be 0 before 'finish' can be emitted\n\n this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs\n // This is relevant for synchronous Transform streams\n\n this.prefinished = false; // True if the error was already emitted and should not be thrown again\n\n this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.\n\n this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')\n\n this.autoDestroy = !!options.autoDestroy; // count buffered requests\n\n this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always\n // one allocated and free to use, and we maintain at most two\n\n this.corkedRequestsFree = new CorkedRequest(this);\n}\n\nWritableState.prototype.getBuffer = function getBuffer() {\n var current = this.bufferedRequest;\n var out = [];\n\n while (current) {\n out.push(current);\n current = current.next;\n }\n\n return out;\n};\n\n(function () {\n try {\n Object.defineProperty(WritableState.prototype, 'buffer', {\n get: internalUtil.deprecate(function writableStateBufferGetter() {\n return this.getBuffer();\n }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')\n });\n } catch (_) {}\n})(); // Test _writableState for inheritance to account for Duplex streams,\n// whose prototype chain only points to Readable.\n\n\nvar realHasInstance;\n\nif (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {\n realHasInstance = Function.prototype[Symbol.hasInstance];\n Object.defineProperty(Writable, Symbol.hasInstance, {\n value: function value(object) {\n if (realHasInstance.call(this, object)) return true;\n if (this !== Writable) return false;\n return object && object._writableState instanceof WritableState;\n }\n });\n} else {\n realHasInstance = function realHasInstance(object) {\n return object instanceof this;\n };\n}\n\nfunction Writable(options) {\n Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.\n // `realHasInstance` is necessary because using plain `instanceof`\n // would return false, as no `_writableState` property is attached.\n // Trying to use the custom `instanceof` for Writable here will also break the\n // Node.js LazyTransform implementation, which has a non-trivial getter for\n // `_writableState` that would lead to infinite recursion.\n // Checking for a Stream.Duplex instance is faster here instead of inside\n // the WritableState constructor, at least with V8 6.5\n\n var isDuplex = this instanceof Duplex;\n if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);\n this._writableState = new WritableState(options, this, isDuplex); // legacy.\n\n this.writable = true;\n\n if (options) {\n if (typeof options.write === 'function') this._write = options.write;\n if (typeof options.writev === 'function') this._writev = options.writev;\n if (typeof options.destroy === 'function') this._destroy = options.destroy;\n if (typeof options.final === 'function') this._final = options.final;\n }\n\n Stream.call(this);\n} // Otherwise people can pipe Writable streams, which is just wrong.\n\n\nWritable.prototype.pipe = function () {\n errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());\n};\n\nfunction writeAfterEnd(stream, cb) {\n var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb\n\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n} // Checks that a user-supplied chunk is valid, especially for the particular\n// mode the stream is in. Currently this means that `null` is never accepted\n// and undefined/non-string values are only allowed in object mode.\n\n\nfunction validChunk(stream, state, chunk, cb) {\n var er;\n\n if (chunk === null) {\n er = new ERR_STREAM_NULL_VALUES();\n } else if (typeof chunk !== 'string' && !state.objectMode) {\n er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);\n }\n\n if (er) {\n errorOrDestroy(stream, er);\n process.nextTick(cb, er);\n return false;\n }\n\n return true;\n}\n\nWritable.prototype.write = function (chunk, encoding, cb) {\n var state = this._writableState;\n var ret = false;\n\n var isBuf = !state.objectMode && _isUint8Array(chunk);\n\n if (isBuf && !Buffer.isBuffer(chunk)) {\n chunk = _uint8ArrayToBuffer(chunk);\n }\n\n if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;\n if (typeof cb !== 'function') cb = nop;\n if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {\n state.pendingcb++;\n ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb);\n }\n return ret;\n};\n\nWritable.prototype.cork = function () {\n this._writableState.corked++;\n};\n\nWritable.prototype.uncork = function () {\n var state = this._writableState;\n\n if (state.corked) {\n state.corked--;\n if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);\n }\n};\n\nWritable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {\n // node::ParseEncoding() requires lower case.\n if (typeof encoding === 'string') encoding = encoding.toLowerCase();\n if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding);\n this._writableState.defaultEncoding = encoding;\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableBuffer', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState && this._writableState.getBuffer();\n }\n});\n\nfunction decodeChunk(state, chunk, encoding) {\n if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {\n chunk = Buffer.from(chunk, encoding);\n }\n\n return chunk;\n}\n\nObject.defineProperty(Writable.prototype, 'writableHighWaterMark', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.highWaterMark;\n }\n}); // if we're already writing something, then just put this\n// in the queue, and wait our turn. Otherwise, call _write\n// If we return false, then we need a drain event, so set that flag.\n\nfunction writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {\n if (!isBuf) {\n var newChunk = decodeChunk(state, chunk, encoding);\n\n if (chunk !== newChunk) {\n isBuf = true;\n encoding = 'buffer';\n chunk = newChunk;\n }\n }\n\n var len = state.objectMode ? 1 : chunk.length;\n state.length += len;\n var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.\n\n if (!ret) state.needDrain = true;\n\n if (state.writing || state.corked) {\n var last = state.lastBufferedRequest;\n state.lastBufferedRequest = {\n chunk: chunk,\n encoding: encoding,\n isBuf: isBuf,\n callback: cb,\n next: null\n };\n\n if (last) {\n last.next = state.lastBufferedRequest;\n } else {\n state.bufferedRequest = state.lastBufferedRequest;\n }\n\n state.bufferedRequestCount += 1;\n } else {\n doWrite(stream, state, false, len, chunk, encoding, cb);\n }\n\n return ret;\n}\n\nfunction doWrite(stream, state, writev, len, chunk, encoding, cb) {\n state.writelen = len;\n state.writecb = cb;\n state.writing = true;\n state.sync = true;\n if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);\n state.sync = false;\n}\n\nfunction onwriteError(stream, state, sync, er, cb) {\n --state.pendingcb;\n\n if (sync) {\n // defer the callback if we are being called synchronously\n // to avoid piling up things on the stack\n process.nextTick(cb, er); // this can emit finish, and it will always happen\n // after error\n\n process.nextTick(finishMaybe, stream, state);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er);\n } else {\n // the caller expect this to happen before if\n // it is async\n cb(er);\n stream._writableState.errorEmitted = true;\n errorOrDestroy(stream, er); // this can emit finish, but finish must\n // always follow error\n\n finishMaybe(stream, state);\n }\n}\n\nfunction onwriteStateUpdate(state) {\n state.writing = false;\n state.writecb = null;\n state.length -= state.writelen;\n state.writelen = 0;\n}\n\nfunction onwrite(stream, er) {\n var state = stream._writableState;\n var sync = state.sync;\n var cb = state.writecb;\n if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK();\n onwriteStateUpdate(state);\n if (er) onwriteError(stream, state, sync, er, cb);else {\n // Check if we're actually ready to finish, but don't emit yet\n var finished = needFinish(state) || stream.destroyed;\n\n if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {\n clearBuffer(stream, state);\n }\n\n if (sync) {\n process.nextTick(afterWrite, stream, state, finished, cb);\n } else {\n afterWrite(stream, state, finished, cb);\n }\n }\n}\n\nfunction afterWrite(stream, state, finished, cb) {\n if (!finished) onwriteDrain(stream, state);\n state.pendingcb--;\n cb();\n finishMaybe(stream, state);\n} // Must force callback to be called on nextTick, so that we don't\n// emit 'drain' before the write() consumer gets the 'false' return\n// value, and has a chance to attach a 'drain' listener.\n\n\nfunction onwriteDrain(stream, state) {\n if (state.length === 0 && state.needDrain) {\n state.needDrain = false;\n stream.emit('drain');\n }\n} // if there's something in the buffer waiting, then process it\n\n\nfunction clearBuffer(stream, state) {\n state.bufferProcessing = true;\n var entry = state.bufferedRequest;\n\n if (stream._writev && entry && entry.next) {\n // Fast case, write everything using _writev()\n var l = state.bufferedRequestCount;\n var buffer = new Array(l);\n var holder = state.corkedRequestsFree;\n holder.entry = entry;\n var count = 0;\n var allBuffers = true;\n\n while (entry) {\n buffer[count] = entry;\n if (!entry.isBuf) allBuffers = false;\n entry = entry.next;\n count += 1;\n }\n\n buffer.allBuffers = allBuffers;\n doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time\n // as the hot path ends with doWrite\n\n state.pendingcb++;\n state.lastBufferedRequest = null;\n\n if (holder.next) {\n state.corkedRequestsFree = holder.next;\n holder.next = null;\n } else {\n state.corkedRequestsFree = new CorkedRequest(state);\n }\n\n state.bufferedRequestCount = 0;\n } else {\n // Slow case, write chunks one-by-one\n while (entry) {\n var chunk = entry.chunk;\n var encoding = entry.encoding;\n var cb = entry.callback;\n var len = state.objectMode ? 1 : chunk.length;\n doWrite(stream, state, false, len, chunk, encoding, cb);\n entry = entry.next;\n state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then\n // it means that we need to wait until it does.\n // also, that means that the chunk and cb are currently\n // being processed, so move the buffer counter past them.\n\n if (state.writing) {\n break;\n }\n }\n\n if (entry === null) state.lastBufferedRequest = null;\n }\n\n state.bufferedRequest = entry;\n state.bufferProcessing = false;\n}\n\nWritable.prototype._write = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));\n};\n\nWritable.prototype._writev = null;\n\nWritable.prototype.end = function (chunk, encoding, cb) {\n var state = this._writableState;\n\n if (typeof chunk === 'function') {\n cb = chunk;\n chunk = null;\n encoding = null;\n } else if (typeof encoding === 'function') {\n cb = encoding;\n encoding = null;\n }\n\n if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks\n\n if (state.corked) {\n state.corked = 1;\n this.uncork();\n } // ignore unnecessary end() calls.\n\n\n if (!state.ending) endWritable(this, state, cb);\n return this;\n};\n\nObject.defineProperty(Writable.prototype, 'writableLength', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n return this._writableState.length;\n }\n});\n\nfunction needFinish(state) {\n return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;\n}\n\nfunction callFinal(stream, state) {\n stream._final(function (err) {\n state.pendingcb--;\n\n if (err) {\n errorOrDestroy(stream, err);\n }\n\n state.prefinished = true;\n stream.emit('prefinish');\n finishMaybe(stream, state);\n });\n}\n\nfunction prefinish(stream, state) {\n if (!state.prefinished && !state.finalCalled) {\n if (typeof stream._final === 'function' && !state.destroyed) {\n state.pendingcb++;\n state.finalCalled = true;\n process.nextTick(callFinal, stream, state);\n } else {\n state.prefinished = true;\n stream.emit('prefinish');\n }\n }\n}\n\nfunction finishMaybe(stream, state) {\n var need = needFinish(state);\n\n if (need) {\n prefinish(stream, state);\n\n if (state.pendingcb === 0) {\n state.finished = true;\n stream.emit('finish');\n\n if (state.autoDestroy) {\n // In case of duplex streams we need a way to detect\n // if the readable side is ready for autoDestroy as well\n var rState = stream._readableState;\n\n if (!rState || rState.autoDestroy && rState.endEmitted) {\n stream.destroy();\n }\n }\n }\n }\n\n return need;\n}\n\nfunction endWritable(stream, state, cb) {\n state.ending = true;\n finishMaybe(stream, state);\n\n if (cb) {\n if (state.finished) process.nextTick(cb);else stream.once('finish', cb);\n }\n\n state.ended = true;\n stream.writable = false;\n}\n\nfunction onCorkedFinish(corkReq, state, err) {\n var entry = corkReq.entry;\n corkReq.entry = null;\n\n while (entry) {\n var cb = entry.callback;\n state.pendingcb--;\n cb(err);\n entry = entry.next;\n } // reuse the free corkReq.\n\n\n state.corkedRequestsFree.next = corkReq;\n}\n\nObject.defineProperty(Writable.prototype, 'destroyed', {\n // making it explicit this property is not enumerable\n // because otherwise some prototype manipulation in\n // userland will fail\n enumerable: false,\n get: function get() {\n if (this._writableState === undefined) {\n return false;\n }\n\n return this._writableState.destroyed;\n },\n set: function set(value) {\n // we ignore the value if the stream\n // has not been initialized yet\n if (!this._writableState) {\n return;\n } // backward compatibility, the user is explicitly\n // managing destroyed\n\n\n this._writableState.destroyed = value;\n }\n});\nWritable.prototype.destroy = destroyImpl.destroy;\nWritable.prototype._undestroy = destroyImpl.undestroy;\n\nWritable.prototype._destroy = function (err, cb) {\n cb(err);\n};","// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n// a transform stream is a readable/writable stream where you do\n// something with the data. Sometimes it's called a \"filter\",\n// but that's not a great name for it, since that implies a thing where\n// some bits pass through, and others are simply ignored. (That would\n// be a valid example of a transform, of course.)\n//\n// While the output is causally related to the input, it's not a\n// necessarily symmetric or synchronous transformation. For example,\n// a zlib stream might take multiple plain-text writes(), and then\n// emit a single compressed chunk some time in the future.\n//\n// Here's how this works:\n//\n// The Transform stream has all the aspects of the readable and writable\n// stream classes. When you write(chunk), that calls _write(chunk,cb)\n// internally, and returns false if there's a lot of pending writes\n// buffered up. When you call read(), that calls _read(n) until\n// there's enough pending readable data buffered up.\n//\n// In a transform stream, the written data is placed in a buffer. When\n// _read(n) is called, it transforms the queued up data, calling the\n// buffered _write cb's as it consumes chunks. If consuming a single\n// written chunk would result in multiple output chunks, then the first\n// outputted bit calls the readcb, and subsequent chunks just go into\n// the read buffer, and will cause it to emit 'readable' if necessary.\n//\n// This way, back-pressure is actually determined by the reading side,\n// since _read has to be called to start processing a new chunk. However,\n// a pathological inflate type of transform can cause excessive buffering\n// here. For example, imagine a stream where every byte of input is\n// interpreted as an integer from 0-255, and then results in that many\n// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in\n// 1kb of data being output. In this case, you could write a very small\n// amount of input, and end up with a very large amount of output. In\n// such a pathological inflating mechanism, there'd be no way to tell\n// the system to stop doing the transform. A single 4MB write could\n// cause the system to run out of memory.\n//\n// However, even in such a pathological case, only a single written chunk\n// would be consumed, and then the rest would wait (un-transformed) until\n// the results of the previous transformed chunk were consumed.\n'use strict';\n\nmodule.exports = Transform;\n\nvar _require$codes = require('../errors').codes,\n ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,\n ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,\n ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,\n ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;\n\nvar Duplex = require('./_stream_duplex');\n\nrequire('inherits')(Transform, Duplex);\n\nfunction afterTransform(er, data) {\n var ts = this._transformState;\n ts.transforming = false;\n var cb = ts.writecb;\n\n if (cb === null) {\n return this.emit('error', new ERR_MULTIPLE_CALLBACK());\n }\n\n ts.writechunk = null;\n ts.writecb = null;\n if (data != null) // single equals check for both `null` and `undefined`\n this.push(data);\n cb(er);\n var rs = this._readableState;\n rs.reading = false;\n\n if (rs.needReadable || rs.length < rs.highWaterMark) {\n this._read(rs.highWaterMark);\n }\n}\n\nfunction Transform(options) {\n if (!(this instanceof Transform)) return new Transform(options);\n Duplex.call(this, options);\n this._transformState = {\n afterTransform: afterTransform.bind(this),\n needTransform: false,\n transforming: false,\n writecb: null,\n writechunk: null,\n writeencoding: null\n }; // start out asking for a readable event once data is transformed.\n\n this._readableState.needReadable = true; // we have implemented the _read method, and done the other things\n // that Readable wants before the first _read call, so unset the\n // sync guard flag.\n\n this._readableState.sync = false;\n\n if (options) {\n if (typeof options.transform === 'function') this._transform = options.transform;\n if (typeof options.flush === 'function') this._flush = options.flush;\n } // When the writable side finishes, then flush out anything remaining.\n\n\n this.on('prefinish', prefinish);\n}\n\nfunction prefinish() {\n var _this = this;\n\n if (typeof this._flush === 'function' && !this._readableState.destroyed) {\n this._flush(function (er, data) {\n done(_this, er, data);\n });\n } else {\n done(this, null, null);\n }\n}\n\nTransform.prototype.push = function (chunk, encoding) {\n this._transformState.needTransform = false;\n return Duplex.prototype.push.call(this, chunk, encoding);\n}; // This is the part where you do stuff!\n// override this function in implementation classes.\n// 'chunk' is an input chunk.\n//\n// Call `push(newChunk)` to pass along transformed output\n// to the readable side. You may call 'push' zero or more times.\n//\n// Call `cb(err)` when you are done with this chunk. If you pass\n// an error, then that'll put the hurt on the whole operation. If you\n// never call cb(), then you'll never get another chunk.\n\n\nTransform.prototype._transform = function (chunk, encoding, cb) {\n cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));\n};\n\nTransform.prototype._write = function (chunk, encoding, cb) {\n var ts = this._transformState;\n ts.writecb = cb;\n ts.writechunk = chunk;\n ts.writeencoding = encoding;\n\n if (!ts.transforming) {\n var rs = this._readableState;\n if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);\n }\n}; // Doesn't matter what the args are here.\n// _transform does all the work.\n// That we got here means that the readable side wants more data.\n\n\nTransform.prototype._read = function (n) {\n var ts = this._transformState;\n\n if (ts.writechunk !== null && !ts.transforming) {\n ts.transforming = true;\n\n this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);\n } else {\n // mark that we need a transform, so that any data that comes in\n // will get processed, now that we've asked for it.\n ts.needTransform = true;\n }\n};\n\nTransform.prototype._destroy = function (err, cb) {\n Duplex.prototype._destroy.call(this, err, function (err2) {\n cb(err2);\n });\n};\n\nfunction done(stream, er, data) {\n if (er) return stream.emit('error', er);\n if (data != null) // single equals check for both `null` and `undefined`\n stream.push(data); // TODO(BridgeAR): Write a test for these two error cases\n // if there's nothing in the write buffer, then that means\n // that nothing more will ever be provided\n\n if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();\n if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();\n return stream.push(null);\n}","'use strict';\n\nvar utils = exports;\n\nfunction toArray(msg, enc) {\n if (Array.isArray(msg))\n return msg.slice();\n if (!msg)\n return [];\n var res = [];\n if (typeof msg !== 'string') {\n for (var i = 0; i < msg.length; i++)\n res[i] = msg[i] | 0;\n return res;\n }\n if (enc === 'hex') {\n msg = msg.replace(/[^a-z0-9]+/ig, '');\n if (msg.length % 2 !== 0)\n msg = '0' + msg;\n for (var i = 0; i < msg.length; i += 2)\n res.push(parseInt(msg[i] + msg[i + 1], 16));\n } else {\n for (var i = 0; i < msg.length; i++) {\n var c = msg.charCodeAt(i);\n var hi = c >> 8;\n var lo = c & 0xff;\n if (hi)\n res.push(hi, lo);\n else\n res.push(lo);\n }\n }\n return res;\n}\nutils.toArray = toArray;\n\nfunction zero2(word) {\n if (word.length === 1)\n return '0' + word;\n else\n return word;\n}\nutils.zero2 = zero2;\n\nfunction toHex(msg) {\n var res = '';\n for (var i = 0; i < msg.length; i++)\n res += zero2(msg[i].toString(16));\n return res;\n}\nutils.toHex = toHex;\n\nutils.encode = function encode(arr, enc) {\n if (enc === 'hex')\n return toHex(arr);\n else\n return arr;\n};\n","'use strict';\n\nvar curve = exports;\n\ncurve.base = require('./base');\ncurve.short = require('./short');\ncurve.mont = require('./mont');\ncurve.edwards = require('./edwards');\n","'use strict';\n\nvar utils = require('../utils');\nvar rotr32 = utils.rotr32;\n\nfunction ft_1(s, x, y, z) {\n if (s === 0)\n return ch32(x, y, z);\n if (s === 1 || s === 3)\n return p32(x, y, z);\n if (s === 2)\n return maj32(x, y, z);\n}\nexports.ft_1 = ft_1;\n\nfunction ch32(x, y, z) {\n return (x & y) ^ ((~x) & z);\n}\nexports.ch32 = ch32;\n\nfunction maj32(x, y, z) {\n return (x & y) ^ (x & z) ^ (y & z);\n}\nexports.maj32 = maj32;\n\nfunction p32(x, y, z) {\n return x ^ y ^ z;\n}\nexports.p32 = p32;\n\nfunction s0_256(x) {\n return rotr32(x, 2) ^ rotr32(x, 13) ^ rotr32(x, 22);\n}\nexports.s0_256 = s0_256;\n\nfunction s1_256(x) {\n return rotr32(x, 6) ^ rotr32(x, 11) ^ rotr32(x, 25);\n}\nexports.s1_256 = s1_256;\n\nfunction g0_256(x) {\n return rotr32(x, 7) ^ rotr32(x, 18) ^ (x >>> 3);\n}\nexports.g0_256 = g0_256;\n\nfunction g1_256(x) {\n return rotr32(x, 17) ^ rotr32(x, 19) ^ (x >>> 10);\n}\nexports.g1_256 = g1_256;\n","'use strict';\n\nvar utils = require('../utils');\nvar common = require('../common');\nvar shaCommon = require('./common');\nvar assert = require('minimalistic-assert');\n\nvar sum32 = utils.sum32;\nvar sum32_4 = utils.sum32_4;\nvar sum32_5 = utils.sum32_5;\nvar ch32 = shaCommon.ch32;\nvar maj32 = shaCommon.maj32;\nvar s0_256 = shaCommon.s0_256;\nvar s1_256 = shaCommon.s1_256;\nvar g0_256 = shaCommon.g0_256;\nvar g1_256 = shaCommon.g1_256;\n\nvar BlockHash = common.BlockHash;\n\nvar sha256_K = [\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,\n 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,\n 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc,\n 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7,\n 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13,\n 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3,\n 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5,\n 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208,\n 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n];\n\nfunction SHA256() {\n if (!(this instanceof SHA256))\n return new SHA256();\n\n BlockHash.call(this);\n this.h = [\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a,\n 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19\n ];\n this.k = sha256_K;\n this.W = new Array(64);\n}\nutils.inherits(SHA256, BlockHash);\nmodule.exports = SHA256;\n\nSHA256.blockSize = 512;\nSHA256.outSize = 256;\nSHA256.hmacStrength = 192;\nSHA256.padLength = 64;\n\nSHA256.prototype._update = function _update(msg, start) {\n var W = this.W;\n\n for (var i = 0; i < 16; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i++)\n W[i] = sum32_4(g1_256(W[i - 2]), W[i - 7], g0_256(W[i - 15]), W[i - 16]);\n\n var a = this.h[0];\n var b = this.h[1];\n var c = this.h[2];\n var d = this.h[3];\n var e = this.h[4];\n var f = this.h[5];\n var g = this.h[6];\n var h = this.h[7];\n\n assert(this.k.length === W.length);\n for (i = 0; i < W.length; i++) {\n var T1 = sum32_5(h, s1_256(e), ch32(e, f, g), this.k[i], W[i]);\n var T2 = sum32(s0_256(a), maj32(a, b, c));\n h = g;\n g = f;\n f = e;\n e = sum32(d, T1);\n d = c;\n c = b;\n b = a;\n a = sum32(T1, T2);\n }\n\n this.h[0] = sum32(this.h[0], a);\n this.h[1] = sum32(this.h[1], b);\n this.h[2] = sum32(this.h[2], c);\n this.h[3] = sum32(this.h[3], d);\n this.h[4] = sum32(this.h[4], e);\n this.h[5] = sum32(this.h[5], f);\n this.h[6] = sum32(this.h[6], g);\n this.h[7] = sum32(this.h[7], h);\n};\n\nSHA256.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n","'use strict';\n\nvar utils = require('../utils');\nvar common = require('../common');\nvar assert = require('minimalistic-assert');\n\nvar rotr64_hi = utils.rotr64_hi;\nvar rotr64_lo = utils.rotr64_lo;\nvar shr64_hi = utils.shr64_hi;\nvar shr64_lo = utils.shr64_lo;\nvar sum64 = utils.sum64;\nvar sum64_hi = utils.sum64_hi;\nvar sum64_lo = utils.sum64_lo;\nvar sum64_4_hi = utils.sum64_4_hi;\nvar sum64_4_lo = utils.sum64_4_lo;\nvar sum64_5_hi = utils.sum64_5_hi;\nvar sum64_5_lo = utils.sum64_5_lo;\n\nvar BlockHash = common.BlockHash;\n\nvar sha512_K = [\n 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd,\n 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc,\n 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019,\n 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118,\n 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe,\n 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2,\n 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1,\n 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694,\n 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3,\n 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65,\n 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483,\n 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5,\n 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210,\n 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4,\n 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725,\n 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70,\n 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926,\n 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df,\n 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8,\n 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b,\n 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001,\n 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30,\n 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910,\n 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8,\n 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53,\n 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8,\n 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb,\n 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3,\n 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60,\n 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec,\n 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9,\n 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b,\n 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207,\n 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178,\n 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6,\n 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b,\n 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493,\n 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c,\n 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a,\n 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817\n];\n\nfunction SHA512() {\n if (!(this instanceof SHA512))\n return new SHA512();\n\n BlockHash.call(this);\n this.h = [\n 0x6a09e667, 0xf3bcc908,\n 0xbb67ae85, 0x84caa73b,\n 0x3c6ef372, 0xfe94f82b,\n 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1,\n 0x9b05688c, 0x2b3e6c1f,\n 0x1f83d9ab, 0xfb41bd6b,\n 0x5be0cd19, 0x137e2179 ];\n this.k = sha512_K;\n this.W = new Array(160);\n}\nutils.inherits(SHA512, BlockHash);\nmodule.exports = SHA512;\n\nSHA512.blockSize = 1024;\nSHA512.outSize = 512;\nSHA512.hmacStrength = 192;\nSHA512.padLength = 128;\n\nSHA512.prototype._prepareBlock = function _prepareBlock(msg, start) {\n var W = this.W;\n\n // 32 x 32bit words\n for (var i = 0; i < 32; i++)\n W[i] = msg[start + i];\n for (; i < W.length; i += 2) {\n var c0_hi = g1_512_hi(W[i - 4], W[i - 3]); // i - 2\n var c0_lo = g1_512_lo(W[i - 4], W[i - 3]);\n var c1_hi = W[i - 14]; // i - 7\n var c1_lo = W[i - 13];\n var c2_hi = g0_512_hi(W[i - 30], W[i - 29]); // i - 15\n var c2_lo = g0_512_lo(W[i - 30], W[i - 29]);\n var c3_hi = W[i - 32]; // i - 16\n var c3_lo = W[i - 31];\n\n W[i] = sum64_4_hi(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n W[i + 1] = sum64_4_lo(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo);\n }\n};\n\nSHA512.prototype._update = function _update(msg, start) {\n this._prepareBlock(msg, start);\n\n var W = this.W;\n\n var ah = this.h[0];\n var al = this.h[1];\n var bh = this.h[2];\n var bl = this.h[3];\n var ch = this.h[4];\n var cl = this.h[5];\n var dh = this.h[6];\n var dl = this.h[7];\n var eh = this.h[8];\n var el = this.h[9];\n var fh = this.h[10];\n var fl = this.h[11];\n var gh = this.h[12];\n var gl = this.h[13];\n var hh = this.h[14];\n var hl = this.h[15];\n\n assert(this.k.length === W.length);\n for (var i = 0; i < W.length; i += 2) {\n var c0_hi = hh;\n var c0_lo = hl;\n var c1_hi = s1_512_hi(eh, el);\n var c1_lo = s1_512_lo(eh, el);\n var c2_hi = ch64_hi(eh, el, fh, fl, gh, gl);\n var c2_lo = ch64_lo(eh, el, fh, fl, gh, gl);\n var c3_hi = this.k[i];\n var c3_lo = this.k[i + 1];\n var c4_hi = W[i];\n var c4_lo = W[i + 1];\n\n var T1_hi = sum64_5_hi(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n var T1_lo = sum64_5_lo(\n c0_hi, c0_lo,\n c1_hi, c1_lo,\n c2_hi, c2_lo,\n c3_hi, c3_lo,\n c4_hi, c4_lo);\n\n c0_hi = s0_512_hi(ah, al);\n c0_lo = s0_512_lo(ah, al);\n c1_hi = maj64_hi(ah, al, bh, bl, ch, cl);\n c1_lo = maj64_lo(ah, al, bh, bl, ch, cl);\n\n var T2_hi = sum64_hi(c0_hi, c0_lo, c1_hi, c1_lo);\n var T2_lo = sum64_lo(c0_hi, c0_lo, c1_hi, c1_lo);\n\n hh = gh;\n hl = gl;\n\n gh = fh;\n gl = fl;\n\n fh = eh;\n fl = el;\n\n eh = sum64_hi(dh, dl, T1_hi, T1_lo);\n el = sum64_lo(dl, dl, T1_hi, T1_lo);\n\n dh = ch;\n dl = cl;\n\n ch = bh;\n cl = bl;\n\n bh = ah;\n bl = al;\n\n ah = sum64_hi(T1_hi, T1_lo, T2_hi, T2_lo);\n al = sum64_lo(T1_hi, T1_lo, T2_hi, T2_lo);\n }\n\n sum64(this.h, 0, ah, al);\n sum64(this.h, 2, bh, bl);\n sum64(this.h, 4, ch, cl);\n sum64(this.h, 6, dh, dl);\n sum64(this.h, 8, eh, el);\n sum64(this.h, 10, fh, fl);\n sum64(this.h, 12, gh, gl);\n sum64(this.h, 14, hh, hl);\n};\n\nSHA512.prototype._digest = function digest(enc) {\n if (enc === 'hex')\n return utils.toHex32(this.h, 'big');\n else\n return utils.split32(this.h, 'big');\n};\n\nfunction ch64_hi(xh, xl, yh, yl, zh) {\n var r = (xh & yh) ^ ((~xh) & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction ch64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ ((~xl) & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_hi(xh, xl, yh, yl, zh) {\n var r = (xh & yh) ^ (xh & zh) ^ (yh & zh);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction maj64_lo(xh, xl, yh, yl, zh, zl) {\n var r = (xl & yl) ^ (xl & zl) ^ (yl & zl);\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 28);\n var c1_hi = rotr64_hi(xl, xh, 2); // 34\n var c2_hi = rotr64_hi(xl, xh, 7); // 39\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 28);\n var c1_lo = rotr64_lo(xl, xh, 2); // 34\n var c2_lo = rotr64_lo(xl, xh, 7); // 39\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 14);\n var c1_hi = rotr64_hi(xh, xl, 18);\n var c2_hi = rotr64_hi(xl, xh, 9); // 41\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction s1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 14);\n var c1_lo = rotr64_lo(xh, xl, 18);\n var c2_lo = rotr64_lo(xl, xh, 9); // 41\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 1);\n var c1_hi = rotr64_hi(xh, xl, 8);\n var c2_hi = shr64_hi(xh, xl, 7);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g0_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 1);\n var c1_lo = rotr64_lo(xh, xl, 8);\n var c2_lo = shr64_lo(xh, xl, 7);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_hi(xh, xl) {\n var c0_hi = rotr64_hi(xh, xl, 19);\n var c1_hi = rotr64_hi(xl, xh, 29); // 61\n var c2_hi = shr64_hi(xh, xl, 6);\n\n var r = c0_hi ^ c1_hi ^ c2_hi;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n\nfunction g1_512_lo(xh, xl) {\n var c0_lo = rotr64_lo(xh, xl, 19);\n var c1_lo = rotr64_lo(xl, xh, 29); // 61\n var c2_lo = shr64_lo(xh, xl, 6);\n\n var r = c0_lo ^ c1_lo ^ c2_lo;\n if (r < 0)\n r += 0x100000000;\n return r;\n}\n","(function (module, exports) {\n 'use strict';\n\n // Utils\n function assert (val, msg) {\n if (!val) throw new Error(msg || 'Assertion failed');\n }\n\n // Could use `inherits` module, but don't want to move from single file\n // architecture yet.\n function inherits (ctor, superCtor) {\n ctor.super_ = superCtor;\n var TempCtor = function () {};\n TempCtor.prototype = superCtor.prototype;\n ctor.prototype = new TempCtor();\n ctor.prototype.constructor = ctor;\n }\n\n // BN\n\n function BN (number, base, endian) {\n if (BN.isBN(number)) {\n return number;\n }\n\n this.negative = 0;\n this.words = null;\n this.length = 0;\n\n // Reduction context\n this.red = null;\n\n if (number !== null) {\n if (base === 'le' || base === 'be') {\n endian = base;\n base = 10;\n }\n\n this._init(number || 0, base || 10, endian || 'be');\n }\n }\n if (typeof module === 'object') {\n module.exports = BN;\n } else {\n exports.BN = BN;\n }\n\n BN.BN = BN;\n BN.wordSize = 26;\n\n var Buffer;\n try {\n if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {\n Buffer = window.Buffer;\n } else {\n Buffer = require('buffer').Buffer;\n }\n } catch (e) {\n }\n\n BN.isBN = function isBN (num) {\n if (num instanceof BN) {\n return true;\n }\n\n return num !== null && typeof num === 'object' &&\n num.constructor.wordSize === BN.wordSize && Array.isArray(num.words);\n };\n\n BN.max = function max (left, right) {\n if (left.cmp(right) > 0) return left;\n return right;\n };\n\n BN.min = function min (left, right) {\n if (left.cmp(right) < 0) return left;\n return right;\n };\n\n BN.prototype._init = function init (number, base, endian) {\n if (typeof number === 'number') {\n return this._initNumber(number, base, endian);\n }\n\n if (typeof number === 'object') {\n return this._initArray(number, base, endian);\n }\n\n if (base === 'hex') {\n base = 16;\n }\n assert(base === (base | 0) && base >= 2 && base <= 36);\n\n number = number.toString().replace(/\\s+/g, '');\n var start = 0;\n if (number[0] === '-') {\n start++;\n this.negative = 1;\n }\n\n if (start < number.length) {\n if (base === 16) {\n this._parseHex(number, start, endian);\n } else {\n this._parseBase(number, base, start);\n if (endian === 'le') {\n this._initArray(this.toArray(), base, endian);\n }\n }\n }\n };\n\n BN.prototype._initNumber = function _initNumber (number, base, endian) {\n if (number < 0) {\n this.negative = 1;\n number = -number;\n }\n if (number < 0x4000000) {\n this.words = [number & 0x3ffffff];\n this.length = 1;\n } else if (number < 0x10000000000000) {\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff\n ];\n this.length = 2;\n } else {\n assert(number < 0x20000000000000); // 2 ^ 53 (unsafe)\n this.words = [\n number & 0x3ffffff,\n (number / 0x4000000) & 0x3ffffff,\n 1\n ];\n this.length = 3;\n }\n\n if (endian !== 'le') return;\n\n // Reverse the bytes\n this._initArray(this.toArray(), base, endian);\n };\n\n BN.prototype._initArray = function _initArray (number, base, endian) {\n // Perhaps a Uint8Array\n assert(typeof number.length === 'number');\n if (number.length <= 0) {\n this.words = [0];\n this.length = 1;\n return this;\n }\n\n this.length = Math.ceil(number.length / 3);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n var j, w;\n var off = 0;\n if (endian === 'be') {\n for (i = number.length - 1, j = 0; i >= 0; i -= 3) {\n w = number[i] | (number[i - 1] << 8) | (number[i - 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n } else if (endian === 'le') {\n for (i = 0, j = 0; i < number.length; i += 3) {\n w = number[i] | (number[i + 1] << 8) | (number[i + 2] << 16);\n this.words[j] |= (w << off) & 0x3ffffff;\n this.words[j + 1] = (w >>> (26 - off)) & 0x3ffffff;\n off += 24;\n if (off >= 26) {\n off -= 26;\n j++;\n }\n }\n }\n return this._strip();\n };\n\n function parseHex4Bits (string, index) {\n var c = string.charCodeAt(index);\n // '0' - '9'\n if (c >= 48 && c <= 57) {\n return c - 48;\n // 'A' - 'F'\n } else if (c >= 65 && c <= 70) {\n return c - 55;\n // 'a' - 'f'\n } else if (c >= 97 && c <= 102) {\n return c - 87;\n } else {\n assert(false, 'Invalid character in ' + string);\n }\n }\n\n function parseHexByte (string, lowerBound, index) {\n var r = parseHex4Bits(string, index);\n if (index - 1 >= lowerBound) {\n r |= parseHex4Bits(string, index - 1) << 4;\n }\n return r;\n }\n\n BN.prototype._parseHex = function _parseHex (number, start, endian) {\n // Create possibly bigger array to ensure that it fits the number\n this.length = Math.ceil((number.length - start) / 6);\n this.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n this.words[i] = 0;\n }\n\n // 24-bits chunks\n var off = 0;\n var j = 0;\n\n var w;\n if (endian === 'be') {\n for (i = number.length - 1; i >= start; i -= 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n } else {\n var parseLength = number.length - start;\n for (i = parseLength % 2 === 0 ? start + 1 : start; i < number.length; i += 2) {\n w = parseHexByte(number, start, i) << off;\n this.words[j] |= w & 0x3ffffff;\n if (off >= 18) {\n off -= 18;\n j += 1;\n this.words[j] |= w >>> 26;\n } else {\n off += 8;\n }\n }\n }\n\n this._strip();\n };\n\n function parseBase (str, start, end, mul) {\n var r = 0;\n var b = 0;\n var len = Math.min(str.length, end);\n for (var i = start; i < len; i++) {\n var c = str.charCodeAt(i) - 48;\n\n r *= mul;\n\n // 'a'\n if (c >= 49) {\n b = c - 49 + 0xa;\n\n // 'A'\n } else if (c >= 17) {\n b = c - 17 + 0xa;\n\n // '0' - '9'\n } else {\n b = c;\n }\n assert(c >= 0 && b < mul, 'Invalid character');\n r += b;\n }\n return r;\n }\n\n BN.prototype._parseBase = function _parseBase (number, base, start) {\n // Initialize as zero\n this.words = [0];\n this.length = 1;\n\n // Find length of limb in base\n for (var limbLen = 0, limbPow = 1; limbPow <= 0x3ffffff; limbPow *= base) {\n limbLen++;\n }\n limbLen--;\n limbPow = (limbPow / base) | 0;\n\n var total = number.length - start;\n var mod = total % limbLen;\n var end = Math.min(total, total - mod) + start;\n\n var word = 0;\n for (var i = start; i < end; i += limbLen) {\n word = parseBase(number, i, i + limbLen, base);\n\n this.imuln(limbPow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n if (mod !== 0) {\n var pow = 1;\n word = parseBase(number, i, number.length, base);\n\n for (i = 0; i < mod; i++) {\n pow *= base;\n }\n\n this.imuln(pow);\n if (this.words[0] + word < 0x4000000) {\n this.words[0] += word;\n } else {\n this._iaddn(word);\n }\n }\n\n this._strip();\n };\n\n BN.prototype.copy = function copy (dest) {\n dest.words = new Array(this.length);\n for (var i = 0; i < this.length; i++) {\n dest.words[i] = this.words[i];\n }\n dest.length = this.length;\n dest.negative = this.negative;\n dest.red = this.red;\n };\n\n function move (dest, src) {\n dest.words = src.words;\n dest.length = src.length;\n dest.negative = src.negative;\n dest.red = src.red;\n }\n\n BN.prototype._move = function _move (dest) {\n move(dest, this);\n };\n\n BN.prototype.clone = function clone () {\n var r = new BN(null);\n this.copy(r);\n return r;\n };\n\n BN.prototype._expand = function _expand (size) {\n while (this.length < size) {\n this.words[this.length++] = 0;\n }\n return this;\n };\n\n // Remove leading `0` from `this`\n BN.prototype._strip = function strip () {\n while (this.length > 1 && this.words[this.length - 1] === 0) {\n this.length--;\n }\n return this._normSign();\n };\n\n BN.prototype._normSign = function _normSign () {\n // -0 = 0\n if (this.length === 1 && this.words[0] === 0) {\n this.negative = 0;\n }\n return this;\n };\n\n // Check Symbol.for because not everywhere where Symbol defined\n // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol#Browser_compatibility\n if (typeof Symbol !== 'undefined' && typeof Symbol.for === 'function') {\n try {\n BN.prototype[Symbol.for('nodejs.util.inspect.custom')] = inspect;\n } catch (e) {\n BN.prototype.inspect = inspect;\n }\n } else {\n BN.prototype.inspect = inspect;\n }\n\n function inspect () {\n return (this.red ? '';\n }\n\n /*\n\n var zeros = [];\n var groupSizes = [];\n var groupBases = [];\n\n var s = '';\n var i = -1;\n while (++i < BN.wordSize) {\n zeros[i] = s;\n s += '0';\n }\n groupSizes[0] = 0;\n groupSizes[1] = 0;\n groupBases[0] = 0;\n groupBases[1] = 0;\n var base = 2 - 1;\n while (++base < 36 + 1) {\n var groupSize = 0;\n var groupBase = 1;\n while (groupBase < (1 << BN.wordSize) / base) {\n groupBase *= base;\n groupSize += 1;\n }\n groupSizes[base] = groupSize;\n groupBases[base] = groupBase;\n }\n\n */\n\n var zeros = [\n '',\n '0',\n '00',\n '000',\n '0000',\n '00000',\n '000000',\n '0000000',\n '00000000',\n '000000000',\n '0000000000',\n '00000000000',\n '000000000000',\n '0000000000000',\n '00000000000000',\n '000000000000000',\n '0000000000000000',\n '00000000000000000',\n '000000000000000000',\n '0000000000000000000',\n '00000000000000000000',\n '000000000000000000000',\n '0000000000000000000000',\n '00000000000000000000000',\n '000000000000000000000000',\n '0000000000000000000000000'\n ];\n\n var groupSizes = [\n 0, 0,\n 25, 16, 12, 11, 10, 9, 8,\n 8, 7, 7, 7, 7, 6, 6,\n 6, 6, 6, 6, 6, 5, 5,\n 5, 5, 5, 5, 5, 5, 5,\n 5, 5, 5, 5, 5, 5, 5\n ];\n\n var groupBases = [\n 0, 0,\n 33554432, 43046721, 16777216, 48828125, 60466176, 40353607, 16777216,\n 43046721, 10000000, 19487171, 35831808, 62748517, 7529536, 11390625,\n 16777216, 24137569, 34012224, 47045881, 64000000, 4084101, 5153632,\n 6436343, 7962624, 9765625, 11881376, 14348907, 17210368, 20511149,\n 24300000, 28629151, 33554432, 39135393, 45435424, 52521875, 60466176\n ];\n\n BN.prototype.toString = function toString (base, padding) {\n base = base || 10;\n padding = padding | 0 || 1;\n\n var out;\n if (base === 16 || base === 'hex') {\n out = '';\n var off = 0;\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = this.words[i];\n var word = (((w << off) | carry) & 0xffffff).toString(16);\n carry = (w >>> (24 - off)) & 0xffffff;\n if (carry !== 0 || i !== this.length - 1) {\n out = zeros[6 - word.length] + word + out;\n } else {\n out = word + out;\n }\n off += 2;\n if (off >= 26) {\n off -= 26;\n i--;\n }\n }\n if (carry !== 0) {\n out = carry.toString(16) + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n if (base === (base | 0) && base >= 2 && base <= 36) {\n // var groupSize = Math.floor(BN.wordSize * Math.LN2 / Math.log(base));\n var groupSize = groupSizes[base];\n // var groupBase = Math.pow(base, groupSize);\n var groupBase = groupBases[base];\n out = '';\n var c = this.clone();\n c.negative = 0;\n while (!c.isZero()) {\n var r = c.modrn(groupBase).toString(base);\n c = c.idivn(groupBase);\n\n if (!c.isZero()) {\n out = zeros[groupSize - r.length] + r + out;\n } else {\n out = r + out;\n }\n }\n if (this.isZero()) {\n out = '0' + out;\n }\n while (out.length % padding !== 0) {\n out = '0' + out;\n }\n if (this.negative !== 0) {\n out = '-' + out;\n }\n return out;\n }\n\n assert(false, 'Base should be between 2 and 36');\n };\n\n BN.prototype.toNumber = function toNumber () {\n var ret = this.words[0];\n if (this.length === 2) {\n ret += this.words[1] * 0x4000000;\n } else if (this.length === 3 && this.words[2] === 0x01) {\n // NOTE: at this stage it is known that the top bit is set\n ret += 0x10000000000000 + (this.words[1] * 0x4000000);\n } else if (this.length > 2) {\n assert(false, 'Number can only safely store up to 53 bits');\n }\n return (this.negative !== 0) ? -ret : ret;\n };\n\n BN.prototype.toJSON = function toJSON () {\n return this.toString(16, 2);\n };\n\n if (Buffer) {\n BN.prototype.toBuffer = function toBuffer (endian, length) {\n return this.toArrayLike(Buffer, endian, length);\n };\n }\n\n BN.prototype.toArray = function toArray (endian, length) {\n return this.toArrayLike(Array, endian, length);\n };\n\n var allocate = function allocate (ArrayType, size) {\n if (ArrayType.allocUnsafe) {\n return ArrayType.allocUnsafe(size);\n }\n return new ArrayType(size);\n };\n\n BN.prototype.toArrayLike = function toArrayLike (ArrayType, endian, length) {\n this._strip();\n\n var byteLength = this.byteLength();\n var reqLength = length || Math.max(1, byteLength);\n assert(byteLength <= reqLength, 'byte array longer than desired length');\n assert(reqLength > 0, 'Requested array length <= 0');\n\n var res = allocate(ArrayType, reqLength);\n var postfix = endian === 'le' ? 'LE' : 'BE';\n this['_toArrayLike' + postfix](res, byteLength);\n return res;\n };\n\n BN.prototype._toArrayLikeLE = function _toArrayLikeLE (res, byteLength) {\n var position = 0;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position++] = word & 0xff;\n if (position < res.length) {\n res[position++] = (word >> 8) & 0xff;\n }\n if (position < res.length) {\n res[position++] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position < res.length) {\n res[position++] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position < res.length) {\n res[position++] = carry;\n\n while (position < res.length) {\n res[position++] = 0;\n }\n }\n };\n\n BN.prototype._toArrayLikeBE = function _toArrayLikeBE (res, byteLength) {\n var position = res.length - 1;\n var carry = 0;\n\n for (var i = 0, shift = 0; i < this.length; i++) {\n var word = (this.words[i] << shift) | carry;\n\n res[position--] = word & 0xff;\n if (position >= 0) {\n res[position--] = (word >> 8) & 0xff;\n }\n if (position >= 0) {\n res[position--] = (word >> 16) & 0xff;\n }\n\n if (shift === 6) {\n if (position >= 0) {\n res[position--] = (word >> 24) & 0xff;\n }\n carry = 0;\n shift = 0;\n } else {\n carry = word >>> 24;\n shift += 2;\n }\n }\n\n if (position >= 0) {\n res[position--] = carry;\n\n while (position >= 0) {\n res[position--] = 0;\n }\n }\n };\n\n if (Math.clz32) {\n BN.prototype._countBits = function _countBits (w) {\n return 32 - Math.clz32(w);\n };\n } else {\n BN.prototype._countBits = function _countBits (w) {\n var t = w;\n var r = 0;\n if (t >= 0x1000) {\n r += 13;\n t >>>= 13;\n }\n if (t >= 0x40) {\n r += 7;\n t >>>= 7;\n }\n if (t >= 0x8) {\n r += 4;\n t >>>= 4;\n }\n if (t >= 0x02) {\n r += 2;\n t >>>= 2;\n }\n return r + t;\n };\n }\n\n BN.prototype._zeroBits = function _zeroBits (w) {\n // Short-cut\n if (w === 0) return 26;\n\n var t = w;\n var r = 0;\n if ((t & 0x1fff) === 0) {\n r += 13;\n t >>>= 13;\n }\n if ((t & 0x7f) === 0) {\n r += 7;\n t >>>= 7;\n }\n if ((t & 0xf) === 0) {\n r += 4;\n t >>>= 4;\n }\n if ((t & 0x3) === 0) {\n r += 2;\n t >>>= 2;\n }\n if ((t & 0x1) === 0) {\n r++;\n }\n return r;\n };\n\n // Return number of used bits in a BN\n BN.prototype.bitLength = function bitLength () {\n var w = this.words[this.length - 1];\n var hi = this._countBits(w);\n return (this.length - 1) * 26 + hi;\n };\n\n function toBitArray (num) {\n var w = new Array(num.bitLength());\n\n for (var bit = 0; bit < w.length; bit++) {\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n w[bit] = (num.words[off] >>> wbit) & 0x01;\n }\n\n return w;\n }\n\n // Number of trailing zero bits\n BN.prototype.zeroBits = function zeroBits () {\n if (this.isZero()) return 0;\n\n var r = 0;\n for (var i = 0; i < this.length; i++) {\n var b = this._zeroBits(this.words[i]);\n r += b;\n if (b !== 26) break;\n }\n return r;\n };\n\n BN.prototype.byteLength = function byteLength () {\n return Math.ceil(this.bitLength() / 8);\n };\n\n BN.prototype.toTwos = function toTwos (width) {\n if (this.negative !== 0) {\n return this.abs().inotn(width).iaddn(1);\n }\n return this.clone();\n };\n\n BN.prototype.fromTwos = function fromTwos (width) {\n if (this.testn(width - 1)) {\n return this.notn(width).iaddn(1).ineg();\n }\n return this.clone();\n };\n\n BN.prototype.isNeg = function isNeg () {\n return this.negative !== 0;\n };\n\n // Return negative clone of `this`\n BN.prototype.neg = function neg () {\n return this.clone().ineg();\n };\n\n BN.prototype.ineg = function ineg () {\n if (!this.isZero()) {\n this.negative ^= 1;\n }\n\n return this;\n };\n\n // Or `num` with `this` in-place\n BN.prototype.iuor = function iuor (num) {\n while (this.length < num.length) {\n this.words[this.length++] = 0;\n }\n\n for (var i = 0; i < num.length; i++) {\n this.words[i] = this.words[i] | num.words[i];\n }\n\n return this._strip();\n };\n\n BN.prototype.ior = function ior (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuor(num);\n };\n\n // Or `num` with `this`\n BN.prototype.or = function or (num) {\n if (this.length > num.length) return this.clone().ior(num);\n return num.clone().ior(this);\n };\n\n BN.prototype.uor = function uor (num) {\n if (this.length > num.length) return this.clone().iuor(num);\n return num.clone().iuor(this);\n };\n\n // And `num` with `this` in-place\n BN.prototype.iuand = function iuand (num) {\n // b = min-length(num, this)\n var b;\n if (this.length > num.length) {\n b = num;\n } else {\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = this.words[i] & num.words[i];\n }\n\n this.length = b.length;\n\n return this._strip();\n };\n\n BN.prototype.iand = function iand (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuand(num);\n };\n\n // And `num` with `this`\n BN.prototype.and = function and (num) {\n if (this.length > num.length) return this.clone().iand(num);\n return num.clone().iand(this);\n };\n\n BN.prototype.uand = function uand (num) {\n if (this.length > num.length) return this.clone().iuand(num);\n return num.clone().iuand(this);\n };\n\n // Xor `num` with `this` in-place\n BN.prototype.iuxor = function iuxor (num) {\n // a.length > b.length\n var a;\n var b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n for (var i = 0; i < b.length; i++) {\n this.words[i] = a.words[i] ^ b.words[i];\n }\n\n if (this !== a) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = a.length;\n\n return this._strip();\n };\n\n BN.prototype.ixor = function ixor (num) {\n assert((this.negative | num.negative) === 0);\n return this.iuxor(num);\n };\n\n // Xor `num` with `this`\n BN.prototype.xor = function xor (num) {\n if (this.length > num.length) return this.clone().ixor(num);\n return num.clone().ixor(this);\n };\n\n BN.prototype.uxor = function uxor (num) {\n if (this.length > num.length) return this.clone().iuxor(num);\n return num.clone().iuxor(this);\n };\n\n // Not ``this`` with ``width`` bitwidth\n BN.prototype.inotn = function inotn (width) {\n assert(typeof width === 'number' && width >= 0);\n\n var bytesNeeded = Math.ceil(width / 26) | 0;\n var bitsLeft = width % 26;\n\n // Extend the buffer with leading zeroes\n this._expand(bytesNeeded);\n\n if (bitsLeft > 0) {\n bytesNeeded--;\n }\n\n // Handle complete words\n for (var i = 0; i < bytesNeeded; i++) {\n this.words[i] = ~this.words[i] & 0x3ffffff;\n }\n\n // Handle the residue\n if (bitsLeft > 0) {\n this.words[i] = ~this.words[i] & (0x3ffffff >> (26 - bitsLeft));\n }\n\n // And remove leading zeroes\n return this._strip();\n };\n\n BN.prototype.notn = function notn (width) {\n return this.clone().inotn(width);\n };\n\n // Set `bit` of `this`\n BN.prototype.setn = function setn (bit, val) {\n assert(typeof bit === 'number' && bit >= 0);\n\n var off = (bit / 26) | 0;\n var wbit = bit % 26;\n\n this._expand(off + 1);\n\n if (val) {\n this.words[off] = this.words[off] | (1 << wbit);\n } else {\n this.words[off] = this.words[off] & ~(1 << wbit);\n }\n\n return this._strip();\n };\n\n // Add `num` to `this` in-place\n BN.prototype.iadd = function iadd (num) {\n var r;\n\n // negative + positive\n if (this.negative !== 0 && num.negative === 0) {\n this.negative = 0;\n r = this.isub(num);\n this.negative ^= 1;\n return this._normSign();\n\n // positive + negative\n } else if (this.negative === 0 && num.negative !== 0) {\n num.negative = 0;\n r = this.isub(num);\n num.negative = 1;\n return r._normSign();\n }\n\n // a.length > b.length\n var a, b;\n if (this.length > num.length) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) + (b.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n this.words[i] = r & 0x3ffffff;\n carry = r >>> 26;\n }\n\n this.length = a.length;\n if (carry !== 0) {\n this.words[this.length] = carry;\n this.length++;\n // Copy the rest of the words\n } else if (a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n return this;\n };\n\n // Add `num` to `this`\n BN.prototype.add = function add (num) {\n var res;\n if (num.negative !== 0 && this.negative === 0) {\n num.negative = 0;\n res = this.sub(num);\n num.negative ^= 1;\n return res;\n } else if (num.negative === 0 && this.negative !== 0) {\n this.negative = 0;\n res = num.sub(this);\n this.negative = 1;\n return res;\n }\n\n if (this.length > num.length) return this.clone().iadd(num);\n\n return num.clone().iadd(this);\n };\n\n // Subtract `num` from `this` in-place\n BN.prototype.isub = function isub (num) {\n // this - (-num) = this + num\n if (num.negative !== 0) {\n num.negative = 0;\n var r = this.iadd(num);\n num.negative = 1;\n return r._normSign();\n\n // -this - num = -(this + num)\n } else if (this.negative !== 0) {\n this.negative = 0;\n this.iadd(num);\n this.negative = 1;\n return this._normSign();\n }\n\n // At this point both numbers are positive\n var cmp = this.cmp(num);\n\n // Optimization - zeroify\n if (cmp === 0) {\n this.negative = 0;\n this.length = 1;\n this.words[0] = 0;\n return this;\n }\n\n // a > b\n var a, b;\n if (cmp > 0) {\n a = this;\n b = num;\n } else {\n a = num;\n b = this;\n }\n\n var carry = 0;\n for (var i = 0; i < b.length; i++) {\n r = (a.words[i] | 0) - (b.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n for (; carry !== 0 && i < a.length; i++) {\n r = (a.words[i] | 0) + carry;\n carry = r >> 26;\n this.words[i] = r & 0x3ffffff;\n }\n\n // Copy rest of the words\n if (carry === 0 && i < a.length && a !== this) {\n for (; i < a.length; i++) {\n this.words[i] = a.words[i];\n }\n }\n\n this.length = Math.max(this.length, i);\n\n if (a !== this) {\n this.negative = 1;\n }\n\n return this._strip();\n };\n\n // Subtract `num` from `this`\n BN.prototype.sub = function sub (num) {\n return this.clone().isub(num);\n };\n\n function smallMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n var len = (self.length + num.length) | 0;\n out.length = len;\n len = (len - 1) | 0;\n\n // Peel one iteration (compiler can't do it, because of code complexity)\n var a = self.words[0] | 0;\n var b = num.words[0] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n var carry = (r / 0x4000000) | 0;\n out.words[0] = lo;\n\n for (var k = 1; k < len; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = carry >>> 26;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = (k - j) | 0;\n a = self.words[i] | 0;\n b = num.words[j] | 0;\n r = a * b + rword;\n ncarry += (r / 0x4000000) | 0;\n rword = r & 0x3ffffff;\n }\n out.words[k] = rword | 0;\n carry = ncarry | 0;\n }\n if (carry !== 0) {\n out.words[k] = carry | 0;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n // TODO(indutny): it may be reasonable to omit it for users who don't need\n // to work with 256-bit numbers, otherwise it gives 20% improvement for 256-bit\n // multiplication (like elliptic secp256k1).\n var comb10MulTo = function comb10MulTo (self, num, out) {\n var a = self.words;\n var b = num.words;\n var o = out.words;\n var c = 0;\n var lo;\n var mid;\n var hi;\n var a0 = a[0] | 0;\n var al0 = a0 & 0x1fff;\n var ah0 = a0 >>> 13;\n var a1 = a[1] | 0;\n var al1 = a1 & 0x1fff;\n var ah1 = a1 >>> 13;\n var a2 = a[2] | 0;\n var al2 = a2 & 0x1fff;\n var ah2 = a2 >>> 13;\n var a3 = a[3] | 0;\n var al3 = a3 & 0x1fff;\n var ah3 = a3 >>> 13;\n var a4 = a[4] | 0;\n var al4 = a4 & 0x1fff;\n var ah4 = a4 >>> 13;\n var a5 = a[5] | 0;\n var al5 = a5 & 0x1fff;\n var ah5 = a5 >>> 13;\n var a6 = a[6] | 0;\n var al6 = a6 & 0x1fff;\n var ah6 = a6 >>> 13;\n var a7 = a[7] | 0;\n var al7 = a7 & 0x1fff;\n var ah7 = a7 >>> 13;\n var a8 = a[8] | 0;\n var al8 = a8 & 0x1fff;\n var ah8 = a8 >>> 13;\n var a9 = a[9] | 0;\n var al9 = a9 & 0x1fff;\n var ah9 = a9 >>> 13;\n var b0 = b[0] | 0;\n var bl0 = b0 & 0x1fff;\n var bh0 = b0 >>> 13;\n var b1 = b[1] | 0;\n var bl1 = b1 & 0x1fff;\n var bh1 = b1 >>> 13;\n var b2 = b[2] | 0;\n var bl2 = b2 & 0x1fff;\n var bh2 = b2 >>> 13;\n var b3 = b[3] | 0;\n var bl3 = b3 & 0x1fff;\n var bh3 = b3 >>> 13;\n var b4 = b[4] | 0;\n var bl4 = b4 & 0x1fff;\n var bh4 = b4 >>> 13;\n var b5 = b[5] | 0;\n var bl5 = b5 & 0x1fff;\n var bh5 = b5 >>> 13;\n var b6 = b[6] | 0;\n var bl6 = b6 & 0x1fff;\n var bh6 = b6 >>> 13;\n var b7 = b[7] | 0;\n var bl7 = b7 & 0x1fff;\n var bh7 = b7 >>> 13;\n var b8 = b[8] | 0;\n var bl8 = b8 & 0x1fff;\n var bh8 = b8 >>> 13;\n var b9 = b[9] | 0;\n var bl9 = b9 & 0x1fff;\n var bh9 = b9 >>> 13;\n\n out.negative = self.negative ^ num.negative;\n out.length = 19;\n /* k = 0 */\n lo = Math.imul(al0, bl0);\n mid = Math.imul(al0, bh0);\n mid = (mid + Math.imul(ah0, bl0)) | 0;\n hi = Math.imul(ah0, bh0);\n var w0 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w0 >>> 26)) | 0;\n w0 &= 0x3ffffff;\n /* k = 1 */\n lo = Math.imul(al1, bl0);\n mid = Math.imul(al1, bh0);\n mid = (mid + Math.imul(ah1, bl0)) | 0;\n hi = Math.imul(ah1, bh0);\n lo = (lo + Math.imul(al0, bl1)) | 0;\n mid = (mid + Math.imul(al0, bh1)) | 0;\n mid = (mid + Math.imul(ah0, bl1)) | 0;\n hi = (hi + Math.imul(ah0, bh1)) | 0;\n var w1 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w1 >>> 26)) | 0;\n w1 &= 0x3ffffff;\n /* k = 2 */\n lo = Math.imul(al2, bl0);\n mid = Math.imul(al2, bh0);\n mid = (mid + Math.imul(ah2, bl0)) | 0;\n hi = Math.imul(ah2, bh0);\n lo = (lo + Math.imul(al1, bl1)) | 0;\n mid = (mid + Math.imul(al1, bh1)) | 0;\n mid = (mid + Math.imul(ah1, bl1)) | 0;\n hi = (hi + Math.imul(ah1, bh1)) | 0;\n lo = (lo + Math.imul(al0, bl2)) | 0;\n mid = (mid + Math.imul(al0, bh2)) | 0;\n mid = (mid + Math.imul(ah0, bl2)) | 0;\n hi = (hi + Math.imul(ah0, bh2)) | 0;\n var w2 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w2 >>> 26)) | 0;\n w2 &= 0x3ffffff;\n /* k = 3 */\n lo = Math.imul(al3, bl0);\n mid = Math.imul(al3, bh0);\n mid = (mid + Math.imul(ah3, bl0)) | 0;\n hi = Math.imul(ah3, bh0);\n lo = (lo + Math.imul(al2, bl1)) | 0;\n mid = (mid + Math.imul(al2, bh1)) | 0;\n mid = (mid + Math.imul(ah2, bl1)) | 0;\n hi = (hi + Math.imul(ah2, bh1)) | 0;\n lo = (lo + Math.imul(al1, bl2)) | 0;\n mid = (mid + Math.imul(al1, bh2)) | 0;\n mid = (mid + Math.imul(ah1, bl2)) | 0;\n hi = (hi + Math.imul(ah1, bh2)) | 0;\n lo = (lo + Math.imul(al0, bl3)) | 0;\n mid = (mid + Math.imul(al0, bh3)) | 0;\n mid = (mid + Math.imul(ah0, bl3)) | 0;\n hi = (hi + Math.imul(ah0, bh3)) | 0;\n var w3 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w3 >>> 26)) | 0;\n w3 &= 0x3ffffff;\n /* k = 4 */\n lo = Math.imul(al4, bl0);\n mid = Math.imul(al4, bh0);\n mid = (mid + Math.imul(ah4, bl0)) | 0;\n hi = Math.imul(ah4, bh0);\n lo = (lo + Math.imul(al3, bl1)) | 0;\n mid = (mid + Math.imul(al3, bh1)) | 0;\n mid = (mid + Math.imul(ah3, bl1)) | 0;\n hi = (hi + Math.imul(ah3, bh1)) | 0;\n lo = (lo + Math.imul(al2, bl2)) | 0;\n mid = (mid + Math.imul(al2, bh2)) | 0;\n mid = (mid + Math.imul(ah2, bl2)) | 0;\n hi = (hi + Math.imul(ah2, bh2)) | 0;\n lo = (lo + Math.imul(al1, bl3)) | 0;\n mid = (mid + Math.imul(al1, bh3)) | 0;\n mid = (mid + Math.imul(ah1, bl3)) | 0;\n hi = (hi + Math.imul(ah1, bh3)) | 0;\n lo = (lo + Math.imul(al0, bl4)) | 0;\n mid = (mid + Math.imul(al0, bh4)) | 0;\n mid = (mid + Math.imul(ah0, bl4)) | 0;\n hi = (hi + Math.imul(ah0, bh4)) | 0;\n var w4 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w4 >>> 26)) | 0;\n w4 &= 0x3ffffff;\n /* k = 5 */\n lo = Math.imul(al5, bl0);\n mid = Math.imul(al5, bh0);\n mid = (mid + Math.imul(ah5, bl0)) | 0;\n hi = Math.imul(ah5, bh0);\n lo = (lo + Math.imul(al4, bl1)) | 0;\n mid = (mid + Math.imul(al4, bh1)) | 0;\n mid = (mid + Math.imul(ah4, bl1)) | 0;\n hi = (hi + Math.imul(ah4, bh1)) | 0;\n lo = (lo + Math.imul(al3, bl2)) | 0;\n mid = (mid + Math.imul(al3, bh2)) | 0;\n mid = (mid + Math.imul(ah3, bl2)) | 0;\n hi = (hi + Math.imul(ah3, bh2)) | 0;\n lo = (lo + Math.imul(al2, bl3)) | 0;\n mid = (mid + Math.imul(al2, bh3)) | 0;\n mid = (mid + Math.imul(ah2, bl3)) | 0;\n hi = (hi + Math.imul(ah2, bh3)) | 0;\n lo = (lo + Math.imul(al1, bl4)) | 0;\n mid = (mid + Math.imul(al1, bh4)) | 0;\n mid = (mid + Math.imul(ah1, bl4)) | 0;\n hi = (hi + Math.imul(ah1, bh4)) | 0;\n lo = (lo + Math.imul(al0, bl5)) | 0;\n mid = (mid + Math.imul(al0, bh5)) | 0;\n mid = (mid + Math.imul(ah0, bl5)) | 0;\n hi = (hi + Math.imul(ah0, bh5)) | 0;\n var w5 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w5 >>> 26)) | 0;\n w5 &= 0x3ffffff;\n /* k = 6 */\n lo = Math.imul(al6, bl0);\n mid = Math.imul(al6, bh0);\n mid = (mid + Math.imul(ah6, bl0)) | 0;\n hi = Math.imul(ah6, bh0);\n lo = (lo + Math.imul(al5, bl1)) | 0;\n mid = (mid + Math.imul(al5, bh1)) | 0;\n mid = (mid + Math.imul(ah5, bl1)) | 0;\n hi = (hi + Math.imul(ah5, bh1)) | 0;\n lo = (lo + Math.imul(al4, bl2)) | 0;\n mid = (mid + Math.imul(al4, bh2)) | 0;\n mid = (mid + Math.imul(ah4, bl2)) | 0;\n hi = (hi + Math.imul(ah4, bh2)) | 0;\n lo = (lo + Math.imul(al3, bl3)) | 0;\n mid = (mid + Math.imul(al3, bh3)) | 0;\n mid = (mid + Math.imul(ah3, bl3)) | 0;\n hi = (hi + Math.imul(ah3, bh3)) | 0;\n lo = (lo + Math.imul(al2, bl4)) | 0;\n mid = (mid + Math.imul(al2, bh4)) | 0;\n mid = (mid + Math.imul(ah2, bl4)) | 0;\n hi = (hi + Math.imul(ah2, bh4)) | 0;\n lo = (lo + Math.imul(al1, bl5)) | 0;\n mid = (mid + Math.imul(al1, bh5)) | 0;\n mid = (mid + Math.imul(ah1, bl5)) | 0;\n hi = (hi + Math.imul(ah1, bh5)) | 0;\n lo = (lo + Math.imul(al0, bl6)) | 0;\n mid = (mid + Math.imul(al0, bh6)) | 0;\n mid = (mid + Math.imul(ah0, bl6)) | 0;\n hi = (hi + Math.imul(ah0, bh6)) | 0;\n var w6 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w6 >>> 26)) | 0;\n w6 &= 0x3ffffff;\n /* k = 7 */\n lo = Math.imul(al7, bl0);\n mid = Math.imul(al7, bh0);\n mid = (mid + Math.imul(ah7, bl0)) | 0;\n hi = Math.imul(ah7, bh0);\n lo = (lo + Math.imul(al6, bl1)) | 0;\n mid = (mid + Math.imul(al6, bh1)) | 0;\n mid = (mid + Math.imul(ah6, bl1)) | 0;\n hi = (hi + Math.imul(ah6, bh1)) | 0;\n lo = (lo + Math.imul(al5, bl2)) | 0;\n mid = (mid + Math.imul(al5, bh2)) | 0;\n mid = (mid + Math.imul(ah5, bl2)) | 0;\n hi = (hi + Math.imul(ah5, bh2)) | 0;\n lo = (lo + Math.imul(al4, bl3)) | 0;\n mid = (mid + Math.imul(al4, bh3)) | 0;\n mid = (mid + Math.imul(ah4, bl3)) | 0;\n hi = (hi + Math.imul(ah4, bh3)) | 0;\n lo = (lo + Math.imul(al3, bl4)) | 0;\n mid = (mid + Math.imul(al3, bh4)) | 0;\n mid = (mid + Math.imul(ah3, bl4)) | 0;\n hi = (hi + Math.imul(ah3, bh4)) | 0;\n lo = (lo + Math.imul(al2, bl5)) | 0;\n mid = (mid + Math.imul(al2, bh5)) | 0;\n mid = (mid + Math.imul(ah2, bl5)) | 0;\n hi = (hi + Math.imul(ah2, bh5)) | 0;\n lo = (lo + Math.imul(al1, bl6)) | 0;\n mid = (mid + Math.imul(al1, bh6)) | 0;\n mid = (mid + Math.imul(ah1, bl6)) | 0;\n hi = (hi + Math.imul(ah1, bh6)) | 0;\n lo = (lo + Math.imul(al0, bl7)) | 0;\n mid = (mid + Math.imul(al0, bh7)) | 0;\n mid = (mid + Math.imul(ah0, bl7)) | 0;\n hi = (hi + Math.imul(ah0, bh7)) | 0;\n var w7 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w7 >>> 26)) | 0;\n w7 &= 0x3ffffff;\n /* k = 8 */\n lo = Math.imul(al8, bl0);\n mid = Math.imul(al8, bh0);\n mid = (mid + Math.imul(ah8, bl0)) | 0;\n hi = Math.imul(ah8, bh0);\n lo = (lo + Math.imul(al7, bl1)) | 0;\n mid = (mid + Math.imul(al7, bh1)) | 0;\n mid = (mid + Math.imul(ah7, bl1)) | 0;\n hi = (hi + Math.imul(ah7, bh1)) | 0;\n lo = (lo + Math.imul(al6, bl2)) | 0;\n mid = (mid + Math.imul(al6, bh2)) | 0;\n mid = (mid + Math.imul(ah6, bl2)) | 0;\n hi = (hi + Math.imul(ah6, bh2)) | 0;\n lo = (lo + Math.imul(al5, bl3)) | 0;\n mid = (mid + Math.imul(al5, bh3)) | 0;\n mid = (mid + Math.imul(ah5, bl3)) | 0;\n hi = (hi + Math.imul(ah5, bh3)) | 0;\n lo = (lo + Math.imul(al4, bl4)) | 0;\n mid = (mid + Math.imul(al4, bh4)) | 0;\n mid = (mid + Math.imul(ah4, bl4)) | 0;\n hi = (hi + Math.imul(ah4, bh4)) | 0;\n lo = (lo + Math.imul(al3, bl5)) | 0;\n mid = (mid + Math.imul(al3, bh5)) | 0;\n mid = (mid + Math.imul(ah3, bl5)) | 0;\n hi = (hi + Math.imul(ah3, bh5)) | 0;\n lo = (lo + Math.imul(al2, bl6)) | 0;\n mid = (mid + Math.imul(al2, bh6)) | 0;\n mid = (mid + Math.imul(ah2, bl6)) | 0;\n hi = (hi + Math.imul(ah2, bh6)) | 0;\n lo = (lo + Math.imul(al1, bl7)) | 0;\n mid = (mid + Math.imul(al1, bh7)) | 0;\n mid = (mid + Math.imul(ah1, bl7)) | 0;\n hi = (hi + Math.imul(ah1, bh7)) | 0;\n lo = (lo + Math.imul(al0, bl8)) | 0;\n mid = (mid + Math.imul(al0, bh8)) | 0;\n mid = (mid + Math.imul(ah0, bl8)) | 0;\n hi = (hi + Math.imul(ah0, bh8)) | 0;\n var w8 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w8 >>> 26)) | 0;\n w8 &= 0x3ffffff;\n /* k = 9 */\n lo = Math.imul(al9, bl0);\n mid = Math.imul(al9, bh0);\n mid = (mid + Math.imul(ah9, bl0)) | 0;\n hi = Math.imul(ah9, bh0);\n lo = (lo + Math.imul(al8, bl1)) | 0;\n mid = (mid + Math.imul(al8, bh1)) | 0;\n mid = (mid + Math.imul(ah8, bl1)) | 0;\n hi = (hi + Math.imul(ah8, bh1)) | 0;\n lo = (lo + Math.imul(al7, bl2)) | 0;\n mid = (mid + Math.imul(al7, bh2)) | 0;\n mid = (mid + Math.imul(ah7, bl2)) | 0;\n hi = (hi + Math.imul(ah7, bh2)) | 0;\n lo = (lo + Math.imul(al6, bl3)) | 0;\n mid = (mid + Math.imul(al6, bh3)) | 0;\n mid = (mid + Math.imul(ah6, bl3)) | 0;\n hi = (hi + Math.imul(ah6, bh3)) | 0;\n lo = (lo + Math.imul(al5, bl4)) | 0;\n mid = (mid + Math.imul(al5, bh4)) | 0;\n mid = (mid + Math.imul(ah5, bl4)) | 0;\n hi = (hi + Math.imul(ah5, bh4)) | 0;\n lo = (lo + Math.imul(al4, bl5)) | 0;\n mid = (mid + Math.imul(al4, bh5)) | 0;\n mid = (mid + Math.imul(ah4, bl5)) | 0;\n hi = (hi + Math.imul(ah4, bh5)) | 0;\n lo = (lo + Math.imul(al3, bl6)) | 0;\n mid = (mid + Math.imul(al3, bh6)) | 0;\n mid = (mid + Math.imul(ah3, bl6)) | 0;\n hi = (hi + Math.imul(ah3, bh6)) | 0;\n lo = (lo + Math.imul(al2, bl7)) | 0;\n mid = (mid + Math.imul(al2, bh7)) | 0;\n mid = (mid + Math.imul(ah2, bl7)) | 0;\n hi = (hi + Math.imul(ah2, bh7)) | 0;\n lo = (lo + Math.imul(al1, bl8)) | 0;\n mid = (mid + Math.imul(al1, bh8)) | 0;\n mid = (mid + Math.imul(ah1, bl8)) | 0;\n hi = (hi + Math.imul(ah1, bh8)) | 0;\n lo = (lo + Math.imul(al0, bl9)) | 0;\n mid = (mid + Math.imul(al0, bh9)) | 0;\n mid = (mid + Math.imul(ah0, bl9)) | 0;\n hi = (hi + Math.imul(ah0, bh9)) | 0;\n var w9 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w9 >>> 26)) | 0;\n w9 &= 0x3ffffff;\n /* k = 10 */\n lo = Math.imul(al9, bl1);\n mid = Math.imul(al9, bh1);\n mid = (mid + Math.imul(ah9, bl1)) | 0;\n hi = Math.imul(ah9, bh1);\n lo = (lo + Math.imul(al8, bl2)) | 0;\n mid = (mid + Math.imul(al8, bh2)) | 0;\n mid = (mid + Math.imul(ah8, bl2)) | 0;\n hi = (hi + Math.imul(ah8, bh2)) | 0;\n lo = (lo + Math.imul(al7, bl3)) | 0;\n mid = (mid + Math.imul(al7, bh3)) | 0;\n mid = (mid + Math.imul(ah7, bl3)) | 0;\n hi = (hi + Math.imul(ah7, bh3)) | 0;\n lo = (lo + Math.imul(al6, bl4)) | 0;\n mid = (mid + Math.imul(al6, bh4)) | 0;\n mid = (mid + Math.imul(ah6, bl4)) | 0;\n hi = (hi + Math.imul(ah6, bh4)) | 0;\n lo = (lo + Math.imul(al5, bl5)) | 0;\n mid = (mid + Math.imul(al5, bh5)) | 0;\n mid = (mid + Math.imul(ah5, bl5)) | 0;\n hi = (hi + Math.imul(ah5, bh5)) | 0;\n lo = (lo + Math.imul(al4, bl6)) | 0;\n mid = (mid + Math.imul(al4, bh6)) | 0;\n mid = (mid + Math.imul(ah4, bl6)) | 0;\n hi = (hi + Math.imul(ah4, bh6)) | 0;\n lo = (lo + Math.imul(al3, bl7)) | 0;\n mid = (mid + Math.imul(al3, bh7)) | 0;\n mid = (mid + Math.imul(ah3, bl7)) | 0;\n hi = (hi + Math.imul(ah3, bh7)) | 0;\n lo = (lo + Math.imul(al2, bl8)) | 0;\n mid = (mid + Math.imul(al2, bh8)) | 0;\n mid = (mid + Math.imul(ah2, bl8)) | 0;\n hi = (hi + Math.imul(ah2, bh8)) | 0;\n lo = (lo + Math.imul(al1, bl9)) | 0;\n mid = (mid + Math.imul(al1, bh9)) | 0;\n mid = (mid + Math.imul(ah1, bl9)) | 0;\n hi = (hi + Math.imul(ah1, bh9)) | 0;\n var w10 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w10 >>> 26)) | 0;\n w10 &= 0x3ffffff;\n /* k = 11 */\n lo = Math.imul(al9, bl2);\n mid = Math.imul(al9, bh2);\n mid = (mid + Math.imul(ah9, bl2)) | 0;\n hi = Math.imul(ah9, bh2);\n lo = (lo + Math.imul(al8, bl3)) | 0;\n mid = (mid + Math.imul(al8, bh3)) | 0;\n mid = (mid + Math.imul(ah8, bl3)) | 0;\n hi = (hi + Math.imul(ah8, bh3)) | 0;\n lo = (lo + Math.imul(al7, bl4)) | 0;\n mid = (mid + Math.imul(al7, bh4)) | 0;\n mid = (mid + Math.imul(ah7, bl4)) | 0;\n hi = (hi + Math.imul(ah7, bh4)) | 0;\n lo = (lo + Math.imul(al6, bl5)) | 0;\n mid = (mid + Math.imul(al6, bh5)) | 0;\n mid = (mid + Math.imul(ah6, bl5)) | 0;\n hi = (hi + Math.imul(ah6, bh5)) | 0;\n lo = (lo + Math.imul(al5, bl6)) | 0;\n mid = (mid + Math.imul(al5, bh6)) | 0;\n mid = (mid + Math.imul(ah5, bl6)) | 0;\n hi = (hi + Math.imul(ah5, bh6)) | 0;\n lo = (lo + Math.imul(al4, bl7)) | 0;\n mid = (mid + Math.imul(al4, bh7)) | 0;\n mid = (mid + Math.imul(ah4, bl7)) | 0;\n hi = (hi + Math.imul(ah4, bh7)) | 0;\n lo = (lo + Math.imul(al3, bl8)) | 0;\n mid = (mid + Math.imul(al3, bh8)) | 0;\n mid = (mid + Math.imul(ah3, bl8)) | 0;\n hi = (hi + Math.imul(ah3, bh8)) | 0;\n lo = (lo + Math.imul(al2, bl9)) | 0;\n mid = (mid + Math.imul(al2, bh9)) | 0;\n mid = (mid + Math.imul(ah2, bl9)) | 0;\n hi = (hi + Math.imul(ah2, bh9)) | 0;\n var w11 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w11 >>> 26)) | 0;\n w11 &= 0x3ffffff;\n /* k = 12 */\n lo = Math.imul(al9, bl3);\n mid = Math.imul(al9, bh3);\n mid = (mid + Math.imul(ah9, bl3)) | 0;\n hi = Math.imul(ah9, bh3);\n lo = (lo + Math.imul(al8, bl4)) | 0;\n mid = (mid + Math.imul(al8, bh4)) | 0;\n mid = (mid + Math.imul(ah8, bl4)) | 0;\n hi = (hi + Math.imul(ah8, bh4)) | 0;\n lo = (lo + Math.imul(al7, bl5)) | 0;\n mid = (mid + Math.imul(al7, bh5)) | 0;\n mid = (mid + Math.imul(ah7, bl5)) | 0;\n hi = (hi + Math.imul(ah7, bh5)) | 0;\n lo = (lo + Math.imul(al6, bl6)) | 0;\n mid = (mid + Math.imul(al6, bh6)) | 0;\n mid = (mid + Math.imul(ah6, bl6)) | 0;\n hi = (hi + Math.imul(ah6, bh6)) | 0;\n lo = (lo + Math.imul(al5, bl7)) | 0;\n mid = (mid + Math.imul(al5, bh7)) | 0;\n mid = (mid + Math.imul(ah5, bl7)) | 0;\n hi = (hi + Math.imul(ah5, bh7)) | 0;\n lo = (lo + Math.imul(al4, bl8)) | 0;\n mid = (mid + Math.imul(al4, bh8)) | 0;\n mid = (mid + Math.imul(ah4, bl8)) | 0;\n hi = (hi + Math.imul(ah4, bh8)) | 0;\n lo = (lo + Math.imul(al3, bl9)) | 0;\n mid = (mid + Math.imul(al3, bh9)) | 0;\n mid = (mid + Math.imul(ah3, bl9)) | 0;\n hi = (hi + Math.imul(ah3, bh9)) | 0;\n var w12 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w12 >>> 26)) | 0;\n w12 &= 0x3ffffff;\n /* k = 13 */\n lo = Math.imul(al9, bl4);\n mid = Math.imul(al9, bh4);\n mid = (mid + Math.imul(ah9, bl4)) | 0;\n hi = Math.imul(ah9, bh4);\n lo = (lo + Math.imul(al8, bl5)) | 0;\n mid = (mid + Math.imul(al8, bh5)) | 0;\n mid = (mid + Math.imul(ah8, bl5)) | 0;\n hi = (hi + Math.imul(ah8, bh5)) | 0;\n lo = (lo + Math.imul(al7, bl6)) | 0;\n mid = (mid + Math.imul(al7, bh6)) | 0;\n mid = (mid + Math.imul(ah7, bl6)) | 0;\n hi = (hi + Math.imul(ah7, bh6)) | 0;\n lo = (lo + Math.imul(al6, bl7)) | 0;\n mid = (mid + Math.imul(al6, bh7)) | 0;\n mid = (mid + Math.imul(ah6, bl7)) | 0;\n hi = (hi + Math.imul(ah6, bh7)) | 0;\n lo = (lo + Math.imul(al5, bl8)) | 0;\n mid = (mid + Math.imul(al5, bh8)) | 0;\n mid = (mid + Math.imul(ah5, bl8)) | 0;\n hi = (hi + Math.imul(ah5, bh8)) | 0;\n lo = (lo + Math.imul(al4, bl9)) | 0;\n mid = (mid + Math.imul(al4, bh9)) | 0;\n mid = (mid + Math.imul(ah4, bl9)) | 0;\n hi = (hi + Math.imul(ah4, bh9)) | 0;\n var w13 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w13 >>> 26)) | 0;\n w13 &= 0x3ffffff;\n /* k = 14 */\n lo = Math.imul(al9, bl5);\n mid = Math.imul(al9, bh5);\n mid = (mid + Math.imul(ah9, bl5)) | 0;\n hi = Math.imul(ah9, bh5);\n lo = (lo + Math.imul(al8, bl6)) | 0;\n mid = (mid + Math.imul(al8, bh6)) | 0;\n mid = (mid + Math.imul(ah8, bl6)) | 0;\n hi = (hi + Math.imul(ah8, bh6)) | 0;\n lo = (lo + Math.imul(al7, bl7)) | 0;\n mid = (mid + Math.imul(al7, bh7)) | 0;\n mid = (mid + Math.imul(ah7, bl7)) | 0;\n hi = (hi + Math.imul(ah7, bh7)) | 0;\n lo = (lo + Math.imul(al6, bl8)) | 0;\n mid = (mid + Math.imul(al6, bh8)) | 0;\n mid = (mid + Math.imul(ah6, bl8)) | 0;\n hi = (hi + Math.imul(ah6, bh8)) | 0;\n lo = (lo + Math.imul(al5, bl9)) | 0;\n mid = (mid + Math.imul(al5, bh9)) | 0;\n mid = (mid + Math.imul(ah5, bl9)) | 0;\n hi = (hi + Math.imul(ah5, bh9)) | 0;\n var w14 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w14 >>> 26)) | 0;\n w14 &= 0x3ffffff;\n /* k = 15 */\n lo = Math.imul(al9, bl6);\n mid = Math.imul(al9, bh6);\n mid = (mid + Math.imul(ah9, bl6)) | 0;\n hi = Math.imul(ah9, bh6);\n lo = (lo + Math.imul(al8, bl7)) | 0;\n mid = (mid + Math.imul(al8, bh7)) | 0;\n mid = (mid + Math.imul(ah8, bl7)) | 0;\n hi = (hi + Math.imul(ah8, bh7)) | 0;\n lo = (lo + Math.imul(al7, bl8)) | 0;\n mid = (mid + Math.imul(al7, bh8)) | 0;\n mid = (mid + Math.imul(ah7, bl8)) | 0;\n hi = (hi + Math.imul(ah7, bh8)) | 0;\n lo = (lo + Math.imul(al6, bl9)) | 0;\n mid = (mid + Math.imul(al6, bh9)) | 0;\n mid = (mid + Math.imul(ah6, bl9)) | 0;\n hi = (hi + Math.imul(ah6, bh9)) | 0;\n var w15 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w15 >>> 26)) | 0;\n w15 &= 0x3ffffff;\n /* k = 16 */\n lo = Math.imul(al9, bl7);\n mid = Math.imul(al9, bh7);\n mid = (mid + Math.imul(ah9, bl7)) | 0;\n hi = Math.imul(ah9, bh7);\n lo = (lo + Math.imul(al8, bl8)) | 0;\n mid = (mid + Math.imul(al8, bh8)) | 0;\n mid = (mid + Math.imul(ah8, bl8)) | 0;\n hi = (hi + Math.imul(ah8, bh8)) | 0;\n lo = (lo + Math.imul(al7, bl9)) | 0;\n mid = (mid + Math.imul(al7, bh9)) | 0;\n mid = (mid + Math.imul(ah7, bl9)) | 0;\n hi = (hi + Math.imul(ah7, bh9)) | 0;\n var w16 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w16 >>> 26)) | 0;\n w16 &= 0x3ffffff;\n /* k = 17 */\n lo = Math.imul(al9, bl8);\n mid = Math.imul(al9, bh8);\n mid = (mid + Math.imul(ah9, bl8)) | 0;\n hi = Math.imul(ah9, bh8);\n lo = (lo + Math.imul(al8, bl9)) | 0;\n mid = (mid + Math.imul(al8, bh9)) | 0;\n mid = (mid + Math.imul(ah8, bl9)) | 0;\n hi = (hi + Math.imul(ah8, bh9)) | 0;\n var w17 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w17 >>> 26)) | 0;\n w17 &= 0x3ffffff;\n /* k = 18 */\n lo = Math.imul(al9, bl9);\n mid = Math.imul(al9, bh9);\n mid = (mid + Math.imul(ah9, bl9)) | 0;\n hi = Math.imul(ah9, bh9);\n var w18 = (((c + lo) | 0) + ((mid & 0x1fff) << 13)) | 0;\n c = (((hi + (mid >>> 13)) | 0) + (w18 >>> 26)) | 0;\n w18 &= 0x3ffffff;\n o[0] = w0;\n o[1] = w1;\n o[2] = w2;\n o[3] = w3;\n o[4] = w4;\n o[5] = w5;\n o[6] = w6;\n o[7] = w7;\n o[8] = w8;\n o[9] = w9;\n o[10] = w10;\n o[11] = w11;\n o[12] = w12;\n o[13] = w13;\n o[14] = w14;\n o[15] = w15;\n o[16] = w16;\n o[17] = w17;\n o[18] = w18;\n if (c !== 0) {\n o[19] = c;\n out.length++;\n }\n return out;\n };\n\n // Polyfill comb\n if (!Math.imul) {\n comb10MulTo = smallMulTo;\n }\n\n function bigMulTo (self, num, out) {\n out.negative = num.negative ^ self.negative;\n out.length = self.length + num.length;\n\n var carry = 0;\n var hncarry = 0;\n for (var k = 0; k < out.length - 1; k++) {\n // Sum all words with the same `i + j = k` and accumulate `ncarry`,\n // note that ncarry could be >= 0x3ffffff\n var ncarry = hncarry;\n hncarry = 0;\n var rword = carry & 0x3ffffff;\n var maxJ = Math.min(k, num.length - 1);\n for (var j = Math.max(0, k - self.length + 1); j <= maxJ; j++) {\n var i = k - j;\n var a = self.words[i] | 0;\n var b = num.words[j] | 0;\n var r = a * b;\n\n var lo = r & 0x3ffffff;\n ncarry = (ncarry + ((r / 0x4000000) | 0)) | 0;\n lo = (lo + rword) | 0;\n rword = lo & 0x3ffffff;\n ncarry = (ncarry + (lo >>> 26)) | 0;\n\n hncarry += ncarry >>> 26;\n ncarry &= 0x3ffffff;\n }\n out.words[k] = rword;\n carry = ncarry;\n ncarry = hncarry;\n }\n if (carry !== 0) {\n out.words[k] = carry;\n } else {\n out.length--;\n }\n\n return out._strip();\n }\n\n function jumboMulTo (self, num, out) {\n // Temporary disable, see https://github.com/indutny/bn.js/issues/211\n // var fftm = new FFTM();\n // return fftm.mulp(self, num, out);\n return bigMulTo(self, num, out);\n }\n\n BN.prototype.mulTo = function mulTo (num, out) {\n var res;\n var len = this.length + num.length;\n if (this.length === 10 && num.length === 10) {\n res = comb10MulTo(this, num, out);\n } else if (len < 63) {\n res = smallMulTo(this, num, out);\n } else if (len < 1024) {\n res = bigMulTo(this, num, out);\n } else {\n res = jumboMulTo(this, num, out);\n }\n\n return res;\n };\n\n // Cooley-Tukey algorithm for FFT\n // slightly revisited to rely on looping instead of recursion\n\n function FFTM (x, y) {\n this.x = x;\n this.y = y;\n }\n\n FFTM.prototype.makeRBT = function makeRBT (N) {\n var t = new Array(N);\n var l = BN.prototype._countBits(N) - 1;\n for (var i = 0; i < N; i++) {\n t[i] = this.revBin(i, l, N);\n }\n\n return t;\n };\n\n // Returns binary-reversed representation of `x`\n FFTM.prototype.revBin = function revBin (x, l, N) {\n if (x === 0 || x === N - 1) return x;\n\n var rb = 0;\n for (var i = 0; i < l; i++) {\n rb |= (x & 1) << (l - i - 1);\n x >>= 1;\n }\n\n return rb;\n };\n\n // Performs \"tweedling\" phase, therefore 'emulating'\n // behaviour of the recursive algorithm\n FFTM.prototype.permute = function permute (rbt, rws, iws, rtws, itws, N) {\n for (var i = 0; i < N; i++) {\n rtws[i] = rws[rbt[i]];\n itws[i] = iws[rbt[i]];\n }\n };\n\n FFTM.prototype.transform = function transform (rws, iws, rtws, itws, N, rbt) {\n this.permute(rbt, rws, iws, rtws, itws, N);\n\n for (var s = 1; s < N; s <<= 1) {\n var l = s << 1;\n\n var rtwdf = Math.cos(2 * Math.PI / l);\n var itwdf = Math.sin(2 * Math.PI / l);\n\n for (var p = 0; p < N; p += l) {\n var rtwdf_ = rtwdf;\n var itwdf_ = itwdf;\n\n for (var j = 0; j < s; j++) {\n var re = rtws[p + j];\n var ie = itws[p + j];\n\n var ro = rtws[p + j + s];\n var io = itws[p + j + s];\n\n var rx = rtwdf_ * ro - itwdf_ * io;\n\n io = rtwdf_ * io + itwdf_ * ro;\n ro = rx;\n\n rtws[p + j] = re + ro;\n itws[p + j] = ie + io;\n\n rtws[p + j + s] = re - ro;\n itws[p + j + s] = ie - io;\n\n /* jshint maxdepth : false */\n if (j !== l) {\n rx = rtwdf * rtwdf_ - itwdf * itwdf_;\n\n itwdf_ = rtwdf * itwdf_ + itwdf * rtwdf_;\n rtwdf_ = rx;\n }\n }\n }\n }\n };\n\n FFTM.prototype.guessLen13b = function guessLen13b (n, m) {\n var N = Math.max(m, n) | 1;\n var odd = N & 1;\n var i = 0;\n for (N = N / 2 | 0; N; N = N >>> 1) {\n i++;\n }\n\n return 1 << i + 1 + odd;\n };\n\n FFTM.prototype.conjugate = function conjugate (rws, iws, N) {\n if (N <= 1) return;\n\n for (var i = 0; i < N / 2; i++) {\n var t = rws[i];\n\n rws[i] = rws[N - i - 1];\n rws[N - i - 1] = t;\n\n t = iws[i];\n\n iws[i] = -iws[N - i - 1];\n iws[N - i - 1] = -t;\n }\n };\n\n FFTM.prototype.normalize13b = function normalize13b (ws, N) {\n var carry = 0;\n for (var i = 0; i < N / 2; i++) {\n var w = Math.round(ws[2 * i + 1] / N) * 0x2000 +\n Math.round(ws[2 * i] / N) +\n carry;\n\n ws[i] = w & 0x3ffffff;\n\n if (w < 0x4000000) {\n carry = 0;\n } else {\n carry = w / 0x4000000 | 0;\n }\n }\n\n return ws;\n };\n\n FFTM.prototype.convert13b = function convert13b (ws, len, rws, N) {\n var carry = 0;\n for (var i = 0; i < len; i++) {\n carry = carry + (ws[i] | 0);\n\n rws[2 * i] = carry & 0x1fff; carry = carry >>> 13;\n rws[2 * i + 1] = carry & 0x1fff; carry = carry >>> 13;\n }\n\n // Pad with zeroes\n for (i = 2 * len; i < N; ++i) {\n rws[i] = 0;\n }\n\n assert(carry === 0);\n assert((carry & ~0x1fff) === 0);\n };\n\n FFTM.prototype.stub = function stub (N) {\n var ph = new Array(N);\n for (var i = 0; i < N; i++) {\n ph[i] = 0;\n }\n\n return ph;\n };\n\n FFTM.prototype.mulp = function mulp (x, y, out) {\n var N = 2 * this.guessLen13b(x.length, y.length);\n\n var rbt = this.makeRBT(N);\n\n var _ = this.stub(N);\n\n var rws = new Array(N);\n var rwst = new Array(N);\n var iwst = new Array(N);\n\n var nrws = new Array(N);\n var nrwst = new Array(N);\n var niwst = new Array(N);\n\n var rmws = out.words;\n rmws.length = N;\n\n this.convert13b(x.words, x.length, rws, N);\n this.convert13b(y.words, y.length, nrws, N);\n\n this.transform(rws, _, rwst, iwst, N, rbt);\n this.transform(nrws, _, nrwst, niwst, N, rbt);\n\n for (var i = 0; i < N; i++) {\n var rx = rwst[i] * nrwst[i] - iwst[i] * niwst[i];\n iwst[i] = rwst[i] * niwst[i] + iwst[i] * nrwst[i];\n rwst[i] = rx;\n }\n\n this.conjugate(rwst, iwst, N);\n this.transform(rwst, iwst, rmws, _, N, rbt);\n this.conjugate(rmws, _, N);\n this.normalize13b(rmws, N);\n\n out.negative = x.negative ^ y.negative;\n out.length = x.length + y.length;\n return out._strip();\n };\n\n // Multiply `this` by `num`\n BN.prototype.mul = function mul (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return this.mulTo(num, out);\n };\n\n // Multiply employing FFT\n BN.prototype.mulf = function mulf (num) {\n var out = new BN(null);\n out.words = new Array(this.length + num.length);\n return jumboMulTo(this, num, out);\n };\n\n // In-place Multiplication\n BN.prototype.imul = function imul (num) {\n return this.clone().mulTo(num, this);\n };\n\n BN.prototype.imuln = function imuln (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n\n // Carry\n var carry = 0;\n for (var i = 0; i < this.length; i++) {\n var w = (this.words[i] | 0) * num;\n var lo = (w & 0x3ffffff) + (carry & 0x3ffffff);\n carry >>= 26;\n carry += (w / 0x4000000) | 0;\n // NOTE: lo is 27bit maximum\n carry += lo >>> 26;\n this.words[i] = lo & 0x3ffffff;\n }\n\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.muln = function muln (num) {\n return this.clone().imuln(num);\n };\n\n // `this` * `this`\n BN.prototype.sqr = function sqr () {\n return this.mul(this);\n };\n\n // `this` * `this` in-place\n BN.prototype.isqr = function isqr () {\n return this.imul(this.clone());\n };\n\n // Math.pow(`this`, `num`)\n BN.prototype.pow = function pow (num) {\n var w = toBitArray(num);\n if (w.length === 0) return new BN(1);\n\n // Skip leading zeroes\n var res = this;\n for (var i = 0; i < w.length; i++, res = res.sqr()) {\n if (w[i] !== 0) break;\n }\n\n if (++i < w.length) {\n for (var q = res.sqr(); i < w.length; i++, q = q.sqr()) {\n if (w[i] === 0) continue;\n\n res = res.mul(q);\n }\n }\n\n return res;\n };\n\n // Shift-left in-place\n BN.prototype.iushln = function iushln (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n var carryMask = (0x3ffffff >>> (26 - r)) << (26 - r);\n var i;\n\n if (r !== 0) {\n var carry = 0;\n\n for (i = 0; i < this.length; i++) {\n var newCarry = this.words[i] & carryMask;\n var c = ((this.words[i] | 0) - newCarry) << r;\n this.words[i] = c | carry;\n carry = newCarry >>> (26 - r);\n }\n\n if (carry) {\n this.words[i] = carry;\n this.length++;\n }\n }\n\n if (s !== 0) {\n for (i = this.length - 1; i >= 0; i--) {\n this.words[i + s] = this.words[i];\n }\n\n for (i = 0; i < s; i++) {\n this.words[i] = 0;\n }\n\n this.length += s;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishln = function ishln (bits) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushln(bits);\n };\n\n // Shift-right in-place\n // NOTE: `hint` is a lowest bit before trailing zeroes\n // NOTE: if `extended` is present - it will be filled with destroyed bits\n BN.prototype.iushrn = function iushrn (bits, hint, extended) {\n assert(typeof bits === 'number' && bits >= 0);\n var h;\n if (hint) {\n h = (hint - (hint % 26)) / 26;\n } else {\n h = 0;\n }\n\n var r = bits % 26;\n var s = Math.min((bits - r) / 26, this.length);\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n var maskedWords = extended;\n\n h -= s;\n h = Math.max(0, h);\n\n // Extended mode, copy masked part\n if (maskedWords) {\n for (var i = 0; i < s; i++) {\n maskedWords.words[i] = this.words[i];\n }\n maskedWords.length = s;\n }\n\n if (s === 0) {\n // No-op, we should not move anything at all\n } else if (this.length > s) {\n this.length -= s;\n for (i = 0; i < this.length; i++) {\n this.words[i] = this.words[i + s];\n }\n } else {\n this.words[0] = 0;\n this.length = 1;\n }\n\n var carry = 0;\n for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h); i--) {\n var word = this.words[i] | 0;\n this.words[i] = (carry << (26 - r)) | (word >>> r);\n carry = word & mask;\n }\n\n // Push carried bits as a mask\n if (maskedWords && carry !== 0) {\n maskedWords.words[maskedWords.length++] = carry;\n }\n\n if (this.length === 0) {\n this.words[0] = 0;\n this.length = 1;\n }\n\n return this._strip();\n };\n\n BN.prototype.ishrn = function ishrn (bits, hint, extended) {\n // TODO(indutny): implement me\n assert(this.negative === 0);\n return this.iushrn(bits, hint, extended);\n };\n\n // Shift-left\n BN.prototype.shln = function shln (bits) {\n return this.clone().ishln(bits);\n };\n\n BN.prototype.ushln = function ushln (bits) {\n return this.clone().iushln(bits);\n };\n\n // Shift-right\n BN.prototype.shrn = function shrn (bits) {\n return this.clone().ishrn(bits);\n };\n\n BN.prototype.ushrn = function ushrn (bits) {\n return this.clone().iushrn(bits);\n };\n\n // Test if n bit is set\n BN.prototype.testn = function testn (bit) {\n assert(typeof bit === 'number' && bit >= 0);\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) return false;\n\n // Check bit and return\n var w = this.words[s];\n\n return !!(w & q);\n };\n\n // Return only lowers bits of number (in-place)\n BN.prototype.imaskn = function imaskn (bits) {\n assert(typeof bits === 'number' && bits >= 0);\n var r = bits % 26;\n var s = (bits - r) / 26;\n\n assert(this.negative === 0, 'imaskn works only with positive numbers');\n\n if (this.length <= s) {\n return this;\n }\n\n if (r !== 0) {\n s++;\n }\n this.length = Math.min(s, this.length);\n\n if (r !== 0) {\n var mask = 0x3ffffff ^ ((0x3ffffff >>> r) << r);\n this.words[this.length - 1] &= mask;\n }\n\n return this._strip();\n };\n\n // Return only lowers bits of number\n BN.prototype.maskn = function maskn (bits) {\n return this.clone().imaskn(bits);\n };\n\n // Add plain number `num` to `this`\n BN.prototype.iaddn = function iaddn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.isubn(-num);\n\n // Possible sign change\n if (this.negative !== 0) {\n if (this.length === 1 && (this.words[0] | 0) <= num) {\n this.words[0] = num - (this.words[0] | 0);\n this.negative = 0;\n return this;\n }\n\n this.negative = 0;\n this.isubn(num);\n this.negative = 1;\n return this;\n }\n\n // Add without checks\n return this._iaddn(num);\n };\n\n BN.prototype._iaddn = function _iaddn (num) {\n this.words[0] += num;\n\n // Carry\n for (var i = 0; i < this.length && this.words[i] >= 0x4000000; i++) {\n this.words[i] -= 0x4000000;\n if (i === this.length - 1) {\n this.words[i + 1] = 1;\n } else {\n this.words[i + 1]++;\n }\n }\n this.length = Math.max(this.length, i + 1);\n\n return this;\n };\n\n // Subtract plain number `num` from `this`\n BN.prototype.isubn = function isubn (num) {\n assert(typeof num === 'number');\n assert(num < 0x4000000);\n if (num < 0) return this.iaddn(-num);\n\n if (this.negative !== 0) {\n this.negative = 0;\n this.iaddn(num);\n this.negative = 1;\n return this;\n }\n\n this.words[0] -= num;\n\n if (this.length === 1 && this.words[0] < 0) {\n this.words[0] = -this.words[0];\n this.negative = 1;\n } else {\n // Carry\n for (var i = 0; i < this.length && this.words[i] < 0; i++) {\n this.words[i] += 0x4000000;\n this.words[i + 1] -= 1;\n }\n }\n\n return this._strip();\n };\n\n BN.prototype.addn = function addn (num) {\n return this.clone().iaddn(num);\n };\n\n BN.prototype.subn = function subn (num) {\n return this.clone().isubn(num);\n };\n\n BN.prototype.iabs = function iabs () {\n this.negative = 0;\n\n return this;\n };\n\n BN.prototype.abs = function abs () {\n return this.clone().iabs();\n };\n\n BN.prototype._ishlnsubmul = function _ishlnsubmul (num, mul, shift) {\n var len = num.length + shift;\n var i;\n\n this._expand(len);\n\n var w;\n var carry = 0;\n for (i = 0; i < num.length; i++) {\n w = (this.words[i + shift] | 0) + carry;\n var right = (num.words[i] | 0) * mul;\n w -= right & 0x3ffffff;\n carry = (w >> 26) - ((right / 0x4000000) | 0);\n this.words[i + shift] = w & 0x3ffffff;\n }\n for (; i < this.length - shift; i++) {\n w = (this.words[i + shift] | 0) + carry;\n carry = w >> 26;\n this.words[i + shift] = w & 0x3ffffff;\n }\n\n if (carry === 0) return this._strip();\n\n // Subtraction overflow\n assert(carry === -1);\n carry = 0;\n for (i = 0; i < this.length; i++) {\n w = -(this.words[i] | 0) + carry;\n carry = w >> 26;\n this.words[i] = w & 0x3ffffff;\n }\n this.negative = 1;\n\n return this._strip();\n };\n\n BN.prototype._wordDiv = function _wordDiv (num, mode) {\n var shift = this.length - num.length;\n\n var a = this.clone();\n var b = num;\n\n // Normalize\n var bhi = b.words[b.length - 1] | 0;\n var bhiBits = this._countBits(bhi);\n shift = 26 - bhiBits;\n if (shift !== 0) {\n b = b.ushln(shift);\n a.iushln(shift);\n bhi = b.words[b.length - 1] | 0;\n }\n\n // Initialize quotient\n var m = a.length - b.length;\n var q;\n\n if (mode !== 'mod') {\n q = new BN(null);\n q.length = m + 1;\n q.words = new Array(q.length);\n for (var i = 0; i < q.length; i++) {\n q.words[i] = 0;\n }\n }\n\n var diff = a.clone()._ishlnsubmul(b, 1, m);\n if (diff.negative === 0) {\n a = diff;\n if (q) {\n q.words[m] = 1;\n }\n }\n\n for (var j = m - 1; j >= 0; j--) {\n var qj = (a.words[b.length + j] | 0) * 0x4000000 +\n (a.words[b.length + j - 1] | 0);\n\n // NOTE: (qj / bhi) is (0x3ffffff * 0x4000000 + 0x3ffffff) / 0x2000000 max\n // (0x7ffffff)\n qj = Math.min((qj / bhi) | 0, 0x3ffffff);\n\n a._ishlnsubmul(b, qj, j);\n while (a.negative !== 0) {\n qj--;\n a.negative = 0;\n a._ishlnsubmul(b, 1, j);\n if (!a.isZero()) {\n a.negative ^= 1;\n }\n }\n if (q) {\n q.words[j] = qj;\n }\n }\n if (q) {\n q._strip();\n }\n a._strip();\n\n // Denormalize\n if (mode !== 'div' && shift !== 0) {\n a.iushrn(shift);\n }\n\n return {\n div: q || null,\n mod: a\n };\n };\n\n // NOTE: 1) `mode` can be set to `mod` to request mod only,\n // to `div` to request div only, or be absent to\n // request both div & mod\n // 2) `positive` is true if unsigned mod is requested\n BN.prototype.divmod = function divmod (num, mode, positive) {\n assert(!num.isZero());\n\n if (this.isZero()) {\n return {\n div: new BN(0),\n mod: new BN(0)\n };\n }\n\n var div, mod, res;\n if (this.negative !== 0 && num.negative === 0) {\n res = this.neg().divmod(num, mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.iadd(num);\n }\n }\n\n return {\n div: div,\n mod: mod\n };\n }\n\n if (this.negative === 0 && num.negative !== 0) {\n res = this.divmod(num.neg(), mode);\n\n if (mode !== 'mod') {\n div = res.div.neg();\n }\n\n return {\n div: div,\n mod: res.mod\n };\n }\n\n if ((this.negative & num.negative) !== 0) {\n res = this.neg().divmod(num.neg(), mode);\n\n if (mode !== 'div') {\n mod = res.mod.neg();\n if (positive && mod.negative !== 0) {\n mod.isub(num);\n }\n }\n\n return {\n div: res.div,\n mod: mod\n };\n }\n\n // Both numbers are positive at this point\n\n // Strip both numbers to approximate shift value\n if (num.length > this.length || this.cmp(num) < 0) {\n return {\n div: new BN(0),\n mod: this\n };\n }\n\n // Very short reduction\n if (num.length === 1) {\n if (mode === 'div') {\n return {\n div: this.divn(num.words[0]),\n mod: null\n };\n }\n\n if (mode === 'mod') {\n return {\n div: null,\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return {\n div: this.divn(num.words[0]),\n mod: new BN(this.modrn(num.words[0]))\n };\n }\n\n return this._wordDiv(num, mode);\n };\n\n // Find `this` / `num`\n BN.prototype.div = function div (num) {\n return this.divmod(num, 'div', false).div;\n };\n\n // Find `this` % `num`\n BN.prototype.mod = function mod (num) {\n return this.divmod(num, 'mod', false).mod;\n };\n\n BN.prototype.umod = function umod (num) {\n return this.divmod(num, 'mod', true).mod;\n };\n\n // Find Round(`this` / `num`)\n BN.prototype.divRound = function divRound (num) {\n var dm = this.divmod(num);\n\n // Fast case - exact division\n if (dm.mod.isZero()) return dm.div;\n\n var mod = dm.div.negative !== 0 ? dm.mod.isub(num) : dm.mod;\n\n var half = num.ushrn(1);\n var r2 = num.andln(1);\n var cmp = mod.cmp(half);\n\n // Round down\n if (cmp < 0 || (r2 === 1 && cmp === 0)) return dm.div;\n\n // Round up\n return dm.div.negative !== 0 ? dm.div.isubn(1) : dm.div.iaddn(1);\n };\n\n BN.prototype.modrn = function modrn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n var p = (1 << 26) % num;\n\n var acc = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n acc = (p * acc + (this.words[i] | 0)) % num;\n }\n\n return isNegNum ? -acc : acc;\n };\n\n // WARNING: DEPRECATED\n BN.prototype.modn = function modn (num) {\n return this.modrn(num);\n };\n\n // In-place division by number\n BN.prototype.idivn = function idivn (num) {\n var isNegNum = num < 0;\n if (isNegNum) num = -num;\n\n assert(num <= 0x3ffffff);\n\n var carry = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var w = (this.words[i] | 0) + carry * 0x4000000;\n this.words[i] = (w / num) | 0;\n carry = w % num;\n }\n\n this._strip();\n return isNegNum ? this.ineg() : this;\n };\n\n BN.prototype.divn = function divn (num) {\n return this.clone().idivn(num);\n };\n\n BN.prototype.egcd = function egcd (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var x = this;\n var y = p.clone();\n\n if (x.negative !== 0) {\n x = x.umod(p);\n } else {\n x = x.clone();\n }\n\n // A * x + B * y = x\n var A = new BN(1);\n var B = new BN(0);\n\n // C * x + D * y = y\n var C = new BN(0);\n var D = new BN(1);\n\n var g = 0;\n\n while (x.isEven() && y.isEven()) {\n x.iushrn(1);\n y.iushrn(1);\n ++g;\n }\n\n var yp = y.clone();\n var xp = x.clone();\n\n while (!x.isZero()) {\n for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n x.iushrn(i);\n while (i-- > 0) {\n if (A.isOdd() || B.isOdd()) {\n A.iadd(yp);\n B.isub(xp);\n }\n\n A.iushrn(1);\n B.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (y.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n y.iushrn(j);\n while (j-- > 0) {\n if (C.isOdd() || D.isOdd()) {\n C.iadd(yp);\n D.isub(xp);\n }\n\n C.iushrn(1);\n D.iushrn(1);\n }\n }\n\n if (x.cmp(y) >= 0) {\n x.isub(y);\n A.isub(C);\n B.isub(D);\n } else {\n y.isub(x);\n C.isub(A);\n D.isub(B);\n }\n }\n\n return {\n a: C,\n b: D,\n gcd: y.iushln(g)\n };\n };\n\n // This is reduced incarnation of the binary EEA\n // above, designated to invert members of the\n // _prime_ fields F(p) at a maximal speed\n BN.prototype._invmp = function _invmp (p) {\n assert(p.negative === 0);\n assert(!p.isZero());\n\n var a = this;\n var b = p.clone();\n\n if (a.negative !== 0) {\n a = a.umod(p);\n } else {\n a = a.clone();\n }\n\n var x1 = new BN(1);\n var x2 = new BN(0);\n\n var delta = b.clone();\n\n while (a.cmpn(1) > 0 && b.cmpn(1) > 0) {\n for (var i = 0, im = 1; (a.words[0] & im) === 0 && i < 26; ++i, im <<= 1);\n if (i > 0) {\n a.iushrn(i);\n while (i-- > 0) {\n if (x1.isOdd()) {\n x1.iadd(delta);\n }\n\n x1.iushrn(1);\n }\n }\n\n for (var j = 0, jm = 1; (b.words[0] & jm) === 0 && j < 26; ++j, jm <<= 1);\n if (j > 0) {\n b.iushrn(j);\n while (j-- > 0) {\n if (x2.isOdd()) {\n x2.iadd(delta);\n }\n\n x2.iushrn(1);\n }\n }\n\n if (a.cmp(b) >= 0) {\n a.isub(b);\n x1.isub(x2);\n } else {\n b.isub(a);\n x2.isub(x1);\n }\n }\n\n var res;\n if (a.cmpn(1) === 0) {\n res = x1;\n } else {\n res = x2;\n }\n\n if (res.cmpn(0) < 0) {\n res.iadd(p);\n }\n\n return res;\n };\n\n BN.prototype.gcd = function gcd (num) {\n if (this.isZero()) return num.abs();\n if (num.isZero()) return this.abs();\n\n var a = this.clone();\n var b = num.clone();\n a.negative = 0;\n b.negative = 0;\n\n // Remove common factor of two\n for (var shift = 0; a.isEven() && b.isEven(); shift++) {\n a.iushrn(1);\n b.iushrn(1);\n }\n\n do {\n while (a.isEven()) {\n a.iushrn(1);\n }\n while (b.isEven()) {\n b.iushrn(1);\n }\n\n var r = a.cmp(b);\n if (r < 0) {\n // Swap `a` and `b` to make `a` always bigger than `b`\n var t = a;\n a = b;\n b = t;\n } else if (r === 0 || b.cmpn(1) === 0) {\n break;\n }\n\n a.isub(b);\n } while (true);\n\n return b.iushln(shift);\n };\n\n // Invert number in the field F(num)\n BN.prototype.invm = function invm (num) {\n return this.egcd(num).a.umod(num);\n };\n\n BN.prototype.isEven = function isEven () {\n return (this.words[0] & 1) === 0;\n };\n\n BN.prototype.isOdd = function isOdd () {\n return (this.words[0] & 1) === 1;\n };\n\n // And first word and num\n BN.prototype.andln = function andln (num) {\n return this.words[0] & num;\n };\n\n // Increment at the bit position in-line\n BN.prototype.bincn = function bincn (bit) {\n assert(typeof bit === 'number');\n var r = bit % 26;\n var s = (bit - r) / 26;\n var q = 1 << r;\n\n // Fast case: bit is much higher than all existing words\n if (this.length <= s) {\n this._expand(s + 1);\n this.words[s] |= q;\n return this;\n }\n\n // Add bit and propagate, if needed\n var carry = q;\n for (var i = s; carry !== 0 && i < this.length; i++) {\n var w = this.words[i] | 0;\n w += carry;\n carry = w >>> 26;\n w &= 0x3ffffff;\n this.words[i] = w;\n }\n if (carry !== 0) {\n this.words[i] = carry;\n this.length++;\n }\n return this;\n };\n\n BN.prototype.isZero = function isZero () {\n return this.length === 1 && this.words[0] === 0;\n };\n\n BN.prototype.cmpn = function cmpn (num) {\n var negative = num < 0;\n\n if (this.negative !== 0 && !negative) return -1;\n if (this.negative === 0 && negative) return 1;\n\n this._strip();\n\n var res;\n if (this.length > 1) {\n res = 1;\n } else {\n if (negative) {\n num = -num;\n }\n\n assert(num <= 0x3ffffff, 'Number is too big');\n\n var w = this.words[0] | 0;\n res = w === num ? 0 : w < num ? -1 : 1;\n }\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Compare two numbers and return:\n // 1 - if `this` > `num`\n // 0 - if `this` == `num`\n // -1 - if `this` < `num`\n BN.prototype.cmp = function cmp (num) {\n if (this.negative !== 0 && num.negative === 0) return -1;\n if (this.negative === 0 && num.negative !== 0) return 1;\n\n var res = this.ucmp(num);\n if (this.negative !== 0) return -res | 0;\n return res;\n };\n\n // Unsigned comparison\n BN.prototype.ucmp = function ucmp (num) {\n // At this point both numbers have the same sign\n if (this.length > num.length) return 1;\n if (this.length < num.length) return -1;\n\n var res = 0;\n for (var i = this.length - 1; i >= 0; i--) {\n var a = this.words[i] | 0;\n var b = num.words[i] | 0;\n\n if (a === b) continue;\n if (a < b) {\n res = -1;\n } else if (a > b) {\n res = 1;\n }\n break;\n }\n return res;\n };\n\n BN.prototype.gtn = function gtn (num) {\n return this.cmpn(num) === 1;\n };\n\n BN.prototype.gt = function gt (num) {\n return this.cmp(num) === 1;\n };\n\n BN.prototype.gten = function gten (num) {\n return this.cmpn(num) >= 0;\n };\n\n BN.prototype.gte = function gte (num) {\n return this.cmp(num) >= 0;\n };\n\n BN.prototype.ltn = function ltn (num) {\n return this.cmpn(num) === -1;\n };\n\n BN.prototype.lt = function lt (num) {\n return this.cmp(num) === -1;\n };\n\n BN.prototype.lten = function lten (num) {\n return this.cmpn(num) <= 0;\n };\n\n BN.prototype.lte = function lte (num) {\n return this.cmp(num) <= 0;\n };\n\n BN.prototype.eqn = function eqn (num) {\n return this.cmpn(num) === 0;\n };\n\n BN.prototype.eq = function eq (num) {\n return this.cmp(num) === 0;\n };\n\n //\n // A reduce context, could be using montgomery or something better, depending\n // on the `m` itself.\n //\n BN.red = function red (num) {\n return new Red(num);\n };\n\n BN.prototype.toRed = function toRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n assert(this.negative === 0, 'red works only with positives');\n return ctx.convertTo(this)._forceRed(ctx);\n };\n\n BN.prototype.fromRed = function fromRed () {\n assert(this.red, 'fromRed works only with numbers in reduction context');\n return this.red.convertFrom(this);\n };\n\n BN.prototype._forceRed = function _forceRed (ctx) {\n this.red = ctx;\n return this;\n };\n\n BN.prototype.forceRed = function forceRed (ctx) {\n assert(!this.red, 'Already a number in reduction context');\n return this._forceRed(ctx);\n };\n\n BN.prototype.redAdd = function redAdd (num) {\n assert(this.red, 'redAdd works only with red numbers');\n return this.red.add(this, num);\n };\n\n BN.prototype.redIAdd = function redIAdd (num) {\n assert(this.red, 'redIAdd works only with red numbers');\n return this.red.iadd(this, num);\n };\n\n BN.prototype.redSub = function redSub (num) {\n assert(this.red, 'redSub works only with red numbers');\n return this.red.sub(this, num);\n };\n\n BN.prototype.redISub = function redISub (num) {\n assert(this.red, 'redISub works only with red numbers');\n return this.red.isub(this, num);\n };\n\n BN.prototype.redShl = function redShl (num) {\n assert(this.red, 'redShl works only with red numbers');\n return this.red.shl(this, num);\n };\n\n BN.prototype.redMul = function redMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.mul(this, num);\n };\n\n BN.prototype.redIMul = function redIMul (num) {\n assert(this.red, 'redMul works only with red numbers');\n this.red._verify2(this, num);\n return this.red.imul(this, num);\n };\n\n BN.prototype.redSqr = function redSqr () {\n assert(this.red, 'redSqr works only with red numbers');\n this.red._verify1(this);\n return this.red.sqr(this);\n };\n\n BN.prototype.redISqr = function redISqr () {\n assert(this.red, 'redISqr works only with red numbers');\n this.red._verify1(this);\n return this.red.isqr(this);\n };\n\n // Square root over p\n BN.prototype.redSqrt = function redSqrt () {\n assert(this.red, 'redSqrt works only with red numbers');\n this.red._verify1(this);\n return this.red.sqrt(this);\n };\n\n BN.prototype.redInvm = function redInvm () {\n assert(this.red, 'redInvm works only with red numbers');\n this.red._verify1(this);\n return this.red.invm(this);\n };\n\n // Return negative clone of `this` % `red modulo`\n BN.prototype.redNeg = function redNeg () {\n assert(this.red, 'redNeg works only with red numbers');\n this.red._verify1(this);\n return this.red.neg(this);\n };\n\n BN.prototype.redPow = function redPow (num) {\n assert(this.red && !num.red, 'redPow(normalNum)');\n this.red._verify1(this);\n return this.red.pow(this, num);\n };\n\n // Prime numbers with efficient reduction\n var primes = {\n k256: null,\n p224: null,\n p192: null,\n p25519: null\n };\n\n // Pseudo-Mersenne prime\n function MPrime (name, p) {\n // P = 2 ^ N - K\n this.name = name;\n this.p = new BN(p, 16);\n this.n = this.p.bitLength();\n this.k = new BN(1).iushln(this.n).isub(this.p);\n\n this.tmp = this._tmp();\n }\n\n MPrime.prototype._tmp = function _tmp () {\n var tmp = new BN(null);\n tmp.words = new Array(Math.ceil(this.n / 13));\n return tmp;\n };\n\n MPrime.prototype.ireduce = function ireduce (num) {\n // Assumes that `num` is less than `P^2`\n // num = HI * (2 ^ N - K) + HI * K + LO = HI * K + LO (mod P)\n var r = num;\n var rlen;\n\n do {\n this.split(r, this.tmp);\n r = this.imulK(r);\n r = r.iadd(this.tmp);\n rlen = r.bitLength();\n } while (rlen > this.n);\n\n var cmp = rlen < this.n ? -1 : r.ucmp(this.p);\n if (cmp === 0) {\n r.words[0] = 0;\n r.length = 1;\n } else if (cmp > 0) {\n r.isub(this.p);\n } else {\n if (r.strip !== undefined) {\n // r is a BN v4 instance\n r.strip();\n } else {\n // r is a BN v5 instance\n r._strip();\n }\n }\n\n return r;\n };\n\n MPrime.prototype.split = function split (input, out) {\n input.iushrn(this.n, 0, out);\n };\n\n MPrime.prototype.imulK = function imulK (num) {\n return num.imul(this.k);\n };\n\n function K256 () {\n MPrime.call(\n this,\n 'k256',\n 'ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f');\n }\n inherits(K256, MPrime);\n\n K256.prototype.split = function split (input, output) {\n // 256 = 9 * 26 + 22\n var mask = 0x3fffff;\n\n var outLen = Math.min(input.length, 9);\n for (var i = 0; i < outLen; i++) {\n output.words[i] = input.words[i];\n }\n output.length = outLen;\n\n if (input.length <= 9) {\n input.words[0] = 0;\n input.length = 1;\n return;\n }\n\n // Shift by 9 limbs\n var prev = input.words[9];\n output.words[output.length++] = prev & mask;\n\n for (i = 10; i < input.length; i++) {\n var next = input.words[i] | 0;\n input.words[i - 10] = ((next & mask) << 4) | (prev >>> 22);\n prev = next;\n }\n prev >>>= 22;\n input.words[i - 10] = prev;\n if (prev === 0 && input.length > 10) {\n input.length -= 10;\n } else {\n input.length -= 9;\n }\n };\n\n K256.prototype.imulK = function imulK (num) {\n // K = 0x1000003d1 = [ 0x40, 0x3d1 ]\n num.words[num.length] = 0;\n num.words[num.length + 1] = 0;\n num.length += 2;\n\n // bounded at: 0x40 * 0x3ffffff + 0x3d0 = 0x100000390\n var lo = 0;\n for (var i = 0; i < num.length; i++) {\n var w = num.words[i] | 0;\n lo += w * 0x3d1;\n num.words[i] = lo & 0x3ffffff;\n lo = w * 0x40 + ((lo / 0x4000000) | 0);\n }\n\n // Fast length reduction\n if (num.words[num.length - 1] === 0) {\n num.length--;\n if (num.words[num.length - 1] === 0) {\n num.length--;\n }\n }\n return num;\n };\n\n function P224 () {\n MPrime.call(\n this,\n 'p224',\n 'ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001');\n }\n inherits(P224, MPrime);\n\n function P192 () {\n MPrime.call(\n this,\n 'p192',\n 'ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff');\n }\n inherits(P192, MPrime);\n\n function P25519 () {\n // 2 ^ 255 - 19\n MPrime.call(\n this,\n '25519',\n '7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed');\n }\n inherits(P25519, MPrime);\n\n P25519.prototype.imulK = function imulK (num) {\n // K = 0x13\n var carry = 0;\n for (var i = 0; i < num.length; i++) {\n var hi = (num.words[i] | 0) * 0x13 + carry;\n var lo = hi & 0x3ffffff;\n hi >>>= 26;\n\n num.words[i] = lo;\n carry = hi;\n }\n if (carry !== 0) {\n num.words[num.length++] = carry;\n }\n return num;\n };\n\n // Exported mostly for testing purposes, use plain name instead\n BN._prime = function prime (name) {\n // Cached version of prime\n if (primes[name]) return primes[name];\n\n var prime;\n if (name === 'k256') {\n prime = new K256();\n } else if (name === 'p224') {\n prime = new P224();\n } else if (name === 'p192') {\n prime = new P192();\n } else if (name === 'p25519') {\n prime = new P25519();\n } else {\n throw new Error('Unknown prime ' + name);\n }\n primes[name] = prime;\n\n return prime;\n };\n\n //\n // Base reduction engine\n //\n function Red (m) {\n if (typeof m === 'string') {\n var prime = BN._prime(m);\n this.m = prime.p;\n this.prime = prime;\n } else {\n assert(m.gtn(1), 'modulus must be greater than 1');\n this.m = m;\n this.prime = null;\n }\n }\n\n Red.prototype._verify1 = function _verify1 (a) {\n assert(a.negative === 0, 'red works only with positives');\n assert(a.red, 'red works only with red numbers');\n };\n\n Red.prototype._verify2 = function _verify2 (a, b) {\n assert((a.negative | b.negative) === 0, 'red works only with positives');\n assert(a.red && a.red === b.red,\n 'red works only with red numbers');\n };\n\n Red.prototype.imod = function imod (a) {\n if (this.prime) return this.prime.ireduce(a)._forceRed(this);\n\n move(a, a.umod(this.m)._forceRed(this));\n return a;\n };\n\n Red.prototype.neg = function neg (a) {\n if (a.isZero()) {\n return a.clone();\n }\n\n return this.m.sub(a)._forceRed(this);\n };\n\n Red.prototype.add = function add (a, b) {\n this._verify2(a, b);\n\n var res = a.add(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.iadd = function iadd (a, b) {\n this._verify2(a, b);\n\n var res = a.iadd(b);\n if (res.cmp(this.m) >= 0) {\n res.isub(this.m);\n }\n return res;\n };\n\n Red.prototype.sub = function sub (a, b) {\n this._verify2(a, b);\n\n var res = a.sub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res._forceRed(this);\n };\n\n Red.prototype.isub = function isub (a, b) {\n this._verify2(a, b);\n\n var res = a.isub(b);\n if (res.cmpn(0) < 0) {\n res.iadd(this.m);\n }\n return res;\n };\n\n Red.prototype.shl = function shl (a, num) {\n this._verify1(a);\n return this.imod(a.ushln(num));\n };\n\n Red.prototype.imul = function imul (a, b) {\n this._verify2(a, b);\n return this.imod(a.imul(b));\n };\n\n Red.prototype.mul = function mul (a, b) {\n this._verify2(a, b);\n return this.imod(a.mul(b));\n };\n\n Red.prototype.isqr = function isqr (a) {\n return this.imul(a, a.clone());\n };\n\n Red.prototype.sqr = function sqr (a) {\n return this.mul(a, a);\n };\n\n Red.prototype.sqrt = function sqrt (a) {\n if (a.isZero()) return a.clone();\n\n var mod3 = this.m.andln(3);\n assert(mod3 % 2 === 1);\n\n // Fast case\n if (mod3 === 3) {\n var pow = this.m.add(new BN(1)).iushrn(2);\n return this.pow(a, pow);\n }\n\n // Tonelli-Shanks algorithm (Totally unoptimized and slow)\n //\n // Find Q and S, that Q * 2 ^ S = (P - 1)\n var q = this.m.subn(1);\n var s = 0;\n while (!q.isZero() && q.andln(1) === 0) {\n s++;\n q.iushrn(1);\n }\n assert(!q.isZero());\n\n var one = new BN(1).toRed(this);\n var nOne = one.redNeg();\n\n // Find quadratic non-residue\n // NOTE: Max is such because of generalized Riemann hypothesis.\n var lpow = this.m.subn(1).iushrn(1);\n var z = this.m.bitLength();\n z = new BN(2 * z * z).toRed(this);\n\n while (this.pow(z, lpow).cmp(nOne) !== 0) {\n z.redIAdd(nOne);\n }\n\n var c = this.pow(z, q);\n var r = this.pow(a, q.addn(1).iushrn(1));\n var t = this.pow(a, q);\n var m = s;\n while (t.cmp(one) !== 0) {\n var tmp = t;\n for (var i = 0; tmp.cmp(one) !== 0; i++) {\n tmp = tmp.redSqr();\n }\n assert(i < m);\n var b = this.pow(c, new BN(1).iushln(m - i - 1));\n\n r = r.redMul(b);\n c = b.redSqr();\n t = t.redMul(c);\n m = i;\n }\n\n return r;\n };\n\n Red.prototype.invm = function invm (a) {\n var inv = a._invmp(this.m);\n if (inv.negative !== 0) {\n inv.negative = 0;\n return this.imod(inv).redNeg();\n } else {\n return this.imod(inv);\n }\n };\n\n Red.prototype.pow = function pow (a, num) {\n if (num.isZero()) return new BN(1).toRed(this);\n if (num.cmpn(1) === 0) return a.clone();\n\n var windowSize = 4;\n var wnd = new Array(1 << windowSize);\n wnd[0] = new BN(1).toRed(this);\n wnd[1] = a;\n for (var i = 2; i < wnd.length; i++) {\n wnd[i] = this.mul(wnd[i - 1], a);\n }\n\n var res = wnd[0];\n var current = 0;\n var currentLen = 0;\n var start = num.bitLength() % 26;\n if (start === 0) {\n start = 26;\n }\n\n for (i = num.length - 1; i >= 0; i--) {\n var word = num.words[i];\n for (var j = start - 1; j >= 0; j--) {\n var bit = (word >> j) & 1;\n if (res !== wnd[0]) {\n res = this.sqr(res);\n }\n\n if (bit === 0 && current === 0) {\n currentLen = 0;\n continue;\n }\n\n current <<= 1;\n current |= bit;\n currentLen++;\n if (currentLen !== windowSize && (i !== 0 || j !== 0)) continue;\n\n res = this.mul(res, wnd[current]);\n currentLen = 0;\n current = 0;\n }\n start = 26;\n }\n\n return res;\n };\n\n Red.prototype.convertTo = function convertTo (num) {\n var r = num.umod(this.m);\n\n return r === num ? r.clone() : r;\n };\n\n Red.prototype.convertFrom = function convertFrom (num) {\n var res = num.clone();\n res.red = null;\n return res;\n };\n\n //\n // Montgomery method engine\n //\n\n BN.mont = function mont (num) {\n return new Mont(num);\n };\n\n function Mont (m) {\n Red.call(this, m);\n\n this.shift = this.m.bitLength();\n if (this.shift % 26 !== 0) {\n this.shift += 26 - (this.shift % 26);\n }\n\n this.r = new BN(1).iushln(this.shift);\n this.r2 = this.imod(this.r.sqr());\n this.rinv = this.r._invmp(this.m);\n\n this.minv = this.rinv.mul(this.r).isubn(1).div(this.m);\n this.minv = this.minv.umod(this.r);\n this.minv = this.r.sub(this.minv);\n }\n inherits(Mont, Red);\n\n Mont.prototype.convertTo = function convertTo (num) {\n return this.imod(num.ushln(this.shift));\n };\n\n Mont.prototype.convertFrom = function convertFrom (num) {\n var r = this.imod(num.mul(this.rinv));\n r.red = null;\n return r;\n };\n\n Mont.prototype.imul = function imul (a, b) {\n if (a.isZero() || b.isZero()) {\n a.words[0] = 0;\n a.length = 1;\n return a;\n }\n\n var t = a.imul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.mul = function mul (a, b) {\n if (a.isZero() || b.isZero()) return new BN(0)._forceRed(this);\n\n var t = a.mul(b);\n var c = t.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m);\n var u = t.isub(c).iushrn(this.shift);\n var res = u;\n if (u.cmp(this.m) >= 0) {\n res = u.isub(this.m);\n } else if (u.cmpn(0) < 0) {\n res = u.iadd(this.m);\n }\n\n return res._forceRed(this);\n };\n\n Mont.prototype.invm = function invm (a) {\n // (AR)^-1 * R^2 = (A^-1 * R^-1) * R^2 = A^-1 * R\n var res = this.imod(a._invmp(this.m).mul(this.r2));\n return res._forceRed(this);\n };\n})(typeof module === 'undefined' || module, this);\n","'use strict';\n\nconst asn1 = exports;\n\nasn1.bignum = require('bn.js');\n\nasn1.define = require('./asn1/api').define;\nasn1.base = require('./asn1/base');\nasn1.constants = require('./asn1/constants');\nasn1.decoders = require('./asn1/decoders');\nasn1.encoders = require('./asn1/encoders');\n","'use strict';\n\nconst encoders = exports;\n\nencoders.der = require('./der');\nencoders.pem = require('./pem');\n","'use strict';\n\nconst inherits = require('inherits');\nconst Buffer = require('safer-buffer').Buffer;\nconst Node = require('../base/node');\n\n// Import DER constants\nconst der = require('../constants/der');\n\nfunction DEREncoder(entity) {\n this.enc = 'der';\n this.name = entity.name;\n this.entity = entity;\n\n // Construct base tree\n this.tree = new DERNode();\n this.tree._init(entity.body);\n}\nmodule.exports = DEREncoder;\n\nDEREncoder.prototype.encode = function encode(data, reporter) {\n return this.tree._encode(data, reporter).join();\n};\n\n// Tree methods\n\nfunction DERNode(parent) {\n Node.call(this, 'der', parent);\n}\ninherits(DERNode, Node);\n\nDERNode.prototype._encodeComposite = function encodeComposite(tag,\n primitive,\n cls,\n content) {\n const encodedTag = encodeTag(tag, primitive, cls, this.reporter);\n\n // Short form\n if (content.length < 0x80) {\n const header = Buffer.alloc(2);\n header[0] = encodedTag;\n header[1] = content.length;\n return this._createEncoderBuffer([ header, content ]);\n }\n\n // Long form\n // Count octets required to store length\n let lenOctets = 1;\n for (let i = content.length; i >= 0x100; i >>= 8)\n lenOctets++;\n\n const header = Buffer.alloc(1 + 1 + lenOctets);\n header[0] = encodedTag;\n header[1] = 0x80 | lenOctets;\n\n for (let i = 1 + lenOctets, j = content.length; j > 0; i--, j >>= 8)\n header[i] = j & 0xff;\n\n return this._createEncoderBuffer([ header, content ]);\n};\n\nDERNode.prototype._encodeStr = function encodeStr(str, tag) {\n if (tag === 'bitstr') {\n return this._createEncoderBuffer([ str.unused | 0, str.data ]);\n } else if (tag === 'bmpstr') {\n const buf = Buffer.alloc(str.length * 2);\n for (let i = 0; i < str.length; i++) {\n buf.writeUInt16BE(str.charCodeAt(i), i * 2);\n }\n return this._createEncoderBuffer(buf);\n } else if (tag === 'numstr') {\n if (!this._isNumstr(str)) {\n return this.reporter.error('Encoding of string type: numstr supports ' +\n 'only digits and space');\n }\n return this._createEncoderBuffer(str);\n } else if (tag === 'printstr') {\n if (!this._isPrintstr(str)) {\n return this.reporter.error('Encoding of string type: printstr supports ' +\n 'only latin upper and lower case letters, ' +\n 'digits, space, apostrophe, left and rigth ' +\n 'parenthesis, plus sign, comma, hyphen, ' +\n 'dot, slash, colon, equal sign, ' +\n 'question mark');\n }\n return this._createEncoderBuffer(str);\n } else if (/str$/.test(tag)) {\n return this._createEncoderBuffer(str);\n } else if (tag === 'objDesc') {\n return this._createEncoderBuffer(str);\n } else {\n return this.reporter.error('Encoding of string type: ' + tag +\n ' unsupported');\n }\n};\n\nDERNode.prototype._encodeObjid = function encodeObjid(id, values, relative) {\n if (typeof id === 'string') {\n if (!values)\n return this.reporter.error('string objid given, but no values map found');\n if (!values.hasOwnProperty(id))\n return this.reporter.error('objid not found in values map');\n id = values[id].split(/[\\s.]+/g);\n for (let i = 0; i < id.length; i++)\n id[i] |= 0;\n } else if (Array.isArray(id)) {\n id = id.slice();\n for (let i = 0; i < id.length; i++)\n id[i] |= 0;\n }\n\n if (!Array.isArray(id)) {\n return this.reporter.error('objid() should be either array or string, ' +\n 'got: ' + JSON.stringify(id));\n }\n\n if (!relative) {\n if (id[1] >= 40)\n return this.reporter.error('Second objid identifier OOB');\n id.splice(0, 2, id[0] * 40 + id[1]);\n }\n\n // Count number of octets\n let size = 0;\n for (let i = 0; i < id.length; i++) {\n let ident = id[i];\n for (size++; ident >= 0x80; ident >>= 7)\n size++;\n }\n\n const objid = Buffer.alloc(size);\n let offset = objid.length - 1;\n for (let i = id.length - 1; i >= 0; i--) {\n let ident = id[i];\n objid[offset--] = ident & 0x7f;\n while ((ident >>= 7) > 0)\n objid[offset--] = 0x80 | (ident & 0x7f);\n }\n\n return this._createEncoderBuffer(objid);\n};\n\nfunction two(num) {\n if (num < 10)\n return '0' + num;\n else\n return num;\n}\n\nDERNode.prototype._encodeTime = function encodeTime(time, tag) {\n let str;\n const date = new Date(time);\n\n if (tag === 'gentime') {\n str = [\n two(date.getUTCFullYear()),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n 'Z'\n ].join('');\n } else if (tag === 'utctime') {\n str = [\n two(date.getUTCFullYear() % 100),\n two(date.getUTCMonth() + 1),\n two(date.getUTCDate()),\n two(date.getUTCHours()),\n two(date.getUTCMinutes()),\n two(date.getUTCSeconds()),\n 'Z'\n ].join('');\n } else {\n this.reporter.error('Encoding ' + tag + ' time is not supported yet');\n }\n\n return this._encodeStr(str, 'octstr');\n};\n\nDERNode.prototype._encodeNull = function encodeNull() {\n return this._createEncoderBuffer('');\n};\n\nDERNode.prototype._encodeInt = function encodeInt(num, values) {\n if (typeof num === 'string') {\n if (!values)\n return this.reporter.error('String int or enum given, but no values map');\n if (!values.hasOwnProperty(num)) {\n return this.reporter.error('Values map doesn\\'t contain: ' +\n JSON.stringify(num));\n }\n num = values[num];\n }\n\n // Bignum, assume big endian\n if (typeof num !== 'number' && !Buffer.isBuffer(num)) {\n const numArray = num.toArray();\n if (!num.sign && numArray[0] & 0x80) {\n numArray.unshift(0);\n }\n num = Buffer.from(numArray);\n }\n\n if (Buffer.isBuffer(num)) {\n let size = num.length;\n if (num.length === 0)\n size++;\n\n const out = Buffer.alloc(size);\n num.copy(out);\n if (num.length === 0)\n out[0] = 0;\n return this._createEncoderBuffer(out);\n }\n\n if (num < 0x80)\n return this._createEncoderBuffer(num);\n\n if (num < 0x100)\n return this._createEncoderBuffer([0, num]);\n\n let size = 1;\n for (let i = num; i >= 0x100; i >>= 8)\n size++;\n\n const out = new Array(size);\n for (let i = out.length - 1; i >= 0; i--) {\n out[i] = num & 0xff;\n num >>= 8;\n }\n if(out[0] & 0x80) {\n out.unshift(0);\n }\n\n return this._createEncoderBuffer(Buffer.from(out));\n};\n\nDERNode.prototype._encodeBool = function encodeBool(value) {\n return this._createEncoderBuffer(value ? 0xff : 0);\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function')\n entity = entity(obj);\n return entity._getEncoder('der').tree;\n};\n\nDERNode.prototype._skipDefault = function skipDefault(dataBuffer, reporter, parent) {\n const state = this._baseState;\n let i;\n if (state['default'] === null)\n return false;\n\n const data = dataBuffer.join();\n if (state.defaultBuffer === undefined)\n state.defaultBuffer = this._encodeValue(state['default'], reporter, parent).join();\n\n if (data.length !== state.defaultBuffer.length)\n return false;\n\n for (i=0; i < data.length; i++)\n if (data[i] !== state.defaultBuffer[i])\n return false;\n\n return true;\n};\n\n// Utility methods\n\nfunction encodeTag(tag, primitive, cls, reporter) {\n let res;\n\n if (tag === 'seqof')\n tag = 'seq';\n else if (tag === 'setof')\n tag = 'set';\n\n if (der.tagByName.hasOwnProperty(tag))\n res = der.tagByName[tag];\n else if (typeof tag === 'number' && (tag | 0) === tag)\n res = tag;\n else\n return reporter.error('Unknown tag: ' + tag);\n\n if (res >= 0x1f)\n return reporter.error('Multi-octet tag encoding unsupported');\n\n if (!primitive)\n res |= 0x20;\n\n res |= (der.tagClassByName[cls || 'universal'] << 6);\n\n return res;\n}\n","'use strict';\n\nconst decoders = exports;\n\ndecoders.der = require('./der');\ndecoders.pem = require('./pem');\n","'use strict';\n\nconst inherits = require('inherits');\n\nconst bignum = require('bn.js');\nconst DecoderBuffer = require('../base/buffer').DecoderBuffer;\nconst Node = require('../base/node');\n\n// Import DER constants\nconst der = require('../constants/der');\n\nfunction DERDecoder(entity) {\n this.enc = 'der';\n this.name = entity.name;\n this.entity = entity;\n\n // Construct base tree\n this.tree = new DERNode();\n this.tree._init(entity.body);\n}\nmodule.exports = DERDecoder;\n\nDERDecoder.prototype.decode = function decode(data, options) {\n if (!DecoderBuffer.isDecoderBuffer(data)) {\n data = new DecoderBuffer(data, options);\n }\n\n return this.tree._decode(data, options);\n};\n\n// Tree methods\n\nfunction DERNode(parent) {\n Node.call(this, 'der', parent);\n}\ninherits(DERNode, Node);\n\nDERNode.prototype._peekTag = function peekTag(buffer, tag, any) {\n if (buffer.isEmpty())\n return false;\n\n const state = buffer.save();\n const decodedTag = derDecodeTag(buffer, 'Failed to peek tag: \"' + tag + '\"');\n if (buffer.isError(decodedTag))\n return decodedTag;\n\n buffer.restore(state);\n\n return decodedTag.tag === tag || decodedTag.tagStr === tag ||\n (decodedTag.tagStr + 'of') === tag || any;\n};\n\nDERNode.prototype._decodeTag = function decodeTag(buffer, tag, any) {\n const decodedTag = derDecodeTag(buffer,\n 'Failed to decode tag of \"' + tag + '\"');\n if (buffer.isError(decodedTag))\n return decodedTag;\n\n let len = derDecodeLen(buffer,\n decodedTag.primitive,\n 'Failed to get length of \"' + tag + '\"');\n\n // Failure\n if (buffer.isError(len))\n return len;\n\n if (!any &&\n decodedTag.tag !== tag &&\n decodedTag.tagStr !== tag &&\n decodedTag.tagStr + 'of' !== tag) {\n return buffer.error('Failed to match tag: \"' + tag + '\"');\n }\n\n if (decodedTag.primitive || len !== null)\n return buffer.skip(len, 'Failed to match body of: \"' + tag + '\"');\n\n // Indefinite length... find END tag\n const state = buffer.save();\n const res = this._skipUntilEnd(\n buffer,\n 'Failed to skip indefinite length body: \"' + this.tag + '\"');\n if (buffer.isError(res))\n return res;\n\n len = buffer.offset - state.offset;\n buffer.restore(state);\n return buffer.skip(len, 'Failed to match body of: \"' + tag + '\"');\n};\n\nDERNode.prototype._skipUntilEnd = function skipUntilEnd(buffer, fail) {\n for (;;) {\n const tag = derDecodeTag(buffer, fail);\n if (buffer.isError(tag))\n return tag;\n const len = derDecodeLen(buffer, tag.primitive, fail);\n if (buffer.isError(len))\n return len;\n\n let res;\n if (tag.primitive || len !== null)\n res = buffer.skip(len);\n else\n res = this._skipUntilEnd(buffer, fail);\n\n // Failure\n if (buffer.isError(res))\n return res;\n\n if (tag.tagStr === 'end')\n break;\n }\n};\n\nDERNode.prototype._decodeList = function decodeList(buffer, tag, decoder,\n options) {\n const result = [];\n while (!buffer.isEmpty()) {\n const possibleEnd = this._peekTag(buffer, 'end');\n if (buffer.isError(possibleEnd))\n return possibleEnd;\n\n const res = decoder.decode(buffer, 'der', options);\n if (buffer.isError(res) && possibleEnd)\n break;\n result.push(res);\n }\n return result;\n};\n\nDERNode.prototype._decodeStr = function decodeStr(buffer, tag) {\n if (tag === 'bitstr') {\n const unused = buffer.readUInt8();\n if (buffer.isError(unused))\n return unused;\n return { unused: unused, data: buffer.raw() };\n } else if (tag === 'bmpstr') {\n const raw = buffer.raw();\n if (raw.length % 2 === 1)\n return buffer.error('Decoding of string type: bmpstr length mismatch');\n\n let str = '';\n for (let i = 0; i < raw.length / 2; i++) {\n str += String.fromCharCode(raw.readUInt16BE(i * 2));\n }\n return str;\n } else if (tag === 'numstr') {\n const numstr = buffer.raw().toString('ascii');\n if (!this._isNumstr(numstr)) {\n return buffer.error('Decoding of string type: ' +\n 'numstr unsupported characters');\n }\n return numstr;\n } else if (tag === 'octstr') {\n return buffer.raw();\n } else if (tag === 'objDesc') {\n return buffer.raw();\n } else if (tag === 'printstr') {\n const printstr = buffer.raw().toString('ascii');\n if (!this._isPrintstr(printstr)) {\n return buffer.error('Decoding of string type: ' +\n 'printstr unsupported characters');\n }\n return printstr;\n } else if (/str$/.test(tag)) {\n return buffer.raw().toString();\n } else {\n return buffer.error('Decoding of string type: ' + tag + ' unsupported');\n }\n};\n\nDERNode.prototype._decodeObjid = function decodeObjid(buffer, values, relative) {\n let result;\n const identifiers = [];\n let ident = 0;\n let subident = 0;\n while (!buffer.isEmpty()) {\n subident = buffer.readUInt8();\n ident <<= 7;\n ident |= subident & 0x7f;\n if ((subident & 0x80) === 0) {\n identifiers.push(ident);\n ident = 0;\n }\n }\n if (subident & 0x80)\n identifiers.push(ident);\n\n const first = (identifiers[0] / 40) | 0;\n const second = identifiers[0] % 40;\n\n if (relative)\n result = identifiers;\n else\n result = [first, second].concat(identifiers.slice(1));\n\n if (values) {\n let tmp = values[result.join(' ')];\n if (tmp === undefined)\n tmp = values[result.join('.')];\n if (tmp !== undefined)\n result = tmp;\n }\n\n return result;\n};\n\nDERNode.prototype._decodeTime = function decodeTime(buffer, tag) {\n const str = buffer.raw().toString();\n\n let year;\n let mon;\n let day;\n let hour;\n let min;\n let sec;\n if (tag === 'gentime') {\n year = str.slice(0, 4) | 0;\n mon = str.slice(4, 6) | 0;\n day = str.slice(6, 8) | 0;\n hour = str.slice(8, 10) | 0;\n min = str.slice(10, 12) | 0;\n sec = str.slice(12, 14) | 0;\n } else if (tag === 'utctime') {\n year = str.slice(0, 2) | 0;\n mon = str.slice(2, 4) | 0;\n day = str.slice(4, 6) | 0;\n hour = str.slice(6, 8) | 0;\n min = str.slice(8, 10) | 0;\n sec = str.slice(10, 12) | 0;\n if (year < 70)\n year = 2000 + year;\n else\n year = 1900 + year;\n } else {\n return buffer.error('Decoding ' + tag + ' time is not supported yet');\n }\n\n return Date.UTC(year, mon - 1, day, hour, min, sec, 0);\n};\n\nDERNode.prototype._decodeNull = function decodeNull() {\n return null;\n};\n\nDERNode.prototype._decodeBool = function decodeBool(buffer) {\n const res = buffer.readUInt8();\n if (buffer.isError(res))\n return res;\n else\n return res !== 0;\n};\n\nDERNode.prototype._decodeInt = function decodeInt(buffer, values) {\n // Bigint, return as it is (assume big endian)\n const raw = buffer.raw();\n let res = new bignum(raw);\n\n if (values)\n res = values[res.toString(10)] || res;\n\n return res;\n};\n\nDERNode.prototype._use = function use(entity, obj) {\n if (typeof entity === 'function')\n entity = entity(obj);\n return entity._getDecoder('der').tree;\n};\n\n// Utility methods\n\nfunction derDecodeTag(buf, fail) {\n let tag = buf.readUInt8(fail);\n if (buf.isError(tag))\n return tag;\n\n const cls = der.tagClass[tag >> 6];\n const primitive = (tag & 0x20) === 0;\n\n // Multi-octet tag - load\n if ((tag & 0x1f) === 0x1f) {\n let oct = tag;\n tag = 0;\n while ((oct & 0x80) === 0x80) {\n oct = buf.readUInt8(fail);\n if (buf.isError(oct))\n return oct;\n\n tag <<= 7;\n tag |= oct & 0x7f;\n }\n } else {\n tag &= 0x1f;\n }\n const tagStr = der.tag[tag];\n\n return {\n cls: cls,\n primitive: primitive,\n tag: tag,\n tagStr: tagStr\n };\n}\n\nfunction derDecodeLen(buf, primitive, fail) {\n let len = buf.readUInt8(fail);\n if (buf.isError(len))\n return len;\n\n // Indefinite form\n if (!primitive && len === 0x80)\n return null;\n\n // Definite form\n if ((len & 0x80) === 0) {\n // Short form\n return len;\n }\n\n // Long form\n const num = len & 0x7f;\n if (num > 4)\n return buf.error('length octect is too long');\n\n len = 0;\n for (let i = 0; i < num; i++) {\n len <<= 8;\n const j = buf.readUInt8(fail);\n if (buf.isError(j))\n return j;\n len |= j;\n }\n\n return len;\n}\n","var createHash = require('create-hash')\nvar Buffer = require('safe-buffer').Buffer\n\nmodule.exports = function (seed, len) {\n var t = Buffer.alloc(0)\n var i = 0\n var c\n while (t.length < len) {\n c = i2ops(i++)\n t = Buffer.concat([t, createHash('sha1').update(seed).update(c).digest()])\n }\n return t.slice(0, len)\n}\n\nfunction i2ops (c) {\n var out = Buffer.allocUnsafe(4)\n out.writeUInt32BE(c, 0)\n return out\n}\n","module.exports = function xor (a, b) {\n var len = a.length\n var i = -1\n while (++i < len) {\n a[i] ^= b[i]\n }\n return a\n}\n","var BN = require('bn.js')\nvar Buffer = require('safe-buffer').Buffer\n\nfunction withPublic (paddedMsg, key) {\n return Buffer.from(paddedMsg\n .toRed(BN.mont(key.modulus))\n .redPow(new BN(key.publicExponent))\n .fromRed()\n .toArray())\n}\n\nmodule.exports = withPublic\n","\"use strict\";\n\n// ref: https://github.com/tc39/proposal-global\nvar getGlobal = function () {\n\t// the only reliable means to get the global object is\n\t// `Function('return this')()`\n\t// However, this causes CSP violations in Chrome apps.\n\tif (typeof self !== 'undefined') { return self; }\n\tif (typeof window !== 'undefined') { return window; }\n\tif (typeof global !== 'undefined') { return global; }\n\tthrow new Error('unable to locate global object');\n}\n\nvar global = getGlobal();\n\nmodule.exports = exports = global.fetch;\n\n// Needed for TypeScript and Webpack.\nexports.default = global.fetch.bind(global);\n\nexports.Headers = global.Headers;\nexports.Request = global.Request;\nexports.Response = global.Response;","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.database\n\nimport co.touchlab.kermit.CommonLogger\nimport co.touchlab.kermit.Logger\nimport com.shabinder.database.Database\n\nactual fun createDatabase(): Database? = null\nactual fun getLogger(): Logger = CommonLogger()\n",null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features.json\n\nimport io.ktor.http.*\n\ninternal class JsonContentTypeMatcher : ContentTypeMatcher {\n override fun contains(contentType: ContentType): Boolean {\n if (ContentType.Application.Json.match(contentType)) {\n return true\n }\n\n val value = contentType.withoutParameters().toString()\n return value.startsWith(\"application/\") && value.endsWith(\"+json\")\n }\n}\n","/*\n * Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features.json\n\nimport io.ktor.client.*\nimport io.ktor.client.features.*\nimport io.ktor.client.request.*\nimport io.ktor.client.statement.*\nimport io.ktor.client.utils.*\nimport io.ktor.http.*\nimport io.ktor.util.*\nimport io.ktor.utils.io.*\n\n/**\n * Platform default serializer.\n *\n * Uses service loader on jvm.\n * Consider to add one of the following dependencies:\n * - ktor-client-gson\n * - ktor-client-json\n */\npublic expect fun defaultSerializer(): JsonSerializer\n\n/**\n * [HttpClient] feature that serializes/de-serializes as JSON custom objects\n * to request and from response bodies using a [serializer].\n *\n * The default [serializer] is [GsonSerializer].\n *\n * The default [acceptContentTypes] is a list which contains [ContentType.Application.Json]\n *\n * Note: It will de-serialize the body response if the specified type is a public accessible class\n * and the Content-Type is one of [acceptContentTypes] list (`application/json` by default).\n *\n * @property serializer that is used to serialize and deserialize request/response bodies\n * @property acceptContentTypes that are allowed when receiving content\n */\npublic class JsonFeature internal constructor(\n public val serializer: JsonSerializer,\n public val acceptContentTypes: List = listOf(ContentType.Application.Json),\n private val receiveContentTypeMatchers: List = listOf(JsonContentTypeMatcher()),\n) {\n @Deprecated(\"Install feature properly instead of direct instantiation.\", level = DeprecationLevel.ERROR)\n public constructor(serializer: JsonSerializer) : this(serializer, listOf(ContentType.Application.Json))\n\n internal constructor(config: Config) : this(\n config.serializer ?: defaultSerializer(),\n config.acceptContentTypes,\n config.receiveContentTypeMatchers\n )\n\n /**\n * [JsonFeature] configuration that is used during installation\n */\n public class Config {\n /**\n * Serializer that will be used for serializing requests and deserializing response bodies.\n *\n * Default value for [serializer] is [defaultSerializer].\n */\n public var serializer: JsonSerializer? = null\n\n /**\n * Backing field with mutable list of content types that are handled by this feature.\n */\n private val _acceptContentTypes: MutableList = mutableListOf(ContentType.Application.Json)\n private val _receiveContentTypeMatchers: MutableList =\n mutableListOf(JsonContentTypeMatcher())\n\n /**\n * List of content types that are handled by this feature.\n * It also affects `Accept` request header value.\n * Please note that wildcard content types are supported but no quality specification provided.\n */\n public var acceptContentTypes: List\n set(value) {\n require(value.isNotEmpty()) { \"At least one content type should be provided to acceptContentTypes\" }\n\n _acceptContentTypes.clear()\n _acceptContentTypes.addAll(value)\n }\n get() = _acceptContentTypes\n\n /**\n * List of content type matchers that are handled by this feature.\n * Please note that wildcard content types are supported but no quality specification provided.\n */\n public var receiveContentTypeMatchers: List\n set(value) {\n require(value.isNotEmpty()) { \"At least one content type should be provided to acceptContentTypes\" }\n _receiveContentTypeMatchers.clear()\n _receiveContentTypeMatchers.addAll(value)\n }\n get() = _receiveContentTypeMatchers\n\n /**\n * Adds accepted content types. Be aware that [ContentType.Application.Json] accepted by default is removed from\n * the list if you use this function to provide accepted content types.\n * It also affects `Accept` request header value.\n */\n public fun accept(vararg contentTypes: ContentType) {\n _acceptContentTypes += contentTypes\n }\n\n /**\n * Adds accepted content types. Existing content types will not be removed.\n */\n public fun receive(matcher: ContentTypeMatcher) {\n _receiveContentTypeMatchers += matcher\n }\n }\n\n internal fun canHandle(contentType: ContentType): Boolean {\n val accepted = acceptContentTypes.any { contentType.match(it) }\n val matchers = receiveContentTypeMatchers\n\n return accepted || matchers.any { matcher -> matcher.contains(contentType) }\n }\n\n /**\n * Companion object for feature installation\n */\n public companion object Feature : HttpClientFeature {\n override val key: AttributeKey = AttributeKey(\"Json\")\n\n override fun prepare(block: Config.() -> Unit): JsonFeature {\n val config = Config().apply(block)\n val serializer = config.serializer ?: defaultSerializer()\n val allowedContentTypes = config.acceptContentTypes.toList()\n val receiveContentTypeMatchers = config.receiveContentTypeMatchers\n\n return JsonFeature(serializer, allowedContentTypes, receiveContentTypeMatchers)\n }\n\n override fun install(feature: JsonFeature, scope: HttpClient) {\n scope.requestPipeline.intercept(HttpRequestPipeline.Transform) { payload ->\n feature.acceptContentTypes.forEach { context.accept(it) }\n\n val contentType = context.contentType() ?: return@intercept\n if (!feature.canHandle(contentType)) return@intercept\n\n context.headers.remove(HttpHeaders.ContentType)\n\n val serializedContent = when (payload) {\n Unit -> EmptyContent\n is EmptyContent -> EmptyContent\n else -> feature.serializer.write(payload, contentType)\n }\n\n proceedWith(serializedContent)\n }\n\n scope.responsePipeline.intercept(HttpResponsePipeline.Transform) { (info, body) ->\n if (body !is ByteReadChannel) return@intercept\n\n val contentType = context.response.contentType() ?: return@intercept\n if (!feature.canHandle(contentType)) return@intercept\n\n val parsedBody = feature.serializer.read(info, body.readRemaining())\n val response = HttpResponseContainer(info, parsedBody)\n proceedWith(response)\n }\n }\n }\n}\n\n/**\n * Install [JsonFeature].\n */\npublic fun HttpClientConfig<*>.Json(block: JsonFeature.Config.() -> Unit) {\n install(JsonFeature, block)\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features.json\n\nimport io.ktor.client.call.*\nimport io.ktor.http.*\nimport io.ktor.http.content.*\nimport io.ktor.utils.io.core.*\n\n/**\n * Client json serializer.\n */\npublic interface JsonSerializer {\n /**\n * Convert data object to [OutgoingContent].\n */\n public fun write(data: Any, contentType: ContentType): OutgoingContent\n\n /**\n * Convert data object to [OutgoingContent].\n */\n public fun write(data: Any): OutgoingContent = write(data, ContentType.Application.Json)\n\n /**\n * Read content from response using information specified in [type].\n */\n public fun read(type: TypeInfo, body: Input): Any\n}\n","/*\n * Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.\n */\n\npackage io.ktor.client.features.json\n\nimport io.ktor.util.*\n\n/**\n * Platform default serializer.\n */\npublic actual fun defaultSerializer(): JsonSerializer =\n serializersStore.first()\n\n@Suppress(\"KDocMissingDocumentation\")\n@InternalAPI\npublic val serializersStore: MutableList = mutableListOf()\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.main\n\nimport com.arkivanov.decompose.ComponentContext\nimport com.arkivanov.mvikotlin.core.store.StoreFactory\nimport com.shabinder.common.di.Dir\nimport com.shabinder.common.di.Picture\nimport com.shabinder.common.main.integration.SpotiFlyerMainImpl\nimport com.shabinder.common.models.Consumer\nimport com.shabinder.common.models.DownloadRecord\nimport com.shabinder.database.Database\nimport kotlinx.coroutines.flow.Flow\n\ninterface SpotiFlyerMain {\n\n val models: Flow\n\n /*\n * We Intend to Move to List Screen\n * Note: Implementation in Root\n * */\n fun onLinkSearch(link: String)\n\n /*\n * Update TextBox's Text\n * */\n fun onInputLinkChanged(link: String)\n\n /*\n * change TabBar Selected Category\n * */\n fun selectCategory(category: HomeCategory)\n\n /*\n * Load Image from cache/Internet and cache it\n * */\n suspend fun loadImage(url: String): Picture\n\n interface Dependencies {\n val mainOutput: Consumer\n val storeFactory: StoreFactory\n val database: Database?\n val dir: Dir\n val showPopUpMessage: (String) -> Unit\n }\n\n sealed class Output {\n data class Search(val link: String) : Output()\n }\n\n data class State(\n val records: List = emptyList(),\n val link: String = \"\",\n val selectedCategory: HomeCategory = HomeCategory.About\n )\n enum class HomeCategory {\n About, History\n }\n}\n\n@Suppress(\"FunctionName\") // Factory function\nfun SpotiFlyerMain(componentContext: ComponentContext, dependencies: SpotiFlyerMain.Dependencies): SpotiFlyerMain =\n SpotiFlyerMainImpl(componentContext, dependencies)\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.main.integration\n\nimport com.arkivanov.decompose.ComponentContext\nimport com.arkivanov.mvikotlin.extensions.coroutines.states\nimport com.shabinder.common.di.Picture\nimport com.shabinder.common.di.isInternetAvailable\nimport com.shabinder.common.main.SpotiFlyerMain\nimport com.shabinder.common.main.SpotiFlyerMain.Dependencies\nimport com.shabinder.common.main.SpotiFlyerMain.HomeCategory\nimport com.shabinder.common.main.SpotiFlyerMain.Output\nimport com.shabinder.common.main.SpotiFlyerMain.State\nimport com.shabinder.common.main.store.SpotiFlyerMainStore.Intent\nimport com.shabinder.common.main.store.SpotiFlyerMainStoreProvider\nimport com.shabinder.common.main.store.getStore\nimport kotlinx.coroutines.flow.Flow\n\ninternal class SpotiFlyerMainImpl(\n componentContext: ComponentContext,\n dependencies: Dependencies\n) : SpotiFlyerMain, ComponentContext by componentContext, Dependencies by dependencies {\n\n private val store =\n instanceKeeper.getStore {\n SpotiFlyerMainStoreProvider(\n storeFactory = storeFactory,\n database = database,\n showPopUpMessage = showPopUpMessage\n ).provide()\n }\n\n override val models: Flow = store.states\n\n override fun onLinkSearch(link: String) {\n if (isInternetAvailable) mainOutput.callback(Output.Search(link = link))\n else showPopUpMessage(\"Check Network Connection Please\")\n }\n\n override fun onInputLinkChanged(link: String) {\n store.accept(Intent.SetLink(link))\n }\n\n override fun selectCategory(category: HomeCategory) {\n store.accept(Intent.SelectCategory(category))\n }\n\n override suspend fun loadImage(url: String): Picture = dir.loadImage(url)\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.main.store\n\nimport com.arkivanov.decompose.instancekeeper.InstanceKeeper\nimport com.arkivanov.decompose.instancekeeper.getOrCreate\nimport com.arkivanov.mvikotlin.core.store.Store\n\nfun > InstanceKeeper.getStore(key: Any, factory: () -> T): T =\n getOrCreate(key) { StoreHolder(factory()) }\n .store\n\ninline fun > InstanceKeeper.getStore(noinline factory: () -> T): T =\n getStore(T::class, factory)\n\nprivate class StoreHolder>(\n val store: T\n) : InstanceKeeper.Instance {\n override fun onDestroy() {\n store.dispose()\n }\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.main.store\n\nimport com.arkivanov.mvikotlin.core.store.Store\nimport com.shabinder.common.main.SpotiFlyerMain\nimport com.shabinder.common.main.store.SpotiFlyerMainStore.Intent\n\ninternal interface SpotiFlyerMainStore : Store {\n sealed class Intent {\n data class OpenPlatform(val platformID: String, val platformLink: String) : Intent()\n data class SetLink(val link: String) : Intent()\n data class SelectCategory(val category: SpotiFlyerMain.HomeCategory) : Intent()\n object GiveDonation : Intent()\n object ShareApp : Intent()\n }\n}\n","/*\n * * Copyright (c) 2021 Shabinder Singh\n * * This program is free software: you can redistribute it and/or modify\n * * it under the terms of the GNU General Public License as published by\n * * the Free Software Foundation, either version 3 of the License, or\n * * (at your option) any later version.\n * *\n * * This program is distributed in the hope that it will be useful,\n * * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * * GNU General Public License for more details.\n * *\n * * You should have received a copy of the GNU General Public License\n * * along with this program. If not, see .\n */\n\npackage com.shabinder.common.main.store\n\nimport com.arkivanov.mvikotlin.core.store.Reducer\nimport com.arkivanov.mvikotlin.core.store.SimpleBootstrapper\nimport com.arkivanov.mvikotlin.core.store.Store\nimport com.arkivanov.mvikotlin.core.store.StoreFactory\nimport com.arkivanov.mvikotlin.extensions.coroutines.SuspendExecutor\nimport com.shabinder.common.di.giveDonation\nimport com.shabinder.common.di.openPlatform\nimport com.shabinder.common.di.shareApp\nimport com.shabinder.common.main.SpotiFlyerMain\nimport com.shabinder.common.main.SpotiFlyerMain.State\nimport com.shabinder.common.main.store.SpotiFlyerMainStore.Intent\nimport com.shabinder.common.models.DownloadRecord\nimport com.shabinder.database.Database\nimport com.squareup.sqldelight.runtime.coroutines.asFlow\nimport com.squareup.sqldelight.runtime.coroutines.mapToList\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.flow.Flow\nimport kotlinx.coroutines.flow.collect\nimport kotlinx.coroutines.flow.map\n\ninternal class SpotiFlyerMainStoreProvider(\n private val storeFactory: StoreFactory,\n private val showPopUpMessage: (String) -> Unit,\n private val database: Database?\n) {\n\n fun provide(): SpotiFlyerMainStore =\n object :\n SpotiFlyerMainStore,\n Store by storeFactory.create(\n name = \"SpotiFlyerHomeStore\",\n initialState = State(),\n bootstrapper = SimpleBootstrapper(Unit),\n executorFactory = ::ExecutorImpl,\n reducer = ReducerImpl\n ) {}\n\n val updates: Flow>? =\n database?.downloadRecordDatabaseQueries\n ?.selectAll()\n ?.asFlow()\n ?.mapToList(Dispatchers.Default)\n ?.map {\n it.map { record ->\n record.run {\n DownloadRecord(id, type, name, link, coverUrl, totalFiles)\n }\n }\n }\n\n private sealed class Result {\n data class ItemsLoaded(val items: List) : Result()\n data class CategoryChanged(val category: SpotiFlyerMain.HomeCategory) : Result()\n data class LinkChanged(val link: String) : Result()\n }\n\n private inner class ExecutorImpl : SuspendExecutor() {\n override suspend fun executeAction(action: Unit, getState: () -> State) {\n updates?.collect {\n dispatch(Result.ItemsLoaded(it))\n }\n }\n\n override suspend fun executeIntent(intent: Intent, getState: () -> State) {\n when (intent) {\n is Intent.OpenPlatform -> openPlatform(intent.platformID, intent.platformLink)\n is Intent.GiveDonation -> giveDonation()\n is Intent.ShareApp -> shareApp()\n is Intent.SetLink -> dispatch(Result.LinkChanged(link = intent.link))\n is Intent.SelectCategory -> dispatch(Result.CategoryChanged(intent.category))\n }\n }\n }\n\n private object ReducerImpl : Reducer {\n override fun State.reduce(result: Result): State =\n when (result) {\n is Result.ItemsLoaded -> copy(records = result.items)\n is Result.LinkChanged -> copy(link = result.link)\n is Result.CategoryChanged -> copy(selectedCategory = result.category)\n }\n }\n}\n","package com.arkivanov.mvikotlin.extensions.coroutines\n\nimport com.arkivanov.mvikotlin.rx.Disposable\nimport com.arkivanov.mvikotlin.rx.Observer\nimport com.arkivanov.mvikotlin.rx.observer\nimport kotlinx.coroutines.ExperimentalCoroutinesApi\nimport kotlinx.coroutines.channels.awaitClose\nimport kotlinx.coroutines.flow.Flow\nimport kotlinx.coroutines.flow.callbackFlow\n\n@ExperimentalCoroutinesApi\ninternal inline fun T.toFlow(\n crossinline subscribe: T.(Observer) -> Disposable\n): Flow =\n callbackFlow {\n val disposable =\n subscribe(\n observer(\n onComplete = { channel.close() },\n onNext = { channel.offer(it) }\n )\n )\n\n awaitClose(disposable::dispose)\n }\n","package com.arkivanov.mvikotlin.extensions.coroutines\n\nimport com.arkivanov.mvikotlin.core.annotations.MainThread\nimport com.arkivanov.mvikotlin.core.store.Bootstrapper\nimport com.arkivanov.mvikotlin.core.store.Executor\nimport com.arkivanov.mvikotlin.core.store.Executor.Callbacks\nimport com.arkivanov.mvikotlin.core.store.Reducer\nimport com.arkivanov.mvikotlin.core.store.Store\nimport com.arkivanov.mvikotlin.utils.internal.atomic\nimport com.arkivanov.mvikotlin.utils.internal.initialize\nimport com.arkivanov.mvikotlin.utils.internal.requireValue\nimport kotlinx.coroutines.CoroutineScope\nimport kotlinx.coroutines.Dispatchers\nimport kotlinx.coroutines.cancel\nimport kotlinx.coroutines.launch\nimport kotlin.coroutines.CoroutineContext\n\n/**\n * An abstract implementation of the [Executor] that provides interoperability with coroutines.\n * All coroutines are launched in a scope which closes when the [Executor] is disposed.\n */\nopen class SuspendExecutor(\n mainContext: CoroutineContext = Dispatchers.Main\n) : Executor {\n\n private val callbacks = atomic>()\n private val getState: () -> State = { callbacks.requireValue().state }\n private val scope = CoroutineScope(mainContext)\n\n final override fun init(callbacks: Callbacks) {\n this.callbacks.initialize(callbacks)\n }\n\n final override fun handleIntent(intent: Intent) {\n scope.launch {\n executeIntent(intent, getState)\n }\n }\n\n /**\n * A suspending variant of the [Executor.handleIntent] method.\n * The coroutine is launched in a scope which closes when the [Executor] is disposed.\n *\n * @param intent an `Intent` received by the [Store]\n * @param getState a `State` supplier that returns the *current* `State` of the [Store]\n */\n @MainThread\n protected open suspend fun executeIntent(intent: Intent, getState: () -> State) {\n }\n\n final override fun handleAction(action: Action) {\n scope.launch {\n executeAction(action, getState)\n }\n }\n\n /**\n * Called for every `Action` produced by the [Executor]\n * The coroutine is launched in a scope which closes when the [Executor] is disposed.\n *\n * @param action an `Action` produced by the [Bootstrapper]\n * @param getState a `State` supplier that returns the *current* `State` of the [Store]\n */\n @MainThread\n protected open suspend fun executeAction(action: Action, getState: () -> State) {\n }\n\n override fun dispose() {\n scope.cancel()\n }\n\n /**\n * Dispatches the provided `Result` to the [Reducer].\n * The updated `State` will be available immediately after this method returns.\n *\n * @param result a `Result` to be dispatched to the `Reducer`\n */\n @MainThread\n protected fun dispatch(result: Result) {\n callbacks.requireValue().onResult(result)\n }\n\n /**\n * Sends the provided `Label` to the [Store] for publication\n *\n * @param label a `Label` to be published\n */\n @MainThread\n protected fun publish(label: Label) {\n callbacks.requireValue().onLabel(label)\n }\n}\n","package com.arkivanov.mvikotlin.extensions.coroutines\n\nimport com.arkivanov.mvikotlin.core.store.Store\nimport kotlinx.coroutines.ExperimentalCoroutinesApi\nimport kotlinx.coroutines.flow.Flow\nimport kotlin.coroutines.CoroutineContext\n\n/**\n * Returns a [Flow] that emits [Store] `States`.\n * The first emission with the current `State` will be performed synchronously on collection.\n * Please not that the actual collection of the [Flow] may not be synchronous depending on [CoroutineContext] being used.\n */\n@ExperimentalCoroutinesApi\nval Store<*, State, *>.states: Flow\n get() = toFlow(Store<*, State, *>::states)\n\n/**\n * Returns a [Flow] that emits [Store] `Labels`\n */\n@ExperimentalCoroutinesApi\nval